(self, dataBase: str, timeStep: int)
| 211 | return edges, juncs |
| 212 | |
| 213 | def updateScene(self, dataBase: str, timeStep: int): |
| 214 | NowTLs = {} |
| 215 | conn = sqlite3.connect(dataBase) |
| 216 | cur = conn.cursor() |
| 217 | cur.execute( |
| 218 | """SELECT * FROM trafficLightStates WHERE frame=%i;""" % timeStep |
| 219 | ) |
| 220 | tlsINFO = cur.fetchall() |
| 221 | if tlsINFO: |
| 222 | for tls in tlsINFO: |
| 223 | frame, tlid, currPhase, nextPhase, switchTime = tls |
| 224 | NowTLs[tlid] = (currPhase, nextPhase, switchTime) |
| 225 | |
| 226 | cur.close() |
| 227 | conn.close() |
| 228 | |
| 229 | if NowTLs: |
| 230 | for jid in self.junctions: |
| 231 | junc = self.netInfo.getJunction(jid) |
| 232 | if junc: |
| 233 | for jlid in junc.JunctionLanes: |
| 234 | jl = self.netInfo.getJunctionLane(jlid) |
| 235 | tlid = jl.tlLogic |
| 236 | if tlid: |
| 237 | try: |
| 238 | currPhase, nextPhase, switchTime = NowTLs[tlid] |
| 239 | except KeyError: |
| 240 | continue |
| 241 | jl.currTlState = currPhase[jl.tlsIndex] |
| 242 | jl.nexttTlState = nextPhase[jl.tlsIndex] |
| 243 | jl.switchTime = switchTime |
| 244 | |
| 245 | def updateSurroundVeh(self): |
| 246 | for vid in self.outOfRange: |
nothing calls this directly
no test coverage detected