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