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 | writeLocation (OutputDevice &into) |
writes the location element More... | |
static void | writeNetwork (const OptionsCont &oc, NBNetBuilder &nb) |
Writes the network into a SUMO-file. More... | |
static void | writePermissions (OutputDevice &into, SVCPermissions permissions) |
writes allowed disallowed attributes if needed; More... | |
static void | writePreferences (OutputDevice &into, SVCPermissions preferred) |
writes allowed disallowed attributes if needed; More... | |
static void | writeProhibitions (OutputDevice &into, const NBConnectionProhibits &prohibitions) |
writes the given prohibitions 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 offset, SUMOReal width, const PositionVector &shape, const std::string &origID, SUMOReal length, unsigned int index, bool origNames) |
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 | writeRoundabout (OutputDevice &into, const std::vector< std::string > &r, const NBEdgeCont &ec) |
Writes a roundabout. 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... | |
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 609 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 457 of file NWWriter_SUMO.cpp.
References OutputDevice::closeTag(), NBEdge::Connection::fromLane, NBNode::getDirection(), Named::getID(), NBEdge::Connection::getInternalLaneID(), NBNode::getLinkState(), NBEdge::getToNode(), LINKDIR_NODIR, NBEdge::Connection::mayDefinitelyPass, OutputDevice::openTag(), PLAIN, SUMO_ATTR_DIR, SUMO_ATTR_FROM, SUMO_ATTR_FROM_LANE, 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, NBEdge::Connection::tlLinkNo, NBEdge::Connection::toEdge, NBEdge::Connection::toLane, toString(), 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 551 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 265 of file NWWriter_SUMO.cpp.
References OutputDevice::closeTag(), EDGEFUNC_CONNECTOR, StringUtils::escapeXML(), NBNode::getCenter(), NBEdge::getFromNode(), NBEdge::getGeometry(), Named::getID(), NBEdge::getLaneID(), NBEdge::getLanes(), NBEdge::getLaneSpreadFunction(), NBEdge::getLoadedLength(), OptionsCont::getOptions(), NBEdge::getPriority(), NBEdge::getStreetName(), NBEdge::getToNode(), NBEdge::getTypeName(), NBEdge::hasDefaultGeometry(), NBEdge::hasLoadedLength(), NBEdge::isMacroscopicConnector(), LANESPREAD_RIGHT, PositionVector::length(), NBEdge::Lane::offset, OutputDevice::openTag(), NBEdge::Lane::origID, NBEdge::Lane::permissions, POSITION_EPS, NBEdge::Lane::preferred, PositionVector::push_back_noDoublePos(), PositionVector::push_front_noDoublePos(), 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 518 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().
|
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 493 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 192 of file NWWriter_SUMO.cpp.
References OutputDevice::closeTag(), EDGEFUNC_INTERNAL, NBNode::getIncomingEdges(), MAX2(), OutputDevice::openTag(), NBEdge::Lane::permissions, POSITION_EPS, NBEdge::Lane::preferred, SUMO_ATTR_FUNCTION, SUMO_ATTR_ID, SUMO_TAG_EDGE, SUMOReal, SVCFreeForAll, NBEdge::UNSPECIFIED_OFFSET, NBEdge::UNSPECIFIED_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 413 of file NWWriter_SUMO.cpp.
References OutputDevice::closeTag(), 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 359 of file NWWriter_SUMO.cpp.
References OutputDevice::closeTag(), Named::getID(), NBNode::getIncomingEdges(), OptionsCont::getOptions(), NBNode::getPosition(), NBNode::getShape(), NBNode::getType(), NODETYPE_DEAD_END, OutputDevice::openTag(), SUMO_ATTR_ID, SUMO_ATTR_INCLANES, SUMO_ATTR_INTLANES, SUMO_ATTR_SHAPE, SUMO_ATTR_TYPE, SUMO_TAG_JUNCTION, 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 |
Definition at line 316 of file NWWriter_SUMO.cpp.
References OutputDevice::closeTag(), PositionVector::getSubpart(), PositionVector::length(), OutputDevice::openTag(), 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, toString(), NBEdge::UNSPECIFIED_OFFSET, NBEdge::UNSPECIFIED_WIDTH, WRITE_WARNING, OutputDevice::writeAttr(), writePermissions(), and writePreferences().
Referenced by writeEdge(), and writeInternalEdges().
|
static |
writes the location element
Definition at line 648 of file NWWriter_SUMO.cpp.
References OutputDevice::closeTag(), GEO_OUTPUT_ACCURACY, GeoConvHelper::getConvBoundary(), GeoConvHelper::getFinal(), GeoConvHelper::getOffsetBase(), GeoConvHelper::getOrigBoundary(), GeoConvHelper::getProjString(), OutputDevice::lf(), OutputDevice::openTag(), OutputDevice::setPrecision(), SUMO_ATTR_CONV_BOUNDARY, SUMO_ATTR_NET_OFFSET, SUMO_ATTR_ORIG_BOUNDARY, SUMO_ATTR_ORIG_PROJ, SUMO_TAG_LOCATION, GeoConvHelper::usingGeoProjection(), and OutputDevice::writeAttr().
Referenced by writeNetwork(), and NWWriter_XML::writeNodes().
|
static |
Writes the network into a SUMO-file.
[in] | oc | The options to use |
[in] | nb | The network builder to fill |
Definition at line 63 of file NWWriter_SUMO.cpp.
References NBDistrictCont::begin(), NBNodeCont::begin(), NBEdgeCont::begin(), OutputDevice::close(), NBDistrictCont::end(), NBNodeCont::end(), NBEdgeCont::end(), OptionsCont::getBool(), NBEdge::getConnections(), OutputDevice::getDevice(), NBNetBuilder::getDistrictCont(), NBNetBuilder::getEdgeCont(), NBNetBuilder::getNodeCont(), NBNetBuilder::getRoundabouts(), OptionsCont::getString(), NBNetBuilder::getTLLogicCont(), OptionsCont::isSet(), OutputDevice::lf(), NWFrame::MAJOR_VERSION, NBDistrictCont::size(), NBEdge::sortOutgoingConnectionsByIndex(), writeConnection(), writeDistrict(), writeEdge(), writeInternalConnections(), writeInternalEdges(), writeInternalNodes(), writeJunction(), writeLocation(), writeProhibitions(), writeRoundabout(), writeTrafficLights(), and OutputDevice::writeXMLHeader().
Referenced by NWFrame::writeNetwork().
|
static |
writes allowed disallowed attributes if needed;
Definition at line 667 of file NWWriter_SUMO.cpp.
References getAllowedVehicleClassNames(), getPermissionEncoding(), SUMO_ATTR_ALLOW, SUMO_ATTR_DISALLOW, SVCFreeForAll, and OutputDevice::writeAttr().
Referenced by NWWriter_XML::writeEdgesAndConnections(), and writeLane().
|
static |
writes allowed disallowed attributes if needed;
Definition at line 686 of file NWWriter_SUMO.cpp.
References getAllowedVehicleClassNames(), SUMO_ATTR_PREFER, SVCFreeForAll, and OutputDevice::writeAttr().
Referenced by NWWriter_XML::writeEdgesAndConnections(), and writeLane().
|
static |
writes the given prohibitions
Definition at line 593 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().
|
staticprotected |
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 536 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, and OutputDevice::writeAttr().
Referenced by writeNetwork().
|
staticprivate |
writes a SUMOTime as int if possible, otherwise as a float
Definition at line 582 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 615 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().