示例#1
0
def getTrafficLightsDictionary(mtraci):
    """
    Returns the traffic lights dictionary(*). This one is obtained from a text file, updated if new map data are detected
    """
    if isDictionaryOutOfDate(constants.SUMO_TLL_DICTIONARY_FILE, constants.SUMO_NETWORK_FILE):
        tllDict = buildTrafficLightsDictionary(mtraci)
        exportTrafficLightsDictionary(tllDict)
    else:
        tllDict = importTrafficLightsDictionary()
    return tllDict
示例#2
0
def getTrafficLightsDictionary(mtraci):
    """
    Returns the traffic lights dictionary(*). This one is obtained from a text file, updated if new map data are detected
    """
    if isDictionaryOutOfDate(constants.SUMO_TLL_DICTIONARY_FILE,
                             constants.SUMO_NETWORK_FILE):
        tllDict = buildTrafficLightsDictionary(mtraci)
        exportTrafficLightsDictionary(tllDict)
    else:
        tllDict = importTrafficLightsDictionary()
    return tllDict
示例#3
0
def getGraphAndJunctionsDictionaryAndEdgesDictionary(mtraci):
    """
    Returns the graph(*), junctions(**) and edges(***) dictionary. This one is obtained from a text file, updated if new map data are detected
    """
    if isDictionaryOutOfDate(constants.SUMO_JUNCTIONS_DICTIONARY_FILE, constants.SUMO_NETWORK_FILE) or isDictionaryOutOfDate(constants.SUMO_EDGES_DICTIONARY_FILE, constants.SUMO_NETWORK_FILE) or isDictionaryOutOfDate(constants.SUMO_GRAPH_FILE, constants.SUMO_NETWORK_FILE):
        graphDict, junctionsDict, edgesDict = buildGraphAndJunctionsDictionaryAndEdgesDictionary(mtraci)
        exportGraph(graphDict)
        exportJunctionsDictionary(junctionsDict)
        exportEdgesDictionary(edgesDict)
    else:
        graphDict = importGraph()
        junctionsDict = importJunctionsDictionary()
        edgesDict = importEdgesDictionary()
    return graphDict, junctionsDict, edgesDict