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