SUMO - Simulation of Urban MObility
NWWriter_SUMO Class Reference

Exporter writing networks using the SUMO format. More...

#include <NWWriter_SUMO.h>

Collaboration diagram for NWWriter_SUMO:
Collaboration graph

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...
 

Detailed Description

Exporter writing networks using the SUMO format.

Definition at line 63 of file NWWriter_SUMO.h.

Member Enumeration Documentation

Enumerator
SUMONET 
PLAIN 
TLL 

Definition at line 66 of file NWWriter_SUMO.h.

Member Function Documentation

std::string NWWriter_SUMO::prohibitionConnection ( const NBConnection c)
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().

void NWWriter_SUMO::writeConnection ( OutputDevice into,
const NBEdge from,
const NBEdge::Connection c,
bool  includeInternal,
ConnectionStyle  style = SUMONET 
)
static
void NWWriter_SUMO::writeInternalConnection ( OutputDevice into,
const std::string &  from,
const std::string &  to,
int  fromLane,
int  toLane,
const std::string &  via 
)
staticprivate

Writes a single internal connection.

Parameters
[in]fromThe id of the from-edge
[in]toThe id of the to-edge
[in]toLaneThe indexd of the to-lane
[in]viaThe (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().

bool NWWriter_SUMO::writeInternalConnections ( OutputDevice into,
const NBNode n 
)
staticprotected

Writes inner connections within the node.

Parameters
[in]intoThe device to write the edge into
[in]nThe 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().

bool NWWriter_SUMO::writeInternalEdges ( OutputDevice into,
const NBNode n,
bool  origNames 
)
staticprotected

Writes internal edges (<edge ... with id[0]==':') of the given node.

Parameters
[in]intoThe device to write the edges into
[in]nThe node to write the edges of
[in]origNamesWhether original names shall be written as parameter
Returns
Whether an internal edge was written

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().

bool NWWriter_SUMO::writeInternalNodes ( OutputDevice into,
const NBNode n 
)
staticprotected

Writes internal junctions (<junction with id[0]==':' ...) of the given node.

Parameters
[in]intoThe device to write the edge into
[in]nThe 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().

void NWWriter_SUMO::writeJunction ( OutputDevice into,
const NBNode n,
const bool  checkLaneFoes 
)
staticprotected
void NWWriter_SUMO::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 
)
staticprotected

Writes a lane (<lane ...) of an edge.

Parameters
[in]intoThe device to write the edge into
[in]lIDThe ID of the lane
[in]eIDThe ID of the edge
[in]lengthLane's length
[in]indexThe index of the lane within the edge
[in]origNamesWhether original names shall be written as parameter
[in]nodeThe 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().

void NWWriter_SUMO::writeNetwork ( const OptionsCont oc,
NBNetBuilder nb 
)
static

Writes the network into a SUMO-file.

Parameters
[in]ocThe options to use
[in]nbThe 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().

void NWWriter_SUMO::writeProhibitions ( OutputDevice into,
const NBConnectionProhibits prohibitions 
)
static
void NWWriter_SUMO::writeRoundabout ( OutputDevice into,
const std::vector< std::string > &  r,
const NBEdgeCont ec 
)
staticprivate

Writes a roundabout.

Parameters
[in]intoThe device to write the edge into
[in]rThe roundabout to write
[in]ecThe 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().

void NWWriter_SUMO::writeRoundabouts ( OutputDevice into,
const std::set< EdgeSet > &  roundabouts,
const NBEdgeCont ec 
)
static

Writes roundabouts.

Parameters
[in]intoThe device to write the edge into
[in]roundaboutesThe roundabouts to write
[in]ecThe 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().

std::string NWWriter_SUMO::writeSUMOTime ( SUMOTime  time)
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().


The documentation for this class was generated from the following files: