def writeConnections(net):
    fd = open("roundabout-connection.con.xml", "w")
    fd.write("<connections>\n")
    for ra in net.getRoundabouts():
        for node in ra.getNodes():
            edgesOut= net.getNode(node)._outgoing
            edgesIn= net.getNode(node)._incoming
            for edgeOut in edgesOut:
                outNumber= edgeOut.getLaneNumber() 
                for edgeIn in edgesIn:
                    if not edgeOut in edgeIn._outgoing:
                        continue
                    inNumber= edgeIn.getLaneNumber() 
                    for x in range(inNumber):
                        if x < inNumber and x < outNumber:
                            fd.write("   <connection from=\"" +str(edgeIn._id)+ "\" to=\"" + str(edgeOut._id)+ "\" lane=\""+ str(x) +":"+ str(x) +"\" />\n")
    fd.write("</connections>\n")
Пример #2
0
def writeConnections(net):
    fd = open("roundabout-connection.con.xml", "w")
    fd.write("<connections>\n")
    for ra in net.getRoundabouts():
        for node in ra.getNodes():
            edgesOut= net.getNode(node)._outgoing
            edgesIn= net.getNode(node)._incoming
            for edgeOut in edgesOut:
                outNumber= edgeOut.getLaneNumber() 
                for edgeIn in edgesIn:
                    if not edgeOut in edgeIn._outgoing:
                        continue
                    inNumber= edgeIn.getLaneNumber() 
                    for x in range(inNumber):
                        if x < inNumber and x < outNumber:
                            fd.write("   <connection from=\"" +str(edgeIn._id)+ "\" to=\"" + str(edgeOut._id)+ "\" lane=\""+ str(x) +":"+ str(x) +"\" />\n")
    fd.write("</connections>\n")
Пример #3
0
#!/usr/bin/env python
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
# Copyright (C) 2008-2018 German Aerospace Center (DLR) and others.
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v2.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v20.html

# @file    runner.py
# @author  Jakob Erdmann
# @date
# @version $Id$

from __future__ import absolute_import
from __future__ import print_function

import os
import sys
sys.path.append(os.path.join(os.environ['SUMO_HOME'], 'tools'))
import sumolib.net

net = sumolib.net.readNet(sys.argv[1])
for r in net.getRoundabouts():
    print("nodes=['%s'] edges=['%s']" %
          ("', '".join(r.getNodes()), "', '".join(r.getEdges())))
Пример #4
0
"""
@file    runner.py
@author  Jakob Erdmann
@version $Id$

This script tests sumolib functions

SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors

This file is part of SUMO.
SUMO is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
"""
from __future__ import absolute_import
from __future__ import print_function


import os
import sys
sys.path.append(os.path.join(os.environ['SUMO_HOME'], 'tools'))
import sumolib.net

net = sumolib.net.readNet(sys.argv[1])
for r in net.getRoundabouts():
    print("nodes=%s edges=%s" % (
        [n for n in r.getNodes()],
        [e for e in r.getEdges()]))