![]() |
SUMO - Simulation of Urban MObility
|
Exporter writing networks using the SUMO format. More...
#include <NWWriter_SUMO.h>
Public Types | |
enum | ConnectionStyle { SUMONET, PLAIN, TLL } |
Static Public Member Functions | |
static void | writeConnection (OutputDevice &into, const NBEdge &from, const NBEdge::Connection &c, bool includeInternal, ConnectionStyle style=SUMONET) |
Writes connections outgoing from the given edge (also used in NWWriter_XML) More... | |
static void | writeNetwork (const OptionsCont &oc, NBNetBuilder &nb) |
Writes the network into a SUMO-file. More... | |
static void | writeProhibitions (OutputDevice &into, const NBConnectionProhibits &prohibitions) |
writes the given prohibitions More... | |
static void | writeRoundabouts (OutputDevice &into, const std::set< EdgeSet > &roundabouts, const NBEdgeCont &ec) |
Writes roundabouts. More... | |
static void | writeTrafficLights (OutputDevice &into, const NBTrafficLightLogicCont &tllCont) |
writes the traffic light logics to the given device More... | |
Methods for writing network parts | |
static bool | writeInternalEdges (OutputDevice &into, const NBNode &n, bool origNames) |
Writes internal edges (<edge ... with id[0]==':') of the given node. More... | |
static void | writeEdge (OutputDevice &into, const NBEdge &e, bool noNames, bool origNames) |
Writes an edge (<edge ...) More... | |
static void | writeLane (OutputDevice &into, const std::string &eID, const std::string &lID, SUMOReal speed, SVCPermissions permissions, SVCPermissions preferred, SUMOReal endOffset, SUMOReal width, PositionVector shape, const std::string &origID, SUMOReal length, unsigned int index, bool origNames, const NBNode *node=0) |
Writes a lane (<lane ...) of an edge. More... | |
static void | writeJunction (OutputDevice &into, const NBNode &n, const bool checkLaneFoes) |
Writes a junction (<junction ...) More... | |
static bool | writeInternalNodes (OutputDevice &into, const NBNode &n) |
Writes internal junctions (<junction with id[0]==':' ...) of the given node. More... | |
static bool | writeInternalConnections (OutputDevice &into, const NBNode &n) |
Writes inner connections within the node. More... | |
static void | writeDistrict (OutputDevice &into, const NBDistrict &d) |
Writes a district. More... | |
static void | writeInternalConnection (OutputDevice &into, const std::string &from, const std::string &to, int fromLane, int toLane, const std::string &via) |
Writes a single internal connection. More... | |
static std::string | writeSUMOTime (SUMOTime time) |
writes a SUMOTime as int if possible, otherwise as a float More... | |
static std::string | prohibitionConnection (const NBConnection &c) |
the attribute value for a prohibition More... | |
static void | writeRoundabout (OutputDevice &into, const std::vector< std::string > &r, const NBEdgeCont &ec) |
Writes a roundabout. More... | |
Exporter writing networks using the SUMO format.
Definition at line 63 of file NWWriter_SUMO.h.
Enumerator | |
---|---|
SUMONET | |
PLAIN | |
TLL |
Definition at line 66 of file NWWriter_SUMO.h.
|
staticprivate |
the attribute value for a prohibition
Definition at line 734 of file NWWriter_SUMO.cpp.
References NBConnection::getFrom(), Named::getID(), and NBConnection::getTo().
Referenced by writeProhibitions().
|
static |
Writes connections outgoing from the given edge (also used in NWWriter_XML)
[in] | into | The device to write the edge into |
[in] | from | The edge to write connections for |
[in] | c | The connection to write |
[in] | includeInternal | Whether information about inner-lanes used to cross the intersection shall be written |
[in] | plain | Whether only plain-xml output should be written (omit some attributes) |
Definition at line 536 of file NWWriter_SUMO.cpp.
References OutputDevice::closeTag(), NBEdge::Connection::contPos, NBEdge::Connection::fromLane, OptionsCont::getBool(), NBNode::getDirection(), Named::getID(), NBEdge::Connection::getInternalLaneID(), NBNode::getKeepClear(), NBNode::getLinkState(), OptionsCont::getOptions(), NBEdge::getToNode(), NBEdge::Connection::keepClear, LINKDIR_NODIR, NBEdge::Connection::mayDefinitelyPass, OutputDevice::openTag(), PLAIN, SUMO_ATTR_CONTPOS, SUMO_ATTR_DIR, SUMO_ATTR_FROM, SUMO_ATTR_FROM_LANE, SUMO_ATTR_KEEP_CLEAR, SUMO_ATTR_PASS, SUMO_ATTR_STATE, SUMO_ATTR_TLID, SUMO_ATTR_TLLINKINDEX, SUMO_ATTR_TO, SUMO_ATTR_TO_LANE, SUMO_ATTR_VIA, SUMO_TAG_CONNECTION, SUMONET, NBEdge::Connection::tlID, TLL, NBEdge::Connection::tlLinkNo, NBEdge::Connection::toEdge, NBEdge::Connection::toLane, toString(), NBEdge::UNSPECIFIED_CONTPOS, and OutputDevice::writeAttr().
Referenced by NWWriter_XML::writeEdgesAndConnections(), writeNetwork(), and NWWriter_XML::writeTrafficLights().
|
staticprotected |
Writes a district.
[in] | into | The device to write the edge into |
[in] | d | The district |
Definition at line 676 of file NWWriter_SUMO.cpp.
References OutputDevice::closeTag(), Named::getID(), NBDistrict::getShape(), NBDistrict::getSinkEdges(), NBDistrict::getSinkWeights(), NBDistrict::getSourceEdges(), NBDistrict::getSourceWeights(), VectorHelper< T >::normaliseSum(), OutputDevice::openTag(), SUMO_ATTR_ID, SUMO_ATTR_SHAPE, SUMO_ATTR_WEIGHT, SUMO_TAG_TAZ, SUMO_TAG_TAZSINK, SUMO_TAG_TAZSOURCE, and OutputDevice::writeAttr().
Referenced by writeNetwork().
|
staticprotected |
Writes an edge (<edge ...)
[in] | into | The device to write the edge into |
[in] | e | The edge to write |
[in] | noNames | Whether names shall be ignored |
[in] | origNames | Whether original names shall be written as parameter |
Definition at line 322 of file NWWriter_SUMO.cpp.
References OutputDevice::closeTag(), EDGEFUNC_CONNECTOR, NBEdge::Lane::endOffset, StringUtils::escapeXML(), NBEdge::getFinalLength(), NBEdge::getFromNode(), NBEdge::getGeometry(), Named::getID(), NBEdge::getLaneID(), NBEdge::getLanes(), NBEdge::getLaneSpreadFunction(), NBEdge::getLoadedLength(), NBEdge::getPriority(), NBEdge::getStreetName(), NBEdge::getToNode(), NBEdge::getTypeID(), NBEdge::hasDefaultGeometry(), NBEdge::hasLoadedLength(), NBEdge::isMacroscopicConnector(), LANESPREAD_RIGHT, OutputDevice::openTag(), NBEdge::Lane::origID, NBEdge::Lane::permissions, NBEdge::Lane::preferred, NBEdge::Lane::shape, NBEdge::Lane::speed, SUMO_ATTR_FROM, SUMO_ATTR_FUNCTION, SUMO_ATTR_ID, SUMO_ATTR_LENGTH, SUMO_ATTR_NAME, SUMO_ATTR_PRIORITY, SUMO_ATTR_SHAPE, SUMO_ATTR_SPREADTYPE, SUMO_ATTR_TO, SUMO_ATTR_TYPE, SUMO_TAG_EDGE, SUMOReal, NBEdge::Lane::width, OutputDevice::writeAttr(), and writeLane().
Referenced by writeNetwork().
|
staticprivate |
Writes a single internal connection.
[in] | from | The id of the from-edge |
[in] | to | The id of the to-edge |
[in] | toLane | The indexd of the to-lane |
[in] | via | The (optional) via edge |
Definition at line 603 of file NWWriter_SUMO.cpp.
References OutputDevice::closeTag(), OutputDevice::openTag(), SUMO_ATTR_DIR, SUMO_ATTR_FROM, SUMO_ATTR_FROM_LANE, SUMO_ATTR_STATE, SUMO_ATTR_TO, SUMO_ATTR_TO_LANE, SUMO_ATTR_VIA, SUMO_TAG_CONNECTION, and OutputDevice::writeAttr().
Referenced by writeInternalConnections(), and writeNetwork().
|
staticprotected |
Writes inner connections within the node.
[in] | into | The device to write the edge into |
[in] | n | The node to write inner links for |
Definition at line 578 of file NWWriter_SUMO.cpp.
References NBEdge::getConnections(), Named::getID(), NBNode::getIncomingEdges(), NBEdge::Connection::haveVia, NBEdge::Connection::id, NBEdge::Connection::internalLaneIndex, NBEdge::Connection::toEdge, NBEdge::Connection::toLane, NBEdge::Connection::viaID, and writeInternalConnection().
Referenced by writeNetwork().
|
staticprotected |
Writes internal edges (<edge ... with id[0]==':') of the given node.
[in] | into | The device to write the edges into |
[in] | n | The node to write the edges of |
[in] | origNames | Whether original names shall be written as parameter |
Definition at line 223 of file NWWriter_SUMO.cpp.
References OutputDevice::closeTag(), EDGEFUNC_CROSSING, EDGEFUNC_INTERNAL, EDGEFUNC_WALKINGAREA, NBNode::getCrossings(), NBNode::getIncomingEdges(), NBNode::getWalkingAreas(), NBNode::WalkingArea::id, NBNode::WalkingArea::length, MAX2(), OutputDevice::openTag(), NBEdge::Lane::permissions, POSITION_EPS, NBEdge::Lane::preferred, NBNode::WalkingArea::shape, SUMO_ATTR_CROSSING_EDGES, SUMO_ATTR_FUNCTION, SUMO_ATTR_ID, SUMO_TAG_EDGE, SUMOReal, SVC_PEDESTRIAN, SVCAll, NBEdge::UNSPECIFIED_OFFSET, NBEdge::Lane::width, NBNode::WalkingArea::width, OutputDevice::writeAttr(), and writeLane().
Referenced by writeNetwork().
|
staticprotected |
Writes internal junctions (<junction with id[0]==':' ...) of the given node.
[in] | into | The device to write the edge into |
[in] | n | The junction/node to write internal nodes for |
Definition at line 488 of file NWWriter_SUMO.cpp.
References OutputDevice::closeTag(), NBNode::getCrossings(), NBNode::getIncomingEdges(), joinToString(), NODETYPE_INTERNAL, OutputDevice::openTag(), SUMO_ATTR_ID, SUMO_ATTR_INCLANES, SUMO_ATTR_INTLANES, SUMO_ATTR_TYPE, SUMO_TAG_JUNCTION, OutputDevice::writeAttr(), and NWFrame::writePositionLong().
Referenced by writeNetwork().
|
staticprotected |
Writes a junction (<junction ...)
[in] | into | The device to write the edge into |
[in] | n | The junction/node to write |
[in] | checkLaneFoes | Whether laneConflicts shall be checked at this junction |
Definition at line 417 of file NWWriter_SUMO.cpp.
References OutputDevice::closeTag(), NBNode::getCrossings(), Named::getID(), NBNode::getIncomingEdges(), OptionsCont::getOptions(), NBNode::getPosition(), NBNode::getRadius(), NBNode::getShape(), NBNode::getType(), NBNode::hasCustomShape(), NODETYPE_DEAD_END, NODETYPE_NOJUNCTION, OutputDevice::openTag(), SUMO_ATTR_CUSTOMSHAPE, SUMO_ATTR_ID, SUMO_ATTR_INCLANES, SUMO_ATTR_INTLANES, SUMO_ATTR_RADIUS, SUMO_ATTR_SHAPE, SUMO_ATTR_TYPE, SUMO_TAG_JUNCTION, NBNode::UNSPECIFIED_RADIUS, OutputDevice::writeAttr(), NBNode::writeLogic(), and NWFrame::writePositionLong().
Referenced by writeNetwork().
|
staticprotected |
Writes a lane (<lane ...) of an edge.
[in] | into | The device to write the edge into |
[in] | lID | The ID of the lane |
[in] | eID | The ID of the edge |
[in] | length | Lane's length |
[in] | index | The index of the lane within the edge |
[in] | origNames | Whether original names shall be written as parameter |
[in] | node | The node to check for custom shape data |
Definition at line 363 of file NWWriter_SUMO.cpp.
References OutputDevice::closeTag(), NBNode::getCustomLaneShapes(), PositionVector::getSubpart(), PositionVector::length(), OutputDevice::openTag(), SUMO_ATTR_CUSTOMSHAPE, SUMO_ATTR_ENDOFFSET, SUMO_ATTR_ID, SUMO_ATTR_INDEX, SUMO_ATTR_KEY, SUMO_ATTR_LENGTH, SUMO_ATTR_SHAPE, SUMO_ATTR_SPEED, SUMO_ATTR_VALUE, SUMO_ATTR_WIDTH, SUMO_TAG_LANE, SUMO_TAG_PARAM, SVC_UNSPECIFIED, toString(), NBEdge::UNSPECIFIED_OFFSET, NBEdge::UNSPECIFIED_WIDTH, WRITE_WARNING, OutputDevice::writeAttr(), writePermissions(), and writePreferences().
Referenced by writeEdge(), and writeInternalEdges().
|
static |
Writes the network into a SUMO-file.
[in] | oc | The options to use |
[in] | nb | The network builder to fill |
Definition at line 64 of file NWWriter_SUMO.cpp.
References NBDistrictCont::begin(), NBNodeCont::begin(), NBEdgeCont::begin(), OutputDevice::close(), OutputDevice::closeTag(), NBDistrictCont::end(), NBNodeCont::end(), NBEdgeCont::end(), OptionsCont::getBool(), NBEdge::getConnections(), NBNode::getControllingTLS(), NBNode::getCrossing(), NBNode::getCrossings(), OutputDevice::getDevice(), NBNetBuilder::getDistrictCont(), NBNetBuilder::getEdgeCont(), OptionsCont::getInt(), NBNetBuilder::getNodeCont(), NBEdgeCont::getRoundabouts(), OptionsCont::getString(), NBNetBuilder::getTLLogicCont(), NBNetBuilder::getTypeCont(), NBNode::getWalkingAreas(), OptionsCont::isDefault(), OptionsCont::isSet(), NBNode::isTLControlled(), OutputDevice::lf(), LINKDIR_STRAIGHT, LINKSTATE_MAJOR, LINKSTATE_MINOR, NWFrame::MAJOR_VERSION, OutputDevice::openTag(), NBNode::Crossing::priority, NBDistrictCont::size(), NBEdge::sortOutgoingConnectionsByIndex(), SUMO_ATTR_CORNERDETAIL, SUMO_ATTR_DIR, SUMO_ATTR_FROM, SUMO_ATTR_FROM_LANE, SUMO_ATTR_LEFTHAND, SUMO_ATTR_LINKDETAIL, SUMO_ATTR_STATE, SUMO_ATTR_TLID, SUMO_ATTR_TLLINKINDEX, SUMO_ATTR_TO, SUMO_ATTR_TO_LANE, SUMO_TAG_CONNECTION, NBNode::Crossing::tlLinkNo, toString(), OutputDevice::writeAttr(), writeConnection(), writeDistrict(), writeEdge(), writeInternalConnection(), writeInternalConnections(), writeInternalEdges(), writeInternalNodes(), writeJunction(), GeoConvHelper::writeLocation(), writeProhibitions(), writeRoundabouts(), writeTrafficLights(), NBTypeCont::writeTypes(), and OutputDevice::writeXMLHeader().
Referenced by NWFrame::writeNetwork().
|
static |
writes the given prohibitions
Definition at line 718 of file NWWriter_SUMO.cpp.
References OutputDevice::closeTag(), OutputDevice::openTag(), prohibitionConnection(), SUMO_ATTR_PROHIBITED, SUMO_ATTR_PROHIBITOR, SUMO_TAG_PROHIBITION, and OutputDevice::writeAttr().
Referenced by NWWriter_XML::writeEdgesAndConnections(), and writeNetwork().
|
staticprivate |
Writes a roundabout.
[in] | into | The device to write the edge into |
[in] | r | The roundabout to write |
[in] | ec | The edge control to retrieve named edges from |
Definition at line 647 of file NWWriter_SUMO.cpp.
References OutputDevice::closeTag(), Named::getID(), NBEdge::getToNode(), joinToString(), OutputDevice::openTag(), NBEdgeCont::retrieve(), SUMO_ATTR_EDGES, SUMO_ATTR_NODES, SUMO_TAG_ROUNDABOUT, WRITE_WARNING, and OutputDevice::writeAttr().
Referenced by writeRoundabouts().
|
static |
Writes roundabouts.
[in] | into | The device to write the edge into |
[in] | roundaboutes | The roundabouts to write |
[in] | ec | The edge control to retrieve named edges from |
Definition at line 621 of file NWWriter_SUMO.cpp.
References OutputDevice::lf(), and writeRoundabout().
Referenced by NWWriter_XML::writeEdgesAndConnections(), and writeNetwork().
|
staticprivate |
writes a SUMOTime as int if possible, otherwise as a float
Definition at line 707 of file NWWriter_SUMO.cpp.
References STEPS2TIME, SUMOReal, and toString().
Referenced by writeTrafficLights().
|
static |
writes the traffic light logics to the given device
Definition at line 740 of file NWWriter_SUMO.cpp.
References OutputDevice::closeTag(), NBTrafficLightLogicCont::getComputed(), OutputDevice::lf(), OutputDevice::openTag(), SUMO_ATTR_DURATION, SUMO_ATTR_ID, SUMO_ATTR_KEY, SUMO_ATTR_OFFSET, SUMO_ATTR_PROGRAMID, SUMO_ATTR_STATE, SUMO_ATTR_TYPE, SUMO_ATTR_VALUE, SUMO_TAG_PARAM, SUMO_TAG_PHASE, SUMO_TAG_TLLOGIC, OutputDevice::writeAttr(), and writeSUMOTime().
Referenced by writeNetwork(), and NWWriter_XML::writeTrafficLights().