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