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 &lID, const std::string &eID, const NBEdge::Lane &lane, SUMOReal length, unsigned int index, bool origNames) |
Writes a lane (<lane ...) of an edge. More... | |
static void | writeJunction (OutputDevice &into, const NBNode &n) |
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::set< NBEdge * > &r) |
Writes a roundabout. More... | |
static void | writeDistrict (OutputDevice &into, const NBDistrict &d) |
Writes a district. More... | |
static void | writeInternalEdge (OutputDevice &into, const std::string &id, SUMOReal vmax, const PositionVector &shape, const std::string &origID) |
Writes a single internal edge. More... | |
static void | writeInternalConnection (OutputDevice &into, const std::string &from, const std::string &to, 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 62 of file NWWriter_SUMO.h.
Enumerator | |
---|---|
SUMONET | |
PLAIN | |
TLL |
Definition at line 65 of file NWWriter_SUMO.h.
|
staticprivate |
the attribute value for a prohibition
Definition at line 540 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 386 of file NWWriter_SUMO.cpp.
References OutputDevice::closeTag(), NBEdge::Connection::fromLane, NBNode::getDirection(), Named::getID(), NBNode::getLinkState(), NBEdge::getToNode(), NBEdge::Connection::id, 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 481 of file NWWriter_SUMO.cpp.
References OutputDevice::closeOpener(), OutputDevice::closeTag(), Named::getID(), NBDistrict::getShape(), NBDistrict::getSinkEdges(), NBDistrict::getSinkWeights(), NBDistrict::getSourceEdges(), NBDistrict::getSourceWeights(), VectorHelper< T >::normaliseSum(), OutputDevice::openTag(), PositionVector::size(), 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 217 of file NWWriter_SUMO.cpp.
References OutputDevice::closeOpener(), OutputDevice::closeTag(), EDGEFUNC_CONNECTOR, StringUtils::escapeXML(), NBEdge::getFromNode(), NBEdge::getGeometry(), Named::getID(), NBEdge::getLaneID(), NBEdge::getLanes(), NBEdge::getLaneSpreadFunction(), NBEdge::getLoadedLength(), NBEdge::getPriority(), NBEdge::getStreetName(), NBEdge::getToNode(), NBEdge::getTypeName(), NBEdge::hasDefaultGeometry(), NBEdge::hasLoadedLength(), NBEdge::isMacroscopicConnector(), LANESPREAD_RIGHT, OutputDevice::openTag(), 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, 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 447 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 422 of file NWWriter_SUMO.cpp.
References NBEdge::getConnections(), Named::getID(), NBNode::getIncomingEdges(), NBEdge::Connection::haveVia, NBEdge::Connection::id, NBEdge::Connection::toEdge, NBEdge::Connection::toLane, NBEdge::Connection::viaID, and writeInternalConnection().
Referenced by writeNetwork().
|
staticprivate |
Writes a single internal edge.
[in] | into | The device to write the edges into |
[in] | id | The id of the edge |
[in] | vmax | The maximum speed of the edge |
[in] | shape | The shape of the edge |
Definition at line 189 of file NWWriter_SUMO.cpp.
References OutputDevice::closeOpener(), OutputDevice::closeTag(), EDGEFUNC_INTERNAL, PositionVector::length(), MAX2(), OutputDevice::openTag(), POSITION_EPS, SUMO_ATTR_FUNCTION, SUMO_ATTR_ID, SUMO_ATTR_INDEX, SUMO_ATTR_KEY, SUMO_ATTR_LENGTH, SUMO_ATTR_SHAPE, SUMO_ATTR_SPEED, SUMO_ATTR_VALUE, SUMO_TAG_EDGE, SUMO_TAG_LANE, SUMO_TAG_PARAM, SUMOReal, and OutputDevice::writeAttr().
Referenced by writeInternalEdges().
|
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 167 of file NWWriter_SUMO.cpp.
References NBNode::getIncomingEdges(), and writeInternalEdge().
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 358 of file NWWriter_SUMO.cpp.
References OutputDevice::closeTag(), NBNode::getIncomingEdges(), 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 |
Definition at line 303 of file NWWriter_SUMO.cpp.
References OutputDevice::closeOpener(), 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] | e | The edge to write |
[in] | lID | The ID of the lane |
[in] | eID | The ID of the edge |
[in] | lane | Lane definition |
[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 258 of file NWWriter_SUMO.cpp.
References OutputDevice::closeOpener(), OutputDevice::closeTag(), PositionVector::getSubpart(), PositionVector::length(), NBEdge::Lane::offset, OutputDevice::openTag(), NBEdge::Lane::origID, NBEdge::Lane::permissions, NBEdge::Lane::preferred, NBEdge::Lane::shape, NBEdge::Lane::speed, 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, NBEdge::Lane::width, WRITE_WARNING, OutputDevice::writeAttr(), writePermissions(), and writePreferences().
Referenced by writeEdge().
|
static |
writes the location element
Definition at line 572 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 62 of file NWWriter_SUMO.cpp.
References NBDistrictCont::begin(), NBNodeCont::begin(), NBEdgeCont::begin(), OutputDevice::close(), SUMOSAXAttributes::ENCODING, 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 591 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 610 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 524 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 |
Definition at line 464 of file NWWriter_SUMO.cpp.
References OutputDevice::closeTag(), OutputDevice::openTag(), 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 513 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 546 of file NWWriter_SUMO.cpp.
References OutputDevice::closeOpener(), OutputDevice::closeTag(), NBTrafficLightLogicCont::getComputed(), OutputDevice::lf(), OutputDevice::openTag(), SUMO_ATTR_DURATION, SUMO_ATTR_ID, SUMO_ATTR_OFFSET, SUMO_ATTR_PROGRAMID, SUMO_ATTR_STATE, SUMO_ATTR_TYPE, SUMO_TAG_PHASE, SUMO_TAG_TLLOGIC, TLTYPE_STATIC, toString(), OutputDevice::writeAttr(), and writeSUMOTime().
Referenced by writeNetwork(), and NWWriter_XML::writeTrafficLights().