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-2018 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  n->writeParams(device);
154  device.closeTag();
155  }
156  device.close();
157 }
158 
159 
160 void
162  OutputDevice& device = OutputDevice::getDevice(oc.getString("plain-output-prefix") + ".typ.xml");
163  std::map<SumoXMLAttr, std::string> attrs;
165  device.writeXMLHeader("types", "types_file.xsd", attrs);
166  tc.writeTypes(device);
167  device.close();
168 }
169 
170 
171 void
173  const GeoConvHelper& gch = GeoConvHelper::getFinal();
174  bool useGeo = oc.exists("proj.plain-geo") && oc.getBool("proj.plain-geo");
175  const bool geoAccuracy = useGeo || gch.usingInverseGeoProjection();
176 
177  std::map<SumoXMLAttr, std::string> attrs;
179  OutputDevice& edevice = OutputDevice::getDevice(oc.getString("plain-output-prefix") + ".edg.xml");
180  edevice.writeXMLHeader("edges", "edges_file.xsd", attrs);
181  OutputDevice& cdevice = OutputDevice::getDevice(oc.getString("plain-output-prefix") + ".con.xml");
182  cdevice.writeXMLHeader("connections", "connections_file.xsd", attrs);
183  const bool writeNames = oc.getBool("output.street-names");
184  for (std::map<std::string, NBEdge*>::const_iterator i = ec.begin(); i != ec.end(); ++i) {
185  // write the edge itself to the edges-files
186  NBEdge* e = (*i).second;
187  edevice.openTag(SUMO_TAG_EDGE);
188  edevice.writeAttr(SUMO_ATTR_ID, e->getID());
189  edevice.writeAttr(SUMO_ATTR_FROM, e->getFromNode()->getID());
190  edevice.writeAttr(SUMO_ATTR_TO, e->getToNode()->getID());
191  if (writeNames && e->getStreetName() != "") {
193  }
195  // write the type if given
196  if (e->getTypeID() != "") {
197  edevice.writeAttr(SUMO_ATTR_TYPE, e->getTypeID());
198  }
200  if (!e->hasLaneSpecificSpeed()) {
201  edevice.writeAttr(SUMO_ATTR_SPEED, e->getSpeed());
202  }
203  // write non-default geometry
204  if (!e->hasDefaultGeometry()) {
205  PositionVector geom = e->getGeometry();
206  if (useGeo) {
207  for (int i = 0; i < (int) geom.size(); i++) {
208  gch.cartesian2geo(geom[i]);
209  }
210  }
211  if (geoAccuracy) {
212  edevice.setPrecision(gPrecisionGeo);
213  }
214  edevice.writeAttr(SUMO_ATTR_SHAPE, geom);
215  if (geoAccuracy) {
216  edevice.setPrecision();
217  }
218  }
219  // write the spread type if not default ("right")
222  }
223  // write the length if it was specified
224  if (e->hasLoadedLength()) {
226  }
227  // some attributes can be set by edge default or per lane. Write as default if possible (efficiency)
229  edevice.writeAttr(SUMO_ATTR_WIDTH, e->getLaneWidth());
230  }
233  }
234  if (!e->hasLaneSpecificPermissions()) {
235  writePermissions(edevice, e->getPermissions(0));
236  }
237  if (!e->hasLaneSpecificStopOffsets() && e->getStopOffsets().size() != 0) {
239  }
240  if (e->needsLaneSpecificOutput()) {
241  for (int i = 0; i < (int)e->getLanes().size(); ++i) {
242  const NBEdge::Lane& lane = e->getLanes()[i];
243  edevice.openTag(SUMO_TAG_LANE);
244  edevice.writeAttr(SUMO_ATTR_INDEX, i);
245  // write allowed lanes
246  if (e->hasLaneSpecificPermissions()) {
247  writePermissions(edevice, lane.permissions);
248  }
249  writePreferences(edevice, lane.preferred);
250  // write other attributes
252  edevice.writeAttr(SUMO_ATTR_WIDTH, lane.width);
253  }
255  edevice.writeAttr(SUMO_ATTR_ENDOFFSET, lane.endOffset);
256  }
257  if (e->hasLaneSpecificSpeed()) {
258  edevice.writeAttr(SUMO_ATTR_SPEED, lane.speed);
259  }
260  if (lane.accelRamp) {
262  }
263  if (lane.customShape.size() > 0) {
264  edevice.writeAttr(SUMO_ATTR_SHAPE, lane.customShape);
265  }
266  if (lane.oppositeID != "") {
267  edevice.openTag(SUMO_TAG_NEIGH);
268  edevice.writeAttr(SUMO_ATTR_LANE, lane.oppositeID);
269  edevice.closeTag();
270  }
271  lane.writeParams(edevice);
273  edevice.closeTag();
274  }
275  }
276  e->writeParams(edevice);
277  edevice.closeTag();
278  // write this edge's connections to the connections-files
279  const std::vector<NBEdge::Connection> connections = e->getConnections();
280  if (connections.empty()) {
281  // if there are no connections and this appears to be customized, preserve the information
282  const int numOutgoing = (int)e->getToNode()->getOutgoingEdges().size();
283  if (numOutgoing > 0) {
284  const SVCPermissions inPerm = e->getPermissions();
285  SVCPermissions outPerm = 0;
286  for (auto out : e->getToNode()->getOutgoingEdges()) {
287  outPerm |= out->getPermissions();
288  }
289  if ((inPerm & outPerm) != 0 && (inPerm & outPerm) != SVC_PEDESTRIAN) {
290  cdevice.openTag(SUMO_TAG_CONNECTION);
291  cdevice.writeAttr(SUMO_ATTR_FROM, e->getID());
292  cdevice.closeTag();
293  cdevice << "\n";
294  }
295  }
296  } else {
297  for (std::vector<NBEdge::Connection>::const_iterator c = connections.begin(); c != connections.end(); ++c) {
298  NWWriter_SUMO::writeConnection(cdevice, *e, *c, false, NWWriter_SUMO::PLAIN);
299  }
300  cdevice << "\n";
301  }
302  }
303  // write roundabout information to the edges-files
304  if (ec.getRoundabouts().size() > 0) {
305  edevice.lf();
307  }
308 
309  // write loaded prohibitions to the connections-file
310  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
311  NWWriter_SUMO::writeProhibitions(cdevice, i->second->getProhibitions());
312  }
313  // write pedestrian crossings to the connections-file
314  for (std::map<std::string, NBNode*>::const_iterator it_node = nc.begin(); it_node != nc.end(); ++it_node) {
315  const std::vector<NBNode::Crossing*>& crossings = (*it_node).second->getCrossings();
316  for (auto c : crossings) {
317  cdevice.openTag(SUMO_TAG_CROSSING);
318  cdevice.writeAttr(SUMO_ATTR_NODE, (*it_node).second->getID());
319  cdevice.writeAttr(SUMO_ATTR_EDGES, c->edges);
320  cdevice.writeAttr(SUMO_ATTR_PRIORITY, c->priority);
321  if (c->customWidth != NBEdge::UNSPECIFIED_WIDTH) {
322  cdevice.writeAttr(SUMO_ATTR_WIDTH, c->customWidth);
323  }
324  if (c->customTLIndex != -1) {
325  cdevice.writeAttr(SUMO_ATTR_TLLINKINDEX, c->customTLIndex);
326  }
327  if (c->customTLIndex2 != -1) {
328  cdevice.writeAttr(SUMO_ATTR_TLLINKINDEX2, c->customTLIndex2);
329  }
330  if (c->customShape.size() != 0) {
331  cdevice.writeAttr(SUMO_ATTR_SHAPE, c->customShape);
332  }
333  cdevice.closeTag();
334  }
335  }
336  // write custom walkingarea shapes to the connections file
337  for (std::map<std::string, NBNode*>::const_iterator it_node = nc.begin(); it_node != nc.end(); ++it_node) {
338  for (const auto& wacs : it_node->second->getWalkingAreaCustomShapes()) {
339  cdevice.openTag(SUMO_TAG_WALKINGAREA);
340  cdevice.writeAttr(SUMO_ATTR_NODE, it_node->first);
341  cdevice.writeAttr(SUMO_ATTR_EDGES, joinNamedToString(wacs.edges, " "));
342  cdevice.writeAttr(SUMO_ATTR_SHAPE, wacs.shape);
343  cdevice.closeTag();
344  }
345  }
346 
347  edevice.close();
348  cdevice.close();
349 }
350 
351 
352 void
354  std::map<SumoXMLAttr, std::string> attrs;
356  OutputDevice& device = OutputDevice::getDevice(oc.getString("plain-output-prefix") + ".tll.xml");
357  device.writeXMLHeader("tlLogics", "tllogic_file.xsd", attrs);
359  // we also need to remember the associations between tlLogics and connections
360  // since the information in con.xml is insufficient
361  for (std::map<std::string, NBEdge*>::const_iterator i = ec.begin(); i != ec.end(); ++i) {
362  NBEdge* e = (*i).second;
363  // write this edge's tl-controlled connections
364  const std::vector<NBEdge::Connection> connections = e->getConnections();
365  for (std::vector<NBEdge::Connection>::const_iterator c = connections.begin(); c != connections.end(); ++c) {
366  if (c->tlID != "") {
367  NWWriter_SUMO::writeConnection(device, *e, *c, false, NWWriter_SUMO::TLL);
368  }
369  }
370  }
371  device.close();
372 }
373 
374 
375 void
377  std::map<SumoXMLAttr, std::string> attrs;
379  OutputDevice& device = OutputDevice::getDevice(oc.getString("junctions.join-output"));
380  device.writeXMLHeader("nodes", "nodes_file.xsd", attrs);
381  const std::vector<std::set<std::string> >& clusters = nc.getJoinedClusters();
382  for (std::vector<std::set<std::string> >::const_iterator it = clusters.begin(); it != clusters.end(); it++) {
383  assert((*it).size() > 0);
384  device.openTag(SUMO_TAG_JOIN);
385  // prepare string
386  std::ostringstream oss;
387  for (std::set<std::string>::const_iterator it_id = it->begin(); it_id != it->end(); it_id++) {
388  oss << *it_id << " ";
389  }
390  // remove final space
391  std::string ids = oss.str();
392  device.writeAttr(SUMO_ATTR_NODES, ids.substr(0, ids.size() - 1));
393  device.closeTag();
394  }
395  device.close();
396 }
397 
398 
399 void
401  OutputDevice& device = OutputDevice::getDevice(oc.getString("street-sign-output"));
402  device.writeXMLHeader("additional", "additional_file.xsd");
403  for (std::map<std::string, NBEdge*>::const_iterator i = ec.begin(); i != ec.end(); ++i) {
404  NBEdge* e = (*i).second;
405  const std::vector<NBSign>& signs = e->getSigns();
406  for (std::vector<NBSign>::const_iterator it = signs.begin(); it != signs.end(); ++it) {
407  it->writeAsPOI(device, e);
408  }
409  }
410  device.close();
411 }
412 void
414  OutputDevice& device = OutputDevice::getDevice(oc.getString("ptstop-output"));
415  device.writeXMLHeader("additional", "additional_file.xsd");
416  for (std::map<std::string, NBPTStop*>::const_iterator i = sc.begin(); i != sc.end(); ++i) {
417  i->second->write(device);
418  }
419  device.close();
420 }
422  OutputDevice& device = OutputDevice::getDevice(oc.getString("ptline-output"));
423  device.writeXMLHeader("additional", "additional_file.xsd");
424  for (std::vector<NBPTLine*>::const_iterator i = lc.begin(); i != lc.end(); ++i) {
425  (*i)->write(device, ec);
426  }
427  device.close();
428 }
429 
431  OutputDevice& device = OutputDevice::getDevice(oc.getString("parking-output"));
432  device.writeXMLHeader("additional", "additional_file.xsd");
433  for (NBParking& p : pc) {
434  p.write(device, ec);
435  }
436  device.close();
437 }
438 
439 
440 /****************************************************************************/
441 
442 
443 /****************************************************************************/
bool getKeepClear() const
Returns the keepClear flag.
Definition: NBNode.h:277
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge&#39;s lanes&#39; lateral offset is computed.
Definition: NBEdge.h:704
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:296
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:271
NBTypeCont & getTypeCont()
Returns a reference to the type container.
Definition: NBNetBuilder.h:160
Whether vehicles must keep the junction clear.
is a pedestrian
const std::map< int, double > & getStopOffsets() const
Returns the stopOffset to the end of the edge.
Definition: NBEdge.h:562
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.
begin/end of the description of a single lane
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:427
const std::string & getTypeID() const
get ID of type
Definition: NBEdge.h:1004
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:511
const std::vector< NBSign > & getSigns() const
get Signs
Definition: NBEdge.h:1233
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:65
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:1992
static void writeProhibitions(OutputDevice &into, const NBConnectionProhibits &prohibitions)
writes the given prohibitions
static const double UNSPECIFIED_RADIUS
unspecified lane width
Definition: NBNode.h:205
static const double UNSPECIFIED_OFFSET
unspecified lane offset
Definition: NBEdge.h:261
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:507
NBPTStopCont & getPTStopCont()
Returns a reference to the pt stop container.
Definition: NBNetBuilder.h:176
NBPTLineCont & getPTLineCont()
Returns a reference to the pt line container.
Definition: NBNetBuilder.h:181
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:589
double endOffset
This lane&#39;s offset to the intersection begin.
Definition: NBEdge.h:133
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:78
static void writeTrafficLights(OutputDevice &into, const NBTrafficLightLogicCont &tllCont)
writes the traffic light logics to the given device
NBParkingCont & getParkingCont()
Definition: NBNetBuilder.h:186
bool hasLaneSpecificStopOffsets() const
whether lanes differ in stopOffsets
Definition: NBEdge.cpp:2025
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:258
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:241
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:146
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:255
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:116
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:127
bool isTLControlled() const
Returns whether this node is controlled by any tls.
Definition: NBNode.h:303
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:2003
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:2014
static methods for processing the coordinates conversion for the current net
Definition: GeoConvHelper.h:53
the edges of a route
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:49
std::vector< NBPTLine * >::const_iterator end() const
Returns the pointer to the end of the stored pt lines.
Definition: NBPTLineCont.h:49
SVCPermissions preferred
List of vehicle types that are preferred on this lane.
Definition: NBEdge.h:130
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:420
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:150
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:2071
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:535
bool exists(const std::string &name) const
Returns the information whether the named option is known.
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:543
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:188
double getEndOffset() const
Returns the offset to the destination node.
Definition: NBEdge.h:555
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:124
double width
This lane&#39;s width.
Definition: NBEdge.h:140
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:3331
bool hasLaneSpecificPermissions() const
whether lanes differ in allowed vehicle classes
Definition: NBEdge.cpp:1978
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:1979
double getSpeed() const
Returns the speed allowed on this edge.
Definition: NBEdge.h:514
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:622
RightOfWay getRightOfWay() const
Returns hint on how to compute right of way.
Definition: NBNode.h:282
double getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:530
double getRadius() const
Returns the turning radius of this node.
Definition: NBNode.h:272
std::string oppositeID
An opposite lane ID, if given.
Definition: NBEdge.h:143
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:867
NBNodeCont & getNodeCont()
Returns a reference to the node container.
Definition: NBNetBuilder.h:155
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:137
Instance responsible for building networks.
Definition: NBNetBuilder.h:109
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:308
Join operation.
alternative definition for junction
A storage for options typed value containers)
Definition: OptionsCont.h:92
SumoXMLNodeType getType() const
Returns the type of this node.
Definition: NBNode.h:267
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
Definition: NBNetBuilder.h:165
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:242
Represents a single node (junction) during network building.
Definition: NBNode.h:68
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:434
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:497
std::vector< NBPTLine * >::const_iterator begin() const
Returns the pointer to the begin of the stored pt lines.
Definition: NBPTLineCont.h:42
PositionVector customShape
A custom shape for this lane set by the user.
Definition: NBEdge.h:153
static const std::string MAJOR_VERSION
The version number for written files.
Definition: NWFrame.h:62
int size() const
Returns the number of known types.
Definition: NBTypeCont.h:97
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:441
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:237
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:120