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

Static Private Member Functions

Methods for writing network parts
static bool writeInternalEdges (OutputDevice &into, const NBEdgeCont &ec, const NBNode &n)
 Writes internal edges (<edge ... with id[0]==':') of the given node. More...
 
static void writeEdge (OutputDevice &into, const NBEdge &e, bool noNames)
 Writes an edge (<edge ...) More...
 
static void writeLane (OutputDevice &into, const std::string &lID, double speed, SVCPermissions permissions, SVCPermissions preferred, double endOffset, double width, PositionVector shape, const Parameterised *params, double length, int index, const std::string &oppositeID, bool accelRamp=false, bool customShape=false)
 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, LinkDirection dir=LINKDIR_STRAIGHT)
 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...
 
static std::string getOppositeInternalID (const NBEdgeCont &ec, const NBEdge *from, const NBEdge::Connection &con)
 retrieve the id of the opposite direction internal lane if it exists More...
 

Detailed Description

Exporter writing networks using the SUMO format.

Definition at line 62 of file NWWriter_SUMO.h.

Member Enumeration Documentation

◆ ConnectionStyle

Enumerator
SUMONET 
PLAIN 
TLL 

Definition at line 65 of file NWWriter_SUMO.h.

Member Function Documentation

◆ getOppositeInternalID()

std::string NWWriter_SUMO::getOppositeInternalID ( const NBEdgeCont ec,
const NBEdge from,
const NBEdge::Connection con 
)
staticprivate

◆ prohibitionConnection()

std::string NWWriter_SUMO::prohibitionConnection ( const NBConnection c)
staticprivate

the attribute value for a prohibition

Definition at line 783 of file NWWriter_SUMO.cpp.

References NBConnection::getFrom(), Named::getID(), and NBConnection::getTo().

Referenced by writeProhibitions().

◆ writeConnection()

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 574 of file NWWriter_SUMO.cpp.

References OutputDevice::closeTag(), NBEdge::Connection::contPos, NBEdge::Connection::customShape, 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, NBEdge::Connection::speed, SUMO_ATTR_CONTPOS, SUMO_ATTR_DIR, SUMO_ATTR_FROM, SUMO_ATTR_FROM_LANE, SUMO_ATTR_KEEP_CLEAR, SUMO_ATTR_PASS, SUMO_ATTR_SHAPE, SUMO_ATTR_SPEED, SUMO_ATTR_STATE, SUMO_ATTR_TLID, SUMO_ATTR_TLLINKINDEX, SUMO_ATTR_TO, SUMO_ATTR_TO_LANE, SUMO_ATTR_VIA, SUMO_ATTR_VISIBILITY_DISTANCE, SUMO_TAG_CONNECTION, SUMONET, NBEdge::Connection::tlID, TLL, NBEdge::Connection::tlLinkNo, NBEdge::Connection::toEdge, NBEdge::Connection::toLane, toString(), NBEdge::UNSPECIFIED_CONTPOS, NBEdge::UNSPECIFIED_SPEED, NBEdge::UNSPECIFIED_VISIBILITY_DISTANCE, NBEdge::Connection::visibility, and OutputDevice::writeAttr().

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

◆ writeDistrict()

◆ writeEdge()

◆ writeInternalConnection()

void NWWriter_SUMO::writeInternalConnection ( OutputDevice into,
const std::string &  from,
const std::string &  to,
int  fromLane,
int  toLane,
const std::string &  via,
LinkDirection  dir = LINKDIR_STRAIGHT 
)
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 652 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().

◆ writeInternalConnections()

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

◆ writeInternalEdges()

◆ writeInternalNodes()

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

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

◆ writeJunction()

void NWWriter_SUMO::writeJunction ( OutputDevice into,
const NBNode n,
const bool  checkLaneFoes 
)
staticprivate

◆ writeLane()

void NWWriter_SUMO::writeLane ( OutputDevice into,
const std::string &  lID,
double  speed,
SVCPermissions  permissions,
SVCPermissions  preferred,
double  endOffset,
double  width,
PositionVector  shape,
const Parameterised params,
double  length,
int  index,
const std::string &  oppositeID,
bool  accelRamp = false,
bool  customShape = false 
)
staticprivate

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

Parameters
[in]intoThe device to write the edge into
[in]lIDThe ID of the lane
[in]origIDThe original ID of the edge in the input
[in]lengthLane's length
[in]indexThe index of the lane within the edge
[in]oppositeIDThe ID of the opposite lane for overtaking
[in]accelRampwhether this lane is an acceleration lane
[in]customShapewhether this lane has a custom shape

Definition at line 398 of file NWWriter_SUMO.cpp.

References OutputDevice::closeTag(), PositionVector::getSubpart(), PositionVector::length(), OutputDevice::openTag(), SUMO_ATTR_ACCELERATION, SUMO_ATTR_CUSTOMSHAPE, SUMO_ATTR_ENDOFFSET, SUMO_ATTR_ID, SUMO_ATTR_INDEX, SUMO_ATTR_LANE, SUMO_ATTR_LENGTH, SUMO_ATTR_SHAPE, SUMO_ATTR_SPEED, SUMO_ATTR_WIDTH, SUMO_TAG_LANE, SUMO_TAG_NEIGH, SVC_UNSPECIFIED, toString(), NBEdge::UNSPECIFIED_OFFSET, NBEdge::UNSPECIFIED_WIDTH, WRITE_WARNING, OutputDevice::writeAttr(), Parameterised::writeParams(), writePermissions(), and writePreferences().

Referenced by writeEdge(), and writeInternalEdges().

◆ writeNetwork()

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 60 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::getCrossing(), NBNode::getCrossings(), OutputDevice::getDevice(), NBNetBuilder::getDistrictCont(), NBNetBuilder::getEdgeCont(), OptionsCont::getInt(), NBNetBuilder::getNodeCont(), NBEdgeCont::getRoundabouts(), OptionsCont::getString(), NBNetBuilder::getTLLogicCont(), NBNetBuilder::getTypeCont(), NBNode::getWalkingAreas(), NBHelpers::interpretLaneID(), OptionsCont::isDefault(), OptionsCont::isSet(), OutputDevice::lf(), LINKDIR_STRAIGHT, LINKSTATE_MAJOR, LINKSTATE_MINOR, NWFrame::MAJOR_VERSION, OutputDevice::openTag(), NBNode::Crossing::priority, NBDistrictCont::size(), SUMO_ATTR_CORNERDETAIL, SUMO_ATTR_DIR, SUMO_ATTR_FROM, SUMO_ATTR_FROM_LANE, SUMO_ATTR_LEFTHAND, SUMO_ATTR_LINKDETAIL, SUMO_ATTR_RECTANGULAR_LANE_CUT, SUMO_ATTR_STATE, SUMO_ATTR_TLID, SUMO_ATTR_TLLINKINDEX, SUMO_ATTR_TO, SUMO_ATTR_TO_LANE, SUMO_ATTR_VERSION, SUMO_ATTR_WALKINGAREAS, SUMO_TAG_CONNECTION, NBNode::Crossing::tlID, 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().

◆ writeProhibitions()

void NWWriter_SUMO::writeProhibitions ( OutputDevice into,
const NBConnectionProhibits prohibitions 
)
static

◆ writeRoundabout()

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

◆ 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 671 of file NWWriter_SUMO.cpp.

References OutputDevice::lf(), and writeRoundabout().

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

◆ writeSUMOTime()

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

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

Definition at line 756 of file NWWriter_SUMO.cpp.

References STEPS2TIME, and toString().

Referenced by writeTrafficLights().

◆ writeTrafficLights()


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