Eclipse SUMO - Simulation of Urban MObility
NWWriter_XML.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
18 // Exporter writing networks using XML (native input) format
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 #include <algorithm>
28 #include <netbuild/NBEdge.h>
29 #include <netbuild/NBEdgeCont.h>
30 #include <netbuild/NBNode.h>
31 #include <netbuild/NBNodeCont.h>
32 #include <netbuild/NBNetBuilder.h>
33 #include <netbuild/NBPTLineCont.h>
34 #include <netbuild/NBParking.h>
35 #include <utils/common/ToString.h>
40 #include "NWFrame.h"
41 #include "NWWriter_SUMO.h"
42 #include "NWWriter_XML.h"
43 
44 
45 
46 // ===========================================================================
47 // method definitions
48 // ===========================================================================
49 // ---------------------------------------------------------------------------
50 // static methods
51 // ---------------------------------------------------------------------------
52 void
54  // check whether plain-output files shall be generated
55  if (oc.isSet("plain-output-prefix")) {
56  writeNodes(oc, nb.getNodeCont());
57  if (nb.getTypeCont().size() > 0) {
58  writeTypes(oc, nb.getTypeCont());
59  }
62  }
63  if (oc.isSet("junctions.join-output")) {
65  }
66  if (oc.isSet("street-sign-output")) {
67  writeStreetSigns(oc, nb.getEdgeCont());
68  }
69  if (oc.exists("ptstop-output") && oc.isSet("ptstop-output")) {
70  writePTStops(oc, nb.getPTStopCont());
71  }
72  if (oc.exists("ptline-output") && oc.isSet("ptline-output")) {
73  writePTLines(oc, nb.getPTLineCont(), nb.getEdgeCont());
74  }
75 
76  if (oc.exists("parking-output") && oc.isSet("parking-output")) {
78  }
79 }
80 
81 
82 void
85  bool useGeo = oc.exists("proj.plain-geo") && oc.getBool("proj.plain-geo");
86  if (useGeo && !gch.usingGeoProjection()) {
87  WRITE_WARNING("Ignoring option \"proj.plain-geo\" because no geo-conversion has been defined");
88  useGeo = false;
89  }
90  const bool geoAccuracy = useGeo || gch.usingInverseGeoProjection();
91 
92  OutputDevice& device = OutputDevice::getDevice(oc.getString("plain-output-prefix") + ".nod.xml");
93  std::map<SumoXMLAttr, std::string> attrs;
95  device.writeXMLHeader("nodes", "nodes_file.xsd", attrs);
96 
97  // write network offsets and projection to allow reconstruction of original coordinates
98  if (!useGeo) {
100  }
101 
102  // write nodes
103  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
104  NBNode* n = (*i).second;
105  device.openTag(SUMO_TAG_NODE);
106  device.writeAttr(SUMO_ATTR_ID, n->getID());
107  // write position
108  Position pos = n->getPosition();
109  if (useGeo) {
110  gch.cartesian2geo(pos);
111  }
112  if (geoAccuracy) {
113  device.setPrecision(gPrecisionGeo);
114  }
115  NWFrame::writePositionLong(pos, device);
116  if (geoAccuracy) {
117  device.setPrecision();
118  }
119 
120  device.writeAttr(SUMO_ATTR_TYPE, toString(n->getType()));
121  if (n->isTLControlled()) {
122  const std::set<NBTrafficLightDefinition*>& tlss = n->getControllingTLS();
123  // set may contain multiple programs for the same id.
124  // make sure ids are unique and sorted
125  std::set<std::string> tlsIDs;
126  std::set<std::string> controlledInnerEdges;
127  for (std::set<NBTrafficLightDefinition*>::const_iterator it_tl = tlss.begin(); it_tl != tlss.end(); it_tl++) {
128  tlsIDs.insert((*it_tl)->getID());
129  std::vector<std::string> cie = (*it_tl)->getControlledInnerEdges();
130  controlledInnerEdges.insert(cie.begin(), cie.end());
131  }
132  std::vector<std::string> sortedIDs(tlsIDs.begin(), tlsIDs.end());
133  sort(sortedIDs.begin(), sortedIDs.end());
134  device.writeAttr(SUMO_ATTR_TLID, sortedIDs);
135  if (controlledInnerEdges.size() > 0) {
136  std::vector<std::string> sortedCIEs(controlledInnerEdges.begin(), controlledInnerEdges.end());
137  sort(sortedCIEs.begin(), sortedCIEs.end());
138  device.writeAttr(SUMO_ATTR_CONTROLLED_INNER, joinToString(sortedCIEs, " "));
139  }
140  }
141  if (n->hasCustomShape()) {
142  device.writeAttr(SUMO_ATTR_SHAPE, n->getShape());
143  }
145  device.writeAttr(SUMO_ATTR_RADIUS, n->getRadius());
146  }
147  if (n->getKeepClear() == false) {
148  device.writeAttr<bool>(SUMO_ATTR_KEEP_CLEAR, n->getKeepClear());
149  }
150  if (n->getRightOfWay() != RIGHT_OF_WAY_DEFAULT) {
151  device.writeAttr<std::string>(SUMO_ATTR_RIGHT_OF_WAY, toString(n->getRightOfWay()));
152  }
153  if (n->getFringeType() != FRINGE_TYPE_DEFAULT) {
154  device.writeAttr<std::string>(SUMO_ATTR_FRINGE, toString(n->getFringeType()));
155  }
156  n->writeParams(device);
157  device.closeTag();
158  }
159  device.close();
160 }
161 
162 
163 void
165  OutputDevice& device = OutputDevice::getDevice(oc.getString("plain-output-prefix") + ".typ.xml");
166  std::map<SumoXMLAttr, std::string> attrs;
168  device.writeXMLHeader("types", "types_file.xsd", attrs);
169  tc.writeTypes(device);
170  device.close();
171 }
172 
173 
174 void
176  const GeoConvHelper& gch = GeoConvHelper::getFinal();
177  bool useGeo = oc.exists("proj.plain-geo") && oc.getBool("proj.plain-geo");
178  const bool geoAccuracy = useGeo || gch.usingInverseGeoProjection();
179 
180  std::map<SumoXMLAttr, std::string> attrs;
182  OutputDevice& edevice = OutputDevice::getDevice(oc.getString("plain-output-prefix") + ".edg.xml");
183  edevice.writeXMLHeader("edges", "edges_file.xsd", attrs);
184  OutputDevice& cdevice = OutputDevice::getDevice(oc.getString("plain-output-prefix") + ".con.xml");
185  cdevice.writeXMLHeader("connections", "connections_file.xsd", attrs);
186  const bool writeNames = oc.getBool("output.street-names");
187  for (std::map<std::string, NBEdge*>::const_iterator i = ec.begin(); i != ec.end(); ++i) {
188  // write the edge itself to the edges-files
189  NBEdge* e = (*i).second;
190  edevice.openTag(SUMO_TAG_EDGE);
191  edevice.writeAttr(SUMO_ATTR_ID, e->getID());
192  edevice.writeAttr(SUMO_ATTR_FROM, e->getFromNode()->getID());
193  edevice.writeAttr(SUMO_ATTR_TO, e->getToNode()->getID());
194  if (writeNames && e->getStreetName() != "") {
196  }
198  // write the type if given
199  if (e->getTypeID() != "") {
200  edevice.writeAttr(SUMO_ATTR_TYPE, e->getTypeID());
201  }
203  if (!e->hasLaneSpecificSpeed()) {
204  edevice.writeAttr(SUMO_ATTR_SPEED, e->getSpeed());
205  }
206  // write non-default geometry
207  if (!e->hasDefaultGeometry()) {
208  PositionVector geom = e->getGeometry();
209  if (useGeo) {
210  for (int i = 0; i < (int) geom.size(); i++) {
211  gch.cartesian2geo(geom[i]);
212  }
213  }
214  if (geoAccuracy) {
215  edevice.setPrecision(gPrecisionGeo);
216  }
217  edevice.writeAttr(SUMO_ATTR_SHAPE, geom);
218  if (geoAccuracy) {
219  edevice.setPrecision();
220  }
221  }
222  // write the spread type if not default ("right")
225  }
226  // write the length if it was specified
227  if (e->hasLoadedLength()) {
229  }
230  // some attributes can be set by edge default or per lane. Write as default if possible (efficiency)
232  edevice.writeAttr(SUMO_ATTR_WIDTH, e->getLaneWidth());
233  }
236  }
237  if (!e->hasLaneSpecificPermissions()) {
238  writePermissions(edevice, e->getPermissions(0));
239  }
240  if (!e->hasLaneSpecificStopOffsets() && e->getStopOffsets().size() != 0) {
242  }
243  if (e->getDistance() != 0) {
245  }
246  if (e->needsLaneSpecificOutput()) {
247  for (int i = 0; i < (int)e->getLanes().size(); ++i) {
248  const NBEdge::Lane& lane = e->getLanes()[i];
249  edevice.openTag(SUMO_TAG_LANE);
250  edevice.writeAttr(SUMO_ATTR_INDEX, i);
251  // write allowed lanes
252  if (e->hasLaneSpecificPermissions()) {
253  writePermissions(edevice, lane.permissions);
254  }
255  writePreferences(edevice, lane.preferred);
256  // write other attributes
258  edevice.writeAttr(SUMO_ATTR_WIDTH, lane.width);
259  }
261  edevice.writeAttr(SUMO_ATTR_ENDOFFSET, lane.endOffset);
262  }
263  if (e->hasLaneSpecificSpeed()) {
264  edevice.writeAttr(SUMO_ATTR_SPEED, lane.speed);
265  }
266  if (lane.accelRamp) {
268  }
269  if (lane.customShape.size() > 0) {
270  edevice.writeAttr(SUMO_ATTR_SHAPE, lane.customShape);
271  }
272  if (lane.type != "") {
273  edevice.writeAttr(SUMO_ATTR_TYPE, lane.type);
274  }
275  if (lane.oppositeID != "") {
276  edevice.openTag(SUMO_TAG_NEIGH);
277  edevice.writeAttr(SUMO_ATTR_LANE, lane.oppositeID);
278  edevice.closeTag();
279  }
280  lane.writeParams(edevice);
282  edevice.closeTag();
283  }
284  }
285  e->writeParams(edevice);
286  edevice.closeTag();
287  // write this edge's connections to the connections-files
288  const std::vector<NBEdge::Connection> connections = e->getConnections();
289  if (connections.empty()) {
290  // if there are no connections and this appears to be customized, preserve the information
291  const int numOutgoing = (int)e->getToNode()->getOutgoingEdges().size();
292  if (numOutgoing > 0) {
293  const SVCPermissions inPerm = e->getPermissions();
294  SVCPermissions outPerm = 0;
295  for (auto out : e->getToNode()->getOutgoingEdges()) {
296  outPerm |= out->getPermissions();
297  }
298  if ((inPerm & outPerm) != 0 && (inPerm & outPerm) != SVC_PEDESTRIAN) {
299  cdevice.openTag(SUMO_TAG_CONNECTION);
300  cdevice.writeAttr(SUMO_ATTR_FROM, e->getID());
301  cdevice.closeTag();
302  cdevice << "\n";
303  }
304  }
305  } else {
306  for (std::vector<NBEdge::Connection>::const_iterator c = connections.begin(); c != connections.end(); ++c) {
307  NWWriter_SUMO::writeConnection(cdevice, *e, *c, false, NWWriter_SUMO::PLAIN);
308  }
309  cdevice << "\n";
310  }
311  }
312  // write roundabout information to the edges-files
313  if (ec.getRoundabouts().size() > 0) {
314  edevice.lf();
316  }
317 
318  // write loaded prohibitions to the connections-file
319  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
320  NWWriter_SUMO::writeProhibitions(cdevice, i->second->getProhibitions());
321  }
322  // write pedestrian crossings to the connections-file
323  for (std::map<std::string, NBNode*>::const_iterator it_node = nc.begin(); it_node != nc.end(); ++it_node) {
324  const std::vector<NBNode::Crossing*>& crossings = (*it_node).second->getCrossings();
325  for (auto c : crossings) {
326  cdevice.openTag(SUMO_TAG_CROSSING);
327  cdevice.writeAttr(SUMO_ATTR_NODE, (*it_node).second->getID());
328  cdevice.writeAttr(SUMO_ATTR_EDGES, c->edges);
329  cdevice.writeAttr(SUMO_ATTR_PRIORITY, c->priority);
330  if (c->customWidth != NBEdge::UNSPECIFIED_WIDTH) {
331  cdevice.writeAttr(SUMO_ATTR_WIDTH, c->customWidth);
332  }
333  if (c->customTLIndex != -1) {
334  cdevice.writeAttr(SUMO_ATTR_TLLINKINDEX, c->customTLIndex);
335  }
336  if (c->customTLIndex2 != -1) {
337  cdevice.writeAttr(SUMO_ATTR_TLLINKINDEX2, c->customTLIndex2);
338  }
339  if (c->customShape.size() != 0) {
340  cdevice.writeAttr(SUMO_ATTR_SHAPE, c->customShape);
341  }
342  cdevice.closeTag();
343  }
344  }
345  // write custom walkingarea shapes to the connections file
346  for (std::map<std::string, NBNode*>::const_iterator it_node = nc.begin(); it_node != nc.end(); ++it_node) {
347  for (const auto& wacs : it_node->second->getWalkingAreaCustomShapes()) {
348  cdevice.openTag(SUMO_TAG_WALKINGAREA);
349  cdevice.writeAttr(SUMO_ATTR_NODE, it_node->first);
350  cdevice.writeAttr(SUMO_ATTR_EDGES, joinNamedToString(wacs.edges, " "));
351  cdevice.writeAttr(SUMO_ATTR_SHAPE, wacs.shape);
352  cdevice.closeTag();
353  }
354  }
355 
356  edevice.close();
357  cdevice.close();
358 }
359 
360 
361 void
363  std::map<SumoXMLAttr, std::string> attrs;
365  OutputDevice& device = OutputDevice::getDevice(oc.getString("plain-output-prefix") + ".tll.xml");
366  device.writeXMLHeader("tlLogics", "tllogic_file.xsd", attrs);
368  // we also need to remember the associations between tlLogics and connections
369  // since the information in con.xml is insufficient
370  for (std::map<std::string, NBEdge*>::const_iterator i = ec.begin(); i != ec.end(); ++i) {
371  NBEdge* e = (*i).second;
372  // write this edge's tl-controlled connections
373  const std::vector<NBEdge::Connection> connections = e->getConnections();
374  for (std::vector<NBEdge::Connection>::const_iterator c = connections.begin(); c != connections.end(); ++c) {
375  if (c->tlID != "") {
376  NWWriter_SUMO::writeConnection(device, *e, *c, false, NWWriter_SUMO::TLL);
377  }
378  }
379  }
380  device.close();
381 }
382 
383 
384 void
386  std::map<SumoXMLAttr, std::string> attrs;
388  OutputDevice& device = OutputDevice::getDevice(oc.getString("junctions.join-output"));
389  device.writeXMLHeader("nodes", "nodes_file.xsd", attrs);
390  const std::vector<std::set<std::string> >& clusters = nc.getJoinedClusters();
391  for (std::vector<std::set<std::string> >::const_iterator it = clusters.begin(); it != clusters.end(); it++) {
392  assert((*it).size() > 0);
393  device.openTag(SUMO_TAG_JOIN);
394  // prepare string
395  std::ostringstream oss;
396  for (std::set<std::string>::const_iterator it_id = it->begin(); it_id != it->end(); it_id++) {
397  oss << *it_id << " ";
398  }
399  // remove final space
400  std::string ids = oss.str();
401  device.writeAttr(SUMO_ATTR_NODES, ids.substr(0, ids.size() - 1));
402  device.closeTag();
403  }
404  device.close();
405 }
406 
407 
408 void
410  OutputDevice& device = OutputDevice::getDevice(oc.getString("street-sign-output"));
411  device.writeXMLHeader("additional", "additional_file.xsd");
412  for (std::map<std::string, NBEdge*>::const_iterator i = ec.begin(); i != ec.end(); ++i) {
413  NBEdge* e = (*i).second;
414  const std::vector<NBSign>& signs = e->getSigns();
415  for (std::vector<NBSign>::const_iterator it = signs.begin(); it != signs.end(); ++it) {
416  it->writeAsPOI(device, e);
417  }
418  }
419  device.close();
420 }
421 void
423  OutputDevice& device = OutputDevice::getDevice(oc.getString("ptstop-output"));
424  device.writeXMLHeader("additional", "additional_file.xsd");
425  for (std::map<std::string, NBPTStop*>::const_iterator i = sc.begin(); i != sc.end(); ++i) {
426  i->second->write(device);
427  }
428  device.close();
429 }
431  OutputDevice& device = OutputDevice::getDevice(oc.getString("ptline-output"));
432  device.writeXMLHeader("additional", "additional_file.xsd");
433  for (const auto& item : lc.getLines()) {
434  item.second->write(device, ec);
435  }
436  device.close();
437 }
438 
440  OutputDevice& device = OutputDevice::getDevice(oc.getString("parking-output"));
441  device.writeXMLHeader("additional", "additional_file.xsd");
442  for (NBParking& p : pc) {
443  p.write(device, ec);
444  }
445  device.close();
446 }
447 
448 
449 /****************************************************************************/
450 
451 
452 /****************************************************************************/
bool getKeepClear() const
Returns the keepClear flag.
Definition: NBNode.h:286
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge&#39;s lanes&#39; lateral offset is computed.
Definition: NBEdge.h:762
The information about how to spread the lanes from the given position.
void writePermissions(OutputDevice &into, SVCPermissions permissions)
writes allowed disallowed attributes if needed;
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:256
void close()
Closes the device and removes it from the dictionary.
const std::vector< std::set< std::string > > & getJoinedClusters() const
gets all joined clusters (see doc for myClusters2Join)
Definition: NBNodeCont.h:303
static void writeLocation(OutputDevice &into)
writes the location element
a list of node ids, used for controlling joining
std::string joinNamedToString(const std::set< T *, C > &ns, const T_BETWEEN &between)
Definition: ToString.h:281
NBTypeCont & getTypeCont()
Returns a reference to the type container.
Definition: NBNetBuilder.h:161
Whether vehicles must keep the junction clear.
const std::map< int, double > & getStopOffsets() const
Returns the stopOffset to the end of the edge.
Definition: NBEdge.h:611
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
Definition: NBNodeCont.h:116
static void writeStreetSigns(const OptionsCont &oc, NBEdgeCont &ec)
Writes street signs as POIs to file.
std::string type
the type of this lane
Definition: NBEdge.h:177
begin/end of the description of a single lane
const std::map< std::string, NBPTLine * > & getLines() const
Definition: NBPTLineCont.h:39
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
Definition: NBNodeCont.h:121
A container for traffic light definitions and built programs.
void writePreferences(OutputDevice &into, SVCPermissions preferred)
writes allowed disallowed attributes if needed;
connectio between two lanes
int getPriority() const
Returns the priority of the edge.
Definition: NBEdge.h:472
const std::string & getTypeID() const
get ID of type
Definition: NBEdge.h:1061
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
bool hasCustomShape() const
return whether the shape was set by the user
Definition: NBNode.h:530
const std::vector< NBSign > & getSigns() const
get Signs
Definition: NBEdge.h:1298
bool usingGeoProjection() const
Returns whether a transformation from geo to metric coordinates will be performed.
The representation of a single edge during network building.
Definition: NBEdge.h:86
static void writeJoinedJunctions(const OptionsCont &oc, NBNodeCont &nc)
Writes the joined-juncionts to file.
bool hasLaneSpecificSpeed() const
whether lanes differ in speed
Definition: NBEdge.cpp:2054
static void writeProhibitions(OutputDevice &into, const NBConnectionProhibits &prohibitions)
writes the given prohibitions
static const double UNSPECIFIED_RADIUS
unspecified lane width
Definition: NBNode.h:212
static const double UNSPECIFIED_OFFSET
unspecified lane offset
Definition: NBEdge.h:306
link,node: the traffic light id responsible for this link
void setPrecision(int precision=gPrecision)
Sets the precison or resets it to default.
bool hasLoadedLength() const
Returns whether a length was set explicitly.
Definition: NBEdge.h:552
NBPTStopCont & getPTStopCont()
Returns a reference to the pt stop container.
Definition: NBNetBuilder.h:177
NBPTLineCont & getPTLineCont()
Returns a reference to the pt line container.
Definition: NBNetBuilder.h:182
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:644
double endOffset
This lane&#39;s offset to the intersection begin.
Definition: NBEdge.h:154
std::map< std::string, NBEdge * >::const_iterator end() const
Returns the pointer to the end of the stored edges.
Definition: NBEdgeCont.h:193
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const std::string & getID() const
Returns the id.
Definition: Named.h:77
static void writeTrafficLights(OutputDevice &into, const NBTrafficLightLogicCont &tllCont)
writes the traffic light logics to the given device
NBParkingCont & getParkingCont()
Definition: NBNetBuilder.h:187
bool hasLaneSpecificStopOffsets() const
whether lanes differ in stopOffsets
Definition: NBEdge.cpp:2098
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:303
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
double getDistance() const
Definition: NBEdge.h:604
static void writeStopOffsets(OutputDevice &into, const std::map< SVCPermissions, double > &stopOffsets)
Write a stopOffset element into output device.
bool accelRamp
Whether this lane is an acceleration lane.
Definition: NBEdge.h:167
link: the index of the opposite direction link of a pedestrian crossing
const EdgeVector & getOutgoingEdges() const
Returns this node&#39;s outgoing edges (The edges which start at this node)
Definition: NBNode.h:264
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
An (internal) definition of a single lane of an edge.
Definition: NBEdge.h:137
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
The representation of a single pt stop.
Definition: NBParking.h:44
SVCPermissions permissions
List of vehicle types that are allowed on this lane.
Definition: NBEdge.h:148
bool isTLControlled() const
Returns whether this node is controlled by any tls.
Definition: NBNode.h:317
static void writeParkingAreas(const OptionsCont &cont, NBParkingCont &pc, NBEdgeCont &ec)
writes imported parking areas to file
How to compute right of way.
The turning radius at an intersection in m.
std::map< std::string, NBPTStop * >::const_iterator begin() const
Returns the pointer to the begin of the stored pt stops.
Definition: NBPTStopCont.h:51
bool hasLaneSpecificWidth() const
whether lanes differ in width
Definition: NBEdge.cpp:2065
std::map< std::string, NBEdge * >::const_iterator begin() const
Returns the pointer to the begin of the stored edges.
Definition: NBEdgeCont.h:185
static void writeNodes(const OptionsCont &oc, NBNodeCont &nc)
Writes the nodes file.
bool hasLaneSpecificEndOffset() const
whether lanes differ in offset
Definition: NBEdge.cpp:2087
static methods for processing the coordinates conversion for the current net
Definition: GeoConvHelper.h:56
the edges of a route
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
SVCPermissions preferred
List of vehicle types that are preferred on this lane.
Definition: NBEdge.h:151
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:465
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >())
Writes an XML header with optional configuration.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
walking area for pedestrians
int gPrecisionGeo
Definition: StdDefs.cpp:28
NBEdgeCont & getEdgeCont()
Definition: NBNetBuilder.h:151
A list of positions.
static void writeTrafficLights(const OptionsCont &oc, NBTrafficLightLogicCont &tc, NBEdgeCont &ec)
Writes the traffic lights file.
bool needsLaneSpecificOutput() const
whether at least one lane has values differing from the edges values
Definition: NBEdge.cpp:2144
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool hasDefaultGeometry() const
Returns whether the geometry consists only of the node positions.
Definition: NBEdge.cpp:550
bool exists(const std::string &name) const
Returns the information whether the named option is known.
const std::string & getID() const
Definition: NBEdge.h:1364
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:61
const std::string & getStreetName() const
Returns the street name of this edge.
Definition: NBEdge.h:588
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network into XML-files (nodes, edges, connections, traffic lights)
const std::set< EdgeSet > getRoundabouts() const
Returns the determined roundabouts.
edge: the shape in xml-definition
static void writePositionLong(const Position &pos, OutputDevice &dev)
Writes the given position to device in long format (one attribute per dimension)
Definition: NWFrame.cpp:189
double getEndOffset() const
Returns the offset to the destination node.
Definition: NBEdge.h:600
begin/end of the description of a neighboring lane
static void writeTypes(const OptionsCont &oc, NBTypeCont &tc)
Writes the types file.
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.
std::map< std::string, NBPTStop * >::const_iterator end() const
Returns the pointer to the end of the stored pt stops.
Definition: NBPTStopCont.h:58
double speed
The speed allowed on this lane.
Definition: NBEdge.h:145
double width
This lane&#39;s width.
Definition: NBEdge.h:161
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:3441
bool hasLaneSpecificPermissions() const
whether lanes differ in allowed vehicle classes
Definition: NBEdge.cpp:2040
static void writePTStops(const OptionsCont &oc, NBPTStopCont &ec)
Writes the pt stops file.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
begin/end of the description of an edge
const PositionVector & getShape() const
retrieve the junction shape
Definition: NBNode.cpp:2143
double getSpeed() const
Returns the speed allowed on this edge.
Definition: NBEdge.h:559
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:680
RightOfWay getRightOfWay() const
Returns hint on how to compute right of way.
Definition: NBNode.h:291
double getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:575
FringeType getFringeType() const
Returns fringe type.
Definition: NBNode.h:296
double getRadius() const
Returns the turning radius of this node.
Definition: NBNode.h:281
std::string oppositeID
An opposite lane ID, if given.
Definition: NBEdge.h:164
static void writeEdgesAndConnections(const OptionsCont &oc, NBNodeCont &nc, NBEdgeCont &ec)
Writes the edges and connections files.
const std::vector< Connection > & getConnections() const
Returns the connections.
Definition: NBEdge.h:924
NBNodeCont & getNodeCont()
Returns a reference to the node container.
Definition: NBNetBuilder.h:156
std::map< int, double > stopOffsets
stopOffsets.second - The stop offset for vehicles stopping at the lane&#39;s end. Applies if vClass is in...
Definition: NBEdge.h:158
Instance responsible for building networks.
Definition: NBNetBuilder.h:110
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node) ...
Definition: NBNode.h:322
Join operation.
alternative definition for junction
A storage for options typed value containers)
Definition: OptionsCont.h:90
SumoXMLNodeType getType() const
Returns the type of this node.
Definition: NBNode.h:276
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
Definition: NBNetBuilder.h:166
crossing between edges for pedestrians
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
bool usingInverseGeoProjection() const
Returns the information whether an inverse transformation will happen.
const Position & getPosition() const
Definition: NBNode.h:251
Represents a single node (junction) during network building.
Definition: NBNode.h:68
const double NETWORK_VERSION
version for written networks and default version for loading
Definition: StdDefs.h:66
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
link: the index of the link within the traffic light
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:479
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:60
static void writePTLines(const OptionsCont &cont, NBPTLineCont &lc, NBEdgeCont &ec)
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn&#39;t set.
Definition: NBEdge.h:542
Fringe type of node.
PositionVector customShape
A custom shape for this lane set by the user.
Definition: NBEdge.h:174
int size() const
Returns the number of known types.
Definition: NBTypeCont.h:100
static void writeRoundabouts(OutputDevice &into, const std::set< EdgeSet > &roundabouts, const NBEdgeCont &ec)
Writes roundabouts.
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:486
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:247
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
void lf()
writes a line feed if applicable
Definition: OutputDevice.h:234
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)
A storage for available types of edges.
Definition: NBTypeCont.h:55
void writeTypes(OutputDevice &into) const
writes all types a s XML
Definition: NBTypeCont.cpp:124