SUMO - Simulation of Urban MObility
NWWriter_SUMO Class Reference

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

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

Writes connections outgoing from the given edge (also used in NWWriter_XML)

Parameters
[in]intoThe device to write the edge into
[in]fromThe edge to write connections for
[in]cThe connection to write
[in]includeInternalWhether information about inner-lanes used to cross the intersection shall be written
[in]plainWhether only plain-xml output should be written (omit some attributes)

Definition at line 532 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, TLL, NBEdge::Connection::tlLinkNo, NBEdge::Connection::toEdge, NBEdge::Connection::toLane, toString(), and OutputDevice::writeAttr().

Referenced by NWWriter_XML::writeEdgesAndConnections(), writeNetwork(), and NWWriter_XML::writeTrafficLights().

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 593 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 568 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 230 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 484 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

Writes a junction (<junction ...)

Parameters
[in]intoThe device to write the edge into
[in]nThe junction/node to write
[in]checkLaneFoesWhether laneConflicts shall be checked at this junction

Definition at line 423 of file NWWriter_SUMO.cpp.

References OutputDevice::closeTag(), NBNode::getCrossings(), 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().

void NWWriter_SUMO::writeLane ( OutputDevice into,
const std::string &  eID,
const std::string &  lID,
SUMOReal  speed,
SVCPermissions  permissions,
SVCPermissions  preferred,
SUMOReal  endOffset,
SUMOReal  width,
const PositionVector shape,
const std::string &  origID,
SUMOReal  length,
unsigned int  index,
bool  origNames 
)
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

Definition at line 380 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().

void NWWriter_SUMO::writeNetwork ( const OptionsCont oc,
NBNetBuilder nb 
)
static
void NWWriter_SUMO::writePermissions ( OutputDevice into,
SVCPermissions  permissions 
)
static
void NWWriter_SUMO::writePreferences ( OutputDevice into,
SVCPermissions  preferred 
)
static

writes allowed disallowed attributes if needed;

Definition at line 765 of file NWWriter_SUMO.cpp.

References getVehicleClassNames(), SUMO_ATTR_PREFER, SVCAll, and OutputDevice::writeAttr().

Referenced by NWWriter_XML::writeEdgesAndConnections(), and writeLane().

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 
)
staticprotected

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

std::string NWWriter_SUMO::writeSUMOTime ( SUMOTime  time)
staticprivate

writes a SUMOTime as int if possible, otherwise as a float

Definition at line 657 of file NWWriter_SUMO.cpp.

References STEPS2TIME, SUMOReal, and toString().

Referenced by writeTrafficLights().


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