SUMO - Simulation of Urban MObility
NIImporter_SUMO.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // Importer for networks stored in SUMO format
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 #include <string>
38 #include <utils/common/ToString.h>
42 #include <utils/xml/XMLSubSys.h>
46 #include <netbuild/NBEdge.h>
47 #include <netbuild/NBEdgeCont.h>
48 #include <netbuild/NBNode.h>
49 #include <netbuild/NBNodeCont.h>
51 #include <netbuild/NBNetBuilder.h>
52 #include "NILoader.h"
53 #include "NIXMLEdgesHandler.h"
54 #include "NIImporter_SUMO.h"
55 
56 #ifdef CHECK_MEMORY_LEAKS
57 #include <foreign/nvwa/debug_new.h>
58 #endif // CHECK_MEMORY_LEAKS
59 
60 
61 // ===========================================================================
62 // method definitions
63 // ===========================================================================
64 // ---------------------------------------------------------------------------
65 // static methods (interface in this case)
66 // ---------------------------------------------------------------------------
67 void
69  NIImporter_SUMO importer(nb);
70  importer._loadNetwork(oc);
71 }
72 
73 
74 // ---------------------------------------------------------------------------
75 // loader methods
76 // ---------------------------------------------------------------------------
78  : SUMOSAXHandler("sumo-network"),
79  myNetBuilder(nb),
80  myNodeCont(nb.getNodeCont()),
81  myTLLCont(nb.getTLLogicCont()),
82  myCurrentEdge(0),
83  myCurrentLane(0),
84  myCurrentTL(0),
85  myLocation(0),
87  myAmLefthand(false),
88  myCornerDetail(0),
89  myLinkDetail(-1) {
90 }
91 
92 
94  for (std::map<std::string, EdgeAttrs*>::const_iterator i = myEdges.begin(); i != myEdges.end(); ++i) {
95  EdgeAttrs* ed = (*i).second;
96  for (std::vector<LaneAttrs*>::const_iterator j = ed->lanes.begin(); j != ed->lanes.end(); ++j) {
97  delete *j;
98  }
99  delete ed;
100  }
101  delete myLocation;
102 }
103 
104 
105 void
107  // check whether the option is set (properly)
108  if (!oc.isUsableFileList("sumo-net-file")) {
109  return;
110  }
111  // parse file(s)
112  std::vector<std::string> files = oc.getStringVector("sumo-net-file");
113  for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
114  if (!FileHelpers::isReadable(*file)) {
115  WRITE_ERROR("Could not open sumo-net-file '" + *file + "'.");
116  return;
117  }
118  setFileName(*file);
119  PROGRESS_BEGIN_MESSAGE("Parsing sumo-net from '" + *file + "'");
120  XMLSubSys::runParser(*this, *file, true);
122  }
123  // build edges
124  for (std::map<std::string, EdgeAttrs*>::const_iterator i = myEdges.begin(); i != myEdges.end(); ++i) {
125  EdgeAttrs* ed = (*i).second;
126  // skip internal edges
127  if (ed->func == EDGEFUNC_INTERNAL || ed->func == EDGEFUNC_CROSSING || ed->func == EDGEFUNC_WALKINGAREA) {
128  continue;
129  }
130  // get and check the nodes
131  NBNode* from = myNodeCont.retrieve(ed->fromNode);
132  NBNode* to = myNodeCont.retrieve(ed->toNode);
133  if (from == 0) {
134  WRITE_ERROR("Edge's '" + ed->id + "' from-node '" + ed->fromNode + "' is not known.");
135  continue;
136  }
137  if (to == 0) {
138  WRITE_ERROR("Edge's '" + ed->id + "' to-node '" + ed->toNode + "' is not known.");
139  continue;
140  }
141  // edge shape
142  PositionVector geom;
143  if (ed->shape.size() > 0) {
144  geom = ed->shape;
145  } else {
146  // either the edge has default shape consisting only of the two node
147  // positions or we have a legacy network
148  geom = reconstructEdgeShape(ed, from->getPosition(), to->getPosition());
149  }
150  // build and insert the edge
151  NBEdge* e = new NBEdge(ed->id, from, to,
152  ed->type, ed->maxSpeed,
153  (int) ed->lanes.size(),
155  geom, ed->streetName, "", ed->lsf, true); // always use tryIgnoreNodePositions to keep original shape
156  e->setLoadedLength(ed->length);
157  if (!myNetBuilder.getEdgeCont().insert(e)) {
158  WRITE_ERROR("Could not insert edge '" + ed->id + "'.");
159  delete e;
160  continue;
161  }
163  }
164  // assign further lane attributes (edges are built)
165  EdgeVector toRemove;
166  for (std::map<std::string, EdgeAttrs*>::const_iterator i = myEdges.begin(); i != myEdges.end(); ++i) {
167  EdgeAttrs* ed = (*i).second;
168  NBEdge* nbe = ed->builtEdge;
169  if (nbe == 0) { // inner edge or removed by explicit list, vclass, ...
170  continue;
171  }
172  for (int fromLaneIndex = 0; fromLaneIndex < (int) ed->lanes.size(); ++fromLaneIndex) {
173  LaneAttrs* lane = ed->lanes[fromLaneIndex];
174  // connections
175  const std::vector<Connection>& connections = lane->connections;
176  for (std::vector<Connection>::const_iterator c_it = connections.begin(); c_it != connections.end(); c_it++) {
177  const Connection& c = *c_it;
178  if (myEdges.count(c.toEdgeID) == 0) {
179  WRITE_ERROR("Unknown edge '" + c.toEdgeID + "' given in connection.");
180  continue;
181  }
182  NBEdge* toEdge = myEdges[c.toEdgeID]->builtEdge;
183  if (toEdge == 0) { // removed by explicit list, vclass, ...
184  continue;
185  }
186  if (nbe->hasConnectionTo(toEdge, c.toLaneIdx)) {
187  WRITE_WARNING("Target lane '" + toEdge->getLaneID(c.toLaneIdx) + "' has multiple connections from '" + nbe->getID() + "'.");
188  }
190  fromLaneIndex, toEdge, c.toLaneIdx, NBEdge::L2L_VALIDATED,
191  true, c.mayDefinitelyPass, c.keepClear, c.contPos);
192 
193  // maybe we have a tls-controlled connection
194  if (c.tlID != "" && myRailSignals.count(c.tlID) == 0) {
195  const std::map<std::string, NBTrafficLightDefinition*>& programs = myTLLCont.getPrograms(c.tlID);
196  if (programs.size() > 0) {
197  std::map<std::string, NBTrafficLightDefinition*>::const_iterator it;
198  for (it = programs.begin(); it != programs.end(); it++) {
199  NBLoadedSUMOTLDef* tlDef = dynamic_cast<NBLoadedSUMOTLDef*>(it->second);
200  if (tlDef) {
201  tlDef->addConnection(nbe, toEdge, fromLaneIndex, c.toLaneIdx, c.tlLinkNo);
202  } else {
203  throw ProcessError("Corrupt traffic light definition '" + c.tlID + "' (program '" + it->first + "')");
204  }
205  }
206  } else {
207  WRITE_ERROR("The traffic light '" + c.tlID + "' is not known.");
208  }
209  }
210  }
211  // allow/disallow XXX preferred
212  nbe->setPermissions(parseVehicleClasses(lane->allow, lane->disallow), fromLaneIndex);
213  // width, offset
214  nbe->setLaneWidth(fromLaneIndex, lane->width);
215  nbe->setEndOffset(fromLaneIndex, lane->endOffset);
216  nbe->setSpeed(fromLaneIndex, lane->maxSpeed);
217  nbe->getLaneStruct(fromLaneIndex).oppositeID = lane->oppositeID;
218  }
220  if (!nbe->hasLaneSpecificWidth() && nbe->getLanes()[0].width != NBEdge::UNSPECIFIED_WIDTH) {
221  nbe->setLaneWidth(-1, nbe->getLaneWidth(0));
222  }
224  nbe->setEndOffset(-1, nbe->getEndOffset(0));
225  }
226  // check again after permissions are set
229  toRemove.push_back(nbe);
230  }
231  }
232  for (EdgeVector::iterator i = toRemove.begin(); i != toRemove.end(); ++i) {
234  }
235  // insert loaded prohibitions
236  for (std::vector<Prohibition>::const_iterator it = myProhibitions.begin(); it != myProhibitions.end(); it++) {
237  NBEdge* prohibitedFrom = myEdges[it->prohibitedFrom]->builtEdge;
238  NBEdge* prohibitedTo = myEdges[it->prohibitedTo]->builtEdge;
239  NBEdge* prohibitorFrom = myEdges[it->prohibitorFrom]->builtEdge;
240  NBEdge* prohibitorTo = myEdges[it->prohibitorTo]->builtEdge;
241  if (prohibitedFrom == 0) {
242  WRITE_WARNING("Edge '" + it->prohibitedFrom + "' in prohibition was not built");
243  } else if (prohibitedTo == 0) {
244  WRITE_WARNING("Edge '" + it->prohibitedTo + "' in prohibition was not built");
245  } else if (prohibitorFrom == 0) {
246  WRITE_WARNING("Edge '" + it->prohibitorFrom + "' in prohibition was not built");
247  } else if (prohibitorTo == 0) {
248  WRITE_WARNING("Edge '" + it->prohibitorTo + "' in prohibition was not built");
249  } else {
250  NBNode* n = prohibitedFrom->getToNode();
252  NBConnection(prohibitorFrom, prohibitorTo),
253  NBConnection(prohibitedFrom, prohibitedTo));
254  }
255  }
256  if (!myHaveSeenInternalEdge) {
258  }
259  if (oc.isDefault("lefthand")) {
260  oc.set("lefthand", toString(myAmLefthand));
261  }
262  if (oc.isDefault("junctions.corner-detail")) {
263  oc.set("junctions.corner-detail", toString(myCornerDetail));
264  }
265  if (oc.isDefault("junctions.internal-link-detail") && myLinkDetail > 0) {
266  oc.set("junctions.internal-link-detail", toString(myLinkDetail));
267  }
268  if (!deprecatedVehicleClassesSeen.empty()) {
269  WRITE_WARNING("Deprecated vehicle class(es) '" + toString(deprecatedVehicleClassesSeen) + "' in input network.");
271  }
272  // add loaded crossings
273  if (!oc.getBool("no-internal-links")) {
274  for (std::map<std::string, std::vector<Crossing> >::const_iterator it = myPedestrianCrossings.begin(); it != myPedestrianCrossings.end(); ++it) {
275  NBNode* node = myNodeCont.retrieve((*it).first);
276  for (std::vector<Crossing>::const_iterator it_c = (*it).second.begin(); it_c != (*it).second.end(); ++it_c) {
277  const Crossing& crossing = (*it_c);
278  EdgeVector edges;
279  for (std::vector<std::string>::const_iterator it_e = crossing.crossingEdges.begin(); it_e != crossing.crossingEdges.end(); ++it_e) {
280  NBEdge* edge = myNetBuilder.getEdgeCont().retrieve(*it_e);
281  // edge might have been removed due to options
282  if (edge != 0) {
283  edges.push_back(edge);
284  }
285  }
286  if (edges.size() > 0) {
287  node->addCrossing(edges, crossing.width, crossing.priority, true);
288  }
289  }
290  }
291  }
292  // add roundabouts
293  for (std::vector<std::vector<std::string> >::const_iterator it = myRoundabouts.begin(); it != myRoundabouts.end(); ++it) {
294  EdgeSet roundabout;
295  for (std::vector<std::string>::const_iterator it_r = it->begin(); it_r != it->end(); ++it_r) {
296  NBEdge* edge = myNetBuilder.getEdgeCont().retrieve(*it_r);
297  if (edge == 0) {
298  if (!myNetBuilder.getEdgeCont().wasIgnored(*it_r)) {
299  WRITE_ERROR("Unknown edge '" + (*it_r) + "' in roundabout");
300  }
301  } else {
302  roundabout.insert(edge);
303  }
304  }
305  myNetBuilder.getEdgeCont().addRoundabout(roundabout);
306  }
307 }
308 
309 
310 
311 void
313  const SUMOSAXAttributes& attrs) {
314  /* our goal is to reproduce the input net faithfully
315  * there are different types of objects in the netfile:
316  * 1) those which must be loaded into NBNetBuilder-Containers for processing
317  * 2) those which can be ignored because they are recomputed based on group 1
318  * 3) those which are of no concern to NBNetBuilder but should be exposed to
319  * NETEDIT. We will probably have to patch NBNetBuilder to contain them
320  * and hand them over to NETEDIT
321  * alternative idea: those shouldn't really be contained within the
322  * network but rather in separate files. teach NETEDIT how to open those
323  * (POI?)
324  * 4) those which are of concern neither to NBNetBuilder nor NETEDIT and
325  * must be copied over - need to patch NBNetBuilder for this.
326  * copy unknown by default
327  */
328  switch (element) {
329  case SUMO_TAG_NET: {
330  bool ok;
331  myAmLefthand = attrs.getOpt<bool>(SUMO_ATTR_LEFTHAND, 0, ok, false);
332  myCornerDetail = attrs.getOpt<int>(SUMO_ATTR_CORNERDETAIL, 0, ok, 0);
333  myLinkDetail = attrs.getOpt<int>(SUMO_ATTR_LINKDETAIL, 0, ok, -1);
334  break;
335  }
336  case SUMO_TAG_EDGE:
337  addEdge(attrs);
338  break;
339  case SUMO_TAG_LANE:
340  addLane(attrs);
341  break;
342  case SUMO_TAG_NEIGH:
344  break;
345  case SUMO_TAG_JUNCTION:
346  addJunction(attrs);
347  break;
348  case SUMO_TAG_REQUEST:
349  addRequest(attrs);
350  break;
351  case SUMO_TAG_CONNECTION:
352  addConnection(attrs);
353  break;
354  case SUMO_TAG_TLLOGIC:
356  break;
357  case SUMO_TAG_PHASE:
358  addPhase(attrs, myCurrentTL);
359  break;
360  case SUMO_TAG_LOCATION:
361  myLocation = loadLocation(attrs);
362  break;
364  addProhibition(attrs);
365  break;
366  case SUMO_TAG_ROUNDABOUT:
367  addRoundabout(attrs);
368  break;
369  default:
370  break;
371  }
372 }
373 
374 
375 void
377  switch (element) {
378  case SUMO_TAG_EDGE:
379  if (myEdges.find(myCurrentEdge->id) != myEdges.end()) {
380  WRITE_ERROR("Edge '" + myCurrentEdge->id + "' occured at least twice in the input.");
381  } else {
383  }
384  myCurrentEdge = 0;
385  break;
386  case SUMO_TAG_LANE:
387  if (myCurrentEdge != 0) {
389  myCurrentEdge->lanes.push_back(myCurrentLane);
390  }
391  myCurrentLane = 0;
392  break;
393  case SUMO_TAG_TLLOGIC:
394  if (!myCurrentTL) {
395  WRITE_ERROR("Unmatched closing tag for tl-logic.");
396  } else {
397  if (!myTLLCont.insert(myCurrentTL)) {
398  WRITE_WARNING("Could not add program '" + myCurrentTL->getProgramID() + "' for traffic light '" + myCurrentTL->getID() + "'");
399  delete myCurrentTL;
400  }
401  myCurrentTL = 0;
402  }
403  break;
404  default:
405  break;
406  }
407 }
408 
409 
410 void
412  // get the id, report an error if not given or empty...
413  bool ok = true;
414  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
415  if (!ok) {
416  return;
417  }
418  myCurrentEdge = new EdgeAttrs();
420  myCurrentEdge->id = id;
421  // get the function
422  myCurrentEdge->func = attrs.getEdgeFunc(ok);
424  // add the crossing but don't do anything else
425  Crossing c;
426  c.edgeID = id;
429  return;
431  return; // skip internal edges
432  }
433  // get the type
434  myCurrentEdge->type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), ok, "");
435  // get the origin and the destination node
436  myCurrentEdge->fromNode = attrs.getOpt<std::string>(SUMO_ATTR_FROM, id.c_str(), ok, "");
437  myCurrentEdge->toNode = attrs.getOpt<std::string>(SUMO_ATTR_TO, id.c_str(), ok, "");
438  myCurrentEdge->priority = attrs.getOpt<int>(SUMO_ATTR_PRIORITY, id.c_str(), ok, -1);
439  myCurrentEdge->type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), ok, "");
443  myCurrentEdge->maxSpeed = 0;
444  myCurrentEdge->streetName = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), ok, "");
445  if (myCurrentEdge->streetName != "" && OptionsCont::getOptions().isDefault("output.street-names")) {
446  OptionsCont::getOptions().set("output.street-names", "true");
447  }
448 
449  std::string lsfS = toString(LANESPREAD_RIGHT);
450  lsfS = attrs.getOpt<std::string>(SUMO_ATTR_SPREADTYPE, id.c_str(), ok, lsfS);
451  if (SUMOXMLDefinitions::LaneSpreadFunctions.hasString(lsfS)) {
453  } else {
454  WRITE_ERROR("Unknown spreadType '" + lsfS + "' for edge '" + id + "'.");
455  }
456 }
457 
458 
459 void
461  bool ok = true;
462  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
463  if (!ok) {
464  return;
465  }
466  if (!myCurrentEdge) {
467  WRITE_ERROR("Found lane '" + id + "' not within edge element");
468  return;
469  }
470  if (attrs.getOpt<bool>(SUMO_ATTR_CUSTOMSHAPE, 0, ok, false)) {
471  const std::string nodeID = NBNode::getNodeIDFromInternalLane(id);
472  myCustomShapeMaps[nodeID][id] = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), ok);
473  }
474  myCurrentLane = new LaneAttrs();
476  // save the width and the lane id of the crossing but don't do anything else
478  assert(crossings.size() > 0);
479  crossings.back().width = attrs.get<SUMOReal>(SUMO_ATTR_WIDTH, id.c_str(), ok);
480  return;
482  myHaveSeenInternalEdge = true;
483  return; // skip internal lanes
484  }
485  if (attrs.hasAttribute("maxspeed")) {
486  // !!! deprecated
487  myCurrentLane->maxSpeed = attrs.getFloat("maxspeed");
488  } else {
489  myCurrentLane->maxSpeed = attrs.get<SUMOReal>(SUMO_ATTR_SPEED, id.c_str(), ok);
490  }
491  try {
492  myCurrentLane->allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, id.c_str(), ok, "", false);
493  } catch (EmptyData e) {
494  // !!! deprecated
495  myCurrentLane->allow = "";
496  }
497  myCurrentLane->disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, id.c_str(), ok, "");
498  myCurrentLane->width = attrs.getOpt<SUMOReal>(SUMO_ATTR_WIDTH, id.c_str(), ok, (SUMOReal) NBEdge::UNSPECIFIED_WIDTH);
499  myCurrentLane->endOffset = attrs.getOpt<SUMOReal>(SUMO_ATTR_ENDOFFSET, id.c_str(), ok, (SUMOReal) NBEdge::UNSPECIFIED_OFFSET);
500  myCurrentLane->shape = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), ok);
501  // lane coordinates are derived (via lane spread) do not include them in convex boundary
502  NBNetBuilder::transformCoordinates(myCurrentLane->shape, false, myLocation);
503 }
504 
505 
506 void
508  // get the id, report an error if not given or empty...
510  myCurrentJunction.intLanes.clear();
511  myCurrentJunction.response.clear();
512  bool ok = true;
513  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
514  if (!ok) {
515  return;
516  }
517  if (id[0] == ':') { // internal node
518  return;
519  }
520  SumoXMLNodeType type = attrs.getNodeType(ok);
521  if (ok) {
522  if (type == NODETYPE_DEAD_END_DEPRECATED || type == NODETYPE_DEAD_END) {
523  // dead end is a computed status. Reset this to unknown so it will
524  // be corrected if additional connections are loaded
525  type = NODETYPE_UNKNOWN;
526  }
527  } else {
528  WRITE_WARNING("Unknown node type for junction '" + id + "'.");
529  }
530  Position pos = readPosition(attrs, id, ok);
532  NBNode* node = new NBNode(id, pos, type);
533  if (!myNodeCont.insert(node)) {
534  WRITE_ERROR("Problems on adding junction '" + id + "'.");
535  delete node;
536  return;
537  }
538  myCurrentJunction.node = node;
540  // set optional radius
541  if (attrs.hasAttribute(SUMO_ATTR_RADIUS)) {
542  node->setRadius(attrs.get<SUMOReal>(SUMO_ATTR_RADIUS, id.c_str(), ok));
543  }
544  // handle custom shape
545  if (attrs.getOpt<bool>(SUMO_ATTR_CUSTOMSHAPE, 0, ok, false)) {
546  node->setCustomShape(attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), ok));
547  }
548  if (myCustomShapeMaps.count(id) > 0) {
549  NBNode::CustomShapeMap customShapes = myCustomShapeMaps[id];
550  for (NBNode::CustomShapeMap::const_iterator it = customShapes.begin(); it != customShapes.end(); ++it) {
551  node->setCustomLaneShape(it->first, it->second);
552  }
553  }
554  if (type == NODETYPE_RAIL_SIGNAL || type == NODETYPE_RAIL_CROSSING) {
555  // both types of nodes come without a tlLogic
556  myRailSignals.insert(id);
557  }
558 }
559 
560 
561 void
563  if (myCurrentJunction.node != 0) {
564  bool ok = true;
565  myCurrentJunction.response.push_back(attrs.get<std::string>(SUMO_ATTR_RESPONSE, 0, ok));
566  }
567 }
568 
569 
570 void
572  bool ok = true;
573  std::string fromID = attrs.get<std::string>(SUMO_ATTR_FROM, 0, ok);
574  if (myEdges.count(fromID) == 0) {
575  WRITE_ERROR("Unknown edge '" + fromID + "' given in connection.");
576  return;
577  }
578  EdgeAttrs* from = myEdges[fromID];
579  Connection conn;
580  conn.toEdgeID = attrs.get<std::string>(SUMO_ATTR_TO, 0, ok);
581  int fromLaneIdx = attrs.get<int>(SUMO_ATTR_FROM_LANE, 0, ok);
582  conn.toLaneIdx = attrs.get<int>(SUMO_ATTR_TO_LANE, 0, ok);
583  conn.tlID = attrs.getOpt<std::string>(SUMO_ATTR_TLID, 0, ok, "");
584  conn.mayDefinitelyPass = attrs.getOpt<bool>(SUMO_ATTR_PASS, 0, ok, false);
585  conn.keepClear = attrs.getOpt<bool>(SUMO_ATTR_KEEP_CLEAR, 0, ok, true);
587  if (conn.tlID != "") {
588  conn.tlLinkNo = attrs.get<int>(SUMO_ATTR_TLLINKINDEX, 0, ok);
589  }
590  if ((int)from->lanes.size() <= fromLaneIdx) {
591  WRITE_ERROR("Invalid lane index '" + toString(fromLaneIdx) + "' for connection from '" + fromID + "'.");
592  return;
593  }
594  from->lanes[fromLaneIdx]->connections.push_back(conn);
595 
596  // determine crossing priority
597  if (myPedestrianCrossings.size() > 0
598  && from->func == EDGEFUNC_WALKINGAREA
599  && myEdges[conn.toEdgeID]->func == EDGEFUNC_CROSSING) {
600  std::vector<Crossing>& crossings = myPedestrianCrossings[SUMOXMLDefinitions::getJunctionIDFromInternalEdge(fromID)];
601  for (std::vector<Crossing>::iterator it = crossings.begin(); it != crossings.end(); ++it) {
602  if (conn.toEdgeID == (*it).edgeID) {
603  if (conn.tlID != "") {
604  (*it).priority = true;
605  } else {
606  LinkState state = SUMOXMLDefinitions::LinkStates.get(attrs.get<std::string>(SUMO_ATTR_STATE, 0, ok));
607  (*it).priority = state == LINKSTATE_MAJOR;
608  }
609  }
610  }
611  }
612 }
613 
614 
615 void
617  bool ok = true;
618  std::string prohibitor = attrs.getOpt<std::string>(SUMO_ATTR_PROHIBITOR, 0, ok, "");
619  std::string prohibited = attrs.getOpt<std::string>(SUMO_ATTR_PROHIBITED, 0, ok, "");
620  if (!ok) {
621  return;
622  }
623  Prohibition p;
626  if (!ok) {
627  return;
628  }
629  myProhibitions.push_back(p);
630 }
631 
632 
634 NIImporter_SUMO::getLaneAttrsFromID(EdgeAttrs* edge, std::string lane_id) {
635  std::string edge_id;
636  int index;
637  interpretLaneID(lane_id, edge_id, index);
638  assert(edge->id == edge_id);
639  if ((int)edge->lanes.size() <= index) {
640  WRITE_ERROR("Unknown lane '" + lane_id + "' given in succedge.");
641  return 0;
642  } else {
643  return edge->lanes[index];
644  }
645 }
646 
647 
648 void
649 NIImporter_SUMO::interpretLaneID(const std::string& lane_id, std::string& edge_id, int& index) {
650  // assume lane_id = edge_id + '_' + index
651  const std::string::size_type sep_index = lane_id.rfind('_');
652  if (sep_index == std::string::npos) {
653  WRITE_ERROR("Invalid lane id '" + lane_id + "' (missing '_').");
654  }
655  edge_id = lane_id.substr(0, sep_index);
656  std::string index_string = lane_id.substr(sep_index + 1);
657  try {
658  index = TplConvert::_2int(index_string.c_str());
659  } catch (NumberFormatException) {
660  WRITE_ERROR("Invalid lane index '" + index_string + "' for lane '" + lane_id + "'.");
661  }
662 }
663 
664 
667  if (currentTL) {
668  WRITE_ERROR("Definition of tl-logic '" + currentTL->getID() + "' was not finished.");
669  return 0;
670  }
671  bool ok = true;
672  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
673  SUMOTime offset = TIME2STEPS(attrs.get<SUMOReal>(SUMO_ATTR_OFFSET, id.c_str(), ok));
674  std::string programID = attrs.getOpt<std::string>(SUMO_ATTR_PROGRAMID, id.c_str(), ok, "<unknown>");
675  std::string typeS = attrs.get<std::string>(SUMO_ATTR_TYPE, 0, ok);
676  TrafficLightType type;
677  if (SUMOXMLDefinitions::TrafficLightTypes.hasString(typeS)) {
679  } else {
680  WRITE_ERROR("Unknown traffic light type '" + typeS + "' for tlLogic '" + id + "'.");
681  return 0;
682  }
683  if (ok) {
684  return new NBLoadedSUMOTLDef(id, programID, offset, type);
685  } else {
686  return 0;
687  }
688 }
689 
690 
691 void
693  if (!currentTL) {
694  WRITE_ERROR("found phase without tl-logic");
695  return;
696  }
697  const std::string& id = currentTL->getID();
698  bool ok = true;
699  std::string state = attrs.get<std::string>(SUMO_ATTR_STATE, id.c_str(), ok);
700  SUMOTime duration = TIME2STEPS(attrs.get<SUMOReal>(SUMO_ATTR_DURATION, id.c_str(), ok));
701  if (duration < 0) {
702  WRITE_ERROR("Phase duration for tl-logic '" + id + "/" + currentTL->getProgramID() + "' must be positive.");
703  return;
704  }
705  // if the traffic light is an actuated traffic light, try to get
706  // the minimum and maximum durations
707  //SUMOTime minDuration = attrs.getOptSUMOTimeReporting(SUMO_ATTR_MINDURATION, id.c_str(), ok, -1);
708  //SUMOTime maxDuration = attrs.getOptSUMOTimeReporting(SUMO_ATTR_MAXDURATION, id.c_str(), ok, -1);
709  if (ok) {
710  currentTL->addPhase(duration, state);
711  }
712 }
713 
714 
716 NIImporter_SUMO::reconstructEdgeShape(const EdgeAttrs* edge, const Position& from, const Position& to) {
717  const PositionVector& firstLane = edge->lanes[0]->shape;
718  PositionVector result;
719  result.push_back(from);
720 
721  // reverse logic of NBEdge::computeLaneShape
722  // !!! this will only work for old-style constant width lanes
723  const int noLanes = (int)edge->lanes.size();
724  SUMOReal offset;
725  if (edge->lsf == LANESPREAD_RIGHT) {
726  offset = (SUMO_const_laneWidth + SUMO_const_laneOffset) / 2.; // @todo: why is the lane offset counted in here?
727  } else {
728  offset = (SUMO_const_laneWidth) / 2. - (SUMO_const_laneWidth * (SUMOReal)noLanes - 1) / 2.;
729  }
730  for (int i = 1; i < (int)firstLane.size() - 1; i++) {
731  const Position& from = firstLane[i - 1];
732  const Position& me = firstLane[i];
733  const Position& to = firstLane[i + 1];
734  Position offsets = PositionVector::sideOffset(from, me, offset);
735  Position offsets2 = PositionVector::sideOffset(me, to, offset);
736 
737  PositionVector l1(from - offsets, me - offsets);
738  l1.extrapolate(100);
739  PositionVector l2(me - offsets2, to - offsets2);
740  l2.extrapolate(100);
741  if (l1.intersects(l2)) {
742  result.push_back(l1.intersectionPosition2D(l2));
743  } else {
744  WRITE_WARNING("Could not reconstruct shape for edge '" + edge->id + "'.");
745  }
746  }
747 
748  result.push_back(to);
749  return result;
750 }
751 
752 
755  // @todo refactor parsing of location since its duplicated in NLHandler and PCNetProjectionLoader
756  bool ok = true;
757  GeoConvHelper* result = 0;
759  Boundary convBoundary = attrs.get<Boundary>(SUMO_ATTR_CONV_BOUNDARY, 0, ok);
760  Boundary origBoundary = attrs.get<Boundary>(SUMO_ATTR_ORIG_BOUNDARY, 0, ok);
761  std::string proj = attrs.get<std::string>(SUMO_ATTR_ORIG_PROJ, 0, ok);
762  if (ok) {
763  Position networkOffset = s[0];
764  result = new GeoConvHelper(proj, networkOffset, origBoundary, convBoundary);
765  GeoConvHelper::setLoaded(*result);
766  }
767  return result;
768 }
769 
770 
771 Position
772 NIImporter_SUMO::readPosition(const SUMOSAXAttributes& attrs, const std::string& id, bool& ok) {
773  SUMOReal x = attrs.get<SUMOReal>(SUMO_ATTR_X, id.c_str(), ok);
774  SUMOReal y = attrs.get<SUMOReal>(SUMO_ATTR_Y, id.c_str(), ok);
775  SUMOReal z = 0;
776  if (attrs.hasAttribute(SUMO_ATTR_Z)) {
777  z = attrs.get<SUMOReal>(SUMO_ATTR_Z, id.c_str(), ok);
778  }
779  return Position(x, y, z);
780 }
781 
782 
783 void
784 NIImporter_SUMO::parseProhibitionConnection(const std::string& attr, std::string& from, std::string& to, bool& ok) {
785  // split from/to
786  const std::string::size_type div = attr.find("->");
787  if (div == std::string::npos) {
788  WRITE_ERROR("Missing connection divider in prohibition attribute '" + attr + "'");
789  ok = false;
790  }
791  from = attr.substr(0, div);
792  to = attr.substr(div + 2);
793  // check whether the definition includes a lane information and discard it
794  if (from.find('_') != std::string::npos) {
795  from = from.substr(0, from.find('_'));
796  }
797  if (to.find('_') != std::string::npos) {
798  to = to.substr(0, to.find('_'));
799  }
800  // check whether the edges are known
801  if (myEdges.count(from) == 0) {
802  WRITE_ERROR("Unknown edge prohibition '" + from + "'");
803  ok = false;
804  }
805  if (myEdges.count(to) == 0) {
806  WRITE_ERROR("Unknown edge prohibition '" + to + "'");
807  ok = false;
808  }
809 }
810 
811 
812 void
814  if (attrs.hasAttribute(SUMO_ATTR_EDGES)) {
816  } else {
817  WRITE_ERROR("Empty edges in roundabout.");
818  }
819 }
820 
821 
822 /****************************************************************************/
std::map< std::string, EdgeAttrs * > myEdges
Loaded edge definitions.
LaneAttrs * myCurrentLane
The currently parsed lanes&#39;s definition (to add the shape to)
The information about how to spread the lanes from the given position.
static Position sideOffset(const Position &beg, const Position &end, const SUMOReal amount)
get a side position of position vector using a offset
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
PositionVector shape
This edges&#39;s shape.
std::vector< Prohibition > myProhibitions
Loaded prohibitions.
static void addPhase(const SUMOSAXAttributes &attrs, NBLoadedSUMOTLDef *currentTL)
adds a phase to the traffic lights logic currently build
long long int SUMOTime
Definition: SUMOTime.h:43
static const SUMOReal UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:203
std::set< std::string > deprecatedVehicleClassesSeen
Whether vehicles must keep the junction clear.
const SUMOReal SUMO_const_laneWidth
Definition: StdDefs.h:49
whether a given shape is user-defined
static bool transformCoordinates(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
static bool isReadable(std::string path)
Checks whether the given file is readable.
Definition: FileHelpers.cpp:58
NBNodeCont & myNodeCont
The node container to fill.
void addEdge(const SUMOSAXAttributes &attrs)
Parses an edge and stores the values in "myCurrentEdge".
void addRoundabout(const SUMOSAXAttributes &attrs)
Parses a roundabout and stores it in myEdgeCont.
SUMOReal maxSpeed
The maximum velocity allowed on this lane.
A loaded (complete) traffic light logic.
std::vector< LaneAttrs * > lanes
This edge&#39;s lanes.
static StringBijection< LaneSpreadFunction > LaneSpreadFunctions
bool hasLaneSpecificEndOffset() const
whether lanes differ in offset
Definition: NBEdge.cpp:1491
void setLaneWidth(int lane, SUMOReal width)
set lane specific width (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2476
void setSpeed(int lane, SUMOReal speed)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2531
Describes a pedestrian crossing.
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:522
static std::string getJunctionIDFromInternalEdge(const std::string internalEdge)
return the junction id when given an edge of type internal, crossing or WalkingArea ...
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const std::string & getProgramID() const
Returns the ProgramID.
The representation of a single edge during network building.
Definition: NBEdge.h:70
void declareConnectionsAsLoaded()
Definition: NBEdge.h:1101
A connection description.
std::vector< std::string > response
static void setLoaded(const GeoConvHelper &loaded)
sets the coordinate transformation loaded from a location element
bool intersects(const Position &p1, const Position &p2) const
Returns the information whether this list of points interesects the given line.
T MAX2(T a, T b)
Definition: StdDefs.h:75
SUMOReal getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:469
void setPermissions(SVCPermissions permissions, int lane=-1)
set allowed/disallowed classes for the given lane or for all lanes if -1 is given ...
Definition: NBEdge.cpp:2547
bool myAmLefthand
whether the loaded network was built for lefthand traffic
static NBLoadedSUMOTLDef * initTrafficLightLogic(const SUMOSAXAttributes &attrs, NBLoadedSUMOTLDef *currentTL)
begins the reading of a traffic lights logic
#define TIME2STEPS(x)
Definition: SUMOTime.h:66
static const SUMOReal UNSPECIFIED_CONTPOS
unspecified internal junction position
Definition: NBEdge.h:209
const SUMOReal SUMO_const_laneOffset
Definition: StdDefs.h:52
static StringBijection< LinkState > LinkStates
SUMOReal contPos
custom position for internal junction on this connection
Lane & getLaneStruct(int lane)
Definition: NBEdge.h:1090
static const SUMOReal UNSPECIFIED_OFFSET
unspecified lane offset
Definition: NBEdge.h:205
void setCustomShape(const PositionVector &shape)
set the junction shape
Definition: NBNode.cpp:1705
SAX-handler base for SUMO-files.
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything&#39;s ok.
Definition: XMLSubSys.cpp:114
NIImporter_SUMO(NBNetBuilder &nb)
Constructor.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
bool addLane2LaneConnection(int fromLane, NBEdge *dest, int toLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false, bool keepClear=true, SUMOReal contPos=UNSPECIFIED_CONTPOS)
Adds a connection between the specified this edge&#39;s lane and an approached one.
Definition: NBEdge.cpp:697
virtual SumoXMLEdgeFunc getEdgeFunc(bool &ok) const =0
Returns the value of the named attribute.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
std::map< std::string, NBNode::CustomShapeMap > myCustomShapeMaps
customLaneShape (cannot be added to the NBNode when parsed since the node doesn&#39;t yet exist ...
Describes the values found in a lane&#39;s definition.
The connection was computed and validated.
Definition: NBEdge.h:115
LaneAttrs * getLaneAttrsFromID(EdgeAttrs *edge, std::string lane_id)
Parses lane index from lane ID an retrieve lane from EdgeAttrs.
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:69
std::string toEdgeID
The id of the target edge.
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
bool myHaveSeenInternalEdge
whether the loaded network contains internal lanes
int tlLinkNo
The index of this connection within the controlling traffic light.
The state of a link.
std::map< std::string, PositionVector > CustomShapeMap
Definition: NBNode.h:82
void addLane(const SUMOSAXAttributes &attrs)
Parses a lane and stores the values in "myCurrentLane".
NBNetBuilder & myNetBuilder
The network builder to fill.
const std::string & getID() const
Returns the id.
Definition: Named.h:66
std::vector< std::vector< std::string > > myRoundabouts
loaded roundabout edges
void addConnection(const SUMOSAXAttributes &attrs)
Parses a connection and saves it into the lane&#39;s definition stored in "myCurrentLane".
static void parseStringVector(const std::string &def, std::vector< std::string > &into)
Splits the given string.
std::string toNode
The node this edge ends at.
const Position & getPosition() const
Returns the position of this node.
Definition: NBNode.h:228
The turning radius at an intersection in m.
Describes the values found in an edge&#39;s definition and this edge&#39;s lanes.
void setFileName(const std::string &name)
Sets the current file name.
std::set< NBEdge * > EdgeSet
Definition: NBCont.h:51
int myLinkDetail
the level of geometry detail for internal lanes in the loaded network
JunctionAttrs myCurrentJunction
The currently parsed junction definition to help in reconstructing crossings.
static methods for processing the coordinates conversion for the current net
Definition: GeoConvHelper.h:60
bool hasConnectionTo(NBEdge *destEdge, int destLane, int fromLane=-1) const
Retrieves info about a connection to a certain lane of a certain edge.
Definition: NBEdge.cpp:825
the edges of a route
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
Definition: NBEdgeCont.cpp:162
std::vector< std::string > crossingEdges
std::string allow
This lane&#39;s allowed vehicle classes.
Encapsulated SAX-Attributes.
void setRadius(SUMOReal radius)
set the turning radius
Definition: NBNode.h:510
static GeoConvHelper * loadLocation(const SUMOSAXAttributes &attrs)
Parses network location description and registers it with GeoConveHelper::setLoaded.
static StringBijection< TrafficLightType > TrafficLightTypes
Describes the values found in a prohibition.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
Importer for networks stored in SUMO format.
std::string tlID
The id of the traffic light that controls this connection.
NBEdgeCont & getEdgeCont()
Returns the edge container.
Definition: NBNetBuilder.h:153
EdgeAttrs * myCurrentEdge
The currently parsed edge&#39;s definition (to add loaded lanes to)
A list of positions.
virtual SUMOReal getFloat(int id) const =0
Returns the SUMOReal-value of the named (by its enum-value) attribute.
bool isUsableFileList(const std::string &name) const
Checks whether the named option is usable as a file list (with at least a single file) ...
void parseProhibitionConnection(const std::string &attr, std::string &from, std::string &to, bool &ok)
parses connection string of a prohibition (very old school)
void haveLoadedNetworkWithoutInternalEdges()
notify about style of loaded network
Definition: NBNetBuilder.h:192
LaneSpreadFunction lsf
The lane spread function.
const std::map< std::string, NBTrafficLightDefinition * > & getPrograms(const std::string &id) const
Returns all programs for the given tl-id.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
void setCustomLaneShape(const std::string &laneID, const PositionVector &shape)
sets a custom shape for an internal lane
Definition: NBNode.cpp:1712
#define PROGRESS_BEGIN_MESSAGE(msg)
Definition: MsgHandler.h:202
std::string disallow
This lane&#39;s disallowed vehicle classes.
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:55
void setLoadedLength(SUMOReal val)
Definition: NBEdge.cpp:2590
NBEdge * builtEdge
The built edge.
virtual SumoXMLNodeType getNodeType(bool &ok) const =0
Returns the value of the named attribute.
static PositionVector reconstructEdgeShape(const EdgeAttrs *edge, const Position &from, const Position &to)
reconstructs the edge shape from the node positions and the given lane shapes since we do not know th...
SumoXMLEdgeFunc func
This edge&#39;s function.
std::string oppositeID
This lane&#39;s opposite lane.
void _loadNetwork(OptionsCont &oc)
load the network
SUMOReal width
The width of this lane.
SUMOReal getEndOffset() const
Returns the offset to the destination node.
Definition: NBEdge.h:498
bool keepClear
Whether the junction must be kept clear coming from this connection.
std::vector< std::string > intLanes
SUMOReal endOffset
This lane&#39;s offset from the intersection.
std::string streetName
This edge&#39;s street name.
static void loadNetwork(OptionsCont &oc, NBNetBuilder &nb)
Loads content of the optionally given SUMO file.
SUMOReal maxSpeed
The maximum velocity allowed on this edge (!!!)
virtual std::vector< std::string > getStringVector(int attr) const =0
Tries to read given attribute assuming it is a string vector.
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:206
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
static int _2int(const E *const data)
converts a char-type array into the integer value described by it
Definition: TplConvert.h:149
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:371
std::vector< Connection > connections
This lane&#39;s connections.
void addJunction(const SUMOSAXAttributes &attrs)
Parses a junction and saves it in the node control.
void addCrossing(EdgeVector edges, SUMOReal width, bool priority, bool fromSumoNet=false)
add a pedestrian crossing to this node
Definition: NBNode.cpp:2506
std::string type
This edge&#39;s type.
static void interpretLaneID(const std::string &lane_id, std::string &edge_id, int &index)
parses edge-id and index from lane-id
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
Definition: NBEdgeCont.cpp:247
std::string oppositeID
An opposite lane ID, if given.
Definition: NBEdge.h:142
static const SUMOReal UNSPECIFIED_LOADED_LENGTH
no length override given
Definition: NBEdge.h:212
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
Instance responsible for building networks.
Definition: NBNetBuilder.h:112
void addPhase(SUMOTime duration, const std::string &state)
Adds a phase to the logic the new phase is inserted at the end of the list of already added phases...
std::vector< NBEdge * > EdgeVector
Definition: NBCont.h:41
int myCornerDetail
the level of corner detail in the loaded network
static Position readPosition(const SUMOSAXAttributes &attrs, const std::string &id, bool &ok)
read position from the given attributes, attribute errors to id
std::map< std::string, std::vector< Crossing > > myPedestrianCrossings
The pedestrian crossings found in the network.
A storage for options typed value containers)
Definition: OptionsCont.h:99
int priority
This edge&#39;s priority.
Position intersectionPosition2D(const Position &p1, const Position &p2, const SUMOReal withinDist=0.) const
Returns the position of the intersection.
void erase(NBDistrictCont &dc, NBEdge *edge)
Removes the given edge from the container (deleting it)
Definition: NBEdgeCont.cpp:381
std::string id
This edge&#39;s id.
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
Definition: NBNodeCont.cpp:81
void myEndElement(int element)
Called when a closing tag occurs.
This is an uncontrolled, major link, may pass.
std::string fromNode
The node this edge starts at.
void ignore(std::string id)
mark the given edge id as ignored
Definition: NBEdgeCont.h:474
Represents a single node (junction) during network building.
Definition: NBNode.h:74
T get(const std::string &str) const
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
~NIImporter_SUMO()
Destructor.
void addRequest(const SUMOSAXAttributes &attrs)
Parses a reques and saves selected attributes in myCurrentJunction.
GeoConvHelper * myLocation
The coordinate transformation which was used to build the loaded network.
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
bool hasLaneSpecificWidth() const
whether lanes differ in width
Definition: NBEdge.cpp:1480
void addSortedLinkFoes(const NBConnection &mayDrive, const NBConnection &mustStop)
Definition: NBNode.cpp:1231
void setEndOffset(int lane, SUMOReal offset)
set lane specific end-offset (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2515
#define SUMOReal
Definition: config.h:213
NBTrafficLightLogicCont & myTLLCont
The node container to fill.
std::string getLaneID(int lane) const
Definition: NBEdge.cpp:2348
SUMOReal length
The length of the edge if set explicitly.
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue, bool report=true) const
Tries to read given attribute assuming it is an int.
bool wasIgnored(std::string id) const
Returns whether the edge with the id was ignored during parsing.
Definition: NBEdgeCont.h:469
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
Definition: NBNodeCont.cpp:110
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
#define PROGRESS_DONE_MESSAGE()
Definition: MsgHandler.h:203
void addRoundabout(const EdgeSet &roundabout)
add user specified roundabout
Definition: NBEdgeCont.cpp:996
void addProhibition(const SUMOSAXAttributes &attrs)
Parses a prohibition and saves it.
NBDistrictCont & getDistrictCont()
Returns the districts container.
Definition: NBNetBuilder.h:185
NBLoadedSUMOTLDef * myCurrentTL
The currently parsed traffic light.
std::set< std::string > myRailSignals
list of node id with rail signals (no NBTrafficLightDefinition exists)
int toLaneIdx
The index of the target lane.
void addConnection(NBEdge *from, NBEdge *to, int fromLane, int toLane, int linkIndex)
Adds a connection and immediately informs the edges.
void extrapolate(const SUMOReal val, const bool onlyFirst=false)
extrapolate position vector
bool ignoreFilterMatch(NBEdge *edge)
Returns true if this edge matches one of the removal criteria.
Definition: NBEdgeCont.cpp:183
TrafficLightType
static std::string getNodeIDFromInternalLane(const std::string id)
returns the node id for internal lanes, crossings and walkingareas
Definition: NBNode.cpp:2594