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  myWalkingAreas(false) {
88 }
89 
90 
92  for (std::map<std::string, EdgeAttrs*>::const_iterator i = myEdges.begin(); i != myEdges.end(); ++i) {
93  EdgeAttrs* ed = (*i).second;
94  for (std::vector<LaneAttrs*>::const_iterator j = ed->lanes.begin(); j != ed->lanes.end(); ++j) {
95  delete *j;
96  }
97  delete ed;
98  }
99  delete myLocation;
100 }
101 
102 
103 void
105  // check whether the option is set (properly)
106  if (!oc.isUsableFileList("sumo-net-file")) {
107  return;
108  }
109  // parse file(s)
111  std::vector<std::string> files = oc.getStringVector("sumo-net-file");
112  for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
113  if (!FileHelpers::isReadable(*file)) {
114  WRITE_ERROR("Could not open sumo-net-file '" + *file + "'.");
115  return;
116  }
117  setFileName(*file);
118  PROGRESS_BEGIN_MESSAGE("Parsing sumo-net from '" + *file + "'");
119  XMLSubSys::runParser(*this, *file, true);
120  XMLSubSys::runParser(*typesHandler, *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, false);
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->setAcceleration(fromLaneIndex, lane->accelRamp);
222  nbe->getLaneStruct(fromLaneIndex).oppositeID = lane->oppositeID;
223  if (lane->customShape) {
224  nbe->setLaneShape(fromLaneIndex, lane->shape);
225  }
226  }
228  if (!nbe->hasLaneSpecificWidth() && nbe->getLanes()[0].width != NBEdge::UNSPECIFIED_WIDTH) {
229  nbe->setLaneWidth(-1, nbe->getLaneWidth(0));
230  }
232  nbe->setEndOffset(-1, nbe->getEndOffset(0));
233  }
234  // check again after permissions are set
237  toRemove.push_back(nbe);
238  }
239  }
240  for (EdgeVector::iterator i = toRemove.begin(); i != toRemove.end(); ++i) {
242  }
243  // insert loaded prohibitions
244  for (std::vector<Prohibition>::const_iterator it = myProhibitions.begin(); it != myProhibitions.end(); it++) {
245  NBEdge* prohibitedFrom = myEdges[it->prohibitedFrom]->builtEdge;
246  NBEdge* prohibitedTo = myEdges[it->prohibitedTo]->builtEdge;
247  NBEdge* prohibitorFrom = myEdges[it->prohibitorFrom]->builtEdge;
248  NBEdge* prohibitorTo = myEdges[it->prohibitorTo]->builtEdge;
249  if (prohibitedFrom == 0) {
250  WRITE_WARNING("Edge '" + it->prohibitedFrom + "' in prohibition was not built");
251  } else if (prohibitedTo == 0) {
252  WRITE_WARNING("Edge '" + it->prohibitedTo + "' in prohibition was not built");
253  } else if (prohibitorFrom == 0) {
254  WRITE_WARNING("Edge '" + it->prohibitorFrom + "' in prohibition was not built");
255  } else if (prohibitorTo == 0) {
256  WRITE_WARNING("Edge '" + it->prohibitorTo + "' in prohibition was not built");
257  } else {
258  NBNode* n = prohibitedFrom->getToNode();
260  NBConnection(prohibitorFrom, prohibitorTo),
261  NBConnection(prohibitedFrom, prohibitedTo));
262  }
263  }
264  if (!myHaveSeenInternalEdge) {
266  }
267  if (oc.isDefault("lefthand")) {
268  oc.set("lefthand", toString(myAmLefthand));
269  }
270  if (oc.isDefault("junctions.corner-detail")) {
271  oc.set("junctions.corner-detail", toString(myCornerDetail));
272  }
273  if (oc.isDefault("junctions.internal-link-detail") && myLinkDetail > 0) {
274  oc.set("junctions.internal-link-detail", toString(myLinkDetail));
275  }
276  if (oc.isDefault("rectangular-lane-cut")) {
277  oc.set("rectangular-lane-cut", toString(myRectLaneCut));
278  }
279  if (oc.isDefault("walkingareas")) {
280  oc.set("walkingareas", toString(myWalkingAreas));
281  }
282  if (!deprecatedVehicleClassesSeen.empty()) {
283  WRITE_WARNING("Deprecated vehicle class(es) '" + toString(deprecatedVehicleClassesSeen) + "' in input network.");
285  }
286  // add loaded crossings
287  if (!oc.getBool("no-internal-links")) {
288  for (std::map<std::string, std::vector<Crossing> >::const_iterator it = myPedestrianCrossings.begin(); it != myPedestrianCrossings.end(); ++it) {
289  NBNode* node = myNodeCont.retrieve((*it).first);
290  for (std::vector<Crossing>::const_iterator it_c = (*it).second.begin(); it_c != (*it).second.end(); ++it_c) {
291  const Crossing& crossing = (*it_c);
292  EdgeVector edges;
293  for (std::vector<std::string>::const_iterator it_e = crossing.crossingEdges.begin(); it_e != crossing.crossingEdges.end(); ++it_e) {
294  NBEdge* edge = myNetBuilder.getEdgeCont().retrieve(*it_e);
295  // edge might have been removed due to options
296  if (edge != 0) {
297  edges.push_back(edge);
298  }
299  }
300  if (edges.size() > 0) {
301  node->addCrossing(edges, crossing.width, crossing.priority, true);
302  }
303  }
304  }
305  }
306  // add roundabouts
307  for (std::vector<std::vector<std::string> >::const_iterator it = myRoundabouts.begin(); it != myRoundabouts.end(); ++it) {
308  EdgeSet roundabout;
309  for (std::vector<std::string>::const_iterator it_r = it->begin(); it_r != it->end(); ++it_r) {
310  NBEdge* edge = myNetBuilder.getEdgeCont().retrieve(*it_r);
311  if (edge == 0) {
312  if (!myNetBuilder.getEdgeCont().wasIgnored(*it_r)) {
313  WRITE_ERROR("Unknown edge '" + (*it_r) + "' in roundabout");
314  }
315  } else {
316  roundabout.insert(edge);
317  }
318  }
319  myNetBuilder.getEdgeCont().addRoundabout(roundabout);
320  }
321 }
322 
323 
324 
325 void
327  const SUMOSAXAttributes& attrs) {
328  /* our goal is to reproduce the input net faithfully
329  * there are different types of objects in the netfile:
330  * 1) those which must be loaded into NBNetBuilder-Containers for processing
331  * 2) those which can be ignored because they are recomputed based on group 1
332  * 3) those which are of no concern to NBNetBuilder but should be exposed to
333  * NETEDIT. We will probably have to patch NBNetBuilder to contain them
334  * and hand them over to NETEDIT
335  * alternative idea: those shouldn't really be contained within the
336  * network but rather in separate files. teach NETEDIT how to open those
337  * (POI?)
338  * 4) those which are of concern neither to NBNetBuilder nor NETEDIT and
339  * must be copied over - need to patch NBNetBuilder for this.
340  * copy unknown by default
341  */
342  switch (element) {
343  case SUMO_TAG_NET: {
344  bool ok;
345  myAmLefthand = attrs.getOpt<bool>(SUMO_ATTR_LEFTHAND, 0, ok, false);
346  myCornerDetail = attrs.getOpt<int>(SUMO_ATTR_CORNERDETAIL, 0, ok, 0);
347  myLinkDetail = attrs.getOpt<int>(SUMO_ATTR_LINKDETAIL, 0, ok, -1);
348  myRectLaneCut = attrs.getOpt<bool>(SUMO_ATTR_RECTANGULAR_LANE_CUT, 0, ok, false);
349  myWalkingAreas = attrs.getOpt<bool>(SUMO_ATTR_WALKINGAREAS, 0, ok, false);
350  break;
351  }
352  case SUMO_TAG_EDGE:
353  addEdge(attrs);
354  break;
355  case SUMO_TAG_LANE:
356  addLane(attrs);
357  break;
358  case SUMO_TAG_NEIGH:
360  break;
361  case SUMO_TAG_JUNCTION:
362  addJunction(attrs);
363  break;
364  case SUMO_TAG_REQUEST:
365  addRequest(attrs);
366  break;
367  case SUMO_TAG_CONNECTION:
368  addConnection(attrs);
369  break;
370  case SUMO_TAG_TLLOGIC:
372  break;
373  case SUMO_TAG_PHASE:
374  addPhase(attrs, myCurrentTL);
375  break;
376  case SUMO_TAG_LOCATION:
377  myLocation = loadLocation(attrs);
378  break;
380  addProhibition(attrs);
381  break;
382  case SUMO_TAG_ROUNDABOUT:
383  addRoundabout(attrs);
384  break;
385  default:
386  break;
387  }
388 }
389 
390 
391 void
393  switch (element) {
394  case SUMO_TAG_EDGE:
395  if (myEdges.find(myCurrentEdge->id) != myEdges.end()) {
396  WRITE_ERROR("Edge '" + myCurrentEdge->id + "' occured at least twice in the input.");
397  } else {
399  }
400  myCurrentEdge = 0;
401  break;
402  case SUMO_TAG_LANE:
403  if (myCurrentEdge != 0) {
405  myCurrentEdge->lanes.push_back(myCurrentLane);
406  }
407  myCurrentLane = 0;
408  break;
409  case SUMO_TAG_TLLOGIC:
410  if (!myCurrentTL) {
411  WRITE_ERROR("Unmatched closing tag for tl-logic.");
412  } else {
413  if (!myTLLCont.insert(myCurrentTL)) {
414  WRITE_WARNING("Could not add program '" + myCurrentTL->getProgramID() + "' for traffic light '" + myCurrentTL->getID() + "'");
415  delete myCurrentTL;
416  }
417  myCurrentTL = 0;
418  }
419  break;
420  default:
421  break;
422  }
423 }
424 
425 
426 void
428  // get the id, report an error if not given or empty...
429  bool ok = true;
430  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
431  if (!ok) {
432  return;
433  }
434  myCurrentEdge = new EdgeAttrs();
436  myCurrentEdge->id = id;
437  // get the function
438  myCurrentEdge->func = attrs.getEdgeFunc(ok);
440  // add the crossing but don't do anything else
441  Crossing c;
442  c.edgeID = id;
445  return;
447  return; // skip internal edges
448  }
449  // get the type
450  myCurrentEdge->type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), ok, "");
451  // get the origin and the destination node
452  myCurrentEdge->fromNode = attrs.getOpt<std::string>(SUMO_ATTR_FROM, id.c_str(), ok, "");
453  myCurrentEdge->toNode = attrs.getOpt<std::string>(SUMO_ATTR_TO, id.c_str(), ok, "");
454  myCurrentEdge->priority = attrs.getOpt<int>(SUMO_ATTR_PRIORITY, id.c_str(), ok, -1);
455  myCurrentEdge->type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), ok, "");
459  myCurrentEdge->maxSpeed = 0;
460  myCurrentEdge->streetName = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), ok, "");
461  if (myCurrentEdge->streetName != "" && OptionsCont::getOptions().isDefault("output.street-names")) {
462  OptionsCont::getOptions().set("output.street-names", "true");
463  }
464 
465  std::string lsfS = toString(LANESPREAD_RIGHT);
466  lsfS = attrs.getOpt<std::string>(SUMO_ATTR_SPREADTYPE, id.c_str(), ok, lsfS);
467  if (SUMOXMLDefinitions::LaneSpreadFunctions.hasString(lsfS)) {
469  } else {
470  WRITE_ERROR("Unknown spreadType '" + lsfS + "' for edge '" + id + "'.");
471  }
472 }
473 
474 
475 void
477  bool ok = true;
478  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
479  if (!ok) {
480  return;
481  }
482  if (!myCurrentEdge) {
483  WRITE_ERROR("Found lane '" + id + "' not within edge element");
484  return;
485  }
486  myCurrentLane = new LaneAttrs();
487  if (attrs.getOpt<bool>(SUMO_ATTR_CUSTOMSHAPE, 0, ok, false)) {
488  myCurrentLane->customShape = true;
489  if (id[0] == ':') {
490  const std::string nodeID = NBNode::getNodeIDFromInternalLane(id);
491  myCustomShapeMaps[nodeID][id] = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), ok);
492  }
493  } else {
494  myCurrentLane->customShape = false;
495  }
497  // save the width and the lane id of the crossing but don't do anything else
499  assert(crossings.size() > 0);
500  crossings.back().width = attrs.get<double>(SUMO_ATTR_WIDTH, id.c_str(), ok);
501  return;
503  myHaveSeenInternalEdge = true;
504  return; // skip internal lanes
505  }
506  if (attrs.hasAttribute("maxspeed")) {
507  // !!! deprecated
508  myCurrentLane->maxSpeed = attrs.getFloat("maxspeed");
509  } else {
510  myCurrentLane->maxSpeed = attrs.get<double>(SUMO_ATTR_SPEED, id.c_str(), ok);
511  }
512  try {
513  myCurrentLane->allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, id.c_str(), ok, "", false);
514  } catch (EmptyData e) {
515  // !!! deprecated
516  myCurrentLane->allow = "";
517  }
518  myCurrentLane->disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, id.c_str(), ok, "");
519  myCurrentLane->width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), ok, (double) NBEdge::UNSPECIFIED_WIDTH);
520  myCurrentLane->endOffset = attrs.getOpt<double>(SUMO_ATTR_ENDOFFSET, id.c_str(), ok, (double) NBEdge::UNSPECIFIED_OFFSET);
521  myCurrentLane->shape = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), ok);
522  myCurrentLane->accelRamp = attrs.getOpt<bool>(SUMO_ATTR_ACCELERATION, id.c_str(), ok, false);
523  // lane coordinates are derived (via lane spread) do not include them in convex boundary
525 }
526 
527 
528 void
530  // get the id, report an error if not given or empty...
532  myCurrentJunction.intLanes.clear();
533  myCurrentJunction.response.clear();
534  bool ok = true;
535  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
536  if (!ok) {
537  return;
538  }
539  if (id[0] == ':') { // internal node
540  return;
541  }
542  SumoXMLNodeType type = attrs.getNodeType(ok);
543  if (ok) {
544  if (type == NODETYPE_DEAD_END_DEPRECATED || type == NODETYPE_DEAD_END) {
545  // dead end is a computed status. Reset this to unknown so it will
546  // be corrected if additional connections are loaded
547  type = NODETYPE_UNKNOWN;
548  }
549  } else {
550  WRITE_WARNING("Unknown node type for junction '" + id + "'.");
551  }
552  Position pos = readPosition(attrs, id, ok);
554  NBNode* node = new NBNode(id, pos, type);
555  if (!myNodeCont.insert(node)) {
556  WRITE_ERROR("Problems on adding junction '" + id + "'.");
557  delete node;
558  return;
559  }
560  myCurrentJunction.node = node;
562  // set optional radius
563  if (attrs.hasAttribute(SUMO_ATTR_RADIUS)) {
564  node->setRadius(attrs.get<double>(SUMO_ATTR_RADIUS, id.c_str(), ok));
565  }
566  // handle custom shape
567  if (attrs.getOpt<bool>(SUMO_ATTR_CUSTOMSHAPE, 0, ok, false)) {
568  node->setCustomShape(attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), ok));
569  }
570  if (myCustomShapeMaps.count(id) > 0) {
571  NBNode::CustomShapeMap customShapes = myCustomShapeMaps[id];
572  for (NBNode::CustomShapeMap::const_iterator it = customShapes.begin(); it != customShapes.end(); ++it) {
573  node->setCustomLaneShape(it->first, it->second);
574  }
575  }
576  if (type == NODETYPE_RAIL_SIGNAL || type == NODETYPE_RAIL_CROSSING) {
577  // both types of nodes come without a tlLogic
578  myRailSignals.insert(id);
579  }
580 }
581 
582 
583 void
585  if (myCurrentJunction.node != 0) {
586  bool ok = true;
587  myCurrentJunction.response.push_back(attrs.get<std::string>(SUMO_ATTR_RESPONSE, 0, ok));
588  }
589 }
590 
591 
592 void
594  bool ok = true;
595  std::string fromID = attrs.get<std::string>(SUMO_ATTR_FROM, 0, ok);
596  if (myEdges.count(fromID) == 0) {
597  WRITE_ERROR("Unknown edge '" + fromID + "' given in connection.");
598  return;
599  }
600  EdgeAttrs* from = myEdges[fromID];
601  Connection conn;
602  conn.toEdgeID = attrs.get<std::string>(SUMO_ATTR_TO, 0, ok);
603  int fromLaneIdx = attrs.get<int>(SUMO_ATTR_FROM_LANE, 0, ok);
604  conn.toLaneIdx = attrs.get<int>(SUMO_ATTR_TO_LANE, 0, ok);
605  conn.tlID = attrs.getOpt<std::string>(SUMO_ATTR_TLID, 0, ok, "");
606  conn.mayDefinitelyPass = attrs.getOpt<bool>(SUMO_ATTR_PASS, 0, ok, false);
607  conn.keepClear = attrs.getOpt<bool>(SUMO_ATTR_KEEP_CLEAR, 0, ok, true);
608  conn.contPos = attrs.getOpt<double>(SUMO_ATTR_CONTPOS, 0, ok, NBEdge::UNSPECIFIED_CONTPOS);
610  if (conn.tlID != "") {
611  conn.tlLinkNo = attrs.get<int>(SUMO_ATTR_TLLINKINDEX, 0, ok);
612  }
613  if ((int)from->lanes.size() <= fromLaneIdx) {
614  WRITE_ERROR("Invalid lane index '" + toString(fromLaneIdx) + "' for connection from '" + fromID + "'.");
615  return;
616  }
617  from->lanes[fromLaneIdx]->connections.push_back(conn);
618 
619  // determine crossing priority
620  if (myPedestrianCrossings.size() > 0
621  && from->func == EDGEFUNC_WALKINGAREA
622  && myEdges[conn.toEdgeID]->func == EDGEFUNC_CROSSING) {
623  std::vector<Crossing>& crossings = myPedestrianCrossings[SUMOXMLDefinitions::getJunctionIDFromInternalEdge(fromID)];
624  for (std::vector<Crossing>::iterator it = crossings.begin(); it != crossings.end(); ++it) {
625  if (conn.toEdgeID == (*it).edgeID) {
626  if (conn.tlID != "") {
627  (*it).priority = true;
628  } else {
629  LinkState state = SUMOXMLDefinitions::LinkStates.get(attrs.get<std::string>(SUMO_ATTR_STATE, 0, ok));
630  (*it).priority = state == LINKSTATE_MAJOR;
631  }
632  }
633  }
634  }
635 }
636 
637 
638 void
640  bool ok = true;
641  std::string prohibitor = attrs.getOpt<std::string>(SUMO_ATTR_PROHIBITOR, 0, ok, "");
642  std::string prohibited = attrs.getOpt<std::string>(SUMO_ATTR_PROHIBITED, 0, ok, "");
643  if (!ok) {
644  return;
645  }
646  Prohibition p;
649  if (!ok) {
650  return;
651  }
652  myProhibitions.push_back(p);
653 }
654 
655 
657 NIImporter_SUMO::getLaneAttrsFromID(EdgeAttrs* edge, std::string lane_id) {
658  std::string edge_id;
659  int index;
660  interpretLaneID(lane_id, edge_id, index);
661  assert(edge->id == edge_id);
662  if ((int)edge->lanes.size() <= index) {
663  WRITE_ERROR("Unknown lane '" + lane_id + "' given in succedge.");
664  return 0;
665  } else {
666  return edge->lanes[index];
667  }
668 }
669 
670 
671 void
672 NIImporter_SUMO::interpretLaneID(const std::string& lane_id, std::string& edge_id, int& index) {
673  // assume lane_id = edge_id + '_' + index
674  const std::string::size_type sep_index = lane_id.rfind('_');
675  if (sep_index == std::string::npos) {
676  WRITE_ERROR("Invalid lane id '" + lane_id + "' (missing '_').");
677  }
678  edge_id = lane_id.substr(0, sep_index);
679  std::string index_string = lane_id.substr(sep_index + 1);
680  try {
681  index = TplConvert::_2int(index_string.c_str());
682  } catch (NumberFormatException) {
683  WRITE_ERROR("Invalid lane index '" + index_string + "' for lane '" + lane_id + "'.");
684  }
685 }
686 
687 
690  if (currentTL) {
691  WRITE_ERROR("Definition of tl-logic '" + currentTL->getID() + "' was not finished.");
692  return 0;
693  }
694  bool ok = true;
695  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
696  SUMOTime offset = TIME2STEPS(attrs.get<double>(SUMO_ATTR_OFFSET, id.c_str(), ok));
697  std::string programID = attrs.getOpt<std::string>(SUMO_ATTR_PROGRAMID, id.c_str(), ok, "<unknown>");
698  std::string typeS = attrs.get<std::string>(SUMO_ATTR_TYPE, 0, ok);
699  TrafficLightType type;
700  if (SUMOXMLDefinitions::TrafficLightTypes.hasString(typeS)) {
702  } else {
703  WRITE_ERROR("Unknown traffic light type '" + typeS + "' for tlLogic '" + id + "'.");
704  return 0;
705  }
706  if (ok) {
707  return new NBLoadedSUMOTLDef(id, programID, offset, type);
708  } else {
709  return 0;
710  }
711 }
712 
713 
714 void
716  if (!currentTL) {
717  WRITE_ERROR("found phase without tl-logic");
718  return;
719  }
720  const std::string& id = currentTL->getID();
721  bool ok = true;
722  std::string state = attrs.get<std::string>(SUMO_ATTR_STATE, id.c_str(), ok);
723  SUMOTime duration = TIME2STEPS(attrs.get<double>(SUMO_ATTR_DURATION, id.c_str(), ok));
724  if (duration < 0) {
725  WRITE_ERROR("Phase duration for tl-logic '" + id + "/" + currentTL->getProgramID() + "' must be positive.");
726  return;
727  }
728  // if the traffic light is an actuated traffic light, try to get
729  // the minimum and maximum durations
732  if (ok) {
733  currentTL->addPhase(duration, state, minDuration, maxDuration);
734  }
735 }
736 
737 
739 NIImporter_SUMO::reconstructEdgeShape(const EdgeAttrs* edge, const Position& from, const Position& to) {
740  PositionVector result;
741  result.push_back(from);
742 
743  if (edge->lanes[0]->customShape) {
744  // this is a new network where edge shapes are writen if they exist.
745  result.push_back(to);
746  return result;
747  }
748  const PositionVector& firstLane = edge->lanes[0]->shape;
749 
750  // reverse logic of NBEdge::computeLaneShape
751  // !!! this will only work for old-style constant width lanes
752  const int noLanes = (int)edge->lanes.size();
753  double offset;
754  if (edge->lsf == LANESPREAD_RIGHT) {
755  offset = (SUMO_const_laneWidth + SUMO_const_laneOffset) / 2.; // @todo: why is the lane offset counted in here?
756  } else {
757  offset = (SUMO_const_laneWidth) / 2. - (SUMO_const_laneWidth * (double)noLanes - 1) / 2.;
758  }
759  for (int i = 1; i < (int)firstLane.size() - 1; i++) {
760  const Position& from = firstLane[i - 1];
761  const Position& me = firstLane[i];
762  const Position& to = firstLane[i + 1];
763  Position offsets = PositionVector::sideOffset(from, me, offset);
764  Position offsets2 = PositionVector::sideOffset(me, to, offset);
765 
766  PositionVector l1(from - offsets, me - offsets);
767  l1.extrapolate(100);
768  PositionVector l2(me - offsets2, to - offsets2);
769  l2.extrapolate(100);
770  if (l1.intersects(l2)) {
771  result.push_back(l1.intersectionPosition2D(l2));
772  } else {
773  WRITE_WARNING("Could not reconstruct shape for edge '" + edge->id + "'.");
774  }
775  }
776 
777  result.push_back(to);
778  return result;
779 }
780 
781 
784  // @todo refactor parsing of location since its duplicated in NLHandler and PCNetProjectionLoader
785  bool ok = true;
786  GeoConvHelper* result = 0;
788  Boundary convBoundary = attrs.get<Boundary>(SUMO_ATTR_CONV_BOUNDARY, 0, ok);
789  Boundary origBoundary = attrs.get<Boundary>(SUMO_ATTR_ORIG_BOUNDARY, 0, ok);
790  std::string proj = attrs.get<std::string>(SUMO_ATTR_ORIG_PROJ, 0, ok);
791  if (ok) {
792  Position networkOffset = s[0];
793  result = new GeoConvHelper(proj, networkOffset, origBoundary, convBoundary);
794  GeoConvHelper::setLoaded(*result);
795  }
796  return result;
797 }
798 
799 
800 Position
801 NIImporter_SUMO::readPosition(const SUMOSAXAttributes& attrs, const std::string& id, bool& ok) {
802  const double x = attrs.get<double>(SUMO_ATTR_X, id.c_str(), ok);
803  const double y = attrs.get<double>(SUMO_ATTR_Y, id.c_str(), ok);
804  const double z = attrs.getOpt<double>(SUMO_ATTR_Z, id.c_str(), ok, 0.);
805  return Position(x, y, z);
806 }
807 
808 
809 void
810 NIImporter_SUMO::parseProhibitionConnection(const std::string& attr, std::string& from, std::string& to, bool& ok) {
811  // split from/to
812  const std::string::size_type div = attr.find("->");
813  if (div == std::string::npos) {
814  WRITE_ERROR("Missing connection divider in prohibition attribute '" + attr + "'");
815  ok = false;
816  }
817  from = attr.substr(0, div);
818  to = attr.substr(div + 2);
819  // check whether the definition includes a lane information and discard it
820  if (from.find('_') != std::string::npos) {
821  from = from.substr(0, from.find('_'));
822  }
823  if (to.find('_') != std::string::npos) {
824  to = to.substr(0, to.find('_'));
825  }
826  // check whether the edges are known
827  if (myEdges.count(from) == 0) {
828  WRITE_ERROR("Unknown edge prohibition '" + from + "'");
829  ok = false;
830  }
831  if (myEdges.count(to) == 0) {
832  WRITE_ERROR("Unknown edge prohibition '" + to + "'");
833  ok = false;
834  }
835 }
836 
837 
838 void
840  if (attrs.hasAttribute(SUMO_ATTR_EDGES)) {
842  } else {
843  WRITE_ERROR("Empty edges in roundabout.");
844  }
845 }
846 
847 
848 /****************************************************************************/
void addPhase(SUMOTime duration, const std::string &state, SUMOTime minDur, SUMOTime maxDur)
Adds a phase to the logic the new phase is inserted at the end of the list of already added phases...
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.
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
PositionVector shape
This edges&#39;s shape.
std::vector< Prohibition > myProhibitions
Loaded prohibitions.
static void addPhase(const SUMOSAXAttributes &attrs, NBLoadedSUMOTLDef *currentTL)
adds a phase to the traffic lights logic currently build
std::set< std::string > deprecatedVehicleClassesSeen
virtual SumoXMLNodeType getNodeType(bool &ok) const =0
Returns the value of the named attribute.
NBTypeCont & getTypeCont()
Returns a reference to the type container.
Definition: NBNetBuilder.h:166
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:271
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
Position intersectionPosition2D(const Position &p1, const Position &p2, const double withinDist=0.) const
Returns the position of the intersection.
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:268
void setEndOffset(int lane, double offset)
set lane specific end-offset (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2913
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
bool hasLaneSpecificEndOffset() const
whether lanes differ in offset
Definition: NBEdge.cpp:1801
void setSpeed(int lane, double speed)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2929
Describes a pedestrian crossing.
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:571
connectio between two lanes
double maxSpeed
The maximum velocity allowed on this lane.
const double SUMO_const_laneWidth
Definition: StdDefs.h:50
static std::string getJunctionIDFromInternalEdge(const std::string internalEdge)
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
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.
link,node: the traffic light id responsible for this link
static const double UNSPECIFIED_OFFSET
unspecified lane offset
Definition: NBEdge.h:259
T MAX2(T a, T b)
Definition: StdDefs.h:74
static const SUMOTime UNSPECIFIED_DURATION
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:2960
double getEndOffset() const
Returns the offset to the destination node.
Definition: NBEdge.h:549
void setLoadedLength(double val)
set loaded lenght
Definition: NBEdge.cpp:3003
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:53
static NBLoadedSUMOTLDef * initTrafficLightLogic(const SUMOSAXAttributes &attrs, NBLoadedSUMOTLDef *currentTL)
begins the reading of a traffic lights logic
maximum duration of a phase
#define TIME2STEPS(x)
Definition: SUMOTime.h:66
static StringBijection< LinkState > LinkStates
link states
Lane & getLaneStruct(int lane)
Definition: NBEdge.h:1161
void setCustomShape(const PositionVector &shape)
set the junction shape
Definition: NBNode.cpp:1732
SAX-handler base for SUMO-files.
virtual double getFloat(int id) const =0
Returns the double-value of the named (by its enum-value) attribute.
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.
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:256
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:115
LaneAttrs * getLaneAttrsFromID(EdgeAttrs *edge, std::string lane_id)
Parses lane index from lane ID an retrieve lane from EdgeAttrs.
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:65
void setLaneShape(int lane, const PositionVector &shape)
sets a custom lane shape
Definition: NBEdge.cpp:2952
void setAcceleration(int lane, bool accelRamp)
marks one lane as acceleration lane
Definition: NBEdge.cpp:2944
std::string toEdgeID
The id of the target edge.
SUMOTime getOptSUMOTimeReporting(int attr, const char *objectid, bool &ok, SUMOTime defaultValue, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
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.
const std::string & getID() const
Returns the id.
Definition: Named.h:66
std::vector< std::vector< std::string > > myRoundabouts
loaded roundabout edges
void addConnection(const SUMOSAXAttributes &attrs)
Parses a connection and saves it into the lane&#39;s definition stored in "myCurrentLane".
void setRadius(double radius)
set the turning radius
Definition: NBNode.h:481
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
Definition: NBNode.h:235
The turning radius at an intersection in m.
Describes the values found in an edge&#39;s definition and this edge&#39;s lanes.
void setFileName(const std::string &name)
Sets the current file name.
std::set< NBEdge * > EdgeSet
container for unique edges
Definition: NBCont.h:51
double getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:524
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:1064
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.
Encapsulated SAX-Attributes.
virtual std::vector< std::string > getStringVector(int attr) const =0
Tries to read given attribute assuming it is a string vector.
static GeoConvHelper * loadLocation(const SUMOSAXAttributes &attrs)
Parses network location description and registers it with GeoConveHelper::setLoaded.
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
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:156
EdgeAttrs * myCurrentEdge
The currently parsed edge&#39;s definition (to add loaded lanes to)
A list of positions.
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)
bool myRectLaneCut
whether all lanes of an edge should have the same stop line
void addConnection(NBEdge *from, NBEdge *to, int fromLane, int toLane, int linkIndex, bool reconstruct=true)
Adds a connection and immediately informs the edges.
void haveLoadedNetworkWithoutInternalEdges()
notify about style of loaded network (Without internal edges
Definition: NBNetBuilder.h:193
double visibility
custom foe visibility for connection
LaneSpreadFunction lsf
The lane spread function.
bool customShape
Whether this lane has a custom shape.
static const double UNSPECIFIED_CONTPOS
unspecified internal junction position
Definition: NBEdge.h:265
const std::map< std::string, NBTrafficLightDefinition * > & getPrograms(const std::string &id) const
Returns all programs for the given tl-id.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
roundabout defined in junction
void setCustomLaneShape(const std::string &laneID, const PositionVector &shape)
sets a custom shape for an internal lane
Definition: NBNode.cpp:1744
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...
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
begin/end of the description of a neighboring lane
NBEdge * builtEdge
The built edge.
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
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
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.
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:206
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
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:156
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:435
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.
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
Definition: NBEdgeCont.cpp:251
std::string oppositeID
An opposite lane ID, if given.
Definition: NBEdge.h:148
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:115
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:41
int myCornerDetail
the level of corner detail in the loaded network
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:913
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:1175
Represents a single node (junction) during network building.
Definition: NBNode.h:75
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.
void addCrossing(EdgeVector edges, double width, bool priority, bool fromSumoNet=false)
add a pedestrian crossing to this node
Definition: NBNode.cpp:2597
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&#39;s shape (needed to reconstruct edge shape for legacy networks)
bool hasLaneSpecificWidth() const
whether lanes differ in width
Definition: NBEdge.cpp:1790
void addSortedLinkFoes(const NBConnection &mayDrive, const NBConnection &mustStop)
add shorted link FOES
Definition: NBNode.cpp:1238
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
std::string getLaneID(int lane) const
get Lane ID (Secure)
Definition: NBEdge.cpp:2746
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.
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
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
Definition: NBNodeCont.cpp:106
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
#define PROGRESS_DONE_MESSAGE()
Definition: MsgHandler.h:203
void addRoundabout(const EdgeSet &roundabout)
add user specified roundabout
void addProhibition(const SUMOSAXAttributes &attrs)
Parses a prohibition and saves it.
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
Definition: NBNetBuilder.h:176
virtual SumoXMLEdgeFunc getEdgeFunc(bool &ok) const =0
Returns the value of the named attribute.
NBLoadedSUMOTLDef * myCurrentTL
The currently parsed traffic light.
bool myWalkingAreas
whether walkingareas must be built
std::set< std::string > myRailSignals
list of node id with rail signals (no NBTrafficLightDefinition exists)
int toLaneIdx
The index of the target lane.
a single phase description
void setLaneWidth(int lane, double width)
set lane specific width (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2874
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:2707