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