SUMO - Simulation of Urban MObility
NWWriter_SUMO.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // Exporter writing networks using the SUMO format
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 #include <cmath>
33 #include <algorithm>
37 #include <utils/common/ToString.h>
41 #include <netbuild/NBEdge.h>
42 #include <netbuild/NBEdgeCont.h>
43 #include <netbuild/NBNode.h>
44 #include <netbuild/NBNodeCont.h>
45 #include <netbuild/NBNetBuilder.h>
47 #include <netbuild/NBDistrict.h>
48 #include "NWFrame.h"
49 #include "NWWriter_SUMO.h"
50 
51 
52 
53 // ===========================================================================
54 // method definitions
55 // ===========================================================================
56 // ---------------------------------------------------------------------------
57 // static methods
58 // ---------------------------------------------------------------------------
59 void
61  // check whether a sumo net-file shall be generated
62  if (!oc.isSet("output-file")) {
63  return;
64  }
65  OutputDevice& device = OutputDevice::getDevice(oc.getString("output-file"));
66  std::map<SumoXMLAttr, std::string> attrs;
68  if (oc.getBool("lefthand")) {
69  attrs[SUMO_ATTR_LEFTHAND] = "true";
70  }
71  const int cornerDetail = oc.getInt("junctions.corner-detail");
72  if (cornerDetail > 0) {
73  attrs[SUMO_ATTR_CORNERDETAIL] = toString(cornerDetail);
74  }
75  if (!oc.isDefault("junctions.internal-link-detail")) {
76  attrs[SUMO_ATTR_LINKDETAIL] = toString(oc.getInt("junctions.internal-link-detail"));
77  }
78  if (oc.getBool("rectangular-lane-cut")) {
79  attrs[SUMO_ATTR_RECTANGULAR_LANE_CUT] = "true";
80  }
81  device.writeXMLHeader("net", "net_file.xsd", attrs); // street names may contain non-ascii chars
82  device.lf();
83  // get involved container
84  const NBNodeCont& nc = nb.getNodeCont();
85  const NBEdgeCont& ec = nb.getEdgeCont();
86  const NBDistrictCont& dc = nb.getDistrictCont();
87 
88  // write network offsets and projection
90 
91  // write edge types and restrictions
92  nb.getTypeCont().writeTypes(device);
93 
94  // write inner lanes
95  bool origNames = oc.getBool("output.original-names");
96  if (!oc.getBool("no-internal-links")) {
97  bool hadAny = false;
98  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
99  hadAny |= writeInternalEdges(device, ec, *(*i).second, origNames);
100  }
101  if (hadAny) {
102  device.lf();
103  }
104  }
105 
106  // write edges with lanes and connected edges
107  bool noNames = !oc.getBool("output.street-names");
108  for (std::map<std::string, NBEdge*>::const_iterator i = ec.begin(); i != ec.end(); ++i) {
109  writeEdge(device, *(*i).second, noNames, origNames);
110  }
111  device.lf();
112 
113  // write tls logics
114  writeTrafficLights(device, nb.getTLLogicCont());
115 
116  // write the nodes (junctions)
117  std::set<NBNode*> roundaboutNodes;
118  const bool checkLaneFoesAll = oc.getBool("check-lane-foes.all");
119  const bool checkLaneFoesRoundabout = !checkLaneFoesAll && oc.getBool("check-lane-foes.roundabout");
120  if (checkLaneFoesRoundabout) {
121  const std::set<EdgeSet>& roundabouts = ec.getRoundabouts();
122  for (std::set<EdgeSet>::const_iterator i = roundabouts.begin(); i != roundabouts.end(); ++i) {
123  for (EdgeSet::const_iterator j = (*i).begin(); j != (*i).end(); ++j) {
124  roundaboutNodes.insert((*j)->getToNode());
125  }
126  }
127  }
128  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
129  const bool checkLaneFoes = checkLaneFoesAll || (checkLaneFoesRoundabout && roundaboutNodes.count((*i).second) > 0);
130  writeJunction(device, *(*i).second, checkLaneFoes);
131  }
132  device.lf();
133  const bool includeInternal = !oc.getBool("no-internal-links");
134  if (includeInternal) {
135  // ... internal nodes if not unwanted
136  bool hadAny = false;
137  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
138  hadAny |= writeInternalNodes(device, *(*i).second);
139  }
140  if (hadAny) {
141  device.lf();
142  }
143  }
144 
145  // write the successors of lanes
146  int numConnections = 0;
147  for (std::map<std::string, NBEdge*>::const_iterator it_edge = ec.begin(); it_edge != ec.end(); it_edge++) {
148  NBEdge* from = it_edge->second;
149  const std::vector<NBEdge::Connection> connections = from->getConnections();
150  numConnections += (int)connections.size();
151  for (std::vector<NBEdge::Connection>::const_iterator it_c = connections.begin(); it_c != connections.end(); it_c++) {
152  writeConnection(device, *from, *it_c, includeInternal);
153  }
154  }
155  if (numConnections > 0) {
156  device.lf();
157  }
158  if (includeInternal) {
159  // ... internal successors if not unwanted
160  bool hadAny = false;
161  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
162  hadAny |= writeInternalConnections(device, *(*i).second);
163  }
164  if (hadAny) {
165  device.lf();
166  }
167  }
168  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
169  NBNode* node = (*i).second;
170  // write connections from pedestrian crossings
171  const std::vector<NBNode::Crossing>& crossings = node->getCrossings();
172  for (std::vector<NBNode::Crossing>::const_iterator it = crossings.begin(); it != crossings.end(); it++) {
173  NWWriter_SUMO::writeInternalConnection(device, (*it).id, (*it).nextWalkingArea, 0, 0, "");
174  }
175  // write connections from pedestrian walking areas
176  const std::vector<NBNode::WalkingArea>& WalkingAreas = node->getWalkingAreas();
177  for (std::vector<NBNode::WalkingArea>::const_iterator it = WalkingAreas.begin(); it != WalkingAreas.end(); it++) {
178  if ((*it).nextCrossing != "") {
179  const NBNode::Crossing& nextCrossing = node->getCrossing((*it).nextCrossing);
180  // connection to next crossing (may be tls-controlled)
182  device.writeAttr(SUMO_ATTR_FROM, (*it).id);
183  device.writeAttr(SUMO_ATTR_TO, (*it).nextCrossing);
184  device.writeAttr(SUMO_ATTR_FROM_LANE, 0);
185  device.writeAttr(SUMO_ATTR_TO_LANE, 0);
186  if (nextCrossing.tlID != "") {
187  device.writeAttr(SUMO_ATTR_TLID, nextCrossing.tlID);
188  assert(nextCrossing.tlLinkNo >= 0);
189  device.writeAttr(SUMO_ATTR_TLLINKINDEX, nextCrossing.tlLinkNo);
190  }
193  device.closeTag();
194  }
195  // optional connections from/to sidewalk
196  for (std::vector<std::string>::const_iterator it_sw = (*it).nextSidewalks.begin(); it_sw != (*it).nextSidewalks.end(); ++it_sw) {
197  NWWriter_SUMO::writeInternalConnection(device, (*it).id, (*it_sw), 0, 0, "");
198  }
199  for (std::vector<std::string>::const_iterator it_sw = (*it).prevSidewalks.begin(); it_sw != (*it).prevSidewalks.end(); ++it_sw) {
200  NWWriter_SUMO::writeInternalConnection(device, (*it_sw), (*it).id, 0, 0, "");
201  }
202  }
203  }
204 
205  // write loaded prohibitions
206  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
207  writeProhibitions(device, i->second->getProhibitions());
208  }
209 
210  // write roundabout information
211  writeRoundabouts(device, ec.getRoundabouts(), ec);
212 
213  // write the districts
214  for (std::map<std::string, NBDistrict*>::const_iterator i = dc.begin(); i != dc.end(); i++) {
215  writeDistrict(device, *(*i).second);
216  }
217  if (dc.size() != 0) {
218  device.lf();
219  }
220  device.close();
221 }
222 
223 
224 std::string
226  const NBEdge::Lane& succ = con.toEdge->getLanes()[con.toLane];
227  const NBEdge::Lane& pred = from->getLanes()[con.fromLane];
228  if (succ.oppositeID != "" && succ.oppositeID != "-" && pred.oppositeID != "" && pred.oppositeID != "-") {
229  // find the connection that connects succ.oppositeID to pred.oppositeID
230  const NBEdge* succOpp = ec.retrieve(succ.oppositeID.substr(0, succ.oppositeID.rfind("_")));
231  const NBEdge* predOpp = ec.retrieve(pred.oppositeID.substr(0, pred.oppositeID.rfind("_")));
232  assert(succOpp != 0);
233  assert(predOpp != 0);
234  const std::vector<NBEdge::Connection>& connections = succOpp->getConnections();
235  for (std::vector<NBEdge::Connection>::const_iterator it_c = connections.begin(); it_c != connections.end(); it_c++) {
236  const NBEdge::Connection& conOpp = *it_c;
237  if (succOpp != from && // turnaround
238  succOpp->getLaneID(conOpp.fromLane) == succ.oppositeID &&
239  predOpp == conOpp.toEdge &&
240  predOpp->getLaneID(conOpp.toLane) == pred.oppositeID) {
241  return conOpp.getInternalLaneID();
242  }
243  }
244  return "";
245  } else {
246  return "";
247  }
248 }
249 
250 
251 bool
252 NWWriter_SUMO::writeInternalEdges(OutputDevice& into, const NBEdgeCont& ec, const NBNode& n, bool origNames) {
253  bool ret = false;
254  const EdgeVector& incoming = n.getIncomingEdges();
255  for (EdgeVector::const_iterator i = incoming.begin(); i != incoming.end(); i++) {
256  const std::vector<NBEdge::Connection>& elv = (*i)->getConnections();
257  if (elv.size() > 0) {
258  bool haveVia = false;
259  NBEdge* toEdge = 0;
260  std::string internalEdgeID = "";
261  // first pass: compute average lengths of non-via edges
262  std::map<NBEdge*, double> lengthSum;
263  std::map<NBEdge*, int> numLanes;
264  for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
265  lengthSum[(*k).toEdge] += MAX2((*k).shape.length(), POSITION_EPS);
266  numLanes[(*k).toEdge] += 1;
267  }
268  // second pass: write non-via edges
269  for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
270  if ((*k).toEdge == 0) {
271  assert(false); // should never happen. tell me when it does
272  continue;
273  }
274  if (toEdge != (*k).toEdge) {
275  internalEdgeID = (*k).id;
276  if (toEdge != 0) {
277  // close the previous edge
278  into.closeTag();
279  }
280  toEdge = (*k).toEdge;
281  into.openTag(SUMO_TAG_EDGE);
282  into.writeAttr(SUMO_ATTR_ID, internalEdgeID);
284  // open a new edge
285  }
286  // to avoid changing to an internal lane which has a successor
287  // with the wrong permissions we need to inherit them from the successor
288  const NBEdge::Lane& successor = (*k).toEdge->getLanes()[(*k).toLane];
289  const double length = lengthSum[toEdge] / numLanes[toEdge];
290  // @note the actual length should be used once sumo supports lanes of
291  // varying length within the same edge
292  //const double length = MAX2((*k).shape.length(), POSITION_EPS);
293  writeLane(into, (*k).getInternalLaneID(), (*k).vmax,
294  successor.permissions, successor.preferred,
295  NBEdge::UNSPECIFIED_OFFSET, successor.width, (*k).shape, (*k).origID,
296  length, (*k).internalLaneIndex, origNames, getOppositeInternalID(ec, *i, *k), &n);
297  haveVia = haveVia || (*k).haveVia;
298  }
299  ret = true;
300  into.closeTag(); // close the last edge
301  // third pass: write via edges
302  if (haveVia) {
303  for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
304  if (!(*k).haveVia) {
305  continue;
306  }
307  if ((*k).toEdge == 0) {
308  assert(false); // should never happen. tell me when it does
309  continue;
310  }
311  const NBEdge::Lane& successor = (*k).toEdge->getLanes()[(*k).toLane];
312  into.openTag(SUMO_TAG_EDGE);
313  into.writeAttr(SUMO_ATTR_ID, (*k).viaID);
315  writeLane(into, (*k).viaID + "_0", (*k).viaVmax, SVCAll, SVCAll,
316  NBEdge::UNSPECIFIED_OFFSET, successor.width, (*k).viaShape, (*k).origID,
317  MAX2((*k).viaShape.length(), POSITION_EPS), // microsim needs positive length
318  0, origNames, "", &n);
319  into.closeTag();
320  }
321  }
322  }
323  }
324  // write pedestrian crossings
325  const std::vector<NBNode::Crossing>& crossings = n.getCrossings();
326  for (std::vector<NBNode::Crossing>::const_iterator it = crossings.begin(); it != crossings.end(); it++) {
327  into.openTag(SUMO_TAG_EDGE);
328  into.writeAttr(SUMO_ATTR_ID, (*it).id);
330  into.writeAttr(SUMO_ATTR_CROSSING_EDGES, (*it).edges);
331  writeLane(into, (*it).id + "_0", 1, SVC_PEDESTRIAN, 0,
332  NBEdge::UNSPECIFIED_OFFSET, (*it).width, (*it).shape, "", (*it).shape.length(), 0, false, "", &n);
333  into.closeTag();
334  }
335  // write pedestrian walking areas
336  const std::vector<NBNode::WalkingArea>& WalkingAreas = n.getWalkingAreas();
337  for (std::vector<NBNode::WalkingArea>::const_iterator it = WalkingAreas.begin(); it != WalkingAreas.end(); it++) {
338  const NBNode::WalkingArea& wa = *it;
339  into.openTag(SUMO_TAG_EDGE);
340  into.writeAttr(SUMO_ATTR_ID, wa.id);
342  writeLane(into, wa.id + "_0", 1, SVC_PEDESTRIAN, 0,
343  NBEdge::UNSPECIFIED_OFFSET, wa.width, wa.shape, "", wa.length, 0, false, "", &n);
344  into.closeTag();
345  }
346  return ret;
347 }
348 
349 
350 void
351 NWWriter_SUMO::writeEdge(OutputDevice& into, const NBEdge& e, bool noNames, bool origNames) {
352  // write the edge's begin
355  into.writeAttr(SUMO_ATTR_TO, e.getToNode()->getID());
356  if (!noNames && e.getStreetName() != "") {
358  }
360  if (e.getTypeID() != "") {
362  }
363  if (e.isMacroscopicConnector()) {
365  }
366  // write the spread type if not default ("right")
369  }
370  if (e.hasLoadedLength()) {
372  }
373  if (!e.hasDefaultGeometry()) {
375  }
376  // write the lanes
377  const std::vector<NBEdge::Lane>& lanes = e.getLanes();
378 
379  const double length = e.getFinalLength();
380  for (int i = 0; i < (int) lanes.size(); i++) {
381  const NBEdge::Lane& l = lanes[i];
382  writeLane(into, e.getLaneID(i), l.speed,
383  l.permissions, l.preferred, l.endOffset, l.width, l.shape, l.origID,
384  length, i, origNames, l.oppositeID, 0, l.accelRamp);
385  }
386  // close the edge
387  into.closeTag();
388 }
389 
390 
391 void
392 NWWriter_SUMO::writeLane(OutputDevice& into, const std::string& lID,
393  double speed, SVCPermissions permissions, SVCPermissions preferred,
394  double endOffset, double width, PositionVector shape,
395  const std::string& origID, double length, int index, bool origNames,
396  const std::string& oppositeID, const NBNode* node, bool accelRamp) {
397  // output the lane's attributes
399  // the first lane of an edge will be the depart lane
400  into.writeAttr(SUMO_ATTR_INDEX, index);
401  // write the list of allowed/disallowed vehicle classes
402  if (permissions != SVC_UNSPECIFIED) {
403  writePermissions(into, permissions);
404  }
405  writePreferences(into, preferred);
406  // some further information
407  if (speed == 0) {
408  WRITE_WARNING("Lane '" + lID + "' has a maximum allowed speed of 0.");
409  } else if (speed < 0) {
410  throw ProcessError("Negative allowed speed (" + toString(speed) + ") on lane '" + lID + "', use --speed.minimum to prevent this.");
411  }
412  if (endOffset > 0) {
413  length = length - endOffset;
414  }
415  into.writeAttr(SUMO_ATTR_SPEED, speed);
416  into.writeAttr(SUMO_ATTR_LENGTH, length);
417  if (endOffset != NBEdge::UNSPECIFIED_OFFSET) {
418  into.writeAttr(SUMO_ATTR_ENDOFFSET, endOffset);
419  }
420  if (width != NBEdge::UNSPECIFIED_WIDTH) {
421  into.writeAttr(SUMO_ATTR_WIDTH, width);
422  }
423  if (accelRamp) {
424  into.writeAttr<bool>(SUMO_ATTR_ACCELERATION, accelRamp);
425  }
426  if (node != 0) {
427  const NBNode::CustomShapeMap& cs = node->getCustomLaneShapes();
428  NBNode::CustomShapeMap::const_iterator it = cs.find(lID);
429  if (it != cs.end()) {
430  shape = it->second;
431  into.writeAttr(SUMO_ATTR_CUSTOMSHAPE, true);
432  }
433  }
434  into.writeAttr(SUMO_ATTR_SHAPE, endOffset > 0 ?
435  shape.getSubpart(0, shape.length() - endOffset) : shape);
436  if (oppositeID != "" && oppositeID != "-") {
437  into.openTag(SUMO_TAG_NEIGH);
438  into.writeAttr(SUMO_ATTR_LANE, oppositeID);
439  into.closeTag();
440  }
441  if (origNames && origID != "") {
442  into.openTag(SUMO_TAG_PARAM);
444  into.writeAttr(SUMO_ATTR_VALUE, origID);
445  into.closeTag();
446  }
447 
448  into.closeTag();
449 }
450 
451 
452 void
453 NWWriter_SUMO::writeJunction(OutputDevice& into, const NBNode& n, const bool checkLaneFoes) {
454  // write the attributes
456  into.writeAttr(SUMO_ATTR_TYPE, n.getType());
458  // write the incoming lanes
459  std::string incLanes;
460  const std::vector<NBEdge*>& incoming = n.getIncomingEdges();
461  for (std::vector<NBEdge*>::const_iterator i = incoming.begin(); i != incoming.end(); ++i) {
462  int noLanes = (*i)->getNumLanes();
463  for (int j = 0; j < noLanes; j++) {
464  incLanes += (*i)->getLaneID(j);
465  if (i != incoming.end() - 1 || j < noLanes - 1) {
466  incLanes += ' ';
467  }
468  }
469  }
470  const std::vector<NBNode::Crossing>& crossings = n.getCrossings();
471  for (std::vector<NBNode::Crossing>::const_iterator it = crossings.begin(); it != crossings.end(); it++) {
472  incLanes += ' ' + (*it).prevWalkingArea + "_0";
473  }
474  into.writeAttr(SUMO_ATTR_INCLANES, incLanes);
475  // write the internal lanes
476  std::string intLanes;
477  if (!OptionsCont::getOptions().getBool("no-internal-links")) {
478  int l = 0;
479  for (EdgeVector::const_iterator i = incoming.begin(); i != incoming.end(); i++) {
480  const std::vector<NBEdge::Connection>& elv = (*i)->getConnections();
481  for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
482  if ((*k).toEdge == 0) {
483  continue;
484  }
485  if (l != 0) {
486  intLanes += ' ';
487  }
488  if (!(*k).haveVia) {
489  intLanes += (*k).getInternalLaneID();
490  } else {
491  intLanes += (*k).viaID + "_0";
492  }
493  l++;
494  }
495  }
496  }
497  if (n.getType() != NODETYPE_DEAD_END && n.getType() != NODETYPE_NOJUNCTION) {
498  for (std::vector<NBNode::Crossing>::const_iterator it = crossings.begin(); it != crossings.end(); it++) {
499  intLanes += ' ' + (*it).id + "_0";
500  }
501  }
502  into.writeAttr(SUMO_ATTR_INTLANES, intLanes);
503  // close writing
505  // write optional radius
508  }
509  // specify whether a custom shape was used
510  if (n.hasCustomShape()) {
511  into.writeAttr(SUMO_ATTR_CUSTOMSHAPE, true);
512  }
513  if (n.getType() == NODETYPE_DEAD_END) {
514  into.closeTag();
515  } else {
516  // write right-of-way logics
517  n.writeLogic(into, checkLaneFoes);
518  into.closeTag();
519  }
520 }
521 
522 
523 bool
525  bool ret = false;
526  const std::vector<NBEdge*>& incoming = n.getIncomingEdges();
527  // build the list of internal lane ids
528  std::vector<std::string> internalLaneIDs;
529  for (EdgeVector::const_iterator i = incoming.begin(); i != incoming.end(); i++) {
530  const std::vector<NBEdge::Connection>& elv = (*i)->getConnections();
531  for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
532  if ((*k).toEdge != 0) {
533  internalLaneIDs.push_back((*k).getInternalLaneID());
534  }
535  }
536  }
537  const std::vector<NBNode::Crossing>& crossings = n.getCrossings();
538  for (std::vector<NBNode::Crossing>::const_iterator it_c = crossings.begin(); it_c != crossings.end(); ++it_c) {
539  internalLaneIDs.push_back((*it_c).id + "_0");
540  }
541  // write the internal nodes
542  for (std::vector<NBEdge*>::const_iterator i = incoming.begin(); i != incoming.end(); i++) {
543  const std::vector<NBEdge::Connection>& elv = (*i)->getConnections();
544  for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
545  if ((*k).toEdge == 0 || !(*k).haveVia) {
546  continue;
547  }
548  Position pos = (*k).shape[-1];
549  into.openTag(SUMO_TAG_JUNCTION).writeAttr(SUMO_ATTR_ID, (*k).viaID + "_0");
551  NWFrame::writePositionLong(pos, into);
552  std::string incLanes = (*k).getInternalLaneID();
553  if ((*k).foeIncomingLanes.length() != 0) {
554  incLanes += " " + (*k).foeIncomingLanes;
555  }
556  into.writeAttr(SUMO_ATTR_INCLANES, incLanes);
557  const std::vector<int>& foes = (*k).foeInternalLinks;
558  std::vector<std::string> foeIDs;
559  for (std::vector<int>::const_iterator it = foes.begin(); it != foes.end(); ++it) {
560  foeIDs.push_back(internalLaneIDs[*it]);
561  }
562  into.writeAttr(SUMO_ATTR_INTLANES, joinToString(foeIDs, " "));
563  into.closeTag();
564  ret = true;
565  }
566  }
567  return ret;
568 }
569 
570 
571 void
573  bool includeInternal, ConnectionStyle style) {
574  assert(c.toEdge != 0);
576  into.writeAttr(SUMO_ATTR_FROM, from.getID());
577  into.writeAttr(SUMO_ATTR_TO, c.toEdge->getID());
580  if (c.mayDefinitelyPass && style != TLL) {
582  }
583  if ((from.getToNode()->getKeepClear() == false || c.keepClear == false) && style != TLL) {
584  into.writeAttr<bool>(SUMO_ATTR_KEEP_CLEAR, false);
585  }
586  if (c.contPos != NBEdge::UNSPECIFIED_CONTPOS && style != TLL) {
588  }
591  }
592  if (style != PLAIN) {
593  if (includeInternal) {
595  }
596  // set information about the controlling tl if any
597  if (c.tlID != "") {
598  into.writeAttr(SUMO_ATTR_TLID, c.tlID);
600  }
601  if (style == SUMONET) {
602  // write the direction information
603  LinkDirection dir = from.getToNode()->getDirection(&from, c.toEdge, OptionsCont::getOptions().getBool("lefthand"));
604  assert(dir != LINKDIR_NODIR);
605  into.writeAttr(SUMO_ATTR_DIR, toString(dir));
606  // write the state information
607  const LinkState linkState = from.getToNode()->getLinkState(
608  &from, c.toEdge, c.fromLane, c.toLane, c.mayDefinitelyPass, c.tlID);
609  into.writeAttr(SUMO_ATTR_STATE, linkState);
610  }
611  }
612  into.closeTag();
613 }
614 
615 
616 bool
618  bool ret = false;
619  const std::vector<NBEdge*>& incoming = n.getIncomingEdges();
620  for (std::vector<NBEdge*>::const_iterator i = incoming.begin(); i != incoming.end(); ++i) {
621  NBEdge* from = *i;
622  const std::vector<NBEdge::Connection>& connections = from->getConnections();
623  for (std::vector<NBEdge::Connection>::const_iterator j = connections.begin(); j != connections.end(); ++j) {
624  const NBEdge::Connection& c = *j;
625  assert(c.toEdge != 0);
626  if (c.haveVia) {
627  // internal split
628  writeInternalConnection(into, c.id, c.toEdge->getID(), c.internalLaneIndex, c.toLane, c.viaID + "_0");
629  writeInternalConnection(into, c.viaID, c.toEdge->getID(), 0, c.toLane, "");
630  } else {
631  // no internal split
633  }
634  ret = true;
635  }
636  }
637  return ret;
638 }
639 
640 
641 void
643  const std::string& from, const std::string& to,
644  int fromLane, int toLane, const std::string& via) {
646  into.writeAttr(SUMO_ATTR_FROM, from);
647  into.writeAttr(SUMO_ATTR_TO, to);
648  into.writeAttr(SUMO_ATTR_FROM_LANE, fromLane);
649  into.writeAttr(SUMO_ATTR_TO_LANE, toLane);
650  if (via != "") {
651  into.writeAttr(SUMO_ATTR_VIA, via);
652  }
653  into.writeAttr(SUMO_ATTR_DIR, "s");
654  into.writeAttr(SUMO_ATTR_STATE, (via != "" ? "m" : "M"));
655  into.closeTag();
656 }
657 
658 
659 void
660 NWWriter_SUMO::writeRoundabouts(OutputDevice& into, const std::set<EdgeSet>& roundabouts,
661  const NBEdgeCont& ec) {
662  // make output deterministic
663  std::vector<std::vector<std::string> > edgeIDs;
664  for (std::set<EdgeSet>::const_iterator i = roundabouts.begin(); i != roundabouts.end(); ++i) {
665  std::vector<std::string> tEdgeIDs;
666  for (EdgeSet::const_iterator j = (*i).begin(); j != (*i).end(); ++j) {
667  // the edges may have been erased from NBEdgeCont but their pointers are still valid
668  // we verify their existance in writeRoundabout()
669  tEdgeIDs.push_back((*j)->getID());
670  }
671  std::sort(tEdgeIDs.begin(), tEdgeIDs.end());
672  edgeIDs.push_back(tEdgeIDs);
673  }
674  std::sort(edgeIDs.begin(), edgeIDs.end());
675  // write
676  for (std::vector<std::vector<std::string> >::const_iterator i = edgeIDs.begin(); i != edgeIDs.end(); ++i) {
677  writeRoundabout(into, *i, ec);
678  }
679  if (roundabouts.size() != 0) {
680  into.lf();
681  }
682 }
683 
684 
685 void
686 NWWriter_SUMO::writeRoundabout(OutputDevice& into, const std::vector<std::string>& edgeIDs,
687  const NBEdgeCont& ec) {
688  std::vector<std::string> validEdgeIDs;
689  std::vector<std::string> invalidEdgeIDs;
690  std::vector<std::string> nodeIDs;
691  for (std::vector<std::string>::const_iterator i = edgeIDs.begin(); i != edgeIDs.end(); ++i) {
692  const NBEdge* edge = ec.retrieve(*i);
693  if (edge != 0) {
694  nodeIDs.push_back(edge->getToNode()->getID());
695  validEdgeIDs.push_back(edge->getID());
696  } else {
697  invalidEdgeIDs.push_back(*i);
698  }
699  }
700  std::sort(nodeIDs.begin(), nodeIDs.end());
701  if (validEdgeIDs.size() > 0) {
703  into.writeAttr(SUMO_ATTR_NODES, joinToString(nodeIDs, " "));
704  into.writeAttr(SUMO_ATTR_EDGES, joinToString(validEdgeIDs, " "));
705  into.closeTag();
706  if (invalidEdgeIDs.size() > 0) {
707  WRITE_WARNING("Writing incomplete roundabout. Edges: '"
708  + joinToString(invalidEdgeIDs, " ") + "' no longer exist'");
709  }
710  }
711 }
712 
713 
714 void
716  std::vector<double> sourceW = d.getSourceWeights();
718  std::vector<double> sinkW = d.getSinkWeights();
720  // write the head and the id of the district
722  if (d.getShape().size() > 0) {
724  }
725  // write all sources
726  const std::vector<NBEdge*>& sources = d.getSourceEdges();
727  for (int i = 0; i < (int)sources.size(); i++) {
728  // write the head and the id of the source
729  into.openTag(SUMO_TAG_TAZSOURCE).writeAttr(SUMO_ATTR_ID, sources[i]->getID()).writeAttr(SUMO_ATTR_WEIGHT, sourceW[i]);
730  into.closeTag();
731  }
732  // write all sinks
733  const std::vector<NBEdge*>& sinks = d.getSinkEdges();
734  for (int i = 0; i < (int)sinks.size(); i++) {
735  // write the head and the id of the sink
736  into.openTag(SUMO_TAG_TAZSINK).writeAttr(SUMO_ATTR_ID, sinks[i]->getID()).writeAttr(SUMO_ATTR_WEIGHT, sinkW[i]);
737  into.closeTag();
738  }
739  // write the tail
740  into.closeTag();
741 }
742 
743 
744 std::string
746  double time = STEPS2TIME(steps);
747  if (time == std::floor(time)) {
748  return toString(int(time));
749  } else {
750  return toString(time);
751  }
752 }
753 
754 
755 void
757  for (NBConnectionProhibits::const_iterator j = prohibitions.begin(); j != prohibitions.end(); j++) {
758  NBConnection prohibited = (*j).first;
759  const NBConnectionVector& prohibiting = (*j).second;
760  for (NBConnectionVector::const_iterator k = prohibiting.begin(); k != prohibiting.end(); k++) {
761  NBConnection prohibitor = *k;
765  into.closeTag();
766  }
767  }
768 }
769 
770 
771 std::string
773  return c.getFrom()->getID() + "->" + c.getTo()->getID();
774 }
775 
776 
777 void
779  std::vector<NBTrafficLightLogic*> logics = tllCont.getComputed();
780  for (std::vector<NBTrafficLightLogic*>::iterator it = logics.begin(); it != logics.end(); it++) {
782  into.writeAttr(SUMO_ATTR_ID, (*it)->getID());
783  into.writeAttr(SUMO_ATTR_TYPE, (*it)->getType());
784  into.writeAttr(SUMO_ATTR_PROGRAMID, (*it)->getProgramID());
785  into.writeAttr(SUMO_ATTR_OFFSET, writeSUMOTime((*it)->getOffset()));
786  // write params
787  (*it)->writeParams(into);
788  // write the phases
789  const std::vector<NBTrafficLightLogic::PhaseDefinition>& phases = (*it)->getPhases();
790  for (std::vector<NBTrafficLightLogic::PhaseDefinition>::const_iterator j = phases.begin(); j != phases.end(); ++j) {
791  into.openTag(SUMO_TAG_PHASE);
792  into.writeAttr(SUMO_ATTR_DURATION, writeSUMOTime(j->duration));
793  into.writeAttr(SUMO_ATTR_STATE, j->state);
794  into.closeTag();
795  }
796  into.closeTag();
797  }
798  if (logics.size() > 0) {
799  into.lf();
800  }
801 }
802 /****************************************************************************/
803 
static void writeRoundabout(OutputDevice &into, const std::vector< std::string > &r, const NBEdgeCont &ec)
Writes a roundabout.
bool getKeepClear() const
Returns the keepClear flag.
Definition: NBNode.h:267
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge&#39;s lanes&#39; lateral offset is computed.
Definition: NBEdge.h:677
std::string id
id of Connection
Definition: NBEdge.h:214
The information about how to spread the lanes from the given position.
int tlLinkNo
The index of this connection within the controlling traffic light.
Definition: NBEdge.h:196
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.
static void writeLocation(OutputDevice &into)
writes the location element
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:164
const std::vector< NBEdge * > & getSourceEdges() const
Returns the sources.
Definition: NBDistrict.h:198
LinkState getLinkState(const NBEdge *incoming, NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
get link state
Definition: NBNode.cpp:1613
int toLane
The lane the connections yields in.
Definition: NBEdge.h:190
a list of node ids, used for controlling joining
NBTypeCont & getTypeCont()
Returns a reference to the type container.
Definition: NBNetBuilder.h:165
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
Whether vehicles must keep the junction clear.
PositionVector shape
The lane&#39;s shape.
Definition: NBEdge.h:129
whether a given shape is user-defined
a source within a district (connection road)
is a pedestrian
static void writeDistrict(OutputDevice &into, const NBDistrict &d)
Writes a district.
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
Definition: NBNodeCont.h:114
std::string viaID
if Connection have a via, ID of it
Definition: NBEdge.h:226
NBEdge * toEdge
The edge the connections yields in.
Definition: NBEdge.h:187
begin/end of the description of a junction
begin/end of the description of a single lane
static const double UNSPECIFIED_VISIBILITY_DISTANCE
unspecified foe visibility for connections
Definition: NBEdge.h:267
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
Definition: NBNodeCont.h:119
const CustomShapeMap & getCustomLaneShapes() const
sets a custom shape for an internal lane
Definition: NBNode.h:478
A container for traffic light definitions and built programs.
a traffic assignment zone
static bool writeInternalEdges(OutputDevice &into, const NBEdgeCont &ec, const NBNode &n, bool origNames)
Writes internal edges (<edge ... with id[0]==&#39;:&#39;) of the given node.
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:420
double length
This lane&#39;s width.
Definition: NBNode.h:182
const std::string & getTypeID() const
get ID of type
Definition: NBEdge.h:971
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:493
std::map< std::string, NBDistrict * >::const_iterator end() const
Returns the pointer to the end of the stored districts.
The representation of a single edge during network building.
Definition: NBEdge.h:71
foe visibility distance of a link
const std::vector< Crossing > & getCrossings() const
return this junctions pedestrian crossings
Definition: NBNode.h:620
static void writeProhibitions(OutputDevice &into, const NBConnectionProhibits &prohibitions)
writes the given prohibitions
static void writeLane(OutputDevice &into, const std::string &lID, double speed, SVCPermissions permissions, SVCPermissions preferred, double endOffset, double width, PositionVector shape, const std::string &origID, double length, int index, bool origNames, const std::string &oppositeID, const NBNode *node=0, bool accelRamp=false)
Writes a lane (<lane ...) of an edge.
static const double UNSPECIFIED_RADIUS
unspecified lane width
Definition: NBNode.h:200
A container for districts.
static const double UNSPECIFIED_OFFSET
unspecified lane offset
Definition: NBEdge.h:258
link,node: the traffic light id responsible for this link
T MAX2(T a, T b)
Definition: StdDefs.h:70
bool hasLoadedLength() const
Returns whether a length was set explicitly.
Definition: NBEdge.h:500
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:570
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
Definition: NBEdge.h:199
double endOffset
This lane&#39;s offset to the intersection begin.
Definition: NBEdge.h:141
NBEdge * getFrom() const
returns the from-edge (start of the connection)
double visibility
custom foe visiblity for connection
Definition: NBEdge.h:208
std::string id
the (edge)-id of this walkingArea
Definition: NBNode.h:178
std::map< std::string, NBEdge * >::const_iterator end() const
Returns the pointer to the end of the stored edges.
Definition: NBEdgeCont.h:198
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:66
std::map< std::string, NBDistrict * >::const_iterator begin() const
Returns the pointer to the begin of the stored districts.
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
const SVCPermissions SVCAll
all VClasses are allowed
static void writeTrafficLights(OutputDevice &into, const NBTrafficLightLogicCont &tllCont)
writes the traffic light logics to the given device
static void writeInternalConnection(OutputDevice &into, const std::string &from, const std::string &to, int fromLane, int toLane, const std::string &via)
Writes a single internal connection.
const Crossing & getCrossing(const std::string &id) const
return the crossing with the given id
Definition: NBNode.cpp:2567
static std::string getOppositeInternalID(const NBEdgeCont &ec, const NBEdge *from, const NBEdge::Connection &con)
retrieve the id of the opposite direction internal lane if it exists
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:255
prohibition of circulation between two edges
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:65
bool accelRamp
Whether this lane is an acceleration lane.
Definition: NBEdge.h:153
bool priority
whether the pedestrians have priority
Definition: NBNode.h:159
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
The link is a straight direction.
The state of a link.
A class representing a single district.
Definition: NBDistrict.h:72
bool keepClear
whether the junction must be kept clear when using this connection
Definition: NBEdge.h:202
std::map< std::string, PositionVector > CustomShapeMap
map for custon shapes
Definition: NBNode.h:85
static std::string prohibitionConnection(const NBConnection &c)
the attribute value for a prohibition
An (internal) definition of a single lane of an edge.
Definition: NBEdge.h:124
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
SVCPermissions permissions
List of vehicle types that are allowed on this lane.
Definition: NBEdge.h:135
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network into a SUMO-file.
bool writeLogic(OutputDevice &into, const bool checkLaneFoes) const
writes the XML-representation of the logic as a bitset-logic XML representation
Definition: NBNode.cpp:771
The turning radius at an intersection in m.
std::map< std::string, NBEdge * >::const_iterator begin() const
Returns the pointer to the begin of the stored edges.
Definition: NBEdgeCont.h:190
the edges of a route
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:56
std::string tlID
The id of the traffic light that controls this connection.
Definition: NBEdge.h:193
SVCPermissions preferred
List of vehicle types that are preferred on this lane.
Definition: NBEdge.h:138
This is an uncontrolled, minor link, has to brake.
const PositionVector & getShape() const
Returns the shape.
Definition: NBDistrict.h:222
std::string getLaneID(int lane) const
get Lane ID (Secure)
Definition: NBEdge.cpp:2679
static bool writeInternalConnections(OutputDevice &into, const NBNode &n)
Writes inner connections within the node.
int fromLane
The lane the connections starts at.
Definition: NBEdge.h:184
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:46
parameter associated to a certain key
NBEdgeCont & getEdgeCont()
Definition: NBNetBuilder.h:155
A list of positions.
static const double UNSPECIFIED_CONTPOS
unspecified internal junction position
Definition: NBEdge.h:264
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
static void writeEdge(OutputDevice &into, const NBEdge &e, bool noNames, bool origNames)
Writes an edge (<edge ...)
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
bool hasDefaultGeometry() const
Returns whether the geometry consists only of the node positions.
Definition: NBEdge.cpp:488
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
roundabout defined in junction
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:66
#define POSITION_EPS
Definition: config.h:175
const std::string & getStreetName() const
Returns the street name of this edge.
Definition: NBEdge.h:536
const std::set< EdgeSet > getRoundabouts() const
Returns the determined roundabouts.
static void writePositionLong(const Position &pos, OutputDevice &dev)
Writes the given position to device in long format (one attribute per dimension)
Definition: NWFrame.cpp:168
edge: the shape in xml-definition
PositionVector getSubpart(double beginOffset, double endOffset) const
get subpart of a position vector
begin/end of the description of a neighboring lane
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.
double speed
The speed allowed on this lane.
Definition: NBEdge.h:132
double width
This lane&#39;s width.
Definition: NBEdge.h:144
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Definition: NBEdge.cpp:3128
std::vector< NBConnection > NBConnectionVector
Definition of a connection vector.
begin/end of the description of an edge
static void normaliseSum(std::vector< T > &v, T msum=1.0)
Definition: VectorHelper.h:58
int size() const
Returns the number of districts inside the container.
LinkDirection getDirection(const NBEdge *const incoming, const NBEdge *const outgoing, bool leftHand=false) const
Returns the representation of the described stream&#39;s direction.
Definition: NBNode.cpp:1549
std::string origID
An original ID, if given.
Definition: NBEdge.h:147
const PositionVector & getShape() const
retrieve the junction shape
Definition: NBNode.cpp:1716
PositionVector simplified() const
return the same shape with intermediate colinear points removed
NBEdge * getTo() const
returns the to-edge (end of the connection)
int internalLaneIndex
The lane index of this internal lane within the internal edge.
Definition: NBEdge.h:241
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:595
const std::vector< double > & getSinkWeights() const
Returns the weights of the sinks.
Definition: NBDistrict.h:206
double length() const
Returns the length.
std::map< NBConnection, NBConnectionVector > NBConnectionProhibits
Definition of a container for connection block dependencies Includes a list of all connections which ...
std::vector< NBTrafficLightLogic * > getComputed() const
Returns a list of all computed logics.
double getRadius() const
Returns the turning radius of this node.
Definition: NBNode.h:262
std::string oppositeID
An opposite lane ID, if given.
Definition: NBEdge.h:150
a sink within a district (connection road)
the edges crossed by a pedestrian crossing
const EdgeVector & getIncomingEdges() const
Returns this node&#39;s incoming edges (The edges which yield in this node)
Definition: NBNode.h:240
const std::vector< Connection > & getConnections() const
Returns the connections.
Definition: NBEdge.h:834
NBNodeCont & getNodeCont()
Returns a reference to the node container.
Definition: NBNetBuilder.h:160
Instance responsible for building networks.
Definition: NBNetBuilder.h:114
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
int tlLinkNo
the traffic light index of this crossing (if controlled)
Definition: NBNode.h:161
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:41
static bool writeInternalNodes(OutputDevice &into, const NBNode &n)
Writes internal junctions (<junction with id[0]==&#39;:&#39; ...) of the given node.
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
Definition: NBEdgeCont.cpp:251
const std::vector< NBEdge * > & getSinkEdges() const
Returns the sinks.
Definition: NBDistrict.h:214
A definition of a pedestrian walking area.
Definition: NBNode.h:170
double contPos
custom position for internal junction on this connection
Definition: NBEdge.h:205
A storage for options typed value containers)
Definition: OptionsCont.h:99
SumoXMLNodeType getType() const
Returns the type of this node.
Definition: NBNode.h:257
This is an uncontrolled, major link, may pass.
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
Definition: NBNetBuilder.h:170
const std::string SUMO_PARAM_ORIGID
The abstract direction of a link.
const Position & getPosition() const
Definition: NBNode.h:232
Represents a single node (junction) during network building.
Definition: NBNode.h:75
A definition of a pedestrian crossing.
Definition: NBNode.h:135
const std::vector< WalkingArea > & getWalkingAreas() const
return this junctions pedestrian walking areas
Definition: NBNode.h:625
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
bool closeTag()
Closes the most recently opened tag.
static void writeJunction(OutputDevice &into, const NBNode &n, const bool checkLaneFoes)
Writes a junction (<junction ...)
link: the index of the link within the traffic light
std::string tlID
The id of the traffic light that controls this connection.
Definition: NBNode.h:163
long long int SUMOTime
Definition: TraCIDefs.h:52
bool isMacroscopicConnector() const
Returns whether this edge was marked as a macroscopic connector.
Definition: NBEdge.h:929
const std::vector< double > & getSourceWeights() const
Returns the weights of the sources.
Definition: NBDistrict.h:190
a traffic light logic
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:427
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:63
std::string getInternalLaneID() const
get ID of internal lane
Definition: NBEdge.cpp:80
bool haveVia
check if Connection have a Via
Definition: NBEdge.h:223
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn&#39;t set.
Definition: NBEdge.h:490
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
Definition: NBNetBuilder.h:175
static const std::string MAJOR_VERSION
The version number for written files.
Definition: NWFrame.h:69
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:434
a single phase description
static std::string writeSUMOTime(SUMOTime time)
writes a SUMOTime as int if possible, otherwise as a float
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:228
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
void lf()
writes a line feed if applicable
Definition: OutputDevice.h:234
const SVCPermissions SVC_UNSPECIFIED
permissions not specified
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)
PositionVector shape
The polygonal shape.
Definition: NBNode.h:184
void writeTypes(OutputDevice &into) const
writes all types a s XML
Definition: NBTypeCont.cpp:127
The link has no direction (is a dead end link)
double width
This lane&#39;s width.
Definition: NBNode.h:180