SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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),
86  myHaveSeenInternalEdge(false),
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  if (from == to) {
142  WRITE_ERROR("Edge's '" + ed->id + "' from-node and to-node '" + ed->toNode + "' art identical.");
143  continue;
144  }
145  // edge shape
146  PositionVector geom;
147  if (ed->shape.size() > 0) {
148  geom = ed->shape;
149  } else {
150  // either the edge has default shape consisting only of the two node
151  // positions or we have a legacy network
152  geom = reconstructEdgeShape(ed, from->getPosition(), to->getPosition());
153  }
154  // build and insert the edge
155  NBEdge* e = new NBEdge(ed->id, from, to,
156  ed->type, ed->maxSpeed,
157  (int) ed->lanes.size(),
159  geom, ed->streetName, "", ed->lsf, true); // always use tryIgnoreNodePositions to keep original shape
160  e->setLoadedLength(ed->length);
161  if (!myNetBuilder.getEdgeCont().insert(e)) {
162  WRITE_ERROR("Could not insert edge '" + ed->id + "'.");
163  delete e;
164  continue;
165  }
167  }
168  // assign further lane attributes (edges are built)
169  EdgeVector toRemove;
170  for (std::map<std::string, EdgeAttrs*>::const_iterator i = myEdges.begin(); i != myEdges.end(); ++i) {
171  EdgeAttrs* ed = (*i).second;
172  NBEdge* nbe = ed->builtEdge;
173  if (nbe == 0) { // inner edge or removed by explicit list, vclass, ...
174  continue;
175  }
176  for (int fromLaneIndex = 0; fromLaneIndex < (int) ed->lanes.size(); ++fromLaneIndex) {
177  LaneAttrs* lane = ed->lanes[fromLaneIndex];
178  // connections
179  const std::vector<Connection>& connections = lane->connections;
180  for (std::vector<Connection>::const_iterator c_it = connections.begin(); c_it != connections.end(); c_it++) {
181  const Connection& c = *c_it;
182  if (myEdges.count(c.toEdgeID) == 0) {
183  WRITE_ERROR("Unknown edge '" + c.toEdgeID + "' given in connection.");
184  continue;
185  }
186  NBEdge* toEdge = myEdges[c.toEdgeID]->builtEdge;
187  if (toEdge == 0) { // removed by explicit list, vclass, ...
188  continue;
189  }
190  if (nbe->hasConnectionTo(toEdge, c.toLaneIdx)) {
191  WRITE_WARNING("Target lane '" + toEdge->getLaneID(c.toLaneIdx) + "' has multiple connections from '" + nbe->getID() + "'.");
192  }
194  fromLaneIndex, toEdge, c.toLaneIdx, NBEdge::L2L_VALIDATED,
195  true, c.mayDefinitelyPass, c.keepClear, c.contPos, c.visibility);
196 
197  // maybe we have a tls-controlled connection
198  if (c.tlID != "" && myRailSignals.count(c.tlID) == 0) {
199  const std::map<std::string, NBTrafficLightDefinition*>& programs = myTLLCont.getPrograms(c.tlID);
200  if (programs.size() > 0) {
201  std::map<std::string, NBTrafficLightDefinition*>::const_iterator it;
202  for (it = programs.begin(); it != programs.end(); it++) {
203  NBLoadedSUMOTLDef* tlDef = dynamic_cast<NBLoadedSUMOTLDef*>(it->second);
204  if (tlDef) {
205  tlDef->addConnection(nbe, toEdge, fromLaneIndex, c.toLaneIdx, c.tlLinkNo);
206  } else {
207  throw ProcessError("Corrupt traffic light definition '" + c.tlID + "' (program '" + it->first + "')");
208  }
209  }
210  } else {
211  WRITE_ERROR("The traffic light '" + c.tlID + "' is not known.");
212  }
213  }
214  }
215  // allow/disallow XXX preferred
216  nbe->setPermissions(parseVehicleClasses(lane->allow, lane->disallow), fromLaneIndex);
217  // width, offset
218  nbe->setLaneWidth(fromLaneIndex, lane->width);
219  nbe->setEndOffset(fromLaneIndex, lane->endOffset);
220  nbe->setSpeed(fromLaneIndex, lane->maxSpeed);
221  nbe->getLaneStruct(fromLaneIndex).oppositeID = lane->oppositeID;
222  }
224  if (!nbe->hasLaneSpecificWidth() && nbe->getLanes()[0].width != NBEdge::UNSPECIFIED_WIDTH) {
225  nbe->setLaneWidth(-1, nbe->getLaneWidth(0));
226  }
228  nbe->setEndOffset(-1, nbe->getEndOffset(0));
229  }
230  // check again after permissions are set
233  toRemove.push_back(nbe);
234  }
235  }
236  for (EdgeVector::iterator i = toRemove.begin(); i != toRemove.end(); ++i) {
238  }
239  // insert loaded prohibitions
240  for (std::vector<Prohibition>::const_iterator it = myProhibitions.begin(); it != myProhibitions.end(); it++) {
241  NBEdge* prohibitedFrom = myEdges[it->prohibitedFrom]->builtEdge;
242  NBEdge* prohibitedTo = myEdges[it->prohibitedTo]->builtEdge;
243  NBEdge* prohibitorFrom = myEdges[it->prohibitorFrom]->builtEdge;
244  NBEdge* prohibitorTo = myEdges[it->prohibitorTo]->builtEdge;
245  if (prohibitedFrom == 0) {
246  WRITE_WARNING("Edge '" + it->prohibitedFrom + "' in prohibition was not built");
247  } else if (prohibitedTo == 0) {
248  WRITE_WARNING("Edge '" + it->prohibitedTo + "' in prohibition was not built");
249  } else if (prohibitorFrom == 0) {
250  WRITE_WARNING("Edge '" + it->prohibitorFrom + "' in prohibition was not built");
251  } else if (prohibitorTo == 0) {
252  WRITE_WARNING("Edge '" + it->prohibitorTo + "' in prohibition was not built");
253  } else {
254  NBNode* n = prohibitedFrom->getToNode();
256  NBConnection(prohibitorFrom, prohibitorTo),
257  NBConnection(prohibitedFrom, prohibitedTo));
258  }
259  }
260  if (!myHaveSeenInternalEdge) {
262  }
263  if (oc.isDefault("lefthand")) {
264  oc.set("lefthand", toString(myAmLefthand));
265  }
266  if (oc.isDefault("junctions.corner-detail")) {
267  oc.set("junctions.corner-detail", toString(myCornerDetail));
268  }
269  if (oc.isDefault("junctions.internal-link-detail") && myLinkDetail > 0) {
270  oc.set("junctions.internal-link-detail", toString(myLinkDetail));
271  }
272  if (!deprecatedVehicleClassesSeen.empty()) {
273  WRITE_WARNING("Deprecated vehicle class(es) '" + toString(deprecatedVehicleClassesSeen) + "' in input network.");
275  }
276  // add loaded crossings
277  if (!oc.getBool("no-internal-links")) {
278  for (std::map<std::string, std::vector<Crossing> >::const_iterator it = myPedestrianCrossings.begin(); it != myPedestrianCrossings.end(); ++it) {
279  NBNode* node = myNodeCont.retrieve((*it).first);
280  for (std::vector<Crossing>::const_iterator it_c = (*it).second.begin(); it_c != (*it).second.end(); ++it_c) {
281  const Crossing& crossing = (*it_c);
282  EdgeVector edges;
283  for (std::vector<std::string>::const_iterator it_e = crossing.crossingEdges.begin(); it_e != crossing.crossingEdges.end(); ++it_e) {
284  NBEdge* edge = myNetBuilder.getEdgeCont().retrieve(*it_e);
285  // edge might have been removed due to options
286  if (edge != 0) {
287  edges.push_back(edge);
288  }
289  }
290  if (edges.size() > 0) {
291  node->addCrossing(edges, crossing.width, crossing.priority, true);
292  }
293  }
294  }
295  }
296  // add roundabouts
297  for (std::vector<std::vector<std::string> >::const_iterator it = myRoundabouts.begin(); it != myRoundabouts.end(); ++it) {
298  EdgeSet roundabout;
299  for (std::vector<std::string>::const_iterator it_r = it->begin(); it_r != it->end(); ++it_r) {
300  NBEdge* edge = myNetBuilder.getEdgeCont().retrieve(*it_r);
301  if (edge == 0) {
302  if (!myNetBuilder.getEdgeCont().wasIgnored(*it_r)) {
303  WRITE_ERROR("Unknown edge '" + (*it_r) + "' in roundabout");
304  }
305  } else {
306  roundabout.insert(edge);
307  }
308  }
309  myNetBuilder.getEdgeCont().addRoundabout(roundabout);
310  }
311 }
312 
313 
314 
315 void
317  const SUMOSAXAttributes& attrs) {
318  /* our goal is to reproduce the input net faithfully
319  * there are different types of objects in the netfile:
320  * 1) those which must be loaded into NBNetBuilder-Containers for processing
321  * 2) those which can be ignored because they are recomputed based on group 1
322  * 3) those which are of no concern to NBNetBuilder but should be exposed to
323  * NETEDIT. We will probably have to patch NBNetBuilder to contain them
324  * and hand them over to NETEDIT
325  * alternative idea: those shouldn't really be contained within the
326  * network but rather in separate files. teach NETEDIT how to open those
327  * (POI?)
328  * 4) those which are of concern neither to NBNetBuilder nor NETEDIT and
329  * must be copied over - need to patch NBNetBuilder for this.
330  * copy unknown by default
331  */
332  switch (element) {
333  case SUMO_TAG_NET: {
334  bool ok;
335  myAmLefthand = attrs.getOpt<bool>(SUMO_ATTR_LEFTHAND, 0, ok, false);
336  myCornerDetail = attrs.getOpt<int>(SUMO_ATTR_CORNERDETAIL, 0, ok, 0);
337  myLinkDetail = attrs.getOpt<int>(SUMO_ATTR_LINKDETAIL, 0, ok, -1);
338  break;
339  }
340  case SUMO_TAG_EDGE:
341  addEdge(attrs);
342  break;
343  case SUMO_TAG_LANE:
344  addLane(attrs);
345  break;
346  case SUMO_TAG_NEIGH:
348  break;
349  case SUMO_TAG_JUNCTION:
350  addJunction(attrs);
351  break;
352  case SUMO_TAG_REQUEST:
353  addRequest(attrs);
354  break;
355  case SUMO_TAG_CONNECTION:
356  addConnection(attrs);
357  break;
358  case SUMO_TAG_TLLOGIC:
360  break;
361  case SUMO_TAG_PHASE:
362  addPhase(attrs, myCurrentTL);
363  break;
364  case SUMO_TAG_LOCATION:
365  myLocation = loadLocation(attrs);
366  break;
368  addProhibition(attrs);
369  break;
370  case SUMO_TAG_ROUNDABOUT:
371  addRoundabout(attrs);
372  break;
373  default:
374  break;
375  }
376 }
377 
378 
379 void
381  switch (element) {
382  case SUMO_TAG_EDGE:
383  if (myEdges.find(myCurrentEdge->id) != myEdges.end()) {
384  WRITE_ERROR("Edge '" + myCurrentEdge->id + "' occured at least twice in the input.");
385  } else {
387  }
388  myCurrentEdge = 0;
389  break;
390  case SUMO_TAG_LANE:
391  if (myCurrentEdge != 0) {
393  myCurrentEdge->lanes.push_back(myCurrentLane);
394  }
395  myCurrentLane = 0;
396  break;
397  case SUMO_TAG_TLLOGIC:
398  if (!myCurrentTL) {
399  WRITE_ERROR("Unmatched closing tag for tl-logic.");
400  } else {
401  if (!myTLLCont.insert(myCurrentTL)) {
402  WRITE_WARNING("Could not add program '" + myCurrentTL->getProgramID() + "' for traffic light '" + myCurrentTL->getID() + "'");
403  delete myCurrentTL;
404  }
405  myCurrentTL = 0;
406  }
407  break;
408  default:
409  break;
410  }
411 }
412 
413 
414 void
416  // get the id, report an error if not given or empty...
417  bool ok = true;
418  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
419  if (!ok) {
420  return;
421  }
422  myCurrentEdge = new EdgeAttrs();
424  myCurrentEdge->id = id;
425  // get the function
426  myCurrentEdge->func = attrs.getEdgeFunc(ok);
428  // add the crossing but don't do anything else
429  Crossing c;
430  c.edgeID = id;
433  return;
435  return; // skip internal edges
436  }
437  // get the type
438  myCurrentEdge->type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), ok, "");
439  // get the origin and the destination node
440  myCurrentEdge->fromNode = attrs.getOpt<std::string>(SUMO_ATTR_FROM, id.c_str(), ok, "");
441  myCurrentEdge->toNode = attrs.getOpt<std::string>(SUMO_ATTR_TO, id.c_str(), ok, "");
442  myCurrentEdge->priority = attrs.getOpt<int>(SUMO_ATTR_PRIORITY, id.c_str(), ok, -1);
443  myCurrentEdge->type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), ok, "");
447  myCurrentEdge->maxSpeed = 0;
448  myCurrentEdge->streetName = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), ok, "");
449  if (myCurrentEdge->streetName != "" && OptionsCont::getOptions().isDefault("output.street-names")) {
450  OptionsCont::getOptions().set("output.street-names", "true");
451  }
452 
453  std::string lsfS = toString(LANESPREAD_RIGHT);
454  lsfS = attrs.getOpt<std::string>(SUMO_ATTR_SPREADTYPE, id.c_str(), ok, lsfS);
455  if (SUMOXMLDefinitions::LaneSpreadFunctions.hasString(lsfS)) {
457  } else {
458  WRITE_ERROR("Unknown spreadType '" + lsfS + "' for edge '" + id + "'.");
459  }
460 }
461 
462 
463 void
465  bool ok = true;
466  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
467  if (!ok) {
468  return;
469  }
470  if (!myCurrentEdge) {
471  WRITE_ERROR("Found lane '" + id + "' not within edge element");
472  return;
473  }
474  if (attrs.getOpt<bool>(SUMO_ATTR_CUSTOMSHAPE, 0, ok, false)) {
475  const std::string nodeID = NBNode::getNodeIDFromInternalLane(id);
476  myCustomShapeMaps[nodeID][id] = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), ok);
477  }
478  myCurrentLane = new LaneAttrs();
480  // save the width and the lane id of the crossing but don't do anything else
482  assert(crossings.size() > 0);
483  crossings.back().width = attrs.get<SUMOReal>(SUMO_ATTR_WIDTH, id.c_str(), ok);
484  return;
486  myHaveSeenInternalEdge = true;
487  return; // skip internal lanes
488  }
489  if (attrs.hasAttribute("maxspeed")) {
490  // !!! deprecated
491  myCurrentLane->maxSpeed = attrs.getFloat("maxspeed");
492  } else {
493  myCurrentLane->maxSpeed = attrs.get<SUMOReal>(SUMO_ATTR_SPEED, id.c_str(), ok);
494  }
495  try {
496  myCurrentLane->allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, id.c_str(), ok, "", false);
497  } catch (EmptyData e) {
498  // !!! deprecated
499  myCurrentLane->allow = "";
500  }
501  myCurrentLane->disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, id.c_str(), ok, "");
504  myCurrentLane->shape = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), ok);
505  // lane coordinates are derived (via lane spread) do not include them in convex boundary
507 }
508 
509 
510 void
512  // get the id, report an error if not given or empty...
514  myCurrentJunction.intLanes.clear();
515  myCurrentJunction.response.clear();
516  bool ok = true;
517  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
518  if (!ok) {
519  return;
520  }
521  if (id[0] == ':') { // internal node
522  return;
523  }
524  SumoXMLNodeType type = attrs.getNodeType(ok);
525  if (ok) {
526  if (type == NODETYPE_DEAD_END_DEPRECATED || type == NODETYPE_DEAD_END) {
527  // dead end is a computed status. Reset this to unknown so it will
528  // be corrected if additional connections are loaded
529  type = NODETYPE_UNKNOWN;
530  }
531  } else {
532  WRITE_WARNING("Unknown node type for junction '" + id + "'.");
533  }
534  Position pos = readPosition(attrs, id, ok);
536  NBNode* node = new NBNode(id, pos, type);
537  if (!myNodeCont.insert(node)) {
538  WRITE_ERROR("Problems on adding junction '" + id + "'.");
539  delete node;
540  return;
541  }
542  myCurrentJunction.node = node;
544  // set optional radius
545  if (attrs.hasAttribute(SUMO_ATTR_RADIUS)) {
546  node->setRadius(attrs.get<SUMOReal>(SUMO_ATTR_RADIUS, id.c_str(), ok));
547  }
548  // handle custom shape
549  if (attrs.getOpt<bool>(SUMO_ATTR_CUSTOMSHAPE, 0, ok, false)) {
550  node->setCustomShape(attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), ok));
551  }
552  if (myCustomShapeMaps.count(id) > 0) {
553  NBNode::CustomShapeMap customShapes = myCustomShapeMaps[id];
554  for (NBNode::CustomShapeMap::const_iterator it = customShapes.begin(); it != customShapes.end(); ++it) {
555  node->setCustomLaneShape(it->first, it->second);
556  }
557  }
558  if (type == NODETYPE_RAIL_SIGNAL || type == NODETYPE_RAIL_CROSSING) {
559  // both types of nodes come without a tlLogic
560  myRailSignals.insert(id);
561  }
562 }
563 
564 
565 void
567  if (myCurrentJunction.node != 0) {
568  bool ok = true;
569  myCurrentJunction.response.push_back(attrs.get<std::string>(SUMO_ATTR_RESPONSE, 0, ok));
570  }
571 }
572 
573 
574 void
576  bool ok = true;
577  std::string fromID = attrs.get<std::string>(SUMO_ATTR_FROM, 0, ok);
578  if (myEdges.count(fromID) == 0) {
579  WRITE_ERROR("Unknown edge '" + fromID + "' given in connection.");
580  return;
581  }
582  EdgeAttrs* from = myEdges[fromID];
583  Connection conn;
584  conn.toEdgeID = attrs.get<std::string>(SUMO_ATTR_TO, 0, ok);
585  int fromLaneIdx = attrs.get<int>(SUMO_ATTR_FROM_LANE, 0, ok);
586  conn.toLaneIdx = attrs.get<int>(SUMO_ATTR_TO_LANE, 0, ok);
587  conn.tlID = attrs.getOpt<std::string>(SUMO_ATTR_TLID, 0, ok, "");
588  conn.mayDefinitelyPass = attrs.getOpt<bool>(SUMO_ATTR_PASS, 0, ok, false);
589  conn.keepClear = attrs.getOpt<bool>(SUMO_ATTR_KEEP_CLEAR, 0, ok, true);
592  if (conn.tlID != "") {
593  conn.tlLinkNo = attrs.get<int>(SUMO_ATTR_TLLINKINDEX, 0, ok);
594  }
595  if ((int)from->lanes.size() <= fromLaneIdx) {
596  WRITE_ERROR("Invalid lane index '" + toString(fromLaneIdx) + "' for connection from '" + fromID + "'.");
597  return;
598  }
599  from->lanes[fromLaneIdx]->connections.push_back(conn);
600 
601  // determine crossing priority
602  if (myPedestrianCrossings.size() > 0
603  && from->func == EDGEFUNC_WALKINGAREA
604  && myEdges[conn.toEdgeID]->func == EDGEFUNC_CROSSING) {
605  std::vector<Crossing>& crossings = myPedestrianCrossings[SUMOXMLDefinitions::getJunctionIDFromInternalEdge(fromID)];
606  for (std::vector<Crossing>::iterator it = crossings.begin(); it != crossings.end(); ++it) {
607  if (conn.toEdgeID == (*it).edgeID) {
608  if (conn.tlID != "") {
609  (*it).priority = true;
610  } else {
611  LinkState state = SUMOXMLDefinitions::LinkStates.get(attrs.get<std::string>(SUMO_ATTR_STATE, 0, ok));
612  (*it).priority = state == LINKSTATE_MAJOR;
613  }
614  }
615  }
616  }
617 }
618 
619 
620 void
622  bool ok = true;
623  std::string prohibitor = attrs.getOpt<std::string>(SUMO_ATTR_PROHIBITOR, 0, ok, "");
624  std::string prohibited = attrs.getOpt<std::string>(SUMO_ATTR_PROHIBITED, 0, ok, "");
625  if (!ok) {
626  return;
627  }
628  Prohibition p;
631  if (!ok) {
632  return;
633  }
634  myProhibitions.push_back(p);
635 }
636 
637 
639 NIImporter_SUMO::getLaneAttrsFromID(EdgeAttrs* edge, std::string lane_id) {
640  std::string edge_id;
641  int index;
642  interpretLaneID(lane_id, edge_id, index);
643  assert(edge->id == edge_id);
644  if ((int)edge->lanes.size() <= index) {
645  WRITE_ERROR("Unknown lane '" + lane_id + "' given in succedge.");
646  return 0;
647  } else {
648  return edge->lanes[index];
649  }
650 }
651 
652 
653 void
654 NIImporter_SUMO::interpretLaneID(const std::string& lane_id, std::string& edge_id, int& index) {
655  // assume lane_id = edge_id + '_' + index
656  const std::string::size_type sep_index = lane_id.rfind('_');
657  if (sep_index == std::string::npos) {
658  WRITE_ERROR("Invalid lane id '" + lane_id + "' (missing '_').");
659  }
660  edge_id = lane_id.substr(0, sep_index);
661  std::string index_string = lane_id.substr(sep_index + 1);
662  try {
663  index = TplConvert::_2int(index_string.c_str());
664  } catch (NumberFormatException) {
665  WRITE_ERROR("Invalid lane index '" + index_string + "' for lane '" + lane_id + "'.");
666  }
667 }
668 
669 
672  if (currentTL) {
673  WRITE_ERROR("Definition of tl-logic '" + currentTL->getID() + "' was not finished.");
674  return 0;
675  }
676  bool ok = true;
677  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
678  SUMOTime offset = TIME2STEPS(attrs.get<SUMOReal>(SUMO_ATTR_OFFSET, id.c_str(), ok));
679  std::string programID = attrs.getOpt<std::string>(SUMO_ATTR_PROGRAMID, id.c_str(), ok, "<unknown>");
680  std::string typeS = attrs.get<std::string>(SUMO_ATTR_TYPE, 0, ok);
681  TrafficLightType type;
682  if (SUMOXMLDefinitions::TrafficLightTypes.hasString(typeS)) {
684  } else {
685  WRITE_ERROR("Unknown traffic light type '" + typeS + "' for tlLogic '" + id + "'.");
686  return 0;
687  }
688  if (ok) {
689  return new NBLoadedSUMOTLDef(id, programID, offset, type);
690  } else {
691  return 0;
692  }
693 }
694 
695 
696 void
698  if (!currentTL) {
699  WRITE_ERROR("found phase without tl-logic");
700  return;
701  }
702  const std::string& id = currentTL->getID();
703  bool ok = true;
704  std::string state = attrs.get<std::string>(SUMO_ATTR_STATE, id.c_str(), ok);
705  SUMOTime duration = TIME2STEPS(attrs.get<SUMOReal>(SUMO_ATTR_DURATION, id.c_str(), ok));
706  if (duration < 0) {
707  WRITE_ERROR("Phase duration for tl-logic '" + id + "/" + currentTL->getProgramID() + "' must be positive.");
708  return;
709  }
710  // if the traffic light is an actuated traffic light, try to get
711  // the minimum and maximum durations
712  //SUMOTime minDuration = attrs.getOptSUMOTimeReporting(SUMO_ATTR_MINDURATION, id.c_str(), ok, -1);
713  //SUMOTime maxDuration = attrs.getOptSUMOTimeReporting(SUMO_ATTR_MAXDURATION, id.c_str(), ok, -1);
714  if (ok) {
715  currentTL->addPhase(duration, state);
716  }
717 }
718 
719 
721 NIImporter_SUMO::reconstructEdgeShape(const EdgeAttrs* edge, const Position& from, const Position& to) {
722  const PositionVector& firstLane = edge->lanes[0]->shape;
723  PositionVector result;
724  result.push_back(from);
725 
726  // reverse logic of NBEdge::computeLaneShape
727  // !!! this will only work for old-style constant width lanes
728  const int noLanes = (int)edge->lanes.size();
729  SUMOReal offset;
730  if (edge->lsf == LANESPREAD_RIGHT) {
731  offset = (SUMO_const_laneWidth + SUMO_const_laneOffset) / 2.; // @todo: why is the lane offset counted in here?
732  } else {
733  offset = (SUMO_const_laneWidth) / 2. - (SUMO_const_laneWidth * (SUMOReal)noLanes - 1) / 2.;
734  }
735  for (int i = 1; i < (int)firstLane.size() - 1; i++) {
736  const Position& from = firstLane[i - 1];
737  const Position& me = firstLane[i];
738  const Position& to = firstLane[i + 1];
739  Position offsets = PositionVector::sideOffset(from, me, offset);
740  Position offsets2 = PositionVector::sideOffset(me, to, offset);
741 
742  PositionVector l1(from - offsets, me - offsets);
743  l1.extrapolate(100);
744  PositionVector l2(me - offsets2, to - offsets2);
745  l2.extrapolate(100);
746  if (l1.intersects(l2)) {
747  result.push_back(l1.intersectionPosition2D(l2));
748  } else {
749  WRITE_WARNING("Could not reconstruct shape for edge '" + edge->id + "'.");
750  }
751  }
752 
753  result.push_back(to);
754  return result;
755 }
756 
757 
760  // @todo refactor parsing of location since its duplicated in NLHandler and PCNetProjectionLoader
761  bool ok = true;
762  GeoConvHelper* result = 0;
764  Boundary convBoundary = attrs.get<Boundary>(SUMO_ATTR_CONV_BOUNDARY, 0, ok);
765  Boundary origBoundary = attrs.get<Boundary>(SUMO_ATTR_ORIG_BOUNDARY, 0, ok);
766  std::string proj = attrs.get<std::string>(SUMO_ATTR_ORIG_PROJ, 0, ok);
767  if (ok) {
768  Position networkOffset = s[0];
769  result = new GeoConvHelper(proj, networkOffset, origBoundary, convBoundary);
770  GeoConvHelper::setLoaded(*result);
771  }
772  return result;
773 }
774 
775 
776 Position
777 NIImporter_SUMO::readPosition(const SUMOSAXAttributes& attrs, const std::string& id, bool& ok) {
778  SUMOReal x = attrs.get<SUMOReal>(SUMO_ATTR_X, id.c_str(), ok);
779  SUMOReal y = attrs.get<SUMOReal>(SUMO_ATTR_Y, id.c_str(), ok);
780  SUMOReal z = 0;
781  if (attrs.hasAttribute(SUMO_ATTR_Z)) {
782  z = attrs.get<SUMOReal>(SUMO_ATTR_Z, id.c_str(), ok);
783  }
784  return Position(x, y, z);
785 }
786 
787 
788 void
789 NIImporter_SUMO::parseProhibitionConnection(const std::string& attr, std::string& from, std::string& to, bool& ok) {
790  // split from/to
791  const std::string::size_type div = attr.find("->");
792  if (div == std::string::npos) {
793  WRITE_ERROR("Missing connection divider in prohibition attribute '" + attr + "'");
794  ok = false;
795  }
796  from = attr.substr(0, div);
797  to = attr.substr(div + 2);
798  // check whether the definition includes a lane information and discard it
799  if (from.find('_') != std::string::npos) {
800  from = from.substr(0, from.find('_'));
801  }
802  if (to.find('_') != std::string::npos) {
803  to = to.substr(0, to.find('_'));
804  }
805  // check whether the edges are known
806  if (myEdges.count(from) == 0) {
807  WRITE_ERROR("Unknown edge prohibition '" + from + "'");
808  ok = false;
809  }
810  if (myEdges.count(to) == 0) {
811  WRITE_ERROR("Unknown edge prohibition '" + to + "'");
812  ok = false;
813  }
814 }
815 
816 
817 void
819  if (attrs.hasAttribute(SUMO_ATTR_EDGES)) {
821  } else {
822  WRITE_ERROR("Empty edges in roundabout.");
823  }
824 }
825 
826 
827 /****************************************************************************/
std::map< std::string, EdgeAttrs * > myEdges
Loaded edge definitions.
LaneAttrs * myCurrentLane
The currently parsed lanes'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'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:237
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's lanes.
static StringBijection< LaneSpreadFunction > LaneSpreadFunctions
bool hasLaneSpecificEndOffset() const
whether lanes differ in offset
Definition: NBEdge.cpp:1642
void setLaneWidth(int lane, SUMOReal width)
set lane specific width (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2627
void setSpeed(int lane, SUMOReal speed)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2682
Describes a pedestrian crossing.
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:552
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:71
void declareConnectionsAsLoaded()
declares connections as fully loaded. This is needed to avoid recomputing connections if an edge has ...
Definition: NBEdge.h:1129
A connection description.
foe visibility distance of a link
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:505
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:2698
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:246
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:1117
static const SUMOReal UNSPECIFIED_OFFSET
unspecified lane offset
Definition: NBEdge.h:240
void setCustomShape(const PositionVector &shape)
set the junction shape
Definition: NBNode.cpp:1728
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'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...
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't yet exist ...
Describes the values found in a lane's definition.
The connection was computed and validated.
Definition: NBEdge.h:117
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'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's definition and this edge'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:953
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'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'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
static const SUMOReal UNSPECIFIED_VISIBILITY_DISTANCE
unspecified foe visibility for connections
Definition: NBEdge.h:249
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.
bool addLane2LaneConnection(int fromLane, NBEdge *dest, int toLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false, bool keepClear=true, SUMOReal contPos=UNSPECIFIED_CONTPOS, SUMOReal visibility=UNSPECIFIED_VISIBILITY_DISTANCE)
Adds a connection between the specified this edge's lane and an approached one.
Definition: NBEdge.cpp:802
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:1735
#define PROGRESS_BEGIN_MESSAGE(msg)
Definition: MsgHandler.h:202
std::string disallow
This lane'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)
set loaded lenght
Definition: NBEdge.cpp:2741
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's function.
std::string oppositeID
This lane'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:530
bool keepClear
Whether the junction must be kept clear coming from this connection.
std::vector< std::string > intLanes
SUMOReal endOffset
This lane's offset from the intersection.
std::string streetName
This edge'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:416
std::vector< Connection > connections
This lane'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:2531
std::string type
This edge'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:150
static const SUMOReal UNSPECIFIED_LOADED_LENGTH
no length override given
Definition: NBEdge.h:252
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'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'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.
PositionVector shape
This lane's shape (needed to reconstruct edge shape for legacy networks)
bool hasLaneSpecificWidth() const
whether lanes differ in width
Definition: NBEdge.cpp:1631
void addSortedLinkFoes(const NBConnection &mayDrive, const NBConnection &mustStop)
Definition: NBNode.cpp:1254
void setEndOffset(int lane, SUMOReal offset)
set lane specific end-offset (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2666
#define SUMOReal
Definition: config.h:214
NBTrafficLightLogicCont & myTLLCont
The node container to fill.
std::string getLaneID(int lane) const
get Lane ID (Secure)
Definition: NBEdge.cpp:2499
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
SUMOReal visibility
custom foe visibility for connection
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:2619