| 32 | |
| 33 | |
| 34 | class NetworkBuild: |
| 35 | def __init__(self, |
| 36 | dataBase: str, |
| 37 | networkFile: str, |
| 38 | obsFile: str = None |
| 39 | ) -> None: |
| 40 | self.dataBase = dataBase |
| 41 | self.networkFile = networkFile |
| 42 | self.obsFile = obsFile |
| 43 | self.edges: dict[str, Edge] = {} |
| 44 | self.lanes: dict[str, NormalLane] = {} |
| 45 | self.junctions: dict[str, Junction] = {} |
| 46 | self.junctionLanes: dict[str, JunctionLane] = {} |
| 47 | self.tlLogics: dict[str, TlLogic] = {} |
| 48 | # self.obstacles: dict[str, circleObs | rectangleObs] = {} |
| 49 | self.dataQue = Queue() |
| 50 | self.geoHashes: dict[tuple[int], geoHash] = {} |
| 51 | |
| 52 | def getEdge(self, eid: str) -> Edge: |
| 53 | try: |
| 54 | return self.edges[eid] |
| 55 | except KeyError: |
| 56 | return |
| 57 | |
| 58 | def getLane(self, lid: str) -> NormalLane: |
| 59 | try: |
| 60 | return self.lanes[lid] |
| 61 | except KeyError: |
| 62 | return |
| 63 | |
| 64 | def getJunction(self, jid: str) -> Junction: |
| 65 | try: |
| 66 | return self.junctions[jid] |
| 67 | except KeyError: |
| 68 | return |
| 69 | |
| 70 | def getJunctionLane(self, jlid: str) -> JunctionLane: |
| 71 | try: |
| 72 | return self.junctionLanes[jlid] |
| 73 | except KeyError: |
| 74 | return |
| 75 | |
| 76 | def getTlLogic(self, tlid: str) -> TlLogic: |
| 77 | try: |
| 78 | return self.tlLogics[tlid] |
| 79 | except KeyError: |
| 80 | return |
| 81 | |
| 82 | # def getObstacle(self, obsid: str) -> circleObs | rectangleObs: |
| 83 | # try: |
| 84 | # return self.obstacles[obsid] |
| 85 | # except KeyError: |
| 86 | # return |
| 87 | |
| 88 | def affGridIDs(self, centerLine: list[tuple[float]]) -> set[tuple[int]]: |
| 89 | affGridIDs = set() |
| 90 | for poi in centerLine: |
| 91 | poixhash = int(poi[0] // 100) |