(self)
| 277 | junction.JunctionLanes.add(junctionLaneID) |
| 278 | |
| 279 | def getData(self): |
| 280 | elementTree = ET.parse(self.networkFile) |
| 281 | root = elementTree.getroot() |
| 282 | for child in root: |
| 283 | if child.tag == 'edge': |
| 284 | eid = child.attrib['id'] |
| 285 | # Some useless internal lanes will be generated by the follow codes. |
| 286 | self.processEdge(eid, child) |
| 287 | elif child.tag == 'junction': |
| 288 | jid = child.attrib['id'] |
| 289 | junc = Junction(jid) |
| 290 | if jid[0] != ':': |
| 291 | intLanes = child.attrib['intLanes'] |
| 292 | if intLanes: |
| 293 | intLanes = intLanes.split(' ') |
| 294 | for il in intLanes: |
| 295 | ilins = self.getJunctionLane(il) |
| 296 | if ilins: |
| 297 | ilins.affJunc = jid |
| 298 | junc.JunctionLanes.add(il) |
| 299 | jrawShape = child.attrib['shape'] |
| 300 | juncShape = self.processRawShape(jrawShape) |
| 301 | # Add the first point to form a closed shape |
| 302 | juncShape.append(juncShape[0]) |
| 303 | junc.shape = juncShape |
| 304 | self.junctions[jid] = junc |
| 305 | self.dataQue.put(( |
| 306 | 'junctionINFO', (jid, jrawShape), 'INSERT' |
| 307 | )) |
| 308 | elif child.tag == 'connection': |
| 309 | # in .net.xml, the elements 'edge' come first than elements |
| 310 | # 'connection', so the follow codes can work well. |
| 311 | self.processConnection(child) |
| 312 | elif child.tag == 'tlLogic': |
| 313 | tlid = child.attrib['id'] |
| 314 | tlType = child.attrib['type'] |
| 315 | preDefPhases = [] |
| 316 | for gchild in child: |
| 317 | if gchild.tag == 'phase': |
| 318 | preDefPhases.append(gchild.attrib['state']) |
| 319 | |
| 320 | self.tlLogics[tlid] = TlLogic(tlid, tlType, preDefPhases) |
| 321 | self.dataQue.put(( |
| 322 | 'tlLogicINFO', |
| 323 | (tlid, tlType, ' '.join(preDefPhases)), 'INSERT' |
| 324 | )) |
| 325 | for junction in self.junctions.values(): |
| 326 | for gridID in junction.affGridIDs: |
| 327 | try: |
| 328 | geohash = self.geoHashes[gridID] |
| 329 | except KeyError: |
| 330 | geohash = geoHash(gridID) |
| 331 | self.geoHashes[gridID] = geohash |
| 332 | geohash.junctions.add(junction.id) |
| 333 | |
| 334 | for ghid, ghins in self.geoHashes.items(): |
| 335 | ghx, ghy = ghid |
| 336 | ghEdges = ','.join(ghins.edges) |
nothing calls this directly
no test coverage detected