Eclipse SUMO - Simulation of Urban MObility
NWWriter_SUMO.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
18 // Exporter writing networks using the SUMO format
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 #include <cmath>
27 #include <algorithm>
31 #include <utils/common/ToString.h>
36 #include <netbuild/NBEdge.h>
37 #include <netbuild/NBEdgeCont.h>
38 #include <netbuild/NBNode.h>
39 #include <netbuild/NBNodeCont.h>
40 #include <netbuild/NBNetBuilder.h>
42 #include <netbuild/NBDistrict.h>
43 #include <netbuild/NBHelpers.h>
44 #include "NWFrame.h"
45 #include "NWWriter_SUMO.h"
46 
47 
48 //#define DEBUG_OPPOSITE_INTERNAL
49 
50 // ===========================================================================
51 // method definitions
52 // ===========================================================================
53 // ---------------------------------------------------------------------------
54 // static methods
55 // ---------------------------------------------------------------------------
56 void
58  // check whether a sumo net-file shall be generated
59  if (!oc.isSet("output-file")) {
60  return;
61  }
62  OutputDevice& device = OutputDevice::getDevice(oc.getString("output-file"));
63  std::map<SumoXMLAttr, std::string> attrs;
65  if (oc.getBool("lefthand")) {
66  attrs[SUMO_ATTR_LEFTHAND] = "true";
67  }
68  const int cornerDetail = oc.getInt("junctions.corner-detail");
69  if (cornerDetail > 0) {
70  attrs[SUMO_ATTR_CORNERDETAIL] = toString(cornerDetail);
71  }
72  if (!oc.isDefault("junctions.internal-link-detail")) {
73  attrs[SUMO_ATTR_LINKDETAIL] = toString(oc.getInt("junctions.internal-link-detail"));
74  }
75  if (oc.getBool("rectangular-lane-cut")) {
76  attrs[SUMO_ATTR_RECTANGULAR_LANE_CUT] = "true";
77  }
78  if (oc.getBool("crossings.guess") || oc.getBool("walkingareas")) {
79  attrs[SUMO_ATTR_WALKINGAREAS] = "true";
80  }
81  if (oc.getFloat("junctions.limit-turn-speed") > 0) {
82  attrs[SUMO_ATTR_LIMIT_TURN_SPEED] = toString(oc.getFloat("junctions.limit-turn-speed"));
83  }
84  if (!oc.isDefault("check-lane-foes.all")) {
85  attrs[SUMO_ATTR_CHECKLANEFOES_ALL] = toString(oc.getBool("check-lane-foes.all"));
86  }
87  if (!oc.isDefault("check-lane-foes.roundabout")) {
88  attrs[SUMO_ATTR_CHECKLANEFOES_ROUNDABOUT] = toString(oc.getBool("check-lane-foes.roundabout"));
89  }
90  device.writeXMLHeader("net", "net_file.xsd", attrs); // street names may contain non-ascii chars
91  device.lf();
92  // get involved container
93  const NBNodeCont& nc = nb.getNodeCont();
94  const NBEdgeCont& ec = nb.getEdgeCont();
95  const NBDistrictCont& dc = nb.getDistrictCont();
96 
97  // write network offsets and projection
99 
100  // write edge types and restrictions
101  nb.getTypeCont().writeTypes(device);
102 
103  // write inner lanes
104  if (!oc.getBool("no-internal-links")) {
105  bool hadAny = false;
106  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
107  hadAny |= writeInternalEdges(device, ec, *(*i).second);
108  }
109  if (hadAny) {
110  device.lf();
111  }
112  }
113 
114  // write edges with lanes and connected edges
115  bool noNames = !oc.getBool("output.street-names");
116  for (std::map<std::string, NBEdge*>::const_iterator i = ec.begin(); i != ec.end(); ++i) {
117  writeEdge(device, *(*i).second, noNames);
118  }
119  device.lf();
120 
121  // write tls logics
122  writeTrafficLights(device, nb.getTLLogicCont());
123 
124  // write the nodes (junctions)
125  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
126  writeJunction(device, *(*i).second);
127  }
128  device.lf();
129  const bool includeInternal = !oc.getBool("no-internal-links");
130  if (includeInternal) {
131  // ... internal nodes if not unwanted
132  bool hadAny = false;
133  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
134  hadAny |= writeInternalNodes(device, *(*i).second);
135  }
136  if (hadAny) {
137  device.lf();
138  }
139  }
140 
141  // write the successors of lanes
142  int numConnections = 0;
143  for (std::map<std::string, NBEdge*>::const_iterator it_edge = ec.begin(); it_edge != ec.end(); it_edge++) {
144  NBEdge* from = it_edge->second;
145  const std::vector<NBEdge::Connection> connections = from->getConnections();
146  numConnections += (int)connections.size();
147  for (std::vector<NBEdge::Connection>::const_iterator it_c = connections.begin(); it_c != connections.end(); it_c++) {
148  writeConnection(device, *from, *it_c, includeInternal);
149  }
150  }
151  if (numConnections > 0) {
152  device.lf();
153  }
154  if (includeInternal) {
155  // ... internal successors if not unwanted
156  bool hadAny = false;
157  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
158  hadAny |= writeInternalConnections(device, *(*i).second);
159  }
160  if (hadAny) {
161  device.lf();
162  }
163  }
164  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
165  NBNode* node = (*i).second;
166  // write connections from pedestrian crossings
167  std::vector<NBNode::Crossing*> crossings = node->getCrossings();
168  for (auto c : crossings) {
169  NWWriter_SUMO::writeInternalConnection(device, c->id, c->nextWalkingArea, 0, 0, "", LINKDIR_STRAIGHT, c->tlID, c->tlLinkIndex2);
170  }
171  // write connections from pedestrian walking areas
172  for (const NBNode::WalkingArea& wa : node->getWalkingAreas()) {
173  for (const std::string& cID : wa.nextCrossings) {
174  const NBNode::Crossing& nextCrossing = *node->getCrossing(cID);
175  // connection to next crossing (may be tls-controlled)
177  device.writeAttr(SUMO_ATTR_FROM, wa.id);
178  device.writeAttr(SUMO_ATTR_TO, cID);
179  device.writeAttr(SUMO_ATTR_FROM_LANE, 0);
180  device.writeAttr(SUMO_ATTR_TO_LANE, 0);
181  if (nextCrossing.tlID != "") {
182  device.writeAttr(SUMO_ATTR_TLID, nextCrossing.tlID);
183  assert(nextCrossing.tlLinkIndex >= 0);
184  device.writeAttr(SUMO_ATTR_TLLINKINDEX, nextCrossing.tlLinkIndex);
185  }
188  device.closeTag();
189  }
190  // optional connections from/to sidewalk
191  std::string edgeID;
192  int laneIndex;
193  for (const std::string& sw : wa.nextSidewalks) {
194  NBHelpers::interpretLaneID(sw, edgeID, laneIndex);
195  NWWriter_SUMO::writeInternalConnection(device, wa.id, edgeID, 0, laneIndex, "");
196  }
197  for (const std::string& sw : wa.prevSidewalks) {
198  NBHelpers::interpretLaneID(sw, edgeID, laneIndex);
199  NWWriter_SUMO::writeInternalConnection(device, edgeID, wa.id, laneIndex, 0, "");
200  }
201  }
202  }
203 
204  // write loaded prohibitions
205  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
206  writeProhibitions(device, i->second->getProhibitions());
207  }
208 
209  // write roundabout information
210  writeRoundabouts(device, ec.getRoundabouts(), ec);
211 
212  // write the districts
213  for (std::map<std::string, NBDistrict*>::const_iterator i = dc.begin(); i != dc.end(); i++) {
214  writeDistrict(device, *(*i).second);
215  }
216  if (dc.size() != 0) {
217  device.lf();
218  }
219  device.close();
220 }
221 
222 
223 std::string
224 NWWriter_SUMO::getOppositeInternalID(const NBEdgeCont& ec, const NBEdge* from, const NBEdge::Connection& con, double& oppositeLength) {
225  const NBEdge::Lane& succ = con.toEdge->getLanes()[con.toLane];
226  const NBEdge::Lane& pred = from->getLanes()[con.fromLane];
227  const bool lefthand = OptionsCont::getOptions().getBool("lefthand");
228  if (succ.oppositeID != "" && succ.oppositeID != "-" && pred.oppositeID != "" && pred.oppositeID != "-") {
229 #ifdef DEBUG_OPPOSITE_INTERNAL
230  std::cout << "getOppositeInternalID con=" << con.getDescription(from) << " (" << con.getInternalLaneID() << ")\n";
231 #endif
232  // find the connection that connects succ.oppositeID to pred.oppositeID
233  const NBEdge* succOpp = ec.retrieve(succ.oppositeID.substr(0, succ.oppositeID.rfind("_")));
234  const NBEdge* predOpp = ec.retrieve(pred.oppositeID.substr(0, pred.oppositeID.rfind("_")));
235  assert(succOpp != 0);
236  assert(predOpp != 0);
237  const std::vector<NBEdge::Connection>& connections = succOpp->getConnections();
238  for (std::vector<NBEdge::Connection>::const_iterator it_c = connections.begin(); it_c != connections.end(); it_c++) {
239  const NBEdge::Connection& conOpp = *it_c;
240  if (succOpp != from // turnaround
241  && predOpp == conOpp.toEdge
242  && succOpp->getLaneID(conOpp.fromLane) == succ.oppositeID
243  && predOpp->getLaneID(conOpp.toLane) == pred.oppositeID
244  && from->getToNode()->getDirection(from, con.toEdge, lefthand) == LINKDIR_STRAIGHT
245  && from->getToNode()->getDirection(succOpp, predOpp, lefthand) == LINKDIR_STRAIGHT
246  ) {
247 #ifdef DEBUG_OPPOSITE_INTERNAL
248  std::cout << " found " << conOpp.getInternalLaneID() << "\n";
249 #endif
250  oppositeLength = conOpp.length;
251  return conOpp.getInternalLaneID();
252  } else {
253  /*
254  #ifdef DEBUG_OPPOSITE_INTERNAL
255  std::cout << " rejected " << conOpp.getInternalLaneID()
256  << "\n succ.oppositeID=" << succ.oppositeID
257  << "\n succOppLane=" << succOpp->getLaneID(conOpp.fromLane)
258  << "\n pred.oppositeID=" << pred.oppositeID
259  << "\n predOppLane=" << predOpp->getLaneID(conOpp.toLane)
260  << "\n predOpp=" << predOpp->getID()
261  << "\n conOppTo=" << conOpp.toEdge->getID()
262  << "\n len1=" << con.shape.length()
263  << "\n len2=" << conOpp.shape.length()
264  << "\n";
265  #endif
266  */
267  }
268  }
269  return "";
270  } else {
271  return "";
272  }
273 }
274 
275 
276 bool
278  bool ret = false;
279  const EdgeVector& incoming = n.getIncomingEdges();
280  // first pass: determine opposite internal edges and average their length
281  std::map<std::string, std::string> oppositeLaneID;
282  std::map<std::string, double> oppositeLengths;
283  for (NBEdge* e : incoming) {
284  for (const NBEdge::Connection& c : e->getConnections()) {
285  double oppositeLength = 0;
286  const std::string op = getOppositeInternalID(ec, e, c, oppositeLength);
287  oppositeLaneID[c.getInternalLaneID()] = op;
288  if (op != "") {
289  oppositeLengths[c.id] = oppositeLength;
290  }
291  }
292  }
293  if (oppositeLengths.size() > 0) {
294  for (NBEdge* e : incoming) {
295  for (NBEdge::Connection& c : e->getConnections()) {
296  if (oppositeLengths.count(c.id) > 0) {
297  c.length = (c.length + oppositeLengths[c.id]) / 2;
298  }
299  }
300  }
301  }
302 
303  for (EdgeVector::const_iterator i = incoming.begin(); i != incoming.end(); i++) {
304  const std::vector<NBEdge::Connection>& elv = (*i)->getConnections();
305  if (elv.size() > 0) {
306  bool haveVia = false;
307  std::string edgeID = "";
308  // second pass: write non-via edges
309  for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
310  if ((*k).toEdge == nullptr) {
311  assert(false); // should never happen. tell me when it does
312  continue;
313  }
314  if (edgeID != (*k).id) {
315  if (edgeID != "") {
316  // close the previous edge
317  into.closeTag();
318  }
319  edgeID = (*k).id;
320  into.openTag(SUMO_TAG_EDGE);
321  into.writeAttr(SUMO_ATTR_ID, edgeID);
323  if ((*i)->isBidiRail() && (*k).toEdge->isBidiRail() &&
324  (*i) != (*k).toEdge->getTurnDestination(true)) {
325  try {
327  0, (*i)->getTurnDestination(true), 0);
328  into.writeAttr(SUMO_ATTR_BIDI, bidiCon.id);
329  } catch (ProcessError&) {
330  std::cout << " could not find bidi-connection\n";
331  }
332  }
333  // open a new edge
334  }
335  // to avoid changing to an internal lane which has a successor
336  // with the wrong permissions we need to inherit them from the successor
337  const NBEdge::Lane& successor = (*k).toEdge->getLanes()[(*k).toLane];
338  const double width = n.isConstantWidthTransition() && (*i)->getNumLanes() > (*k).toEdge->getNumLanes() ? (*i)->getLaneWidth((*k).fromLane) : successor.width;
339  writeLane(into, (*k).getInternalLaneID(), (*k).vmax,
340  successor.permissions, successor.preferred,
342  std::map<int, double>(), width, (*k).shape, &(*k),
343  (*k).length, (*k).internalLaneIndex, oppositeLaneID[(*k).getInternalLaneID()], "");
344  haveVia = haveVia || (*k).haveVia;
345  }
346  ret = true;
347  into.closeTag(); // close the last edge
348  // third pass: write via edges
349  if (haveVia) {
350  for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
351  if (!(*k).haveVia) {
352  continue;
353  }
354  if ((*k).toEdge == nullptr) {
355  assert(false); // should never happen. tell me when it does
356  continue;
357  }
358  const NBEdge::Lane& successor = (*k).toEdge->getLanes()[(*k).toLane];
359  into.openTag(SUMO_TAG_EDGE);
360  into.writeAttr(SUMO_ATTR_ID, (*k).viaID);
362  writeLane(into, (*k).viaID + "_0", (*k).vmax, successor.permissions, successor.preferred,
364  std::map<int, double>(), successor.width, (*k).viaShape, &(*k),
365  MAX2((*k).viaShape.length(), POSITION_EPS), // microsim needs positive length
366  0, "", "");
367  into.closeTag();
368  }
369  }
370  }
371  }
372  // write pedestrian crossings
373  for (auto c : n.getCrossings()) {
374  into.openTag(SUMO_TAG_EDGE);
375  into.writeAttr(SUMO_ATTR_ID, c->id);
377  into.writeAttr(SUMO_ATTR_CROSSING_EDGES, c->edges);
378  writeLane(into, c->id + "_0", 1, SVC_PEDESTRIAN, 0,
380  std::map<int, double>(), c->width, c->shape, nullptr,
381  MAX2(c->shape.length(), POSITION_EPS), 0, "", "", false, c->customShape.size() != 0);
382  into.closeTag();
383  }
384  // write pedestrian walking areas
385  const std::vector<NBNode::WalkingArea>& WalkingAreas = n.getWalkingAreas();
386  for (std::vector<NBNode::WalkingArea>::const_iterator it = WalkingAreas.begin(); it != WalkingAreas.end(); it++) {
387  const NBNode::WalkingArea& wa = *it;
388  into.openTag(SUMO_TAG_EDGE);
389  into.writeAttr(SUMO_ATTR_ID, wa.id);
391  writeLane(into, wa.id + "_0", 1, SVC_PEDESTRIAN, 0,
393  std::map<int, double>(), wa.width, wa.shape, nullptr, wa.length, 0, "", "", false, wa.hasCustomShape);
394  into.closeTag();
395  }
396  return ret;
397 }
398 
399 
400 void
401 NWWriter_SUMO::writeEdge(OutputDevice& into, const NBEdge& e, bool noNames) {
402  // write the edge's begin
405  into.writeAttr(SUMO_ATTR_TO, e.getToNode()->getID());
406  if (!noNames && e.getStreetName() != "") {
408  }
410  if (e.getTypeID() != "") {
412  }
413  if (e.isMacroscopicConnector()) {
415  }
416  // write the spread type if not default ("right")
419  }
420  if (e.hasLoadedLength()) {
422  }
423  if (!e.hasDefaultGeometry()) {
425  }
426  if (e.getStopOffsets().size() != 0) {
427  writeStopOffsets(into, e.getStopOffsets());
428  }
429  if (e.isBidiRail()) {
431  }
432  if (e.getDistance() != 0) {
434  }
435 
436  // write the lanes
437  const std::vector<NBEdge::Lane>& lanes = e.getLanes();
438 
439  const double length = e.getFinalLength();
440  double startOffset = e.isBidiRail() ? e.getTurnDestination(true)->getEndOffset() : 0;
441  for (int i = 0; i < (int) lanes.size(); i++) {
442  const NBEdge::Lane& l = lanes[i];
443  std::map<int, double> stopOffsets;
444  if (l.stopOffsets != e.getStopOffsets()) {
445  stopOffsets = l.stopOffsets;
446  }
447  writeLane(into, e.getLaneID(i), l.speed,
448  l.permissions, l.preferred,
449  startOffset, l.endOffset,
450  stopOffsets, l.width, l.shape, &l,
451  length, i, l.oppositeID, l.type, l.accelRamp, l.customShape.size() > 0);
452  }
453  // close the edge
454  e.writeParams(into);
455  into.closeTag();
456 }
457 
458 
459 void
460 NWWriter_SUMO::writeLane(OutputDevice& into, const std::string& lID,
461  double speed, SVCPermissions permissions, SVCPermissions preferred,
462  double startOffset, double endOffset,
463  std::map<SVCPermissions, double> stopOffsets, double width, PositionVector shape,
464  const Parameterised* params, double length, int index,
465  const std::string& oppositeID,
466  const std::string& type,
467  bool accelRamp, bool customShape) {
468  // output the lane's attributes
470  // the first lane of an edge will be the depart lane
471  into.writeAttr(SUMO_ATTR_INDEX, index);
472  // write the list of allowed/disallowed vehicle classes
473  if (permissions != SVC_UNSPECIFIED) {
474  writePermissions(into, permissions);
475  }
476  writePreferences(into, preferred);
477  // some further information
478  if (speed == 0) {
479  WRITE_WARNING("Lane '" + lID + "' has a maximum allowed speed of 0.");
480  } else if (speed < 0) {
481  throw ProcessError("Negative allowed speed (" + toString(speed) + ") on lane '" + lID + "', use --speed.minimum to prevent this.");
482  }
483  into.writeAttr(SUMO_ATTR_SPEED, speed);
484  into.writeAttr(SUMO_ATTR_LENGTH, length);
485  if (endOffset != NBEdge::UNSPECIFIED_OFFSET) {
486  into.writeAttr(SUMO_ATTR_ENDOFFSET, endOffset);
487  }
488  if (width != NBEdge::UNSPECIFIED_WIDTH) {
489  into.writeAttr(SUMO_ATTR_WIDTH, width);
490  }
491  if (accelRamp) {
492  into.writeAttr<bool>(SUMO_ATTR_ACCELERATION, accelRamp);
493  }
494  if (customShape) {
495  into.writeAttr(SUMO_ATTR_CUSTOMSHAPE, true);
496  }
497  if (endOffset > 0 || startOffset > 0) {
498  if (startOffset + endOffset < shape.length()) {
499  shape = shape.getSubpart(startOffset, shape.length() - endOffset);
500  } else {
501  WRITE_ERROR("Invalid endOffset " + toString(endOffset) + " at lane '" + lID
502  + "' with length " + toString(shape.length()) + " (startOffset " + toString(startOffset) + ")");
503  if (!OptionsCont::getOptions().getBool("ignore-errors")) {
504  throw ProcessError();
505  }
506  }
507  }
508  into.writeAttr(SUMO_ATTR_SHAPE, shape);
509  if (type != "") {
510  into.writeAttr(SUMO_ATTR_TYPE, type);
511  }
512 
513  if (stopOffsets.size() != 0) {
514  writeStopOffsets(into, stopOffsets);
515  }
516 
517  if (oppositeID != "" && oppositeID != "-") {
518  into.openTag(SUMO_TAG_NEIGH);
519  into.writeAttr(SUMO_ATTR_LANE, oppositeID);
520  into.closeTag();
521  }
522 
523  if (params != nullptr) {
524  params->writeParams(into);
525  }
526 
527  into.closeTag();
528 }
529 
530 
531 void
533  // write the attributes
535  into.writeAttr(SUMO_ATTR_TYPE, n.getType());
537  // write the incoming lanes
538  std::string incLanes;
539  const std::vector<NBEdge*>& incoming = n.getIncomingEdges();
540  for (std::vector<NBEdge*>::const_iterator i = incoming.begin(); i != incoming.end(); ++i) {
541  int noLanes = (*i)->getNumLanes();
542  for (int j = 0; j < noLanes; j++) {
543  incLanes += (*i)->getLaneID(j);
544  if (i != incoming.end() - 1 || j < noLanes - 1) {
545  incLanes += ' ';
546  }
547  }
548  }
549  std::vector<NBNode::Crossing*> crossings = n.getCrossings();
550  std::set<std::string> prevWAs;
551  // avoid duplicates
552  for (auto c : crossings) {
553  if (prevWAs.count(c->prevWalkingArea) == 0) {
554  incLanes += ' ' + c->prevWalkingArea + "_0";
555  prevWAs.insert(c->prevWalkingArea);
556  }
557  }
558  into.writeAttr(SUMO_ATTR_INCLANES, incLanes);
559  // write the internal lanes
560  std::string intLanes;
561  if (!OptionsCont::getOptions().getBool("no-internal-links")) {
562  int l = 0;
563  for (EdgeVector::const_iterator i = incoming.begin(); i != incoming.end(); i++) {
564  const std::vector<NBEdge::Connection>& elv = (*i)->getConnections();
565  for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
566  if ((*k).toEdge == nullptr) {
567  continue;
568  }
569  if (l != 0) {
570  intLanes += ' ';
571  }
572  if (!(*k).haveVia) {
573  intLanes += (*k).getInternalLaneID();
574  } else {
575  intLanes += (*k).viaID + "_0";
576  }
577  l++;
578  }
579  }
580  }
581  if (n.getType() != NODETYPE_DEAD_END && n.getType() != NODETYPE_NOJUNCTION) {
582  for (auto c : crossings) {
583  intLanes += ' ' + c->id + "_0";
584  }
585  }
586  into.writeAttr(SUMO_ATTR_INTLANES, intLanes);
587  // close writing
589  // write optional radius
592  }
593  // specify whether a custom shape was used
594  if (n.hasCustomShape()) {
595  into.writeAttr(SUMO_ATTR_CUSTOMSHAPE, true);
596  }
597  if (n.getRightOfWay() != RIGHT_OF_WAY_DEFAULT) {
598  into.writeAttr<std::string>(SUMO_ATTR_RIGHT_OF_WAY, toString(n.getRightOfWay()));
599  }
600  if (n.getFringeType() != FRINGE_TYPE_DEFAULT) {
601  into.writeAttr<std::string>(SUMO_ATTR_FRINGE, toString(n.getFringeType()));
602  }
603  if (n.getType() != NODETYPE_DEAD_END) {
604  // write right-of-way logics
605  n.writeLogic(into);
606  }
607  n.writeParams(into);
608  into.closeTag();
609 }
610 
611 
612 bool
614  bool ret = false;
615  const std::vector<NBEdge*>& incoming = n.getIncomingEdges();
616  // build the list of internal lane ids
617  std::vector<std::string> internalLaneIDs;
618  std::map<std::string, std::string> viaIDs;
619  for (EdgeVector::const_iterator i = incoming.begin(); i != incoming.end(); i++) {
620  const std::vector<NBEdge::Connection>& elv = (*i)->getConnections();
621  for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
622  if ((*k).toEdge != nullptr) {
623  internalLaneIDs.push_back((*k).getInternalLaneID());
624  viaIDs[(*k).getInternalLaneID()] = ((*k).viaID);
625  }
626  }
627  }
628  for (auto c : n.getCrossings()) {
629  internalLaneIDs.push_back(c->id + "_0");
630  }
631  // write the internal nodes
632  for (std::vector<NBEdge*>::const_iterator i = incoming.begin(); i != incoming.end(); i++) {
633  const std::vector<NBEdge::Connection>& elv = (*i)->getConnections();
634  for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
635  if ((*k).toEdge == nullptr || !(*k).haveVia) {
636  continue;
637  }
638  Position pos = (*k).shape[-1];
639  into.openTag(SUMO_TAG_JUNCTION).writeAttr(SUMO_ATTR_ID, (*k).viaID + "_0");
641  NWFrame::writePositionLong(pos, into);
642  std::string incLanes = (*k).getInternalLaneID();
643  std::vector<std::string> foeIDs;
644  for (std::string incLane : (*k).foeIncomingLanes) {
645  incLanes += " " + incLane;
646  if (incLane[0] == ':' && viaIDs[incLane] != "") {
647  // intersecting left turns
648  foeIDs.push_back(viaIDs[incLane] + "_0");
649  }
650  }
651  into.writeAttr(SUMO_ATTR_INCLANES, incLanes);
652  const std::vector<int>& foes = (*k).foeInternalLinks;
653  for (std::vector<int>::const_iterator it = foes.begin(); it != foes.end(); ++it) {
654  foeIDs.push_back(internalLaneIDs[*it]);
655  }
656  into.writeAttr(SUMO_ATTR_INTLANES, joinToString(foeIDs, " "));
657  into.closeTag();
658  ret = true;
659  }
660  }
661  return ret;
662 }
663 
664 
665 void
667  bool includeInternal, ConnectionStyle style) {
668  assert(c.toEdge != 0);
670  into.writeAttr(SUMO_ATTR_FROM, from.getID());
671  into.writeAttr(SUMO_ATTR_TO, c.toEdge->getID());
674  if (c.mayDefinitelyPass && style != TLL) {
676  }
677  if ((from.getToNode()->getKeepClear() == false || c.keepClear == false) && style != TLL) {
678  into.writeAttr<bool>(SUMO_ATTR_KEEP_CLEAR, false);
679  }
680  if (c.contPos != NBEdge::UNSPECIFIED_CONTPOS && style != TLL) {
682  }
685  }
686  if (c.speed != NBEdge::UNSPECIFIED_SPEED && style != TLL) {
688  }
689  if (c.customShape.size() != 0 && style != TLL) {
691  }
692  if (c.uncontrolled != false && style != TLL) {
694  }
695  if (style != PLAIN) {
696  if (includeInternal) {
698  }
699  // set information about the controlling tl if any
700  if (c.tlID != "") {
701  into.writeAttr(SUMO_ATTR_TLID, c.tlID);
703  }
704  if (style == SUMONET) {
705  // write the direction information
706  LinkDirection dir = from.getToNode()->getDirection(&from, c.toEdge, OptionsCont::getOptions().getBool("lefthand"));
707  assert(dir != LINKDIR_NODIR);
708  into.writeAttr(SUMO_ATTR_DIR, toString(dir));
709  // write the state information
710  const LinkState linkState = from.getToNode()->getLinkState(
711  &from, c.toEdge, c.fromLane, c.toLane, c.mayDefinitelyPass, c.tlID);
712  into.writeAttr(SUMO_ATTR_STATE, linkState);
713  }
714  }
715  c.writeParams(into);
716  into.closeTag();
717 }
718 
719 
720 bool
722  bool ret = false;
723  const bool lefthand = OptionsCont::getOptions().getBool("lefthand");
724  const std::vector<NBEdge*>& incoming = n.getIncomingEdges();
725  for (std::vector<NBEdge*>::const_iterator i = incoming.begin(); i != incoming.end(); ++i) {
726  NBEdge* from = *i;
727  const std::vector<NBEdge::Connection>& connections = from->getConnections();
728  for (std::vector<NBEdge::Connection>::const_iterator j = connections.begin(); j != connections.end(); ++j) {
729  const NBEdge::Connection& c = *j;
730  LinkDirection dir = n.getDirection(from, c.toEdge, lefthand);
731  assert(c.toEdge != 0);
732  if (c.haveVia) {
733  // internal split
734  writeInternalConnection(into, c.id, c.toEdge->getID(), c.internalLaneIndex, c.toLane, c.viaID + "_0", dir);
735  writeInternalConnection(into, c.viaID, c.toEdge->getID(), 0, c.toLane, "", dir);
736  } else {
737  // no internal split
738  writeInternalConnection(into, c.id, c.toEdge->getID(), c.internalLaneIndex, c.toLane, "", dir);
739  }
740  ret = true;
741  }
742  }
743  return ret;
744 }
745 
746 
747 void
749  const std::string& from, const std::string& to,
750  int fromLane, int toLane, const std::string& via,
751  LinkDirection dir, const std::string& tlID, int linkIndex) {
753  into.writeAttr(SUMO_ATTR_FROM, from);
754  into.writeAttr(SUMO_ATTR_TO, to);
755  into.writeAttr(SUMO_ATTR_FROM_LANE, fromLane);
756  into.writeAttr(SUMO_ATTR_TO_LANE, toLane);
757  if (via != "") {
758  into.writeAttr(SUMO_ATTR_VIA, via);
759  }
760  if (tlID != "" && linkIndex != NBConnection::InvalidTlIndex) {
761  // used for the reverse direction of pedestrian crossings
762  into.writeAttr(SUMO_ATTR_TLID, tlID);
763  into.writeAttr(SUMO_ATTR_TLLINKINDEX, linkIndex);
764  }
765  into.writeAttr(SUMO_ATTR_DIR, dir);
766  into.writeAttr(SUMO_ATTR_STATE, (via != "" ? "m" : "M"));
767  into.closeTag();
768 }
769 
770 
771 void
772 NWWriter_SUMO::writeRoundabouts(OutputDevice& into, const std::set<EdgeSet>& roundabouts,
773  const NBEdgeCont& ec) {
774  // make output deterministic
775  std::vector<std::vector<std::string> > edgeIDs;
776  for (std::set<EdgeSet>::const_iterator i = roundabouts.begin(); i != roundabouts.end(); ++i) {
777  std::vector<std::string> tEdgeIDs;
778  for (EdgeSet::const_iterator j = (*i).begin(); j != (*i).end(); ++j) {
779  // the edges may have been erased from NBEdgeCont but their pointers are still valid
780  // we verify their existance in writeRoundabout()
781  tEdgeIDs.push_back((*j)->getID());
782  }
783  std::sort(tEdgeIDs.begin(), tEdgeIDs.end());
784  edgeIDs.push_back(tEdgeIDs);
785  }
786  std::sort(edgeIDs.begin(), edgeIDs.end());
787  // write
788  for (std::vector<std::vector<std::string> >::const_iterator i = edgeIDs.begin(); i != edgeIDs.end(); ++i) {
789  writeRoundabout(into, *i, ec);
790  }
791  if (roundabouts.size() != 0) {
792  into.lf();
793  }
794 }
795 
796 
797 void
798 NWWriter_SUMO::writeRoundabout(OutputDevice& into, const std::vector<std::string>& edgeIDs,
799  const NBEdgeCont& ec) {
800  std::vector<std::string> validEdgeIDs;
801  std::vector<std::string> invalidEdgeIDs;
802  std::vector<std::string> nodeIDs;
803  for (std::vector<std::string>::const_iterator i = edgeIDs.begin(); i != edgeIDs.end(); ++i) {
804  const NBEdge* edge = ec.retrieve(*i);
805  if (edge != nullptr) {
806  nodeIDs.push_back(edge->getToNode()->getID());
807  validEdgeIDs.push_back(edge->getID());
808  } else {
809  invalidEdgeIDs.push_back(*i);
810  }
811  }
812  std::sort(nodeIDs.begin(), nodeIDs.end());
813  if (validEdgeIDs.size() > 0) {
815  into.writeAttr(SUMO_ATTR_NODES, joinToString(nodeIDs, " "));
816  into.writeAttr(SUMO_ATTR_EDGES, joinToString(validEdgeIDs, " "));
817  into.closeTag();
818  if (invalidEdgeIDs.size() > 0) {
819  WRITE_WARNING("Writing incomplete roundabout. Edges: '"
820  + joinToString(invalidEdgeIDs, " ") + "' no longer exist'");
821  }
822  }
823 }
824 
825 
826 void
828  std::vector<double> sourceW = d.getSourceWeights();
830  std::vector<double> sinkW = d.getSinkWeights();
832  // write the head and the id of the district
834  if (d.getShape().size() > 0) {
836  }
837  // write all sources
838  const std::vector<NBEdge*>& sources = d.getSourceEdges();
839  for (int i = 0; i < (int)sources.size(); i++) {
840  // write the head and the id of the source
841  into.openTag(SUMO_TAG_TAZSOURCE).writeAttr(SUMO_ATTR_ID, sources[i]->getID()).writeAttr(SUMO_ATTR_WEIGHT, sourceW[i]);
842  into.closeTag();
843  }
844  // write all sinks
845  const std::vector<NBEdge*>& sinks = d.getSinkEdges();
846  for (int i = 0; i < (int)sinks.size(); i++) {
847  // write the head and the id of the sink
848  into.openTag(SUMO_TAG_TAZSINK).writeAttr(SUMO_ATTR_ID, sinks[i]->getID()).writeAttr(SUMO_ATTR_WEIGHT, sinkW[i]);
849  into.closeTag();
850  }
851  // write the tail
852  into.closeTag();
853 }
854 
855 
856 std::string
858  double time = STEPS2TIME(steps);
859  if (time == std::floor(time)) {
860  return toString(int(time));
861  } else {
862  return toString(time);
863  }
864 }
865 
866 
867 void
869  for (NBConnectionProhibits::const_iterator j = prohibitions.begin(); j != prohibitions.end(); j++) {
870  NBConnection prohibited = (*j).first;
871  const NBConnectionVector& prohibiting = (*j).second;
872  for (NBConnectionVector::const_iterator k = prohibiting.begin(); k != prohibiting.end(); k++) {
873  NBConnection prohibitor = *k;
877  into.closeTag();
878  }
879  }
880 }
881 
882 
883 std::string
885  return c.getFrom()->getID() + "->" + c.getTo()->getID();
886 }
887 
888 
889 void
891  std::vector<NBTrafficLightLogic*> logics = tllCont.getComputed();
892  for (std::vector<NBTrafficLightLogic*>::iterator it = logics.begin(); it != logics.end(); it++) {
894  into.writeAttr(SUMO_ATTR_ID, (*it)->getID());
895  into.writeAttr(SUMO_ATTR_TYPE, (*it)->getType());
896  into.writeAttr(SUMO_ATTR_PROGRAMID, (*it)->getProgramID());
897  into.writeAttr(SUMO_ATTR_OFFSET, writeSUMOTime((*it)->getOffset()));
898  // write the phases
899  const bool varPhaseLength = (*it)->getType() != TLTYPE_STATIC;
900  const std::vector<NBTrafficLightLogic::PhaseDefinition>& phases = (*it)->getPhases();
901  for (std::vector<NBTrafficLightLogic::PhaseDefinition>::const_iterator j = phases.begin(); j != phases.end(); ++j) {
902  into.openTag(SUMO_TAG_PHASE);
903  into.writeAttr(SUMO_ATTR_DURATION, writeSUMOTime(j->duration));
904  if (j->duration < TIME2STEPS(10)) {
905  into.writePadding(" ");
906  }
907  into.writeAttr(SUMO_ATTR_STATE, j->state);
908  if (varPhaseLength) {
911  }
914  }
915  }
916  if (j->name != "") {
917  into.writeAttr(SUMO_ATTR_NAME, j->name);
918  }
919  if (j->next.size() > 0) {
920  into.writeAttr(SUMO_ATTR_NEXT, j->next);
921  }
922  into.closeTag();
923  }
924  // write params
925  (*it)->writeParams(into);
926  into.closeTag();
927  }
928  if (logics.size() > 0) {
929  into.lf();
930  }
931 }
932 
933 
934 void
935 NWWriter_SUMO::writeStopOffsets(OutputDevice& into, const std::map<SVCPermissions, double>& stopOffsets) {
936  if (stopOffsets.size() == 0) {
937  return;
938  }
939  assert(stopOffsets.size() == 1);
940  std::pair<int, double> offset = *stopOffsets.begin();
941  std::string ss_vclasses = getVehicleClassNames(offset.first);
942  if (ss_vclasses.length() == 0) {
943  // This stopOffset would have no effect...
944  return;
945  }
947  std::string ss_exceptions = getVehicleClassNames(~offset.first);
948  if (ss_vclasses.length() <= ss_exceptions.length()) {
949  into.writeAttr(SUMO_ATTR_VCLASSES, ss_vclasses);
950  } else {
951  if (ss_exceptions.length() == 0) {
952  into.writeAttr(SUMO_ATTR_VCLASSES, "all");
953  } else {
954  into.writeAttr(SUMO_ATTR_EXCEPTIONS, ss_exceptions);
955  }
956  }
957  into.writeAttr(SUMO_ATTR_VALUE, offset.second);
958  into.closeTag();
959 }
960 
961 /****************************************************************************/
962 
GeoConvHelper::writeLocation
static void writeLocation(OutputDevice &into)
writes the location element
Definition: GeoConvHelper.cpp:557
SUMO_ATTR_ENDOFFSET
Definition: SUMOXMLDefinitions.h:415
NBEdge::Connection::tlID
std::string tlID
The id of the traffic light that controls this connection.
Definition: NBEdge.h:212
NBEdge::Lane::preferred
SVCPermissions preferred
List of vehicle types that are preferred on this lane.
Definition: NBEdge.h:151
OptionsCont::isSet
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
Definition: OptionsCont.cpp:136
SUMO_ATTR_TYPE
Definition: SUMOXMLDefinitions.h:382
NBEdge::UNSPECIFIED_OFFSET
static const double UNSPECIFIED_OFFSET
unspecified lane offset
Definition: NBEdge.h:306
EDGEFUNC_INTERNAL
Definition: SUMOXMLDefinitions.h:1080
SVC_PEDESTRIAN
pedestrian
Definition: SUMOVehicleClass.h:157
SUMO_TAG_STOPOFFSET
Information on vClass specific stop offsets at lane end.
Definition: SUMOXMLDefinitions.h:231
NWWriter_SUMO::writeEdge
static void writeEdge(OutputDevice &into, const NBEdge &e, bool noNames)
Writes an edge (<edge ...)
Definition: NWWriter_SUMO.cpp:401
SVC_UNSPECIFIED
const SVCPermissions SVC_UNSPECIFIED
permissions not specified
Definition: SUMOVehicleClass.cpp:149
OptionsCont::getInt
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
Definition: OptionsCont.cpp:216
ToString.h
NBEdge::Connection::toEdge
NBEdge * toEdge
The edge the connections yields in.
Definition: NBEdge.h:206
SUMO_ATTR_ACCELERATION
Definition: SUMOXMLDefinitions.h:889
NBEdge::Lane::speed
double speed
The speed allowed on this lane.
Definition: NBEdge.h:145
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:890
NBEdge::Connection::haveVia
bool haveVia
check if Connection have a Via
Definition: NBEdge.h:245
NBNode::getLinkState
LinkState getLinkState(const NBEdge *incoming, NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
get link state
Definition: NBNode.cpp:2014
NBEdgeCont::retrieve
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
Definition: NBEdgeCont.cpp:245
NBNode::WalkingArea::shape
PositionVector shape
The polygonal shape.
Definition: NBNode.h:187
NBEdge::Connection::length
double length
computed length (average of all internal lane shape lengths that share an internal edge)
Definition: NBEdge.h:272
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
Parameterised
An upper class for objects with additional parameters.
Definition: Parameterised.h:43
NBDistrict::getSourceEdges
const std::vector< NBEdge * > & getSourceEdges() const
Returns the sources.
Definition: NBDistrict.h:191
RIGHT_OF_WAY_DEFAULT
Definition: SUMOXMLDefinitions.h:1100
NBEdgeCont
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:61
NBDistrict::getSourceWeights
const std::vector< double > & getSourceWeights() const
Returns the weights of the sources.
Definition: NBDistrict.h:183
SUMO_ATTR_LENGTH
Definition: SUMOXMLDefinitions.h:394
NBEdge::Lane::type
std::string type
the type of this lane
Definition: NBEdge.h:177
NBDistrictCont::begin
std::map< std::string, NBDistrict * >::const_iterator begin() const
Returns the pointer to the begin of the stored districts.
Definition: NBDistrictCont.h:82
SUMO_ATTR_INCLANES
Definition: SUMOXMLDefinitions.h:416
NBNetBuilder
Instance responsible for building networks.
Definition: NBNetBuilder.h:110
NBDistrict::getSinkEdges
const std::vector< NBEdge * > & getSinkEdges() const
Returns the sinks.
Definition: NBDistrict.h:207
PositionVector::simplified
PositionVector simplified() const
return the same shape with intermediate colinear points removed
Definition: PositionVector.cpp:1475
NBTrafficLightLogicCont
A container for traffic light definitions and built programs.
Definition: NBTrafficLightLogicCont.h:58
SUMO_ATTR_LIMIT_TURN_SPEED
Definition: SUMOXMLDefinitions.h:879
EDGEFUNC_CROSSING
Definition: SUMOXMLDefinitions.h:1078
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
GeomConvHelper.h
NETWORK_VERSION
const double NETWORK_VERSION
version for written networks and default version for loading
Definition: StdDefs.h:66
NBNodeCont::end
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
Definition: NBNodeCont.h:121
NBEdge::getConnection
Connection getConnection(int fromLane, const NBEdge *to, int toLane) const
Returns the specified connection This method goes through "myConnections" and returns the specified o...
Definition: NBEdge.cpp:1141
NBEdge::Connection::uncontrolled
bool uncontrolled
check if Connection is uncontrolled
Definition: NBEdge.h:263
SUMO_ATTR_CHECKLANEFOES_ALL
Definition: SUMOXMLDefinitions.h:880
OptionsCont.h
NBTrafficLightLogic.h
SUMO_ATTR_RECTANGULAR_LANE_CUT
Definition: SUMOXMLDefinitions.h:876
TLTYPE_STATIC
Definition: SUMOXMLDefinitions.h:1193
LANESPREAD_RIGHT
Definition: SUMOXMLDefinitions.h:1093
PositionVector::getSubpart
PositionVector getSubpart(double beginOffset, double endOffset) const
get subpart of a position vector
Definition: PositionVector.cpp:698
SUMO_ATTR_TO_LANE
Definition: SUMOXMLDefinitions.h:717
MsgHandler.h
SUMO_ATTR_LINKDETAIL
Definition: SUMOXMLDefinitions.h:875
NWWriter_SUMO::SUMONET
Definition: NWWriter_SUMO.h:61
EdgeVector
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:35
SUMO_TAG_TAZSOURCE
a source within a district (connection road)
Definition: SUMOXMLDefinitions.h:136
NBEdge::hasDefaultGeometry
bool hasDefaultGeometry() const
Returns whether the geometry consists only of the node positions.
Definition: NBEdge.cpp:550
NBNode::WalkingArea::hasCustomShape
bool hasCustomShape
whether this walkingArea has a custom shape
Definition: NBNode.h:195
NWWriter_SUMO::prohibitionConnection
static std::string prohibitionConnection(const NBConnection &c)
the attribute value for a prohibition
Definition: NWWriter_SUMO.cpp:884
SUMO_ATTR_CUSTOMSHAPE
whether a given shape is user-defined
Definition: SUMOXMLDefinitions.h:699
NBEdge::Connection::contPos
double contPos
custom position for internal junction on this connection
Definition: NBEdge.h:224
VectorHelper::normaliseSum
static void normaliseSum(std::vector< T > &v, T msum=1.0)
Definition: VectorHelper.h:50
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:202
NWWriter_SUMO::writeJunction
static void writeJunction(OutputDevice &into, const NBNode &n)
Writes a junction (<junction ...)
Definition: NWWriter_SUMO.cpp:532
NWWriter_SUMO::writeInternalEdges
static bool writeInternalEdges(OutputDevice &into, const NBEdgeCont &ec, const NBNode &n)
Writes internal edges (<edge ... with id[0]==':') of the given node.
Definition: NWWriter_SUMO.cpp:277
NBEdge::isBidiRail
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
Definition: NBEdge.cpp:683
SUMO_TAG_LANE
begin/end of the description of a single lane
Definition: SUMOXMLDefinitions.h:50
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
NBConnection::getFrom
NBEdge * getFrom() const
returns the from-edge (start of the connection)
Definition: NBConnection.cpp:86
SUMO_ATTR_TLID
link,node: the traffic light id responsible for this link
Definition: SUMOXMLDefinitions.h:679
NBEdgeCont.h
GeoConvHelper.h
NBDistrict::getSinkWeights
const std::vector< double > & getSinkWeights() const
Returns the weights of the sinks.
Definition: NBDistrict.h:199
NODETYPE_INTERNAL
Definition: SUMOXMLDefinitions.h:1063
NBConnection::InvalidTlIndex
const static int InvalidTlIndex
Definition: NBConnection.h:120
NBNodeCont::begin
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
Definition: NBNodeCont.h:116
NBConnection::getTo
NBEdge * getTo() const
returns the to-edge (end of the connection)
Definition: NBConnection.cpp:92
OptionsCont::getBool
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Definition: OptionsCont.cpp:223
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
NBNode::getType
SumoXMLNodeType getType() const
Returns the type of this node.
Definition: NBNode.h:276
NBEdge::getPriority
int getPriority() const
Returns the priority of the edge.
Definition: NBEdge.h:472
SUMO_ATTR_MINDURATION
Definition: SUMOXMLDefinitions.h:729
NWWriter_SUMO::writeLane
static void writeLane(OutputDevice &into, const std::string &lID, double speed, SVCPermissions permissions, SVCPermissions preferred, double startOffset, double endOffset, std::map< SVCPermissions, double > stopOffsets, double width, PositionVector shape, const Parameterised *params, double length, int index, const std::string &oppositeID, const std::string &type, bool accelRamp=false, bool customShape=false)
Writes a lane (<lane ...) of an edge.
Definition: NWWriter_SUMO.cpp:460
SUMO_ATTR_EXCEPTIONS
Definition: SUMOXMLDefinitions.h:454
SUMO_ATTR_SPEED
Definition: SUMOXMLDefinitions.h:385
SUMO_ATTR_VISIBILITY_DISTANCE
foe visibility distance of a link
Definition: SUMOXMLDefinitions.h:707
SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:379
PositionVector::length
double length() const
Returns the length.
Definition: PositionVector.cpp:476
NBNode::getKeepClear
bool getKeepClear() const
Returns the keepClear flag.
Definition: NBNode.h:286
SUMO_ATTR_LANE
Definition: SUMOXMLDefinitions.h:635
NWWriter_SUMO::TLL
Definition: NWWriter_SUMO.h:63
LinkDirection
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)....
Definition: SUMOXMLDefinitions.h:1171
NBNode::isConstantWidthTransition
bool isConstantWidthTransition() const
detects whether a given junction splits or merges lanes while keeping constant road width
Definition: NBNode.cpp:778
NBEdge::Connection::tlLinkIndex
int tlLinkIndex
The index of this connection within the controlling traffic light.
Definition: NBEdge.h:215
SUMO_TAG_PHASE
a single phase description
Definition: SUMOXMLDefinitions.h:144
LINKSTATE_MAJOR
This is an uncontrolled, major link, may pass.
Definition: SUMOXMLDefinitions.h:1150
NBNode::WalkingArea
A definition of a pedestrian walking area.
Definition: NBNode.h:171
PositionVector
A list of positions.
Definition: PositionVector.h:46
NWWriter_SUMO.h
OutputDevice::close
void close()
Closes the device and removes it from the dictionary.
Definition: OutputDevice.cpp:208
NBDistrictCont
A container for districts.
Definition: NBDistrictCont.h:53
LINKDIR_NODIR
The link has no direction (is a dead end link)
Definition: SUMOXMLDefinitions.h:1187
NWWriter_SUMO::writeConnection
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)
Definition: NWWriter_SUMO.cpp:666
SUMO_ATTR_SPREADTYPE
The information about how to spread the lanes from the given position.
Definition: SUMOXMLDefinitions.h:689
NBNode::writeLogic
bool writeLogic(OutputDevice &into) const
writes the XML-representation of the logic as a bitset-logic XML representation
Definition: NBNode.cpp:961
SUMO_ATTR_DIR
The abstract direction of a link.
Definition: SUMOXMLDefinitions.h:703
SUMO_ATTR_CHECKLANEFOES_ROUNDABOUT
Definition: SUMOXMLDefinitions.h:881
NBDistrict.h
NBNetBuilder::getEdgeCont
NBEdgeCont & getEdgeCont()
Definition: NBNetBuilder.h:151
NBNodeCont
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:60
NBEdge::Connection::fromLane
int fromLane
The lane the connections starts at.
Definition: NBEdge.h:203
NWWriter_SUMO::writeNetwork
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network into a SUMO-file.
Definition: NWWriter_SUMO.cpp:57
Parameterised::writeParams
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
Definition: Parameterised.cpp:111
SUMO_ATTR_NEXT
succesor phase index
Definition: SUMOXMLDefinitions.h:733
SUMO_ATTR_WEIGHT
Definition: SUMOXMLDefinitions.h:422
NBEdge
The representation of a single edge during network building.
Definition: NBEdge.h:86
OutputDevice::closeTag
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
Definition: OutputDevice.cpp:254
SUMO_ATTR_TO
Definition: SUMOXMLDefinitions.h:638
NWWriter_SUMO::writeProhibitions
static void writeProhibitions(OutputDevice &into, const NBConnectionProhibits &prohibitions)
writes the given prohibitions
Definition: NWWriter_SUMO.cpp:868
SUMO_ATTR_CORNERDETAIL
Definition: SUMOXMLDefinitions.h:874
NBEdge::Connection::speed
double speed
custom speed for connection
Definition: NBEdge.h:230
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:80
SUMO_ATTR_FUNCTION
Definition: SUMOXMLDefinitions.h:657
NBEdge::Connection::toLane
int toLane
The lane the connections yields in.
Definition: NBEdge.h:209
NBNode::getPosition
const Position & getPosition() const
Definition: NBNode.h:251
SUMO_TAG_PROHIBITION
prohibition of circulation between two edges
Definition: SUMOXMLDefinitions.h:205
SUMO_ATTR_PROHIBITED
Definition: SUMOXMLDefinitions.h:778
OutputDevice::writeAttr
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:256
NWWriter_SUMO::getOppositeInternalID
static std::string getOppositeInternalID(const NBEdgeCont &ec, const NBEdge *from, const NBEdge::Connection &con, double &oppositeLength)
retrieve the id of the opposite direction internal lane if it exists
Definition: NWWriter_SUMO.cpp:224
SUMO_ATTR_INTLANES
Definition: SUMOXMLDefinitions.h:417
LinkState
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
Definition: SUMOXMLDefinitions.h:1132
SUMO_TAG_NEIGH
begin/end of the description of a neighboring lane
Definition: SUMOXMLDefinitions.h:52
NBNode::getWalkingAreas
const std::vector< WalkingArea > & getWalkingAreas() const
return this junctions pedestrian walking areas
Definition: NBNode.h:678
LINKDIR_STRAIGHT
The link is a straight direction.
Definition: SUMOXMLDefinitions.h:1173
NWWriter_SUMO::writeSUMOTime
static std::string writeSUMOTime(SUMOTime time)
writes a SUMOTime as int if possible, otherwise as a float
Definition: NWWriter_SUMO.cpp:857
NBEdge::getToNode
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:486
NWWriter_SUMO::writeInternalNodes
static bool writeInternalNodes(OutputDevice &into, const NBNode &n)
Writes internal junctions (<junction with id[0]==':' ...) of the given node.
Definition: NWWriter_SUMO.cpp:613
NBEdge::getGeometry
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:680
writePreferences
void writePreferences(OutputDevice &into, SVCPermissions preferred)
writes allowed disallowed attributes if needed;
Definition: SUMOVehicleClass.cpp:333
NWWriter_SUMO::writeRoundabout
static void writeRoundabout(OutputDevice &into, const std::vector< std::string > &r, const NBEdgeCont &ec)
Writes a roundabout.
Definition: NWWriter_SUMO.cpp:798
NBEdge::Connection::mayDefinitelyPass
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
Definition: NBEdge.h:218
SUMO_ATTR_KEEP_CLEAR
Whether vehicles must keep the junction clear.
Definition: SUMOXMLDefinitions.h:693
SVCPermissions
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
Definition: SUMOVehicleClass.h:219
TIME2STEPS
#define TIME2STEPS(x)
Definition: SUMOTime.h:59
NBEdge::getStopOffsets
const std::map< int, double > & getStopOffsets() const
Returns the stopOffset to the end of the edge.
Definition: NBEdge.h:611
NBTrafficLightDefinition::UNSPECIFIED_DURATION
static const SUMOTime UNSPECIFIED_DURATION
Definition: NBTrafficLightDefinition.h:71
NBEdge::UNSPECIFIED_CONTPOS
static const double UNSPECIFIED_CONTPOS
unspecified internal junction position
Definition: NBEdge.h:312
EDGEFUNC_WALKINGAREA
Definition: SUMOXMLDefinitions.h:1079
SUMO_ATTR_PASS
Definition: SUMOXMLDefinitions.h:765
NBEdge::Connection::getDescription
std::string getDescription(const NBEdge *parent) const
get string describing this connection
Definition: NBEdge.cpp:88
NBNode::getRadius
double getRadius() const
Returns the turning radius of this node.
Definition: NBNode.h:281
NBEdge::getLaneID
std::string getLaneID(int lane) const
get lane ID
Definition: NBEdge.cpp:3125
NBNode::getDirection
LinkDirection getDirection(const NBEdge *const incoming, const NBEdge *const outgoing, bool leftHand=false) const
Returns the representation of the described stream's direction.
Definition: NBNode.cpp:1936
STEPS2TIME
#define STEPS2TIME(x)
Definition: SUMOTime.h:57
writePermissions
void writePermissions(OutputDevice &into, SVCPermissions permissions)
writes allowed disallowed attributes if needed;
Definition: SUMOVehicleClass.cpp:310
SUMO_ATTR_WIDTH
Definition: SUMOXMLDefinitions.h:387
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:158
SUMOVehicleClass.h
NBNode::Crossing::priority
bool priority
whether the pedestrians have priority
Definition: NBNode.h:152
SUMO_ATTR_EDGES
the edges of a route
Definition: SUMOXMLDefinitions.h:428
SUMO_ATTR_BIDI
Definition: SUMOXMLDefinitions.h:395
OutputDevice.h
SUMO_TAG_EDGE
begin/end of the description of an edge
Definition: SUMOXMLDefinitions.h:48
NBEdge::hasLoadedLength
bool hasLoadedLength() const
Returns whether a length was set explicitly.
Definition: NBEdge.h:552
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:158
NBNetBuilder.h
ProcessError
Definition: UtilExceptions.h:40
getVehicleClassNames
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
Definition: SUMOVehicleClass.cpp:169
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
NBHelpers.h
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:90
EDGEFUNC_CONNECTOR
Definition: SUMOXMLDefinitions.h:1077
NBEdge::Lane::width
double width
This lane's width.
Definition: NBEdge.h:161
NBEdge::UNSPECIFIED_VISIBILITY_DISTANCE
static const double UNSPECIFIED_VISIBILITY_DISTANCE
unspecified foe visibility for connections
Definition: NBEdge.h:315
NWWriter_SUMO::ConnectionStyle
ConnectionStyle
Definition: NWWriter_SUMO.h:60
NBConnection
Definition: NBConnection.h:44
LINKSTATE_MINOR
This is an uncontrolled, minor link, has to brake.
Definition: SUMOXMLDefinitions.h:1152
SUMO_ATTR_DISTANCE
Definition: SUMOXMLDefinitions.h:396
NBEdge::UNSPECIFIED_SPEED
static const double UNSPECIFIED_SPEED
unspecified lane speed
Definition: NBEdge.h:309
NWWriter_SUMO::writeInternalConnections
static bool writeInternalConnections(OutputDevice &into, const NBNode &n)
Writes inner connections within the node.
Definition: NWWriter_SUMO.cpp:721
SUMO_ATTR_LEFTHAND
Definition: SUMOXMLDefinitions.h:878
NBHelpers::interpretLaneID
static void interpretLaneID(const std::string &lane_id, std::string &edge_id, int &index)
parses edge-id and index from lane-id
Definition: NBHelpers.cpp:121
NBNode::getCrossings
std::vector< Crossing * > getCrossings() const
return this junctions pedestrian crossings
Definition: NBNode.cpp:2455
NBEdgeCont::end
std::map< std::string, NBEdge * >::const_iterator end() const
Returns the pointer to the end of the stored edges.
Definition: NBEdgeCont.h:193
NODETYPE_DEAD_END
Definition: SUMOXMLDefinitions.h:1064
NBEdge::getLanes
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:644
OptionsCont::isDefault
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
Definition: OptionsCont.cpp:164
NBNode::hasCustomShape
bool hasCustomShape() const
return whether the shape was set by the user
Definition: NBNode.h:530
NBTrafficLightLogicCont::getComputed
std::vector< NBTrafficLightLogic * > getComputed() const
Returns a list of all computed logics.
Definition: NBTrafficLightLogicCont.cpp:296
NBEdge::getStreetName
const std::string & getStreetName() const
Returns the street name of this edge.
Definition: NBEdge.h:588
SUMO_ATTR_FROM_LANE
Definition: SUMOXMLDefinitions.h:716
SUMO_ATTR_INDEX
Definition: SUMOXMLDefinitions.h:801
SUMO_ATTR_FROM
Definition: SUMOXMLDefinitions.h:637
SUMO_ATTR_RADIUS
The turning radius at an intersection in m.
Definition: SUMOXMLDefinitions.h:691
SUMO_TAG_TLLOGIC
a traffic light logic
Definition: SUMOXMLDefinitions.h:142
NBEdge::getLoadedLength
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
Definition: NBEdge.h:542
SUMO_TAG_TAZ
a traffic assignment zone
Definition: SUMOXMLDefinitions.h:134
OptionsCont::getFloat
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
Definition: OptionsCont.cpp:209
NBEdge::getEndOffset
double getEndOffset() const
Returns the offset to the destination node.
Definition: NBEdge.h:600
NBConnectionProhibits
std::map< NBConnection, NBConnectionVector > NBConnectionProhibits
Definition of a container for connection block dependencies Includes a list of all connections which ...
Definition: NBConnectionDefs.h:40
OutputDevice::openTag
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
Definition: OutputDevice.cpp:240
NBNodeCont.h
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
StringUtils.h
NBNode::getShape
const PositionVector & getShape() const
retrieve the junction shape
Definition: NBNode.cpp:2143
NBEdge::Lane::customShape
PositionVector customShape
A custom shape for this lane set by the user.
Definition: NBEdge.h:174
SUMO_TAG_TAZSINK
a sink within a district (connection road)
Definition: SUMOXMLDefinitions.h:138
SUMO_ATTR_STATE
The state of a link.
Definition: SUMOXMLDefinitions.h:705
SUMO_ATTR_PRIORITY
Definition: SUMOXMLDefinitions.h:383
OutputDevice::getDevice
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
Definition: OutputDevice.cpp:55
SUMO_ATTR_DURATION
Definition: SUMOXMLDefinitions.h:665
SUMO_ATTR_VIA
Definition: SUMOXMLDefinitions.h:720
SUMO_ATTR_WALKINGAREAS
Definition: SUMOXMLDefinitions.h:877
NBTypeCont::writeTypes
void writeTypes(OutputDevice &into) const
writes all types a s XML
Definition: NBTypeCont.cpp:124
NBNode::Crossing::tlLinkIndex
int tlLinkIndex
the traffic light index of this crossing (if controlled)
Definition: NBNode.h:156
NBEdge::Connection::id
std::string id
id of Connection
Definition: NBEdge.h:236
SUMO_ATTR_TLLINKINDEX
link: the index of the link within the traffic light
Definition: SUMOXMLDefinitions.h:683
NBNetBuilder::getTLLogicCont
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
Definition: NBNetBuilder.h:166
NBEdge::Connection::viaID
std::string viaID
if Connection have a via, ID of it
Definition: NBEdge.h:248
NBEdge::Lane
An (internal) definition of a single lane of an edge.
Definition: NBEdge.h:137
NBNode::getFringeType
FringeType getFringeType() const
Returns fringe type.
Definition: NBNode.h:296
NBNode::WalkingArea::width
double width
This lane's width.
Definition: NBNode.h:183
NBEdge::Connection::keepClear
bool keepClear
whether the junction must be kept clear when using this connection
Definition: NBEdge.h:221
NBNode::getIncomingEdges
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
Definition: NBNode.h:259
NBEdge::Lane::oppositeID
std::string oppositeID
An opposite lane ID, if given.
Definition: NBEdge.h:164
SUMO_ATTR_VALUE
Definition: SUMOXMLDefinitions.h:776
NBNode::UNSPECIFIED_RADIUS
static const double UNSPECIFIED_RADIUS
unspecified lane width
Definition: NBNode.h:212
OutputDevice::lf
void lf()
writes a line feed if applicable
Definition: OutputDevice.h:234
NBConnectionVector
std::vector< NBConnection > NBConnectionVector
Definition of a connection vector.
Definition: NBConnectionDefs.h:35
NBNetBuilder::getDistrictCont
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
Definition: NBNetBuilder.h:171
NBEdge::Lane::permissions
SVCPermissions permissions
List of vehicle types that are allowed on this lane.
Definition: NBEdge.h:148
SUMO_ATTR_RIGHT_OF_WAY
How to compute right of way.
Definition: SUMOXMLDefinitions.h:695
SUMO_TAG_CONNECTION
connectio between two lanes
Definition: SUMOXMLDefinitions.h:203
NWWriter_SUMO::writeDistrict
static void writeDistrict(OutputDevice &into, const NBDistrict &d)
Writes a district.
Definition: NWWriter_SUMO.cpp:827
joinToString
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:247
NBEdge::UNSPECIFIED_WIDTH
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:303
SUMO_ATTR_UNCONTROLLED
Definition: SUMOXMLDefinitions.h:764
NBEdge::Connection::customShape
PositionVector customShape
custom shape for connection
Definition: NBEdge.h:233
SUMO_ATTR_PROHIBITOR
Definition: SUMOXMLDefinitions.h:777
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:935
NBEdge::isMacroscopicConnector
bool isMacroscopicConnector() const
Returns whether this edge was marked as a macroscopic connector.
Definition: NBEdge.h:1019
NBNode::getCrossing
Crossing * getCrossing(const std::string &id) const
return the crossing with the given id
Definition: NBNode.cpp:3116
NBEdge::getFinalLength
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Definition: NBEdge.cpp:3704
NWWriter_SUMO::PLAIN
Definition: NWWriter_SUMO.h:62
NBNode::WalkingArea::length
double length
This lane's width.
Definition: NBNode.h:185
NBEdge::getTypeID
const std::string & getTypeID() const
get ID of type
Definition: NBEdge.h:1061
SUMO_ATTR_MAXDURATION
maximum duration of a phase
Definition: SUMOXMLDefinitions.h:731
NBEdge::Lane::accelRamp
bool accelRamp
Whether this lane is an acceleration lane.
Definition: NBEdge.h:167
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:189
NBEdge::Connection::getInternalLaneID
std::string getInternalLaneID() const
get ID of internal lane
Definition: NBEdge.cpp:82
NWWriter_SUMO::writeInternalConnection
static void writeInternalConnection(OutputDevice &into, const std::string &from, const std::string &to, int fromLane, int toLane, const std::string &via, LinkDirection dir=LINKDIR_STRAIGHT, const std::string &tlID="", int linkIndex=NBConnection::InvalidTlIndex)
Writes a single internal connection.
Definition: NWWriter_SUMO.cpp:748
FRINGE_TYPE_DEFAULT
Definition: SUMOXMLDefinitions.h:1108
NBDistrictCont::end
std::map< std::string, NBDistrict * >::const_iterator end() const
Returns the pointer to the end of the stored districts.
Definition: NBDistrictCont.h:90
SUMO_ATTR_FRINGE
Fringe type of node.
Definition: SUMOXMLDefinitions.h:697
NWWriter_SUMO::writeRoundabouts
static void writeRoundabouts(OutputDevice &into, const std::set< EdgeSet > &roundabouts, const NBEdgeCont &ec)
Writes roundabouts.
Definition: NWWriter_SUMO.cpp:772
NBEdge::Lane::endOffset
double endOffset
This lane's offset to the intersection begin.
Definition: NBEdge.h:154
SUMO_ATTR_PROGRAMID
Definition: SUMOXMLDefinitions.h:413
NBEdge::Lane::shape
PositionVector shape
The lane's shape.
Definition: NBEdge.h:142
SUMO_ATTR_CROSSING_EDGES
the edges crossed by a pedestrian crossing
Definition: SUMOXMLDefinitions.h:671
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:228
SUMO_ATTR_NAME
Definition: SUMOXMLDefinitions.h:381
NBNode
Represents a single node (junction) during network building.
Definition: NBNode.h:68
SUMO_TAG_ROUNDABOUT
roundabout defined in junction
Definition: SUMOXMLDefinitions.h:221
NBNetBuilder::getNodeCont
NBNodeCont & getNodeCont()
Returns a reference to the node container.
Definition: NBNetBuilder.h:156
NBNode::Crossing
A definition of a pedestrian crossing.
Definition: NBNode.h:132
NBEdge::Connection
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:184
NBNetBuilder::getTypeCont
NBTypeCont & getTypeCont()
Returns a reference to the type container.
Definition: NBNetBuilder.h:161
NBNode.h
NBEdge::Connection::visibility
double visibility
custom foe visiblity for connection
Definition: NBEdge.h:227
SUMO_ATTR_SHAPE
edge: the shape in xml-definition
Definition: SUMOXMLDefinitions.h:687
NBEdge::Connection::internalLaneIndex
int internalLaneIndex
The lane index of this internal lane within the internal edge.
Definition: NBEdge.h:260
NBNode::getRightOfWay
RightOfWay getRightOfWay() const
Returns hint on how to compute right of way.
Definition: NBNode.h:291
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:77
NBEdgeCont::begin
std::map< std::string, NBEdge * >::const_iterator begin() const
Returns the pointer to the begin of the stored edges.
Definition: NBEdgeCont.h:185
POSITION_EPS
#define POSITION_EPS
Definition: config.h:169
WRITE_ERROR
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:245
NBNode::Crossing::tlID
std::string tlID
The id of the traffic light that controls this connection.
Definition: NBNode.h:162
NBEdge::getConnections
const std::vector< Connection > & getConnections() const
Returns the connections.
Definition: NBEdge.h:924
NBDistrict
A class representing a single district.
Definition: NBDistrict.h:65
NBEdge::getFromNode
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:479
NBNode::WalkingArea::id
std::string id
the (edge)-id of this walkingArea
Definition: NBNode.h:181
SUMO_ATTR_VERSION
Definition: SUMOXMLDefinitions.h:873
NBEdgeCont::getRoundabouts
const std::set< EdgeSet > getRoundabouts() const
Returns the determined roundabouts.
Definition: NBEdgeCont.cpp:1232
NBDistrictCont::size
int size() const
Returns the number of districts inside the container.
Definition: NBDistrictCont.cpp:70
NBDistrict::getShape
const PositionVector & getShape() const
Returns the shape.
Definition: NBDistrict.h:215
SUMO_ATTR_OFFSET
Definition: SUMOXMLDefinitions.h:414
NBEdge.h
NBEdge::getDistance
double getDistance() const
Definition: NBEdge.h:604
SUMO_TAG_JUNCTION
begin/end of the description of a junction
Definition: SUMOXMLDefinitions.h:60
SUMO_ATTR_CONTPOS
Definition: SUMOXMLDefinitions.h:746
NBEdge::getLaneSpreadFunction
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge's lanes' lateral offset is computed.
Definition: NBEdge.h:762
SUMO_ATTR_VCLASSES
Definition: SUMOXMLDefinitions.h:453
NODETYPE_NOJUNCTION
Definition: SUMOXMLDefinitions.h:1062
SUMO_ATTR_NODES
a list of node ids, used for controlling joining
Definition: SUMOXMLDefinitions.h:724
NBEdge::getTurnDestination
NBEdge * getTurnDestination(bool possibleDestination=false) const
Definition: NBEdge.cpp:3116
NBEdge::getID
const std::string & getID() const
Definition: NBEdge.h:1364
OutputDevice::writePadding
OutputDevice & writePadding(const std::string &val)
writes padding (ignored for binary output)
Definition: OutputDevice.h:308