Eclipse SUMO - Simulation of Urban MObility
NIImporter_SUMO.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // Importer for networks stored in SUMO format
18 /****************************************************************************/
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 #include <string>
31 #include <utils/common/ToString.h>
35 #include <utils/xml/XMLSubSys.h>
39 #include <netbuild/NBEdge.h>
40 #include <netbuild/NBEdgeCont.h>
41 #include <netbuild/NBNode.h>
42 #include <netbuild/NBNodeCont.h>
44 #include <netbuild/NBNetBuilder.h>
45 #include "NILoader.h"
46 #include "NIXMLTypesHandler.h"
47 #include "NIImporter_SUMO.h"
48 
49 
50 // ===========================================================================
51 // method definitions
52 // ===========================================================================
53 // ---------------------------------------------------------------------------
54 // static methods (interface in this case)
55 // ---------------------------------------------------------------------------
56 void
58  NIImporter_SUMO importer(nb);
59  importer._loadNetwork(oc);
60 }
61 
62 
63 // ---------------------------------------------------------------------------
64 // loader methods
65 // ---------------------------------------------------------------------------
67  : SUMOSAXHandler("sumo-network"),
68  myNetBuilder(nb),
69  myNodeCont(nb.getNodeCont()),
70  myTLLCont(nb.getTLLogicCont()),
71  myTypesHandler(nb.getTypeCont()),
72  myCurrentEdge(nullptr),
73  myCurrentLane(nullptr),
74  myCurrentTL(nullptr),
75  myLocation(nullptr),
76  myNetworkVersion(0),
77  myHaveSeenInternalEdge(false),
78  myAmLefthand(false),
79  myCornerDetail(0),
80  myLinkDetail(-1),
81  myRectLaneCut(false),
82  myWalkingAreas(false),
83  myLimitTurnSpeed(-1),
84  myCheckLaneFoesAll(false),
85  myCheckLaneFoesRoundabout(true) {
86 }
87 
88 
90  for (std::map<std::string, EdgeAttrs*>::const_iterator i = myEdges.begin(); i != myEdges.end(); ++i) {
91  EdgeAttrs* ed = (*i).second;
92  for (std::vector<LaneAttrs*>::const_iterator j = ed->lanes.begin(); j != ed->lanes.end(); ++j) {
93  delete *j;
94  }
95  delete ed;
96  }
97  delete myLocation;
98 
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)
109  std::vector<std::string> files = oc.getStringVector("sumo-net-file");
110  for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
111  if (!FileHelpers::isReadable(*file)) {
112  WRITE_ERROR("Could not open sumo-net-file '" + *file + "'.");
113  return;
114  }
115  setFileName(*file);
116  PROGRESS_BEGIN_MESSAGE("Parsing sumo-net from '" + *file + "'");
117  XMLSubSys::runParser(*this, *file, true);
119  }
120  // build edges
121  const double maxSegmentLength = oc.getFloat("geometry.max-segment-length");
122  for (std::map<std::string, EdgeAttrs*>::const_iterator i = myEdges.begin(); i != myEdges.end(); ++i) {
123  EdgeAttrs* ed = (*i).second;
124  // skip internal edges
125  if (ed->func == EDGEFUNC_INTERNAL || ed->func == EDGEFUNC_CROSSING || ed->func == EDGEFUNC_WALKINGAREA) {
126  continue;
127  }
128  // get and check the nodes
129  NBNode* from = myNodeCont.retrieve(ed->fromNode);
130  NBNode* to = myNodeCont.retrieve(ed->toNode);
131  if (from == nullptr) {
132  WRITE_ERROR("Edge's '" + ed->id + "' from-node '" + ed->fromNode + "' is not known.");
133  continue;
134  }
135  if (to == nullptr) {
136  WRITE_ERROR("Edge's '" + ed->id + "' to-node '" + ed->toNode + "' is not known.");
137  continue;
138  }
139  if (from == to) {
140  WRITE_ERROR("Edge's '" + ed->id + "' from-node and to-node '" + ed->toNode + "' are identical.");
141  continue;
142  }
143  if (ed->shape.size() == 0 && maxSegmentLength > 0) {
144  ed->shape.push_back(from->getPosition());
145  ed->shape.push_back(to->getPosition());
146  // shape is already cartesian but we must use a copy because the original will be modified
147  NBNetBuilder::addGeometrySegments(ed->shape, PositionVector(ed->shape), maxSegmentLength);
148  }
149  // build and insert the edge
150  NBEdge* e = new NBEdge(ed->id, from, to,
151  ed->type, ed->maxSpeed,
152  (int) ed->lanes.size(),
154  ed->shape, ed->streetName, "", ed->lsf, true); // always use tryIgnoreNodePositions to keep original shape
155  e->setLoadedLength(ed->length);
157  e->setDistance(ed->distance);
158  if (!myNetBuilder.getEdgeCont().insert(e)) {
159  WRITE_ERROR("Could not insert edge '" + ed->id + "'.");
160  delete e;
161  continue;
162  }
164  if (ed->builtEdge != nullptr) {
165  ed->builtEdge->setStopOffsets(-1, ed->stopOffsets);
166  }
167  }
168  // assign further lane attributes (edges are built)
169  EdgeVector toRemove;
170  const bool dismissVclasses = oc.getBool("dismiss-vclasses");
171  for (std::map<std::string, EdgeAttrs*>::const_iterator i = myEdges.begin(); i != myEdges.end(); ++i) {
172  EdgeAttrs* ed = (*i).second;
173  NBEdge* nbe = ed->builtEdge;
174  if (nbe == nullptr) { // inner edge or removed by explicit list, vclass, ...
175  continue;
176  }
177  const SumoXMLNodeType toType = nbe->getToNode()->getType();
178  for (int fromLaneIndex = 0; fromLaneIndex < (int) ed->lanes.size(); ++fromLaneIndex) {
179  LaneAttrs* lane = ed->lanes[fromLaneIndex];
180  // connections
181  const std::vector<Connection>& connections = lane->connections;
182  for (const Connection& c : connections) {
183  if (myEdges.count(c.toEdgeID) == 0) {
184  WRITE_ERROR("Unknown edge '" + c.toEdgeID + "' given in connection.");
185  continue;
186  }
187  NBEdge* toEdge = myEdges[c.toEdgeID]->builtEdge;
188  if (toEdge == nullptr) { // removed by explicit list, vclass, ...
189  continue;
190  }
191  if (nbe->hasConnectionTo(toEdge, c.toLaneIdx)) {
192  WRITE_WARNING("Target lane '" + toEdge->getLaneID(c.toLaneIdx) + "' has multiple connections from '" + nbe->getID() + "'.");
193  }
194  // patch attribute uncontrolled for legacy networks where it is not set explicitly
195  bool uncontrolled = c.uncontrolled;
196 
197  if ((NBNode::isTrafficLight(toType) || toType == NODETYPE_RAIL_SIGNAL)
198  && c.tlLinkIndex == NBConnection::InvalidTlIndex) {
199  uncontrolled = true;
200  }
202  fromLaneIndex, toEdge, c.toLaneIdx, NBEdge::L2L_VALIDATED,
203  true, c.mayDefinitelyPass, c.keepClear, c.contPos, c.visibility, c.speed, c.customShape, uncontrolled, c.permissions);
204  if (c.getParametersMap().size() > 0) {
205  nbe->getConnectionRef(fromLaneIndex, toEdge, c.toLaneIdx).updateParameters(c.getParametersMap());
206  }
207  // maybe we have a tls-controlled connection
208  if (c.tlID != "" && myRailSignals.count(c.tlID) == 0) {
209  const std::map<std::string, NBTrafficLightDefinition*>& programs = myTLLCont.getPrograms(c.tlID);
210  if (programs.size() > 0) {
211  std::map<std::string, NBTrafficLightDefinition*>::const_iterator it;
212  for (it = programs.begin(); it != programs.end(); it++) {
213  NBLoadedSUMOTLDef* tlDef = dynamic_cast<NBLoadedSUMOTLDef*>(it->second);
214  if (tlDef) {
215  tlDef->addConnection(nbe, toEdge, fromLaneIndex, c.toLaneIdx, c.tlLinkIndex, c.tlLinkIndex2, false);
216  } else {
217  throw ProcessError("Corrupt traffic light definition '" + c.tlID + "' (program '" + it->first + "')");
218  }
219  }
220  } else {
221  WRITE_ERROR("The traffic light '" + c.tlID + "' is not known.");
222  }
223  }
224  }
225  // allow/disallow XXX preferred
226  if (!dismissVclasses) {
227  nbe->setPermissions(parseVehicleClasses(lane->allow, lane->disallow, myNetworkVersion), fromLaneIndex);
228  }
229  // width, offset
230  nbe->setLaneWidth(fromLaneIndex, lane->width);
231  nbe->setEndOffset(fromLaneIndex, lane->endOffset);
232  nbe->setSpeed(fromLaneIndex, lane->maxSpeed);
233  nbe->setAcceleration(fromLaneIndex, lane->accelRamp);
234  nbe->getLaneStruct(fromLaneIndex).oppositeID = lane->oppositeID;
235  nbe->getLaneStruct(fromLaneIndex).type = lane->type;
236  nbe->getLaneStruct(fromLaneIndex).updateParameters(lane->getParametersMap());
237  if (lane->customShape) {
238  nbe->setLaneShape(fromLaneIndex, lane->shape);
239  }
240  // stop offset for lane
241  bool stopOffsetSet = false;
242  if (lane->stopOffsets.size() != 0 || nbe->getStopOffsets().size() == 0) {
243  // apply lane-specific stopOffset (might be none as well)
244  stopOffsetSet = nbe->setStopOffsets(fromLaneIndex, lane->stopOffsets);
245  }
246  if (!stopOffsetSet) {
247  // apply default stop offset to lane
248  nbe->setStopOffsets(fromLaneIndex, nbe->getStopOffsets());
249  }
250  }
252  if (!nbe->hasLaneSpecificWidth() && nbe->getLanes()[0].width != NBEdge::UNSPECIFIED_WIDTH) {
253  nbe->setLaneWidth(-1, nbe->getLaneWidth(0));
254  }
256  nbe->setEndOffset(-1, nbe->getEndOffset(0));
257  }
258  if (!nbe->hasLaneSpecificStopOffsets() && nbe->getStopOffsets().size() != 0) {
259  nbe->setStopOffsets(-1, nbe->getStopOffsets());
260  }
261  // check again after permissions are set
264  toRemove.push_back(nbe);
265  }
266  }
267  for (EdgeVector::iterator i = toRemove.begin(); i != toRemove.end(); ++i) {
269  }
270  // insert loaded prohibitions
271  for (std::vector<Prohibition>::const_iterator it = myProhibitions.begin(); it != myProhibitions.end(); it++) {
272  NBEdge* prohibitedFrom = myEdges[it->prohibitedFrom]->builtEdge;
273  NBEdge* prohibitedTo = myEdges[it->prohibitedTo]->builtEdge;
274  NBEdge* prohibitorFrom = myEdges[it->prohibitorFrom]->builtEdge;
275  NBEdge* prohibitorTo = myEdges[it->prohibitorTo]->builtEdge;
276  if (prohibitedFrom == nullptr) {
277  WRITE_WARNING("Edge '" + it->prohibitedFrom + "' in prohibition was not built");
278  } else if (prohibitedTo == nullptr) {
279  WRITE_WARNING("Edge '" + it->prohibitedTo + "' in prohibition was not built");
280  } else if (prohibitorFrom == nullptr) {
281  WRITE_WARNING("Edge '" + it->prohibitorFrom + "' in prohibition was not built");
282  } else if (prohibitorTo == nullptr) {
283  WRITE_WARNING("Edge '" + it->prohibitorTo + "' in prohibition was not built");
284  } else {
285  NBNode* n = prohibitedFrom->getToNode();
287  NBConnection(prohibitorFrom, prohibitorTo),
288  NBConnection(prohibitedFrom, prohibitedTo));
289  }
290  }
291  if (!myHaveSeenInternalEdge && oc.isDefault("no-internal-links")) {
292  oc.set("no-internal-links", "true");
293  }
294  if (oc.isDefault("lefthand")) {
295  oc.set("lefthand", toString(myAmLefthand));
296  }
297  if (oc.isDefault("junctions.corner-detail")) {
298  oc.set("junctions.corner-detail", toString(myCornerDetail));
299  }
300  if (oc.isDefault("junctions.internal-link-detail") && myLinkDetail > 0) {
301  oc.set("junctions.internal-link-detail", toString(myLinkDetail));
302  }
303  if (oc.isDefault("rectangular-lane-cut")) {
304  oc.set("rectangular-lane-cut", toString(myRectLaneCut));
305  }
306  if (oc.isDefault("walkingareas")) {
307  oc.set("walkingareas", toString(myWalkingAreas));
308  }
309  if (oc.isDefault("junctions.limit-turn-speed")) {
310  oc.set("junctions.limit-turn-speed", toString(myLimitTurnSpeed));
311  }
312  if (oc.isDefault("check-lane-foes.all") && oc.getBool("check-lane-foes.all") != myCheckLaneFoesAll) {
313  oc.set("check-lane-foes.all", toString(myCheckLaneFoesAll));
314  }
315  if (oc.isDefault("check-lane-foes.roundabout") && oc.getBool("check-lane-foes.roundabout") != myCheckLaneFoesRoundabout) {
316  oc.set("check-lane-foes.roundabout", toString(myCheckLaneFoesRoundabout));
317  }
318  if (!deprecatedVehicleClassesSeen.empty()) {
319  WRITE_WARNING("Deprecated vehicle class(es) '" + toString(deprecatedVehicleClassesSeen) + "' in input network.");
321  }
322  if (!oc.getBool("no-internal-links")) {
323  // add loaded crossings
324  for (std::map<std::string, std::vector<Crossing> >::const_iterator it = myPedestrianCrossings.begin(); it != myPedestrianCrossings.end(); ++it) {
325  NBNode* node = myNodeCont.retrieve((*it).first);
326  for (std::vector<Crossing>::const_iterator it_c = (*it).second.begin(); it_c != (*it).second.end(); ++it_c) {
327  const Crossing& crossing = (*it_c);
328  EdgeVector edges;
329  for (std::vector<std::string>::const_iterator it_e = crossing.crossingEdges.begin(); it_e != crossing.crossingEdges.end(); ++it_e) {
330  NBEdge* edge = myNetBuilder.getEdgeCont().retrieve(*it_e);
331  // edge might have been removed due to options
332  if (edge != nullptr) {
333  edges.push_back(edge);
334  }
335  }
336  if (edges.size() > 0) {
337  node->addCrossing(edges, crossing.width, crossing.priority, crossing.customTLIndex, crossing.customTLIndex2, crossing.customShape, true);
338  }
339  }
340  }
341  // add walking area custom shapes
342  for (auto item : myWACustomShapes) {
343  std::string nodeID = SUMOXMLDefinitions::getJunctionIDFromInternalEdge(item.first);
344  NBNode* node = myNodeCont.retrieve(nodeID);
345  std::vector<std::string> edgeIDs;
346  if (item.second.fromEdges.size() + item.second.toEdges.size() == 0) {
347  // must be a split crossing
348  assert(item.second.fromCrossed.size() > 0);
349  assert(item.second.toCrossed.size() > 0);
350  edgeIDs = item.second.fromCrossed;
351  edgeIDs.insert(edgeIDs.end(), item.second.toCrossed.begin(), item.second.toCrossed.end());
352  } else if (item.second.fromEdges.size() > 0) {
353  edgeIDs = item.second.fromEdges;
354  } else {
355  edgeIDs = item.second.toEdges;
356  }
357  EdgeVector edges;
358  for (std::string edgeID : edgeIDs) {
359  NBEdge* edge = myNetBuilder.getEdgeCont().retrieve(edgeID);
360  // edge might have been removed due to options
361  if (edge != nullptr) {
362  edges.push_back(edge);
363  }
364  }
365  if (edges.size() > 0) {
366  node->addWalkingAreaShape(edges, item.second.shape);
367  }
368  }
369  }
370  // add roundabouts
371  for (std::vector<std::vector<std::string> >::const_iterator it = myRoundabouts.begin(); it != myRoundabouts.end(); ++it) {
372  EdgeSet roundabout;
373  for (std::vector<std::string>::const_iterator it_r = it->begin(); it_r != it->end(); ++it_r) {
374  NBEdge* edge = myNetBuilder.getEdgeCont().retrieve(*it_r);
375  if (edge == nullptr) {
376  if (!myNetBuilder.getEdgeCont().wasIgnored(*it_r)) {
377  WRITE_ERROR("Unknown edge '" + (*it_r) + "' in roundabout");
378  }
379  } else {
380  roundabout.insert(edge);
381  }
382  }
383  myNetBuilder.getEdgeCont().addRoundabout(roundabout);
384  }
385 }
386 
387 
388 
389 void
391  const SUMOSAXAttributes& attrs) {
392  /* our goal is to reproduce the input net faithfully
393  * there are different types of objects in the netfile:
394  * 1) those which must be loaded into NBNetBuilder-Containers for processing
395  * 2) those which can be ignored because they are recomputed based on group 1
396  * 3) those which are of no concern to NBNetBuilder but should be exposed to
397  * NETEDIT. We will probably have to patch NBNetBuilder to contain them
398  * and hand them over to NETEDIT
399  * alternative idea: those shouldn't really be contained within the
400  * network but rather in separate files. teach NETEDIT how to open those
401  * (POI?)
402  * 4) those which are of concern neither to NBNetBuilder nor NETEDIT and
403  * must be copied over - need to patch NBNetBuilder for this.
404  * copy unknown by default
405  */
406  switch (element) {
407  case SUMO_TAG_NET: {
408  bool ok;
409  myNetworkVersion = attrs.getOpt<double>(SUMO_ATTR_VERSION, nullptr, ok, 0);
410  myAmLefthand = attrs.getOpt<bool>(SUMO_ATTR_LEFTHAND, nullptr, ok, false);
411  myCornerDetail = attrs.getOpt<int>(SUMO_ATTR_CORNERDETAIL, nullptr, ok, 0);
412  myLinkDetail = attrs.getOpt<int>(SUMO_ATTR_LINKDETAIL, nullptr, ok, -1);
413  myRectLaneCut = attrs.getOpt<bool>(SUMO_ATTR_RECTANGULAR_LANE_CUT, nullptr, ok, false);
414  myWalkingAreas = attrs.getOpt<bool>(SUMO_ATTR_WALKINGAREAS, nullptr, ok, false);
415  myLimitTurnSpeed = attrs.getOpt<double>(SUMO_ATTR_LIMIT_TURN_SPEED, nullptr, ok, -1);
416  myWalkingAreas = attrs.getOpt<bool>(SUMO_ATTR_WALKINGAREAS, nullptr, ok, false);
417  myCheckLaneFoesAll = attrs.getOpt<bool>(SUMO_ATTR_CHECKLANEFOES_ALL, nullptr, ok, false);
418  myCheckLaneFoesRoundabout = attrs.getOpt<bool>(SUMO_ATTR_CHECKLANEFOES_ALL, nullptr, ok, true);
419  break;
420  }
421  case SUMO_TAG_EDGE:
422  addEdge(attrs);
423  break;
424  case SUMO_TAG_LANE:
425  addLane(attrs);
426  break;
427  case SUMO_TAG_STOPOFFSET: {
428  bool ok = true;
429  addStopOffsets(attrs, ok);
430  }
431  break;
432  case SUMO_TAG_NEIGH:
434  break;
435  case SUMO_TAG_JUNCTION:
436  addJunction(attrs);
437  break;
438  case SUMO_TAG_REQUEST:
439  addRequest(attrs);
440  break;
441  case SUMO_TAG_CONNECTION:
442  addConnection(attrs);
443  break;
444  case SUMO_TAG_TLLOGIC:
446  if (myCurrentTL) {
447  myLastParameterised.push_back(myCurrentTL);
448  }
449  break;
450  case SUMO_TAG_PHASE:
451  addPhase(attrs, myCurrentTL);
452  break;
453  case SUMO_TAG_LOCATION:
454  myLocation = loadLocation(attrs);
455  break;
457  addProhibition(attrs);
458  break;
459  case SUMO_TAG_ROUNDABOUT:
460  addRoundabout(attrs);
461  break;
462  case SUMO_TAG_PARAM:
463  if (myLastParameterised.size() != 0) {
464  bool ok = true;
465  const std::string key = attrs.get<std::string>(SUMO_ATTR_KEY, nullptr, ok);
466  // circumventing empty string test
467  const std::string val = attrs.hasAttribute(SUMO_ATTR_VALUE) ? attrs.getString(SUMO_ATTR_VALUE) : "";
468  myLastParameterised.back()->setParameter(key, val);
469  }
470  break;
471  default:
472  myTypesHandler.myStartElement(element, attrs);
473  break;
474  }
475 }
476 
477 
478 void
480  switch (element) {
481  case SUMO_TAG_EDGE:
482  if (myCurrentEdge != nullptr) {
483  if (myEdges.find(myCurrentEdge->id) != myEdges.end()) {
484  WRITE_ERROR("Edge '" + myCurrentEdge->id + "' occurred at least twice in the input.");
485  } else {
487  }
488  myCurrentEdge = nullptr;
489  myLastParameterised.pop_back();
490  }
491  break;
492  case SUMO_TAG_LANE:
493  if (myCurrentEdge != nullptr && myCurrentLane != nullptr) {
495  myCurrentEdge->lanes.push_back(myCurrentLane);
496  myLastParameterised.pop_back();
497  }
498  myCurrentLane = nullptr;
499  break;
500  case SUMO_TAG_TLLOGIC:
501  if (!myCurrentTL) {
502  WRITE_ERROR("Unmatched closing tag for tl-logic.");
503  } else {
504  if (!myTLLCont.insert(myCurrentTL)) {
505  WRITE_WARNING("Could not add program '" + myCurrentTL->getProgramID() + "' for traffic light '" + myCurrentTL->getID() + "'");
506  delete myCurrentTL;
507  }
508  myCurrentTL = nullptr;
509  myLastParameterised.pop_back();
510  }
511  break;
512  case SUMO_TAG_JUNCTION:
513  if (myCurrentJunction.node != nullptr) {
514  myLastParameterised.pop_back();
515  }
516  break;
517  case SUMO_TAG_CONNECTION:
518  // !!! this just avoids a crash but is not a real check that it was a connection
519  if (!myLastParameterised.empty()) {
520  myLastParameterised.pop_back();
521  }
522  break;
523  default:
524  break;
525  }
526 }
527 
528 
529 void
531  // get the id, report an error if not given or empty...
532  bool ok = true;
533  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
534  if (!ok) {
535  return;
536  }
537  myCurrentEdge = new EdgeAttrs();
539  myCurrentEdge->builtEdge = nullptr;
540  myCurrentEdge->id = id;
541  // get the function
542  myCurrentEdge->func = attrs.getEdgeFunc(ok);
544  // add the crossing but don't do anything else
545  Crossing c(id);
546  c.crossingEdges = attrs.get<std::vector<std::string> >(SUMO_ATTR_CROSSING_EDGES, nullptr, ok);
548  return;
550  myHaveSeenInternalEdge = true;
551  return; // skip internal edges
552  }
553  // get the type
554  myCurrentEdge->type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), ok, "");
555  // get the origin and the destination node
556  myCurrentEdge->fromNode = attrs.getOpt<std::string>(SUMO_ATTR_FROM, id.c_str(), ok, "");
557  myCurrentEdge->toNode = attrs.getOpt<std::string>(SUMO_ATTR_TO, id.c_str(), ok, "");
558  myCurrentEdge->priority = attrs.getOpt<int>(SUMO_ATTR_PRIORITY, id.c_str(), ok, -1);
559  myCurrentEdge->type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), ok, "");
563  myCurrentEdge->maxSpeed = 0;
564  myCurrentEdge->streetName = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), ok, "");
565  myCurrentEdge->distance = attrs.getOpt<double>(SUMO_ATTR_DISTANCE, id.c_str(), ok, 0);
566  if (myCurrentEdge->streetName != "" && OptionsCont::getOptions().isDefault("output.street-names")) {
567  OptionsCont::getOptions().set("output.street-names", "true");
568  }
569 
570  std::string lsfS = toString(LANESPREAD_RIGHT);
571  lsfS = attrs.getOpt<std::string>(SUMO_ATTR_SPREADTYPE, id.c_str(), ok, lsfS);
572  if (SUMOXMLDefinitions::LaneSpreadFunctions.hasString(lsfS)) {
574  } else {
575  WRITE_ERROR("Unknown spreadType '" + lsfS + "' for edge '" + id + "'.");
576  }
577 }
578 
579 
580 void
582  bool ok = true;
583  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
584  if (!ok) {
585  return;
586  }
587  if (!myCurrentEdge) {
588  WRITE_ERROR("Found lane '" + id + "' not within edge element.");
589  return;
590  }
591  const std::string expectedID = myCurrentEdge->id + "_" + toString(myCurrentEdge->lanes.size());
592  if (id != expectedID) {
593  WRITE_WARNING("Renaming lane '" + id + "' to '" + expectedID + "'.");
594  }
595  myCurrentLane = new LaneAttrs();
597  myCurrentLane->customShape = attrs.getOpt<bool>(SUMO_ATTR_CUSTOMSHAPE, nullptr, ok, false);
598  myCurrentLane->shape = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), ok);
599  myCurrentLane->type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), ok, "");
601  // save the width and the lane id of the crossing but don't do anything else
603  assert(crossings.size() > 0);
604  crossings.back().width = attrs.get<double>(SUMO_ATTR_WIDTH, id.c_str(), ok);
605  if (myCurrentLane->customShape) {
606  crossings.back().customShape = myCurrentLane->shape;
607  NBNetBuilder::transformCoordinates(crossings.back().customShape, true, myLocation);
608  }
609  } else if (myCurrentEdge->func == EDGEFUNC_WALKINGAREA) {
610  // save custom shape if needed but don't do anything else
611  if (myCurrentLane->customShape) {
613  wacs.shape = myCurrentLane->shape;
616  }
617  return;
618  } else if (myCurrentEdge->func == EDGEFUNC_INTERNAL) {
619  return; // skip internal edges
620  }
621  if (attrs.hasAttribute("maxspeed")) {
622  // !!! deprecated
623  myCurrentLane->maxSpeed = attrs.getFloat("maxspeed");
624  } else {
625  myCurrentLane->maxSpeed = attrs.get<double>(SUMO_ATTR_SPEED, id.c_str(), ok);
626  }
627  try {
628  myCurrentLane->allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, id.c_str(), ok, "", false);
629  } catch (EmptyData&) {
630  // !!! deprecated
631  myCurrentLane->allow = "";
632  }
633  myCurrentLane->disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, id.c_str(), ok, "");
634  myCurrentLane->width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, id.c_str(), ok, (double) NBEdge::UNSPECIFIED_WIDTH);
635  myCurrentLane->endOffset = attrs.getOpt<double>(SUMO_ATTR_ENDOFFSET, id.c_str(), ok, (double) NBEdge::UNSPECIFIED_OFFSET);
636  myCurrentLane->accelRamp = attrs.getOpt<bool>(SUMO_ATTR_ACCELERATION, id.c_str(), ok, false);
637  // lane coordinates are derived (via lane spread) do not include them in convex boundary
639 }
640 
641 
642 void
644  std::map<SVCPermissions, double> offsets = parseStopOffsets(attrs, ok);
645  if (!ok) {
646  return;
647  }
648  assert(offsets.size() == 1);
649  // Admissibility of value will be checked in _loadNetwork(), when lengths are known
650  if (myCurrentLane == nullptr) {
651  if (myCurrentEdge->stopOffsets.size() != 0) {
652  std::stringstream ss;
653  ss << "Duplicate definition of stopOffset for edge " << myCurrentEdge->id << ".\nIgnoring duplicate specification.";
654  WRITE_WARNING(ss.str());
655  return;
656  } else {
657  myCurrentEdge->stopOffsets = offsets;
658  }
659  } else {
660  if (myCurrentLane->stopOffsets.size() != 0) {
661  std::stringstream ss;
662  ss << "Duplicate definition of lane's stopOffset on edge " << myCurrentEdge->id << ".\nIgnoring duplicate specifications.";
663  WRITE_WARNING(ss.str());
664  return;
665  } else {
666  myCurrentLane->stopOffsets = offsets;
667  }
668  }
669 }
670 
671 
672 void
674  // get the id, report an error if not given or empty...
675  myCurrentJunction.node = nullptr;
676  myCurrentJunction.intLanes.clear();
677  myCurrentJunction.response.clear();
678  bool ok = true;
679  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
680  if (!ok) {
681  return;
682  }
683  if (id[0] == ':') { // internal node
684  return;
685  }
686  SumoXMLNodeType type = attrs.getNodeType(ok);
687  if (ok) {
688  if (type == NODETYPE_DEAD_END_DEPRECATED || type == NODETYPE_DEAD_END) {
689  // dead end is a computed status. Reset this to unknown so it will
690  // be corrected if additional connections are loaded
691  type = NODETYPE_UNKNOWN;
692  }
693  } else {
694  WRITE_WARNING("Unknown node type for junction '" + id + "'.");
695  }
696  Position pos = readPosition(attrs, id, ok);
698  NBNode* node = new NBNode(id, pos, type);
699  myLastParameterised.push_back(node);
700  if (!myNodeCont.insert(node)) {
701  WRITE_ERROR("Problems on adding junction '" + id + "'.");
702  delete node;
703  return;
704  }
705  myCurrentJunction.node = node;
706  myCurrentJunction.intLanes = attrs.get<std::vector<std::string> >(SUMO_ATTR_INTLANES, nullptr, ok, false);
707  // set optional radius
708  if (attrs.hasAttribute(SUMO_ATTR_RADIUS)) {
709  node->setRadius(attrs.get<double>(SUMO_ATTR_RADIUS, id.c_str(), ok));
710  }
711  // handle custom shape
712  if (attrs.getOpt<bool>(SUMO_ATTR_CUSTOMSHAPE, nullptr, ok, false)) {
713  PositionVector shape = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), ok);
715  node->setCustomShape(shape);
716  }
717  if (type == NODETYPE_RAIL_SIGNAL || type == NODETYPE_RAIL_CROSSING) {
718  // both types of nodes come without a tlLogic
719  myRailSignals.insert(id);
720  }
722  node->setRightOfWay(attrs.getRightOfWay(ok));
723  }
724  if (attrs.hasAttribute(SUMO_ATTR_FRINGE)) {
725  node->setFringeType(attrs.getFringeType(ok));
726  }
727 }
728 
729 
730 void
732  if (myCurrentJunction.node != nullptr) {
733  bool ok = true;
734  myCurrentJunction.response.push_back(attrs.get<std::string>(SUMO_ATTR_RESPONSE, nullptr, ok));
735  }
736 }
737 
738 
739 void
741  bool ok = true;
742  std::string fromID = attrs.get<std::string>(SUMO_ATTR_FROM, nullptr, ok);
743  if (myEdges.count(fromID) == 0) {
744  WRITE_ERROR("Unknown edge '" + fromID + "' given in connection.");
745  return;
746  }
747  EdgeAttrs* from = myEdges[fromID];
748  Connection conn;
749  conn.toEdgeID = attrs.get<std::string>(SUMO_ATTR_TO, nullptr, ok);
750  int fromLaneIdx = attrs.get<int>(SUMO_ATTR_FROM_LANE, nullptr, ok);
751  conn.toLaneIdx = attrs.get<int>(SUMO_ATTR_TO_LANE, nullptr, ok);
752  conn.tlID = attrs.getOpt<std::string>(SUMO_ATTR_TLID, nullptr, ok, "");
753  conn.mayDefinitelyPass = attrs.getOpt<bool>(SUMO_ATTR_PASS, nullptr, ok, false);
754  conn.keepClear = attrs.getOpt<bool>(SUMO_ATTR_KEEP_CLEAR, nullptr, ok, true);
755  conn.contPos = attrs.getOpt<double>(SUMO_ATTR_CONTPOS, nullptr, ok, NBEdge::UNSPECIFIED_CONTPOS);
757  std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, nullptr, ok, "", false);
758  std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, nullptr, ok, "", false);
759  if (allow == "" && disallow == "") {
761  } else {
762  conn.permissions = parseVehicleClasses(allow, disallow, myNetworkVersion);
763  }
764  conn.speed = attrs.getOpt<double>(SUMO_ATTR_SPEED, nullptr, ok, NBEdge::UNSPECIFIED_SPEED);
768  if (conn.tlID != "") {
769  conn.tlLinkIndex = attrs.get<int>(SUMO_ATTR_TLLINKINDEX, nullptr, ok);
770  conn.tlLinkIndex2 = attrs.getOpt<int>(SUMO_ATTR_TLLINKINDEX2, nullptr, ok, -1);
771  } else {
773  }
774  if ((int)from->lanes.size() <= fromLaneIdx) {
775  WRITE_ERROR("Invalid lane index '" + toString(fromLaneIdx) + "' for connection from '" + fromID + "'.");
776  return;
777  }
778  from->lanes[fromLaneIdx]->connections.push_back(conn);
779  myLastParameterised.push_back(&from->lanes[fromLaneIdx]->connections.back());
780 
781  // determine crossing priority and tlIndex
782  if (myPedestrianCrossings.size() > 0) {
783  if (from->func == EDGEFUNC_WALKINGAREA && myEdges[conn.toEdgeID]->func == EDGEFUNC_CROSSING) {
784  // connection from walkingArea to crossing
785  std::vector<Crossing>& crossings = myPedestrianCrossings[SUMOXMLDefinitions::getJunctionIDFromInternalEdge(fromID)];
786  for (std::vector<Crossing>::iterator it = crossings.begin(); it != crossings.end(); ++it) {
787  if (conn.toEdgeID == (*it).edgeID) {
788  if (conn.tlID != "") {
789  (*it).priority = true;
790  (*it).customTLIndex = conn.tlLinkIndex;
791  } else {
792  LinkState state = SUMOXMLDefinitions::LinkStates.get(attrs.get<std::string>(SUMO_ATTR_STATE, nullptr, ok));
793  (*it).priority = state == LINKSTATE_MAJOR;
794  }
795  }
796  }
797  } else if (from->func == EDGEFUNC_CROSSING && myEdges[conn.toEdgeID]->func == EDGEFUNC_WALKINGAREA) {
798  // connection from crossing to walkingArea (set optional linkIndex2)
800  if (fromID == c.edgeID) {
801  c.customTLIndex2 = attrs.getOpt<int>(SUMO_ATTR_TLLINKINDEX, nullptr, ok, -1);
802  }
803  }
804  }
805  }
806  // determine walking area reference edges
807  if (myWACustomShapes.size() > 0) {
808  EdgeAttrs* to = myEdges[conn.toEdgeID];
809  if (from->func == EDGEFUNC_WALKINGAREA) {
810  std::map<std::string, WalkingAreaParsedCustomShape>::iterator it = myWACustomShapes.find(fromID);
811  if (it != myWACustomShapes.end()) {
812  if (to->func == EDGEFUNC_NORMAL) {
813  // add target sidewalk as reference
814  it->second.toEdges.push_back(conn.toEdgeID);
815  } else if (to->func == EDGEFUNC_CROSSING) {
816  // add target crossing edges as reference
818  if (conn.toEdgeID == crossing.edgeID) {
819  it->second.toCrossed.insert(it->second.toCrossed.end(), crossing.crossingEdges.begin(), crossing.crossingEdges.end());
820  }
821  }
822  }
823  }
824  } else if (to->func == EDGEFUNC_WALKINGAREA) {
825  std::map<std::string, WalkingAreaParsedCustomShape>::iterator it = myWACustomShapes.find(conn.toEdgeID);
826  if (it != myWACustomShapes.end()) {
827  if (from->func == EDGEFUNC_NORMAL) {
828  // add origin sidewalk as reference
829  it->second.fromEdges.push_back(fromID);
830  } else if (from->func == EDGEFUNC_CROSSING) {
831  // add origin crossing edges as reference
833  if (fromID == crossing.edgeID) {
834  it->second.fromCrossed.insert(it->second.fromCrossed.end(), crossing.crossingEdges.begin(), crossing.crossingEdges.end());
835  }
836  }
837  }
838  }
839  }
840  }
841 }
842 
843 
844 void
846  bool ok = true;
847  std::string prohibitor = attrs.getOpt<std::string>(SUMO_ATTR_PROHIBITOR, nullptr, ok, "");
848  std::string prohibited = attrs.getOpt<std::string>(SUMO_ATTR_PROHIBITED, nullptr, ok, "");
849  if (!ok) {
850  return;
851  }
852  Prohibition p;
855  if (!ok) {
856  return;
857  }
858  myProhibitions.push_back(p);
859 }
860 
861 
863 NIImporter_SUMO::getLaneAttrsFromID(EdgeAttrs* edge, std::string lane_id) {
864  std::string edge_id;
865  int index;
866  NBHelpers::interpretLaneID(lane_id, edge_id, index);
867  assert(edge->id == edge_id);
868  if ((int)edge->lanes.size() <= index) {
869  WRITE_ERROR("Unknown lane '" + lane_id + "' given in succedge.");
870  return nullptr;
871  } else {
872  return edge->lanes[index];
873  }
874 }
875 
876 
879  if (currentTL) {
880  WRITE_ERROR("Definition of tl-logic '" + currentTL->getID() + "' was not finished.");
881  return nullptr;
882  }
883  bool ok = true;
884  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
885  SUMOTime offset = TIME2STEPS(attrs.get<double>(SUMO_ATTR_OFFSET, id.c_str(), ok));
886  std::string programID = attrs.getOpt<std::string>(SUMO_ATTR_PROGRAMID, id.c_str(), ok, "<unknown>");
887  std::string typeS = attrs.get<std::string>(SUMO_ATTR_TYPE, nullptr, ok);
888  TrafficLightType type;
889  if (SUMOXMLDefinitions::TrafficLightTypes.hasString(typeS)) {
891  } else {
892  WRITE_ERROR("Unknown traffic light type '" + typeS + "' for tlLogic '" + id + "'.");
893  return nullptr;
894  }
895  if (ok) {
896  return new NBLoadedSUMOTLDef(id, programID, offset, type);
897  } else {
898  return nullptr;
899  }
900 }
901 
902 
903 void
905  if (!currentTL) {
906  WRITE_ERROR("found phase without tl-logic");
907  return;
908  }
909  const std::string& id = currentTL->getID();
910  bool ok = true;
911  std::string state = attrs.get<std::string>(SUMO_ATTR_STATE, id.c_str(), ok);
912  SUMOTime duration = TIME2STEPS(attrs.get<double>(SUMO_ATTR_DURATION, id.c_str(), ok));
913  if (duration < 0) {
914  WRITE_ERROR("Phase duration for tl-logic '" + id + "/" + currentTL->getProgramID() + "' must be positive.");
915  return;
916  }
917  // if the traffic light is an actuated traffic light, try to get
918  // the minimum and maximum durations
921  std::vector<int> nextPhases = attrs.getOptIntVector(SUMO_ATTR_NEXT, nullptr, ok);
922  const std::string name = attrs.getOpt<std::string>(SUMO_ATTR_NAME, nullptr, ok, "");
923  if (ok) {
924  currentTL->addPhase(duration, state, minDuration, maxDuration, nextPhases, name);
925  }
926 }
927 
928 
931  // @todo refactor parsing of location since its duplicated in NLHandler and PCNetProjectionLoader
932  bool ok = true;
933  GeoConvHelper* result = nullptr;
934  PositionVector s = attrs.get<PositionVector>(SUMO_ATTR_NET_OFFSET, nullptr, ok);
935  Boundary convBoundary = attrs.get<Boundary>(SUMO_ATTR_CONV_BOUNDARY, nullptr, ok);
936  Boundary origBoundary = attrs.get<Boundary>(SUMO_ATTR_ORIG_BOUNDARY, nullptr, ok);
937  std::string proj = attrs.get<std::string>(SUMO_ATTR_ORIG_PROJ, nullptr, ok);
938  if (ok) {
939  Position networkOffset = s[0];
940  result = new GeoConvHelper(proj, networkOffset, origBoundary, convBoundary);
941  GeoConvHelper::setLoaded(*result);
942  }
943  return result;
944 }
945 
946 
947 Position
948 NIImporter_SUMO::readPosition(const SUMOSAXAttributes& attrs, const std::string& id, bool& ok) {
949  const double x = attrs.get<double>(SUMO_ATTR_X, id.c_str(), ok);
950  const double y = attrs.get<double>(SUMO_ATTR_Y, id.c_str(), ok);
951  const double z = attrs.getOpt<double>(SUMO_ATTR_Z, id.c_str(), ok, 0.);
952  return Position(x, y, z);
953 }
954 
955 
956 void
957 NIImporter_SUMO::parseProhibitionConnection(const std::string& attr, std::string& from, std::string& to, bool& ok) {
958  // split from/to
959  const std::string::size_type div = attr.find("->");
960  if (div == std::string::npos) {
961  WRITE_ERROR("Missing connection divider in prohibition attribute '" + attr + "'");
962  ok = false;
963  }
964  from = attr.substr(0, div);
965  to = attr.substr(div + 2);
966  // check whether the definition includes a lane information and discard it
967  if (from.find('_') != std::string::npos) {
968  from = from.substr(0, from.find('_'));
969  }
970  if (to.find('_') != std::string::npos) {
971  to = to.substr(0, to.find('_'));
972  }
973  // check whether the edges are known
974  if (myEdges.count(from) == 0) {
975  WRITE_ERROR("Unknown edge prohibition '" + from + "'");
976  ok = false;
977  }
978  if (myEdges.count(to) == 0) {
979  WRITE_ERROR("Unknown edge prohibition '" + to + "'");
980  ok = false;
981  }
982 }
983 
984 
985 void
987  if (attrs.hasAttribute(SUMO_ATTR_EDGES)) {
989  } else {
990  WRITE_ERROR("Empty edges in roundabout.");
991  }
992 }
993 
994 
995 /****************************************************************************/
SUMO_ATTR_ENDOFFSET
@ SUMO_ATTR_ENDOFFSET
Definition: SUMOXMLDefinitions.h:414
SUMO_ATTR_TYPE
@ SUMO_ATTR_TYPE
Definition: SUMOXMLDefinitions.h:381
NBEdge::UNSPECIFIED_OFFSET
static const double UNSPECIFIED_OFFSET
unspecified lane offset
Definition: NBEdge.h:318
SUMOSAXAttributes::getStringVector
const std::vector< std::string > getStringVector(int attr) const
Tries to read given attribute assuming it is a string vector.
Definition: SUMOSAXAttributes.cpp:113
EDGEFUNC_INTERNAL
@ EDGEFUNC_INTERNAL
Definition: SUMOXMLDefinitions.h:1085
SUMO_TAG_STOPOFFSET
@ SUMO_TAG_STOPOFFSET
Information on vClass specific stop offsets at lane end.
Definition: SUMOXMLDefinitions.h:230
SVC_UNSPECIFIED
const SVCPermissions SVC_UNSPECIFIED
permissions not specified
Definition: SUMOVehicleClass.cpp:148
NIImporter_SUMO::JunctionAttrs::response
std::vector< std::string > response
Definition: NIImporter_SUMO.h:318
ToString.h
XMLSubSys::runParser
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything's ok.
Definition: XMLSubSys.cpp:112
SUMO_ATTR_ACCELERATION
@ SUMO_ATTR_ACCELERATION
Definition: SUMOXMLDefinitions.h:892
NIImporter_SUMO::myWACustomShapes
std::map< std::string, WalkingAreaParsedCustomShape > myWACustomShapes
Map from walkingArea edge IDs to custom shapes.
Definition: NIImporter_SUMO.h:358
NIImporter_SUMO::EdgeAttrs::distance
double distance
The position at the start of this edge (kilometrage/mileage)
Definition: NIImporter_SUMO.h:269
SUMOSAXAttributes::hasAttribute
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
NBTrafficLightLogicCont::getPrograms
const std::map< std::string, NBTrafficLightDefinition * > & getPrograms(const std::string &id) const
Returns all programs for the given tl-id.
Definition: NBTrafficLightLogicCont.cpp:243
NBEdgeCont::retrieve
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
Definition: NBEdgeCont.cpp:246
SUMO_ATTR_DISALLOW
@ SUMO_ATTR_DISALLOW
Definition: SUMOXMLDefinitions.h:783
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:275
SUMOXMLDefinitions::LinkStates
static StringBijection< LinkState > LinkStates
link states
Definition: SUMOXMLDefinitions.h:1386
NIXMLTypesHandler.h
NODETYPE_DEAD_END_DEPRECATED
@ NODETYPE_DEAD_END_DEPRECATED
Definition: SUMOXMLDefinitions.h:1070
NIImporter_SUMO::myRailSignals
std::set< std::string > myRailSignals
list of node id with rail signals (no NBTrafficLightDefinition exists)
Definition: NIImporter_SUMO.h:395
NBEdge::UNSPECIFIED_CONNECTION_UNCONTROLLED
static const bool UNSPECIFIED_CONNECTION_UNCONTROLLED
TLS-controlled despite its node controlled not specified.
Definition: NBEdge.h:342
NIImporter_SUMO::addPhase
static void addPhase(const SUMOSAXAttributes &attrs, NBLoadedSUMOTLDef *currentTL)
adds a phase to the traffic lights logic currently build
Definition: NIImporter_SUMO.cpp:904
NIImporter_SUMO::WalkingAreaParsedCustomShape
Describes custom shape for a walking area during parsing.
Definition: NIImporter_SUMO.h:302
NIImporter_SUMO::EdgeAttrs::id
std::string id
This edge's id.
Definition: NIImporter_SUMO.h:241
NIImporter_SUMO
Importer for networks stored in SUMO format.
Definition: NIImporter_SUMO.h:52
SUMOSAXAttributes::getString
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
SUMO_ATTR_LENGTH
@ SUMO_ATTR_LENGTH
Definition: SUMOXMLDefinitions.h:393
NBEdge::Lane::type
std::string type
the type of this lane
Definition: NBEdge.h:182
SUMOSAXHandler
SAX-handler base for SUMO-files.
Definition: SUMOSAXHandler.h:41
NBNetBuilder
Instance responsible for building networks.
Definition: NBNetBuilder.h:109
NIImporter_SUMO::myProhibitions
std::vector< Prohibition > myProhibitions
Loaded prohibitions.
Definition: NIImporter_SUMO.h:325
SUMO_ATTR_LIMIT_TURN_SPEED
@ SUMO_ATTR_LIMIT_TURN_SPEED
Definition: SUMOXMLDefinitions.h:882
NBEdge::declareConnectionsAsLoaded
void declareConnectionsAsLoaded(EdgeBuildingStep step=EdgeBuildingStep::LANES2LANES_USER)
declares connections as fully loaded. This is needed to avoid recomputing connections if an edge has ...
Definition: NBEdge.h:1301
NIImporter_SUMO::EdgeAttrs::stopOffsets
std::map< SVCPermissions, double > stopOffsets
This edge's vehicle specific stop offsets (used for lanes, that do not have a specified stopOffset)
Definition: NIImporter_SUMO.h:267
EDGEFUNC_CROSSING
@ EDGEFUNC_CROSSING
Definition: SUMOXMLDefinitions.h:1083
NBEdgeCont::erase
void erase(NBDistrictCont &dc, NBEdge *edge)
Removes the given edge from the container (deleting it)
Definition: NBEdgeCont.cpp:380
GeomConvHelper.h
NIImporter_SUMO::EdgeAttrs::func
SumoXMLEdgeFunc func
This edge's function.
Definition: NIImporter_SUMO.h:247
NBNode::setRightOfWay
void setRightOfWay(RightOfWay rightOfWay)
set method for computing right-of-way
Definition: NBNode.h:516
SUMO_ATTR_NET_OFFSET
@ SUMO_ATTR_NET_OFFSET
Definition: SUMOXMLDefinitions.h:827
SUMO_ATTR_CHECKLANEFOES_ALL
@ SUMO_ATTR_CHECKLANEFOES_ALL
Definition: SUMOXMLDefinitions.h:883
OptionsCont.h
NIImporter_SUMO::Crossing::customTLIndex
int customTLIndex
Definition: NIImporter_SUMO.h:295
SUMO_TAG_PARAM
@ SUMO_TAG_PARAM
parameter associated to a certain key
Definition: SUMOXMLDefinitions.h:169
OptionsCont::set
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
Definition: OptionsCont.cpp:241
SUMO_ATTR_RECTANGULAR_LANE_CUT
@ SUMO_ATTR_RECTANGULAR_LANE_CUT
Definition: SUMOXMLDefinitions.h:879
LANESPREAD_RIGHT
@ LANESPREAD_RIGHT
Definition: SUMOXMLDefinitions.h:1098
NIImporter_SUMO::addEdge
void addEdge(const SUMOSAXAttributes &attrs)
Parses an edge and stores the values in "myCurrentEdge".
Definition: NIImporter_SUMO.cpp:530
SUMOSAXAttributes::get
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
Definition: SUMOSAXAttributes.h:492
SUMO_ATTR_TO_LANE
@ SUMO_ATTR_TO_LANE
Definition: SUMOXMLDefinitions.h:720
SUMOSAXAttributes::getOptIntVector
const std::vector< int > getOptIntVector(int attr, const char *objectid, bool &ok, bool report=true) const
convenience function to avoid the default argument and the template stuff at getOpt<>
Definition: SUMOSAXAttributes.cpp:142
MsgHandler.h
NBEdgeCont::ignore
void ignore(std::string id)
mark the given edge id as ignored
Definition: NBEdgeCont.h:506
SUMO_ATTR_LINKDETAIL
@ SUMO_ATTR_LINKDETAIL
Definition: SUMOXMLDefinitions.h:878
EdgeVector
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:34
NIImporter_SUMO::myCurrentLane
LaneAttrs * myCurrentLane
The currently parsed lanes's definition (to add the shape to)
Definition: NIImporter_SUMO.h:346
SUMO_ATTR_CUSTOMSHAPE
@ SUMO_ATTR_CUSTOMSHAPE
whether a given shape is user-defined
Definition: SUMOXMLDefinitions.h:702
GeoConvHelper::setLoaded
static void setLoaded(const GeoConvHelper &loaded)
sets the coordinate transformation loaded from a location element
Definition: GeoConvHelper.cpp:539
NBNodeCont::insert
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
Definition: NBNodeCont.cpp:78
SUMO_ATTR_Z
@ SUMO_ATTR_Z
Definition: SUMOXMLDefinitions.h:400
SUMOSAXHandler.h
FileHelpers.h
SUMO_TAG_LANE
@ SUMO_TAG_LANE
begin/end of the description of a single lane
Definition: SUMOXMLDefinitions.h:49
NIImporter_SUMO::Crossing::customShape
PositionVector customShape
Definition: NIImporter_SUMO.h:294
TrafficLightType
TrafficLightType
Definition: SUMOXMLDefinitions.h:1197
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
NIImporter_SUMO::Connection::contPos
double contPos
custom position for internal junction on this connection
Definition: NIImporter_SUMO.h:191
NBNetBuilder::transformCoordinates
static bool transformCoordinates(PositionVector &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
Definition: NBNetBuilder.cpp:660
SUMO_ATTR_TLID
@ SUMO_ATTR_TLID
link,node: the traffic light id responsible for this link
Definition: SUMOXMLDefinitions.h:682
NIImporter_SUMO::getLaneAttrsFromID
LaneAttrs * getLaneAttrsFromID(EdgeAttrs *edge, std::string lane_id)
Parses lane index from lane ID an retrieve lane from EdgeAttrs.
Definition: NIImporter_SUMO.cpp:863
NBEdgeCont.h
GeoConvHelper.h
NBConnection::InvalidTlIndex
static const int InvalidTlIndex
Definition: NBConnection.h:125
OptionsCont::getBool
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Definition: OptionsCont.cpp:222
NIImporter_SUMO::Prohibition::prohibitedTo
std::string prohibitedTo
Definition: NIImporter_SUMO.h:280
NBLoadedSUMOTLDef::addPhase
void addPhase(SUMOTime duration, const std::string &state, SUMOTime minDur, SUMOTime maxDur, const std::vector< int > &next, const std::string &name)
Adds a phase to the logic the new phase is inserted at the end of the list of already added phases.
Definition: NBLoadedSUMOTLDef.cpp:172
NODETYPE_UNKNOWN
@ NODETYPE_UNKNOWN
Definition: SUMOXMLDefinitions.h:1055
NIImporter_SUMO::EdgeAttrs::priority
int priority
This edge's priority.
Definition: NIImporter_SUMO.h:257
EmptyData
Definition: UtilExceptions.h:68
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:57
NBNode::getType
SumoXMLNodeType getType() const
Returns the type of this node.
Definition: NBNode.h:272
NBNode::addWalkingAreaShape
void addWalkingAreaShape(EdgeVector edges, const PositionVector &shape)
add custom shape for walkingArea
Definition: NBNode.cpp:3017
SUMO_ATTR_MINDURATION
@ SUMO_ATTR_MINDURATION
Definition: SUMOXMLDefinitions.h:732
NBEdge::setDistance
void setDistance(double distance)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.h:1279
SUMO_ATTR_SPEED
@ SUMO_ATTR_SPEED
Definition: SUMOXMLDefinitions.h:384
NIImporter_SUMO::NIImporter_SUMO
NIImporter_SUMO(NBNetBuilder &nb)
Constructor.
Definition: NIImporter_SUMO.cpp:66
NBNetBuilder::transformCoordinate
static bool transformCoordinate(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
Definition: NBNetBuilder.cpp:633
SUMO_ATTR_VISIBILITY_DISTANCE
@ SUMO_ATTR_VISIBILITY_DISTANCE
foe visibility distance of a link
Definition: SUMOXMLDefinitions.h:710
NBEdgeCont::insert
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
Definition: NBEdgeCont.cpp:153
SUMO_ATTR_ID
@ SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:378
NIImporter_SUMO::addRoundabout
void addRoundabout(const SUMOSAXAttributes &attrs)
Parses a roundabout and stores it in myEdgeCont.
Definition: NIImporter_SUMO.cpp:986
NIImporter_SUMO::WalkingAreaParsedCustomShape::shape
PositionVector shape
Definition: NIImporter_SUMO.h:303
SUMO_ATTR_LANE
@ SUMO_ATTR_LANE
Definition: SUMOXMLDefinitions.h:637
NBEdge::setPermissions
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:3376
NIImporter_SUMO::myCheckLaneFoesRoundabout
bool myCheckLaneFoesRoundabout
Definition: NIImporter_SUMO.h:389
NIImporter_SUMO::Connection
A connection description.
Definition: NIImporter_SUMO.h:176
NBEdge::setLoadedLength
void setLoadedLength(double val)
set loaded length
Definition: NBEdge.cpp:3419
SUMOSAXAttributes::getFloat
virtual double getFloat(int id) const =0
Returns the double-value of the named (by its enum-value) attribute.
SUMO_TAG_PHASE
@ SUMO_TAG_PHASE
a single phase description
Definition: SUMOXMLDefinitions.h:143
LINKSTATE_MAJOR
@ LINKSTATE_MAJOR
This is an uncontrolled, major link, may pass.
Definition: SUMOXMLDefinitions.h:1155
PositionVector
A list of positions.
Definition: PositionVector.h:45
NBLoadedSUMOTLDef::addConnection
void addConnection(NBEdge *from, NBEdge *to, int fromLane, int toLane, int linkIndex, int linkIndex2, bool reconstruct=true)
Adds a connection and immediately informs the edges.
Definition: NBLoadedSUMOTLDef.cpp:95
NBNode::addSortedLinkFoes
void addSortedLinkFoes(const NBConnection &mayDrive, const NBConnection &mustStop)
add shorted link FOES
Definition: NBNode.cpp:1561
GeoConvHelper
static methods for processing the coordinates conversion for the current net
Definition: GeoConvHelper.h:55
NIImporter_SUMO::myLimitTurnSpeed
double myLimitTurnSpeed
whether turning speed was limited in the network
Definition: NIImporter_SUMO.h:385
SUMO_ATTR_SPREADTYPE
@ SUMO_ATTR_SPREADTYPE
The information about how to spread the lanes from the given position.
Definition: SUMOXMLDefinitions.h:692
NBEdgeCont::ignoreFilterMatch
bool ignoreFilterMatch(NBEdge *edge)
Returns true if this edge matches one of the removal criteria.
Definition: NBEdgeCont.cpp:174
NBNetBuilder::getEdgeCont
NBEdgeCont & getEdgeCont()
Definition: NBNetBuilder.h:150
NIImporter_SUMO::LaneAttrs
Describes the values found in a lane's definition.
Definition: NIImporter_SUMO.h:208
SUMOSAXAttributes::getFringeType
virtual FringeType getFringeType(bool &ok) const =0
returns fringe type
SUMO_ATTR_ORIG_BOUNDARY
@ SUMO_ATTR_ORIG_BOUNDARY
Definition: SUMOXMLDefinitions.h:829
NIImporter_SUMO::addStopOffsets
void addStopOffsets(const SUMOSAXAttributes &attrs, bool &ok)
parses stop offsets for the current lane or edge
Definition: NIImporter_SUMO.cpp:643
NIImporter_SUMO::Connection::speed
double speed
custom speed for connection
Definition: NIImporter_SUMO.h:197
NIImporter_SUMO::LaneAttrs::type
std::string type
the type of this lane
Definition: NIImporter_SUMO.h:232
NIImporter_SUMO::myLastParameterised
std::vector< Parameterised * > myLastParameterised
element to receive parameters
Definition: NIImporter_SUMO.h:361
SUMO_ATTR_NEXT
@ SUMO_ATTR_NEXT
succesor phase index
Definition: SUMOXMLDefinitions.h:736
NIImporter_SUMO::LaneAttrs::customShape
bool customShape
Whether this lane has a custom shape.
Definition: NIImporter_SUMO.h:230
NBEdge
The representation of a single edge during network building.
Definition: NBEdge.h:91
OptionsCont::getStringVector
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
Definition: OptionsCont.cpp:235
NIImporter_SUMO::myAmLefthand
bool myAmLefthand
whether the loaded network was built for lefthand traffic
Definition: NIImporter_SUMO.h:370
SUMO_ATTR_TO
@ SUMO_ATTR_TO
Definition: SUMOXMLDefinitions.h:640
NIImporter_SUMO::initTrafficLightLogic
static NBLoadedSUMOTLDef * initTrafficLightLogic(const SUMOSAXAttributes &attrs, NBLoadedSUMOTLDef *currentTL)
begins the reading of a traffic lights logic
Definition: NIImporter_SUMO.cpp:878
NIImporter_SUMO::Connection::permissions
SVCPermissions permissions
custom permissions for connection
Definition: NIImporter_SUMO.h:195
SUMO_ATTR_CORNERDETAIL
@ SUMO_ATTR_CORNERDETAIL
Definition: SUMOXMLDefinitions.h:877
SUMO_TAG_LOCATION
@ SUMO_TAG_LOCATION
Definition: SUMOXMLDefinitions.h:263
NIImporter_SUMO::LaneAttrs::width
double width
The width of this lane.
Definition: NIImporter_SUMO.h:220
NIImporter_SUMO::EdgeAttrs::builtEdge
NBEdge * builtEdge
The built edge.
Definition: NIImporter_SUMO.h:263
NIImporter_SUMO::Prohibition::prohibitorTo
std::string prohibitorTo
Definition: NIImporter_SUMO.h:278
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:79
NIImporter_SUMO::addLane
void addLane(const SUMOSAXAttributes &attrs)
Parses a lane and stores the values in "myCurrentLane".
Definition: NIImporter_SUMO.cpp:581
NIImporter_SUMO::parseProhibitionConnection
void parseProhibitionConnection(const std::string &attr, std::string &from, std::string &to, bool &ok)
parses connection string of a prohibition (very old school)
Definition: NIImporter_SUMO.cpp:957
NIImporter_SUMO::myRoundabouts
std::vector< std::vector< std::string > > myRoundabouts
loaded roundabout edges
Definition: NIImporter_SUMO.h:392
parseVehicleClasses
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
Definition: SUMOVehicleClass.cpp:222
NIImporter_SUMO::Connection::keepClear
bool keepClear
Whether the junction must be kept clear coming from this connection.
Definition: NIImporter_SUMO.h:189
NBNode::getPosition
const Position & getPosition() const
Definition: NBNode.h:247
NBEdge::setLaneShape
void setLaneShape(int lane, const PositionVector &shape)
sets a custom lane shape
Definition: NBEdge.cpp:3368
NBEdge::setEndOffset
void setEndOffset(int lane, double offset)
set lane specific end-offset (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3300
SUMO_TAG_PROHIBITION
@ SUMO_TAG_PROHIBITION
prohibition of circulation between two edges
Definition: SUMOXMLDefinitions.h:204
SUMO_ATTR_PROHIBITED
@ SUMO_ATTR_PROHIBITED
Definition: SUMOXMLDefinitions.h:781
NIImporter_SUMO::myCurrentJunction
JunctionAttrs myCurrentJunction
The currently parsed junction definition to help in reconstructing crossings.
Definition: NIImporter_SUMO.h:343
SUMO_ATTR_INTLANES
@ SUMO_ATTR_INTLANES
Definition: SUMOXMLDefinitions.h:416
LinkState
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
Definition: SUMOXMLDefinitions.h:1137
SUMO_TAG_NEIGH
@ SUMO_TAG_NEIGH
begin/end of the description of a neighboring lane
Definition: SUMOXMLDefinitions.h:51
NODETYPE_RAIL_SIGNAL
@ NODETYPE_RAIL_SIGNAL
Definition: SUMOXMLDefinitions.h:1059
NIImporter_SUMO::LaneAttrs::stopOffsets
std::map< SVCPermissions, double > stopOffsets
This lane's vehicle specific stop offsets.
Definition: NIImporter_SUMO.h:224
Parameterised::getParametersMap
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
Definition: Parameterised.cpp:106
NBEdge::getToNode
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:498
NIImporter_SUMO::Connection::tlLinkIndex
int tlLinkIndex
The index of this connection within the controlling traffic light.
Definition: NIImporter_SUMO.h:184
OptionsCont::isUsableFileList
bool isUsableFileList(const std::string &name) const
Checks whether the named option is usable as a file list (with at least a single file)
Definition: OptionsCont.cpp:356
Parameterised::updateParameters
void updateParameters(const std::map< std::string, std::string > &mapArg)
Adds or updates all given parameters from the map.
Definition: Parameterised.cpp:58
NIImporter_SUMO::myHaveSeenInternalEdge
bool myHaveSeenInternalEdge
whether the loaded network contains internal lanes
Definition: NIImporter_SUMO.h:367
NIImporter_SUMO::Connection::visibility
double visibility
custom foe visibility for connection
Definition: NIImporter_SUMO.h:193
NBEdge::getLaneWidth
double getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:587
NIImporter_SUMO::LaneAttrs::oppositeID
std::string oppositeID
This lane's opposite lane.
Definition: NIImporter_SUMO.h:228
NBEdge::hasLaneSpecificEndOffset
bool hasLaneSpecificEndOffset() const
whether lanes differ in offset
Definition: NBEdge.cpp:2060
SUMO_ATTR_KEEP_CLEAR
@ SUMO_ATTR_KEEP_CLEAR
Whether vehicles must keep the junction clear.
Definition: SUMOXMLDefinitions.h:696
NIImporter_SUMO::myRectLaneCut
bool myRectLaneCut
whether all lanes of an edge should have the same stop line
Definition: NIImporter_SUMO.h:379
TIME2STEPS
#define TIME2STEPS(x)
Definition: SUMOTime.h:58
NBEdge::getStopOffsets
const std::map< int, double > & getStopOffsets() const
Returns the stopOffset to the end of the edge.
Definition: NBEdge.h:623
NBTrafficLightDefinition::UNSPECIFIED_DURATION
static const SUMOTime UNSPECIFIED_DURATION
Definition: NBTrafficLightDefinition.h:70
NBEdge::UNSPECIFIED_CONTPOS
static const double UNSPECIFIED_CONTPOS
unspecified internal junction position
Definition: NBEdge.h:324
SUMO_TAG_REQUEST
@ SUMO_TAG_REQUEST
description of a logic request within the junction
Definition: SUMOXMLDefinitions.h:129
EDGEFUNC_WALKINGAREA
@ EDGEFUNC_WALKINGAREA
Definition: SUMOXMLDefinitions.h:1084
SUMO_ATTR_PASS
@ SUMO_ATTR_PASS
Definition: SUMOXMLDefinitions.h:768
NIImporter_SUMO::LaneAttrs::allow
std::string allow
This lane's allowed vehicle classes.
Definition: NIImporter_SUMO.h:216
SUMO_ATTR_TLLINKINDEX2
@ SUMO_ATTR_TLLINKINDEX2
link: the index of the opposite direction link of a pedestrian crossing
Definition: SUMOXMLDefinitions.h:688
SumoXMLNodeType
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
Definition: SUMOXMLDefinitions.h:1054
NIImporter_SUMO::myNetBuilder
NBNetBuilder & myNetBuilder
The network builder to fill.
Definition: NIImporter_SUMO.h:328
StringBijection::get
T get(const std::string &str) const
Definition: StringBijection.h:97
NBEdge::getLaneID
std::string getLaneID(int lane) const
get lane ID
Definition: NBEdge.cpp:3093
EdgeSet
std::set< NBEdge * > EdgeSet
container for unique edges
Definition: NBCont.h:49
NIImporter_SUMO::LaneAttrs::disallow
std::string disallow
This lane's disallowed vehicle classes.
Definition: NIImporter_SUMO.h:218
NIImporter_SUMO::LaneAttrs::endOffset
double endOffset
This lane's offset from the intersection.
Definition: NIImporter_SUMO.h:222
NIImporter_SUMO::myTypesHandler
NIXMLTypesHandler myTypesHandler
The handler for parsing edge types and restrictions.
Definition: NIImporter_SUMO.h:337
NIImporter_SUMO::EdgeAttrs
Describes the values found in an edge's definition and this edge's lanes.
Definition: NIImporter_SUMO.h:239
SUMO_ATTR_WIDTH
@ SUMO_ATTR_WIDTH
Definition: SUMOXMLDefinitions.h:386
NIImporter_SUMO::_loadNetwork
void _loadNetwork(OptionsCont &oc)
load the network
Definition: NIImporter_SUMO.cpp:103
SUMO_ATTR_EDGES
@ SUMO_ATTR_EDGES
the edges of a route
Definition: SUMOXMLDefinitions.h:427
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
SUMO_ATTR_ORIG_PROJ
@ SUMO_ATTR_ORIG_PROJ
Definition: SUMOXMLDefinitions.h:830
SUMO_TAG_EDGE
@ SUMO_TAG_EDGE
begin/end of the description of an edge
Definition: SUMOXMLDefinitions.h:47
NBNetBuilder.h
NIImporter_SUMO::myLinkDetail
int myLinkDetail
the level of geometry detail for internal lanes in the loaded network
Definition: NIImporter_SUMO.h:376
ProcessError
Definition: UtilExceptions.h:39
NIImporter_SUMO.h
NIImporter_SUMO::loadLocation
static GeoConvHelper * loadLocation(const SUMOSAXAttributes &attrs)
Parses network location description and registers it with GeoConveHelper::setLoaded.
Definition: NIImporter_SUMO.cpp:930
NBEdge::setSpeed
void setSpeed(int lane, double speed)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3345
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
NIImporter_SUMO::myCurrentEdge
EdgeAttrs * myCurrentEdge
The currently parsed edge's definition (to add loaded lanes to)
Definition: NIImporter_SUMO.h:340
SUMOSAXAttributes::getRightOfWay
virtual RightOfWay getRightOfWay(bool &ok) const =0
Returns the right-of-way method.
NBEdge::hasLaneSpecificStopOffsets
bool hasLaneSpecificStopOffsets() const
whether lanes differ in stopOffsets
Definition: NBEdge.cpp:2071
NIImporter_SUMO::EdgeAttrs::shape
PositionVector shape
This edges's shape.
Definition: NIImporter_SUMO.h:253
NIImporter_SUMO::Connection::customShape
PositionVector customShape
custom shape connection
Definition: NIImporter_SUMO.h:199
NIImporter_SUMO::Prohibition::prohibitorFrom
std::string prohibitorFrom
Definition: NIImporter_SUMO.h:277
UtilExceptions.h
SUMO_ATTR_Y
@ SUMO_ATTR_Y
Definition: SUMOXMLDefinitions.h:399
NIImporter_SUMO::addConnection
void addConnection(const SUMOSAXAttributes &attrs)
Parses a connection and saves it into the lane's definition stored in "myCurrentLane".
Definition: NIImporter_SUMO.cpp:740
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
PositionVector::EMPTY
static const PositionVector EMPTY
empty Vector
Definition: PositionVector.h:73
NBEdge::getLaneStruct
Lane & getLaneStruct(int lane)
Definition: NBEdge.h:1287
NBEdge::UNSPECIFIED_VISIBILITY_DISTANCE
static const double UNSPECIFIED_VISIBILITY_DISTANCE
unspecified foe visibility for connections
Definition: NBEdge.h:327
NBNode::setCustomShape
void setCustomShape(const PositionVector &shape)
set the junction shape
Definition: NBNode.cpp:2146
SUMOSAXAttributes::getOpt
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.
Definition: SUMOSAXAttributes.h:518
NIImporter_SUMO::Connection::uncontrolled
bool uncontrolled
if set to true, This connection will not be TLS-controlled despite its node being controlled.
Definition: NIImporter_SUMO.h:201
NIImporter_SUMO::Connection::mayDefinitelyPass
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
Definition: NIImporter_SUMO.h:187
NBEdge::getConnectionRef
Connection & getConnectionRef(int fromLane, const NBEdge *to, int toLane)
Returns reference to the specified connection This method goes through "myConnections" and returns th...
Definition: NBEdge.cpp:1128
NBConnection
Definition: NBConnection.h:43
EDGEFUNC_NORMAL
@ EDGEFUNC_NORMAL
Definition: SUMOXMLDefinitions.h:1081
SUMO_ATTR_DISTANCE
@ SUMO_ATTR_DISTANCE
Definition: SUMOXMLDefinitions.h:395
NBEdge::UNSPECIFIED_SPEED
static const double UNSPECIFIED_SPEED
unspecified lane speed
Definition: NBEdge.h:321
NBNode::setRadius
void setRadius(double radius)
set the turning radius
Definition: NBNode.h:506
NBAlgorithms_Ramps.h
NIImporter_SUMO::loadNetwork
static void loadNetwork(OptionsCont &oc, NBNetBuilder &nb)
Loads content of the optionally given SUMO file.
Definition: NIImporter_SUMO.cpp:57
NIImporter_SUMO::EdgeAttrs::streetName
std::string streetName
This edge's street name.
Definition: NIImporter_SUMO.h:243
NIImporter_SUMO::myPedestrianCrossings
std::map< std::string, std::vector< Crossing > > myPedestrianCrossings
The pedestrian crossings found in the network.
Definition: NIImporter_SUMO.h:355
NBEdge::L2L_VALIDATED
@ L2L_VALIDATED
The connection was computed and validated.
Definition: NBEdge.h:135
NODETYPE_RAIL_CROSSING
@ NODETYPE_RAIL_CROSSING
Definition: SUMOXMLDefinitions.h:1060
SUMO_ATTR_LEFTHAND
@ SUMO_ATTR_LEFTHAND
Definition: SUMOXMLDefinitions.h:881
NBHelpers::interpretLaneID
static void interpretLaneID(const std::string &lane_id, std::string &edge_id, int &index)
parses edge-id and index from lane-id
Definition: NBHelpers.cpp:120
NODETYPE_DEAD_END
@ NODETYPE_DEAD_END
Definition: SUMOXMLDefinitions.h:1069
NBNodeCont::retrieve
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
Definition: NBNodeCont.cpp:107
NBEdge::getLanes
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:656
OptionsCont::isDefault
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
Definition: OptionsCont.cpp:163
NBEdge::UNSPECIFIED_LOADED_LENGTH
static const double UNSPECIFIED_LOADED_LENGTH
no length override given
Definition: NBEdge.h:330
NIImporter_SUMO::Crossing
Describes a pedestrian crossing.
Definition: NIImporter_SUMO.h:286
SUMO_ATTR_FROM_LANE
@ SUMO_ATTR_FROM_LANE
Definition: SUMOXMLDefinitions.h:719
SUMO_ATTR_FROM
@ SUMO_ATTR_FROM
Definition: SUMOXMLDefinitions.h:639
SUMO_ATTR_RADIUS
@ SUMO_ATTR_RADIUS
The turning radius at an intersection in m.
Definition: SUMOXMLDefinitions.h:694
SUMO_TAG_TLLOGIC
@ SUMO_TAG_TLLOGIC
a traffic light logic
Definition: SUMOXMLDefinitions.h:141
NIImporter_SUMO::EdgeAttrs::type
std::string type
This edge's type.
Definition: NIImporter_SUMO.h:245
NIImporter_SUMO::Connection::toEdgeID
std::string toEdgeID
The id of the target edge.
Definition: NIImporter_SUMO.h:178
NIXMLTypesHandler::myStartElement
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag; Parses edge type information.
Definition: NIXMLTypesHandler.cpp:55
OptionsCont::getFloat
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
Definition: OptionsCont.cpp:208
NBEdge::getEndOffset
double getEndOffset() const
Returns the offset to the destination node.
Definition: NBEdge.h:612
NBNodeCont.h
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
NIImporter_SUMO::Connection::toLaneIdx
int toLaneIdx
The index of the target lane.
Definition: NIImporter_SUMO.h:180
StringUtils.h
SUMO_ATTR_STATE
@ SUMO_ATTR_STATE
The state of a link.
Definition: SUMOXMLDefinitions.h:708
NIImporter_SUMO::EdgeAttrs::toNode
std::string toNode
The node this edge ends at.
Definition: NIImporter_SUMO.h:251
NBNode::addCrossing
NBNode::Crossing * addCrossing(EdgeVector edges, double width, bool priority, int tlIndex=-1, int tlIndex2=-1, const PositionVector &customShape=PositionVector::EMPTY, bool fromSumoNet=false)
add a pedestrian crossing to this node
Definition: NBNode.cpp:3069
SUMO_ATTR_PRIORITY
@ SUMO_ATTR_PRIORITY
Definition: SUMOXMLDefinitions.h:382
NIImporter_SUMO::myStartElement
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Definition: NIImporter_SUMO.cpp:390
NILoader.h
NIImporter_SUMO::Connection::tlID
std::string tlID
The id of the traffic light that controls this connection.
Definition: NIImporter_SUMO.h:182
SUMO_ATTR_DURATION
@ SUMO_ATTR_DURATION
Definition: SUMOXMLDefinitions.h:667
SUMOSAXAttributes::getOptSUMOTimeReporting
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.
Definition: SUMOSAXAttributes.cpp:90
PROGRESS_BEGIN_MESSAGE
#define PROGRESS_BEGIN_MESSAGE(msg)
Definition: MsgHandler.h:278
SUMO_ATTR_WALKINGAREAS
@ SUMO_ATTR_WALKINGAREAS
Definition: SUMOXMLDefinitions.h:880
deprecatedVehicleClassesSeen
std::set< std::string > deprecatedVehicleClassesSeen
Definition: SUMOVehicleClass.cpp:84
NIImporter_SUMO::Crossing::width
double width
Definition: NIImporter_SUMO.h:292
NBEdge::setAcceleration
void setAcceleration(int lane, bool accelRamp)
marks one lane as acceleration lane
Definition: NBEdge.cpp:3360
NBEdge::setLaneWidth
void setLaneWidth(int lane, double width)
set lane specific width (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3239
SUMO_ATTR_TLLINKINDEX
@ SUMO_ATTR_TLLINKINDEX
link: the index of the link within the traffic light
Definition: SUMOXMLDefinitions.h:686
SUMO_ATTR_RESPONSE
@ SUMO_ATTR_RESPONSE
Definition: SUMOXMLDefinitions.h:411
SUMO_ATTR_CONV_BOUNDARY
@ SUMO_ATTR_CONV_BOUNDARY
Definition: SUMOXMLDefinitions.h:828
NIImporter_SUMO::JunctionAttrs::node
NBNode * node
Definition: NIImporter_SUMO.h:314
SUMO_TAG_NET
@ SUMO_TAG_NET
root element of a network file
Definition: SUMOXMLDefinitions.h:45
SUMO_ATTR_KEY
@ SUMO_ATTR_KEY
Definition: SUMOXMLDefinitions.h:408
NBEdge::Lane::oppositeID
std::string oppositeID
An opposite lane ID, if given.
Definition: NBEdge.h:169
NIImporter_SUMO::addJunction
void addJunction(const SUMOSAXAttributes &attrs)
Parses a junction and saves it in the node control.
Definition: NIImporter_SUMO.cpp:673
SUMO_ATTR_VALUE
@ SUMO_ATTR_VALUE
Definition: SUMOXMLDefinitions.h:779
PROGRESS_DONE_MESSAGE
#define PROGRESS_DONE_MESSAGE()
Definition: MsgHandler.h:279
SUMOSAXAttributes::getNodeType
virtual SumoXMLNodeType getNodeType(bool &ok) const =0
Returns the value of the named attribute.
NIImporter_SUMO::myNetworkVersion
double myNetworkVersion
the loaded network version
Definition: NIImporter_SUMO.h:364
NBTrafficLightDefinition::getProgramID
const std::string & getProgramID() const
Returns the ProgramID.
Definition: NBTrafficLightDefinition.h:308
NBNetBuilder::getDistrictCont
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
Definition: NBNetBuilder.h:170
SUMO_ATTR_ALLOW
@ SUMO_ATTR_ALLOW
Definition: SUMOXMLDefinitions.h:782
SUMO_ATTR_RIGHT_OF_WAY
@ SUMO_ATTR_RIGHT_OF_WAY
How to compute right of way.
Definition: SUMOXMLDefinitions.h:698
SUMO_TAG_CONNECTION
@ SUMO_TAG_CONNECTION
connectio between two lanes
Definition: SUMOXMLDefinitions.h:202
NBNode::isTrafficLight
static bool isTrafficLight(SumoXMLNodeType type)
return whether the given type is a traffic light
Definition: NBNode.cpp:3250
parseStopOffsets
std::map< SVCPermissions, double > parseStopOffsets(const SUMOSAXAttributes &attrs, bool &ok)
Extract stopOffsets from attributes of stopOffset element.
Definition: SUMOVehicleClass.cpp:392
NBEdge::UNSPECIFIED_WIDTH
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:315
SUMO_ATTR_UNCONTROLLED
@ SUMO_ATTR_UNCONTROLLED
Definition: SUMOXMLDefinitions.h:767
SUMO_ATTR_PROHIBITOR
@ SUMO_ATTR_PROHIBITOR
Definition: SUMOXMLDefinitions.h:780
NIImporter_SUMO::~NIImporter_SUMO
~NIImporter_SUMO()
Destructor.
Definition: NIImporter_SUMO.cpp:89
SUMOXMLDefinitions::TrafficLightTypes
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
Definition: SUMOXMLDefinitions.h:1392
NIImporter_SUMO::myTLLCont
NBTrafficLightLogicCont & myTLLCont
The node container to fill.
Definition: NIImporter_SUMO.h:334
NBNetBuilder::addGeometrySegments
static int addGeometrySegments(PositionVector &from, const PositionVector &cartesian, const double maxLength)
insertion geometry points to ensure maximum segment length between points
Definition: NBNetBuilder.cpp:678
NIImporter_SUMO::Prohibition::prohibitedFrom
std::string prohibitedFrom
Definition: NIImporter_SUMO.h:279
NIImporter_SUMO::LaneAttrs::maxSpeed
double maxSpeed
The maximum velocity allowed on this lane.
Definition: NIImporter_SUMO.h:210
NIImporter_SUMO::myWalkingAreas
bool myWalkingAreas
whether walkingareas must be built
Definition: NIImporter_SUMO.h:382
NIImporter_SUMO::Connection::tlLinkIndex2
int tlLinkIndex2
Definition: NIImporter_SUMO.h:185
FileHelpers::isReadable
static bool isReadable(std::string path)
Checks whether the given file is readable.
Definition: FileHelpers.cpp:49
NBNode::setFringeType
void setFringeType(FringeType fringeType)
set method for computing right-of-way
Definition: NBNode.h:521
SUMO_ATTR_MAXDURATION
@ SUMO_ATTR_MAXDURATION
maximum duration of a phase
Definition: SUMOXMLDefinitions.h:734
config.h
NBEdgeCont::addRoundabout
void addRoundabout(const EdgeSet &roundabout)
add user specified roundabout
Definition: NBEdgeCont.cpp:1353
SUMOXMLDefinitions::LaneSpreadFunctions
static StringBijection< LaneSpreadFunction > LaneSpreadFunctions
lane spread functions
Definition: SUMOXMLDefinitions.h:1374
NIImporter_SUMO::EdgeAttrs::lsf
LaneSpreadFunction lsf
The lane spread function.
Definition: NIImporter_SUMO.h:265
NIImporter_SUMO::EdgeAttrs::maxSpeed
double maxSpeed
The maximum velocity allowed on this edge (!!!)
Definition: NIImporter_SUMO.h:259
StringTokenizer.h
NIImporter_SUMO::Crossing::priority
bool priority
Definition: NIImporter_SUMO.h:293
NIImporter_SUMO::Crossing::customTLIndex2
int customTLIndex2
Definition: NIImporter_SUMO.h:296
SUMO_ATTR_FRINGE
@ SUMO_ATTR_FRINGE
Fringe type of node.
Definition: SUMOXMLDefinitions.h:700
NIImporter_SUMO::Crossing::crossingEdges
std::vector< std::string > crossingEdges
Definition: NIImporter_SUMO.h:291
SUMOXMLDefinitions::getJunctionIDFromInternalEdge
static std::string getJunctionIDFromInternalEdge(const std::string internalEdge)
return the junction id when given an edge of type internal, crossing or WalkingArea
Definition: SUMOXMLDefinitions.cpp:954
SUMO_ATTR_PROGRAMID
@ SUMO_ATTR_PROGRAMID
Definition: SUMOXMLDefinitions.h:412
NIImporter_SUMO::EdgeAttrs::fromNode
std::string fromNode
The node this edge starts at.
Definition: NIImporter_SUMO.h:249
SUMO_ATTR_CROSSING_EDGES
@ SUMO_ATTR_CROSSING_EDGES
the edges crossed by a pedestrian crossing
Definition: SUMOXMLDefinitions.h:674
SUMO_ATTR_NAME
@ SUMO_ATTR_NAME
Definition: SUMOXMLDefinitions.h:380
SUMOSAXAttributes::getEdgeFunc
virtual SumoXMLEdgeFunc getEdgeFunc(bool &ok) const =0
Returns the value of the named attribute.
NBNode
Represents a single node (junction) during network building.
Definition: NBNode.h:67
NIImporter_SUMO::EdgeAttrs::lanes
std::vector< LaneAttrs * > lanes
This edge's lanes.
Definition: NIImporter_SUMO.h:261
NIImporter_SUMO::myCheckLaneFoesAll
bool myCheckLaneFoesAll
whether foe-relationships where checked at lane-level
Definition: NIImporter_SUMO.h:388
SUMO_TAG_ROUNDABOUT
@ SUMO_TAG_ROUNDABOUT
roundabout defined in junction
Definition: SUMOXMLDefinitions.h:220
NBEdge::hasConnectionTo
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:1143
NIImporter_SUMO::addRequest
void addRequest(const SUMOSAXAttributes &attrs)
Parses a reques and saves selected attributes in myCurrentJunction.
Definition: NIImporter_SUMO.cpp:731
NIImporter_SUMO::myCornerDetail
int myCornerDetail
the level of corner detail in the loaded network
Definition: NIImporter_SUMO.h:373
NIImporter_SUMO::LaneAttrs::connections
std::vector< Connection > connections
This lane's connections.
Definition: NIImporter_SUMO.h:214
NIImporter_SUMO::myCurrentTL
NBLoadedSUMOTLDef * myCurrentTL
The currently parsed traffic light.
Definition: NIImporter_SUMO.h:349
NBTrafficLightLogicCont::insert
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
Definition: NBTrafficLightLogicCont.cpp:73
NBNode.h
NIImporter_SUMO::EdgeAttrs::length
double length
The length of the edge if set explicitly.
Definition: NIImporter_SUMO.h:255
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:56
SUMO_ATTR_SHAPE
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
Definition: SUMOXMLDefinitions.h:690
NIImporter_SUMO::myEndElement
void myEndElement(int element)
Called when a closing tag occurs.
Definition: NIImporter_SUMO.cpp:479
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:76
SUMO_ATTR_X
@ SUMO_ATTR_X
Definition: SUMOXMLDefinitions.h:398
NIImporter_SUMO::LaneAttrs::shape
PositionVector shape
This lane's shape (may be custom)
Definition: NIImporter_SUMO.h:212
NIImporter_SUMO::readPosition
static Position readPosition(const SUMOSAXAttributes &attrs, const std::string &id, bool &ok)
read position from the given attributes, attribute errors to id
Definition: NIImporter_SUMO.cpp:948
WRITE_ERROR
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:283
NBEdge::addLane2LaneConnection
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, double speed=UNSPECIFIED_SPEED, const PositionVector &customShape=PositionVector::EMPTY, const bool uncontrolled=UNSPECIFIED_CONNECTION_UNCONTROLLED, SVCPermissions=SVC_UNSPECIFIED)
Adds a connection between the specified this edge's lane and an approached one.
Definition: NBEdge.cpp:984
NIImporter_SUMO::addProhibition
void addProhibition(const SUMOSAXAttributes &attrs)
Parses a prohibition and saves it.
Definition: NIImporter_SUMO.cpp:845
NIImporter_SUMO::myEdges
std::map< std::string, EdgeAttrs * > myEdges
Loaded edge definitions.
Definition: NIImporter_SUMO.h:322
SUMO_ATTR_VERSION
@ SUMO_ATTR_VERSION
Definition: SUMOXMLDefinitions.h:876
NIImporter_SUMO::myNodeCont
NBNodeCont & myNodeCont
The node container to fill.
Definition: NIImporter_SUMO.h:331
SUMOXMLDefinitions.h
NBEdge::setStopOffsets
bool setStopOffsets(int lane, std::map< int, double > offsets, bool overwrite=false)
set lane and vehicle class specific stopOffset (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3316
NBEdgeCont::wasIgnored
bool wasIgnored(std::string id) const
Returns whether the edge with the id was ignored during parsing.
Definition: NBEdgeCont.h:501
NIImporter_SUMO::JunctionAttrs::intLanes
std::vector< std::string > intLanes
Definition: NIImporter_SUMO.h:316
NIImporter_SUMO::myLocation
GeoConvHelper * myLocation
The coordinate transformation which was used to build the loaded network.
Definition: NIImporter_SUMO.h:352
SUMO_ATTR_OFFSET
@ SUMO_ATTR_OFFSET
Definition: SUMOXMLDefinitions.h:413
NBEdge.h
GenericSAXHandler::setFileName
void setFileName(const std::string &name)
Sets the current file name.
Definition: GenericSAXHandler.cpp:68
SUMO_TAG_JUNCTION
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
Definition: SUMOXMLDefinitions.h:59
XMLSubSys.h
SUMO_ATTR_CONTPOS
@ SUMO_ATTR_CONTPOS
Definition: SUMOXMLDefinitions.h:749
NIImporter_SUMO::LaneAttrs::accelRamp
bool accelRamp
Whether this lane is an acceleration lane.
Definition: NIImporter_SUMO.h:226
NBEdge::hasLaneSpecificWidth
bool hasLaneSpecificWidth() const
whether lanes differ in width
Definition: NBEdge.cpp:2038
NBEdge::getID
const std::string & getID() const
Definition: NBEdge.h:1380
NIImporter_SUMO::Prohibition
Describes the values found in a prohibition.
Definition: NIImporter_SUMO.h:276
NBLoadedSUMOTLDef
A loaded (complete) traffic light logic.
Definition: NBLoadedSUMOTLDef.h:44