Eclipse SUMO - Simulation of Urban MObility
NBNetBuilder.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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
23 // Instance responsible for building networks
24 /****************************************************************************/
25 #include <config.h>
26 
27 #include <string>
28 #include <fstream>
29 #include "NBNetBuilder.h"
30 #include "NBNodeCont.h"
31 #include "NBEdgeCont.h"
33 #include "NBDistrictCont.h"
34 #include "NBDistrict.h"
35 #include "NBRequest.h"
36 #include "NBTypeCont.h"
42 #include <utils/common/SysUtils.h>
43 #include <utils/common/ToString.h>
45 #include "NBAlgorithms.h"
46 #include "NBAlgorithms_Ramps.h"
47 #include "NBAlgorithms_Railway.h"
48 #include "NBHeightMapper.h"
49 
50 
51 // ===========================================================================
52 // method definitions
53 // ===========================================================================
55  myEdgeCont(myTypeCont),
56  myNetworkHaveCrossings(false) {
57 }
58 
59 
61 
62 
63 void
65  // apply options to type control
66  myTypeCont.setEdgeTypeDefaults(oc.getInt("default.lanenumber"), oc.getFloat("default.lanewidth"), oc.getFloat("default.speed"),
67  oc.getInt("default.priority"), parseVehicleClasses("", oc.getString("default.disallow")));
68  // apply options to edge control
70  // apply options to traffic light logics control
72  NBEdge::setDefaultConnectionLength(oc.getFloat("default.connection-length"));
73 }
74 
75 
76 void
77 NBNetBuilder::compute(OptionsCont& oc, const std::set<std::string>& explicitTurnarounds, bool mayAddOrRemove) {
79 
80  const bool lefthand = oc.getBool("lefthand");
81  if (lefthand) {
82  mirrorX();
83  }
84 
85  // MODIFYING THE SETS OF NODES AND EDGES
86  // Removes edges that are connecting the same node
87  long before = PROGRESS_BEGIN_TIME_MESSAGE("Removing self-loops");
89  PROGRESS_TIME_MESSAGE(before);
90  if (mayAddOrRemove && oc.exists("remove-edges.isolated") && oc.getBool("remove-edges.isolated")) {
91  before = PROGRESS_BEGIN_TIME_MESSAGE("Finding isolated roads");
93  PROGRESS_TIME_MESSAGE(before);
94  }
95  if (mayAddOrRemove && oc.exists("keep-edges.components") && oc.getInt("keep-edges.components") > 0) {
96  before = PROGRESS_BEGIN_TIME_MESSAGE("Finding largest components");
97  myNodeCont.removeComponents(myDistrictCont, myEdgeCont, oc.getInt("keep-edges.components"));
98  PROGRESS_TIME_MESSAGE(before);
99  }
100  if (mayAddOrRemove && oc.exists("keep-edges.postload") && oc.getBool("keep-edges.postload")) {
101  if (oc.isSet("keep-edges.explicit") || oc.isSet("keep-edges.input-file")) {
102  before = PROGRESS_BEGIN_TIME_MESSAGE("Removing unwished edges");
104  PROGRESS_TIME_MESSAGE(before);
105  }
106  }
107  // Processing pt stops and lines
108  if (oc.exists("ptstop-output") && oc.isSet("ptstop-output")) {
109  before = PROGRESS_BEGIN_TIME_MESSAGE("Processing public transport stops");
110  if (!(oc.exists("ptline-output") && oc.isSet("ptline-output"))
111  && !oc.getBool("ptstop-output.no-bidi")) {
113  }
115  PROGRESS_TIME_MESSAGE(before);
116  }
117 
118  if (oc.exists("ptline-output") && oc.isSet("ptline-output")) {
119  before = PROGRESS_BEGIN_TIME_MESSAGE("Revising public transport stops based on pt lines");
121  PROGRESS_TIME_MESSAGE(before);
122  }
123 
124  if (oc.exists("ptline-output") && oc.isSet("ptline-output")) {
125  if (oc.exists("ptline-clean-up") && oc.getBool("ptline-clean-up")) {
126  before = PROGRESS_BEGIN_TIME_MESSAGE("Cleaning up public transport stops that are not served by any line");
128  PROGRESS_TIME_MESSAGE(before);
129  } else {
130  int numDeletedStops = myPTStopCont.cleanupDeleted(myEdgeCont);
131  if (numDeletedStops > 0) {
132  WRITE_WARNING("Removed " + toString(numDeletedStops) + " pt stops because they could not be assigned to the network");
133  }
134  }
135  }
136 
137  if (oc.exists("ptstop-output") && oc.isSet("ptstop-output") && !oc.getBool("ptstop-output.no-bidi")) {
138  before = PROGRESS_BEGIN_TIME_MESSAGE("Align pt stop id signs with corresponding edge id signs");
140  PROGRESS_TIME_MESSAGE(before);
141  }
142 
143  // analyze and fix railway topology
144  if (oc.exists("railway.topology.all-bidi") && oc.getBool("railway.topology.all-bidi")) {
147  } else if (oc.exists("railway.topology.repair") && oc.getBool("railway.topology.repair")) {
148  // correct railway angles for angle-based connectivity heuristic
150  oc.getFloat("geometry.min-radius"), false,
151  oc.getBool("geometry.min-radius.fix.railways"), true);
154  }
155  if (oc.exists("railway.topology.direction-priority") && oc.getBool("railway.topology.direction-priority")) {
156  NBTurningDirectionsComputer::computeTurnDirections(myNodeCont, false); // recompute after new edges were added
158  }
159  if (oc.exists("railway.topology.output") && oc.isSet("railway.topology.output")) {
160  NBTurningDirectionsComputer::computeTurnDirections(myNodeCont, false); // recompute after new edges were added
162  }
163 
164 
165  if (mayAddOrRemove && oc.exists("edges.join-tram-dist") && oc.getFloat("edges.join-tram-dist") >= 0) {
166  // should come before joining junctions
167  before = PROGRESS_BEGIN_TIME_MESSAGE("Joining tram edges");
168  int numJoinedTramEdges = myEdgeCont.joinTramEdges(myDistrictCont, myPTLineCont, oc.getFloat("edges.join-tram-dist"));
169  PROGRESS_TIME_MESSAGE(before);
170  if (numJoinedTramEdges > 0) {
171  WRITE_MESSAGE(" Joined " + toString(numJoinedTramEdges) + " tram edges into roads.");
172  }
173  }
174  if (oc.getBool("junctions.join")
175  || (oc.exists("ramps.guess") && oc.getBool("ramps.guess"))
176  || oc.getBool("tls.guess.joining")
177  || (oc.exists("tls.guess-signals") && oc.getBool("tls.guess-signals"))) {
178  // preliminary geometry computations to determine the length of edges
179  // This depends on turning directions and sorting of edge list
180  // in case junctions are joined geometry computations have to be repeated
181  // preliminary roundabout computations to avoid damaging roundabouts via junctions.join or ramps.guess
187  if (oc.getBool("roundabouts.guess")) {
189  }
190  const std::set<EdgeSet>& roundabouts = myEdgeCont.getRoundabouts();
191  for (std::set<EdgeSet>::const_iterator it_round = roundabouts.begin();
192  it_round != roundabouts.end(); ++it_round) {
193  std::vector<std::string> nodeIDs;
194  for (EdgeSet::const_iterator it_edge = it_round->begin(); it_edge != it_round->end(); ++it_edge) {
195  nodeIDs.push_back((*it_edge)->getToNode()->getID());
196  }
197  myNodeCont.addJoinExclusion(nodeIDs);
198  }
200  }
201  // join junctions (may create new "geometry"-nodes so it needs to come before removing these
202  if (mayAddOrRemove && oc.exists("junctions.join-exclude") && oc.isSet("junctions.join-exclude")) {
203  myNodeCont.addJoinExclusion(oc.getStringVector("junctions.join-exclude"));
204  }
206  if (mayAddOrRemove && oc.getBool("junctions.join")) {
207  before = PROGRESS_BEGIN_TIME_MESSAGE("Joining junction clusters");
208  numJoined += myNodeCont.joinJunctions(oc.getFloat("junctions.join-dist"), myDistrictCont, myEdgeCont, myTLLCont, myPTStopCont);
209  PROGRESS_TIME_MESSAGE(before);
210  }
211  if (numJoined > 0) {
212  WRITE_MESSAGE(" Joined " + toString(numJoined) + " junction cluster(s).");
213  }
214  if (mayAddOrRemove && oc.exists("junctions.join-same") && oc.getBool("junctions.join-same")) {
215  before = PROGRESS_BEGIN_TIME_MESSAGE("Joining junctions with identical coordinates");
217  PROGRESS_TIME_MESSAGE(before);
218  if (numJoined2 > 0) {
219  WRITE_MESSAGE(" Joined " + toString(numJoined2) + " junctions.");
220  }
221  }
222  //
223  if (mayAddOrRemove && oc.exists("join-lanes") && oc.getBool("join-lanes")) {
224  before = PROGRESS_BEGIN_TIME_MESSAGE("Joining lanes");
226  PROGRESS_TIME_MESSAGE(before);
227  WRITE_MESSAGE(" Joined lanes on " + toString(num) + " edges.");
228  }
229  //
230  if (mayAddOrRemove) {
231  int no = 0;
232  const bool removeGeometryNodes = oc.exists("geometry.remove") && oc.getBool("geometry.remove");
233  before = PROGRESS_BEGIN_TIME_MESSAGE("Removing empty nodes" + std::string(removeGeometryNodes ? " and geometry nodes" : ""));
234  // removeUnwishedNodes needs turnDirections. @todo: try to call this less often
237  PROGRESS_TIME_MESSAGE(before);
238  WRITE_MESSAGE(" " + toString(no) + " nodes removed.");
239  }
240 
241  // MOVE TO ORIGIN
242  // compute new boundary after network modifications have taken place
243  Boundary boundary;
244  for (std::map<std::string, NBNode*>::const_iterator it = myNodeCont.begin(); it != myNodeCont.end(); ++it) {
245  boundary.add(it->second->getPosition());
246  }
247  for (std::map<std::string, NBEdge*>::const_iterator it = myEdgeCont.begin(); it != myEdgeCont.end(); ++it) {
248  boundary.add(it->second->getGeometry().getBoxBoundary());
249  }
250  geoConvHelper.setConvBoundary(boundary);
251 
252  if (!oc.getBool("offset.disable-normalization") && oc.isDefault("offset.x") && oc.isDefault("offset.y")) {
253  moveToOrigin(geoConvHelper, lefthand);
254  }
255  geoConvHelper.computeFinal(lefthand); // information needed for location element fixed at this point
256 
257  if (oc.exists("geometry.min-dist") && !oc.isDefault("geometry.min-dist")) {
258  before = PROGRESS_BEGIN_TIME_MESSAGE("Reducing geometries");
259  myEdgeCont.reduceGeometries(oc.getFloat("geometry.min-dist"));
260  PROGRESS_TIME_MESSAGE(before);
261  }
262  // @note: removing geometry can create similar edges so joinSimilarEdges must come afterwards
263  // @note: likewise splitting can destroy similarities so joinSimilarEdges must come before
264  if (mayAddOrRemove && oc.getBool("edges.join")) {
265  before = PROGRESS_BEGIN_TIME_MESSAGE("Joining similar edges");
267  PROGRESS_TIME_MESSAGE(before);
268  }
269  if (oc.getBool("opposites.guess")) {
270  PROGRESS_BEGIN_MESSAGE("guessing opposite direction edges");
273  }
274  //
275  if (mayAddOrRemove && oc.exists("geometry.split") && oc.getBool("geometry.split")) {
276  before = PROGRESS_BEGIN_TIME_MESSAGE("Splitting geometry edges");
278  PROGRESS_TIME_MESSAGE(before);
279  }
280  // turning direction
281  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing turning directions");
283  PROGRESS_TIME_MESSAGE(before);
284  // correct edge geometries to avoid overlap
285  if (oc.exists("geometry.avoid-overlap") && oc.getBool("geometry.avoid-overlap")) {
287  }
288 
289  // GUESS TLS POSITIONS
290  before = PROGRESS_BEGIN_TIME_MESSAGE("Assigning nodes to traffic lights");
291  if (oc.isSet("tls.set")) {
292  std::vector<std::string> tlControlledNodes = oc.getStringVector("tls.set");
294  for (std::vector<std::string>::const_iterator i = tlControlledNodes.begin(); i != tlControlledNodes.end(); ++i) {
295  NBNode* node = myNodeCont.retrieve(*i);
296  if (node == nullptr) {
297  WRITE_WARNING("Building a tl-logic for junction '" + *i + "' is not possible." + "\n The junction '" + *i + "' is not known.");
298  } else {
300  }
301  }
302  }
304  PROGRESS_TIME_MESSAGE(before);
305 
306  // guess ramps (after guessing tls because ramps should not be build at traffic lights)
307  const bool modifyRamps = mayAddOrRemove && (
308  (oc.exists("ramps.guess") && oc.getBool("ramps.guess"))
309  || (oc.exists("ramps.set") && oc.isSet("ramps.set")));
310  if (modifyRamps || (oc.exists("ramps.guess-acceleration-lanes") && oc.getBool("ramps.guess-acceleration-lanes"))) {
311  before = SysUtils::getCurrentMillis();
312  if (modifyRamps) {
313  PROGRESS_BEGIN_MESSAGE("Guessing and setting on-/off-ramps");
314  }
316  NBRampsComputer::computeRamps(*this, oc, mayAddOrRemove);
317  if (modifyRamps) {
318  PROGRESS_TIME_MESSAGE(before);
319  }
320  }
321  // guess bike lanes
322  int addedLanes = 0;
323  if (mayAddOrRemove && ((oc.getBool("bikelanes.guess") || oc.getBool("bikelanes.guess.from-permissions")))) {
324  const int bikelanes = myEdgeCont.guessSpecialLanes(SVC_BICYCLE, oc.getFloat("default.bikelane-width"),
325  oc.getFloat("bikelanes.guess.min-speed"),
326  oc.getFloat("bikelanes.guess.max-speed"),
327  oc.getBool("bikelanes.guess.from-permissions"),
328  "bikelanes.guess.exclude");
329  WRITE_MESSAGE("Guessed " + toString(bikelanes) + " bike lanes.");
330  addedLanes += bikelanes;
331  }
332 
333  // guess sidewalks
334  if (mayAddOrRemove && ((oc.getBool("sidewalks.guess") || oc.getBool("sidewalks.guess.from-permissions")))) {
335  const int sidewalks = myEdgeCont.guessSpecialLanes(SVC_PEDESTRIAN, oc.getFloat("default.sidewalk-width"),
336  oc.getFloat("sidewalks.guess.min-speed"),
337  oc.getFloat("sidewalks.guess.max-speed"),
338  oc.getBool("sidewalks.guess.from-permissions"),
339  "sidewalks.guess.exclude");
340  WRITE_MESSAGE("Guessed " + toString(sidewalks) + " sidewalks.");
341  addedLanes += sidewalks;
342  }
343  // re-adapt stop lanes after adding special lanes
344  if (oc.exists("ptstop-output") && oc.isSet("ptstop-output") && addedLanes > 0) {
346  }
347 
348  // check whether any not previously setable connections may be set now
350 
351  // remap ids if wished
352  int numChangedEdges = myEdgeCont.remapIDs(oc.getBool("numerical-ids"), oc.isSet("reserved-ids"), oc.getString("prefix"), myPTStopCont);
353  int numChangedNodes = myNodeCont.remapIDs(oc.getBool("numerical-ids"), oc.isSet("reserved-ids"), oc.getString("prefix"));
354  if (numChangedEdges + numChangedNodes > 0) {
355  WRITE_MESSAGE("Remapped " + toString(numChangedEdges) + " edge IDs and " + toString(numChangedNodes) + " node IDs.");
356  }
357 
358  //
359  if (oc.exists("geometry.max-angle")) {
361  DEG2RAD(oc.getFloat("geometry.max-angle")),
362  oc.getFloat("geometry.min-radius"),
363  oc.getBool("geometry.min-radius.fix"),
364  oc.getBool("geometry.min-radius.fix.railways"));
365  }
366 
367  // GEOMETRY COMPUTATION
368  //
369  before = PROGRESS_BEGIN_TIME_MESSAGE("Sorting nodes' edges");
371  PROGRESS_TIME_MESSAGE(before);
373  //
374  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing node shapes");
375  if (oc.exists("geometry.junction-mismatch-threshold")) {
376  myNodeCont.computeNodeShapes(oc.getFloat("geometry.junction-mismatch-threshold"));
377  } else {
379  }
380  PROGRESS_TIME_MESSAGE(before);
381  //
382  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing edge shapes");
383  myEdgeCont.computeEdgeShapes(oc.getBool("geometry.max-grade.fix") ? oc.getFloat("geometry.max-grade") / 100 : -1);
384  PROGRESS_TIME_MESSAGE(before);
385  // resort edges based on the node and edge shapes
388 
389  // APPLY SPEED MODIFICATIONS
390  if (oc.exists("speed.offset")) {
391  const double speedOffset = oc.getFloat("speed.offset");
392  const double speedFactor = oc.getFloat("speed.factor");
393  const double speedMin = oc.getFloat("speed.minimum");
394  if (speedOffset != 0 || speedFactor != 1 || speedMin > 0) {
395  before = PROGRESS_BEGIN_TIME_MESSAGE("Applying speed modifications");
396  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
397  (*i).second->setSpeed(-1, MAX2((*i).second->getSpeed() * speedFactor + speedOffset, speedMin));
398  }
399  PROGRESS_TIME_MESSAGE(before);
400  }
401  }
402 
403  // CONNECTIONS COMPUTATION
404  //
405  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing node types");
407  PROGRESS_TIME_MESSAGE(before);
408  //
409  myNetworkHaveCrossings = oc.getBool("walkingareas");
410  if (mayAddOrRemove && oc.getBool("crossings.guess")) {
411  myNetworkHaveCrossings = true;
412  int crossings = 0;
413  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
414  crossings += (*i).second->guessCrossings();
415  }
416  WRITE_MESSAGE("Guessed " + toString(crossings) + " pedestrian crossings.");
417  }
418  if (!myNetworkHaveCrossings) {
419  // recheck whether we had crossings in the input
420  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
421  if (i->second->getCrossingsIncludingInvalid().size() > 0) {
422  myNetworkHaveCrossings = true;
423  break;
424  }
425  }
426  }
427 
428  if (!mayAddOrRemove && myNetworkHaveCrossings) {
429  // crossings added via netedit
430  oc.resetWritable();
431  oc.set("no-internal-links", "false");
432  }
433 
434  //
435  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing priorities");
437  PROGRESS_TIME_MESSAGE(before);
438  //
439  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing approached edges");
440  myEdgeCont.computeEdge2Edges(oc.getBool("no-left-connections"));
441  PROGRESS_TIME_MESSAGE(before);
442  //
443  if (oc.getBool("roundabouts.guess")) {
444  before = PROGRESS_BEGIN_TIME_MESSAGE("Guessing and setting roundabouts");
445  const int numGuessed = myEdgeCont.guessRoundabouts();
446  if (numGuessed > 0) {
447  WRITE_MESSAGE(" Guessed " + toString(numGuessed) + " roundabout(s).");
448  }
449  PROGRESS_TIME_MESSAGE(before);
450  }
452  //
453  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing approaching lanes");
455  PROGRESS_TIME_MESSAGE(before);
456  //
457  before = PROGRESS_BEGIN_TIME_MESSAGE("Dividing of lanes on approached lanes");
460  PROGRESS_TIME_MESSAGE(before);
461  //
462  if (oc.getBool("fringe.guess")) {
463  before = PROGRESS_BEGIN_TIME_MESSAGE("Guessing Network fringe");
464  const int numGuessed = myNodeCont.guessFringe();
465  if (numGuessed > 0) {
466  WRITE_MESSAGE(" Guessed " + toString(numGuessed) + " fringe nodes.");
467  }
468  PROGRESS_TIME_MESSAGE(before);
469  }
470  //
471  before = PROGRESS_BEGIN_TIME_MESSAGE("Processing turnarounds");
472  if (!oc.getBool("no-turnarounds")) {
474  oc.getBool("no-turnarounds.tls"),
475  oc.getBool("no-turnarounds.fringe"),
476  oc.getBool("no-turnarounds.except-deadend"),
477  oc.getBool("no-turnarounds.except-turnlane"),
478  oc.getBool("no-turnarounds.geometry"));
479  } else {
480  myEdgeCont.appendTurnarounds(explicitTurnarounds, oc.getBool("no-turnarounds.tls"));
481  }
482  if (oc.exists("railway.topology.repair.stop-turn") && oc.getBool("railway.topology.repair.stop-turn")
483  && myPTStopCont.getStops().size() > 0) {
484  // allow direction reversal at all bidi-edges with stops
486  }
487  PROGRESS_TIME_MESSAGE(before);
488  //
489  before = PROGRESS_BEGIN_TIME_MESSAGE("Rechecking of lane endings");
491  PROGRESS_TIME_MESSAGE(before);
492 
493  if (myNetworkHaveCrossings && !oc.getBool("no-internal-links")) {
494  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
495  i->second->buildCrossingsAndWalkingAreas();
496  }
497  } else {
498  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
499  // needed by netedit if the last crossings was deleted from the network
500  // and walkingareas have been invalidated since the last call to compute()
501  i->second->discardWalkingareas();
502  }
503  if (oc.getBool("no-internal-links")) {
504  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
505  i->second->discardAllCrossings(false);
506  }
507  }
508  }
509  // join traffic lights (after building connections)
510  if (oc.getBool("tls.join")) {
511  before = PROGRESS_BEGIN_TIME_MESSAGE("Joining traffic light nodes");
512  myNodeCont.joinTLS(myTLLCont, oc.getFloat("tls.join-dist"));
513  PROGRESS_TIME_MESSAGE(before);
514  }
515 
516  // COMPUTING RIGHT-OF-WAY AND TRAFFIC LIGHT PROGRAMS
517  //
518  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing traffic light control information");
520  if (oc.exists("opendrive-files") && oc.isSet("opendrive-files")) {
522  }
523  PROGRESS_TIME_MESSAGE(before);
524  //
525  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing node logics");
527  PROGRESS_TIME_MESSAGE(before);
528 
529  //
530  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing traffic light logics");
531  std::pair<int, int> numbers = myTLLCont.computeLogics(oc);
532  PROGRESS_TIME_MESSAGE(before);
533  std::string progCount = "";
534  if (numbers.first != numbers.second) {
535  progCount = "(" + toString(numbers.second) + " programs) ";
536  }
537  WRITE_MESSAGE(" " + toString(numbers.first) + " traffic light(s) " + progCount + "computed.");
538 
539  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
540  (*i).second->sortOutgoingConnectionsByIndex();
541  }
542  // FINISHING INNER EDGES
543  if (!oc.getBool("no-internal-links")) {
544  before = PROGRESS_BEGIN_TIME_MESSAGE("Building inner edges");
545  // walking areas shall only be built if crossings are wished as well
546  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
547  (*i).second->buildInnerEdges();
548  }
549  PROGRESS_TIME_MESSAGE(before);
550  }
551  // PATCH NODE SHAPES
552  if (oc.getFloat("junctions.scurve-stretch") > 0) {
553  // @note: nodes have collected correction hints in buildInnerEdges()
554  before = PROGRESS_BEGIN_TIME_MESSAGE("stretching junctions to smooth geometries");
557  myEdgeCont.computeEdgeShapes(oc.getBool("geometry.max-grade.fix") ? oc.getFloat("geometry.max-grade") / 100 : -1);
558  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
559  (*i).second->buildInnerEdges();
560  }
561  PROGRESS_TIME_MESSAGE(before);
562  }
563  // compute lane-to-lane node logics (require traffic lights and inner edges to be done)
565 
566  // remove guessed traffic lights at junctions without conflicts (requires computeLogics2)
568 
569  // compute keepClear status (requires computeLogics2)
571 
572  //
573  if (oc.isSet("street-sign-output")) {
574  before = PROGRESS_BEGIN_TIME_MESSAGE("Generating street signs");
576  PROGRESS_TIME_MESSAGE(before);
577  }
578 
579 
580  if (lefthand != oc.getBool("flip-y-axis")) {
581  mirrorX();
582  };
583 
584  if (oc.exists("geometry.check-overlap") && oc.getFloat("geometry.check-overlap") > 0) {
585  before = PROGRESS_BEGIN_TIME_MESSAGE("Checking overlapping edges");
586  myEdgeCont.checkOverlap(oc.getFloat("geometry.check-overlap"), oc.getFloat("geometry.check-overlap.vertical-threshold"));
587  PROGRESS_TIME_MESSAGE(before);
588  }
589  if (geoConvHelper.getConvBoundary().getZRange() > 0 && oc.getFloat("geometry.max-grade") > 0) {
590  before = PROGRESS_BEGIN_TIME_MESSAGE("Checking edge grade");
591  // user input is in %
592  myEdgeCont.checkGrade(oc.getFloat("geometry.max-grade") / 100);
593  PROGRESS_TIME_MESSAGE(before);
594  }
595 
596  //find accesses for pt rail stops and add bidi-stops
597  if (oc.exists("ptstop-output") && oc.isSet("ptstop-output")) {
598  before = SysUtils::getCurrentMillis();
599  int numBidiStops = 0;
600  if (!oc.getBool("ptstop-output.no-bidi")) {
601  numBidiStops = myPTStopCont.generateBidiStops(myEdgeCont);
602  }
603  PROGRESS_BEGIN_MESSAGE("Find accesses for pt rail stops");
604  double maxRadius = oc.getFloat("railway.access-distance");
605  double accessFactor = oc.getFloat("railway.access-factor");
606  int maxCount = oc.getInt("railway.max-accesses");
607  myPTStopCont.findAccessEdgesForRailStops(myEdgeCont, maxRadius, maxCount, accessFactor);
608  PROGRESS_TIME_MESSAGE(before);
609  if (numBidiStops > 0) {
610  if (oc.exists("ptline-output") && oc.isSet("ptline-output")) {
612  }
613  }
614  }
615 
616  // report
617  WRITE_MESSAGE("-----------------------------------------------------");
618  WRITE_MESSAGE("Summary:");
620  WRITE_MESSAGE(" Network boundaries:");
621  WRITE_MESSAGE(" Original boundary : " + toString(geoConvHelper.getOrigBoundary()));
622  WRITE_MESSAGE(" Applied offset : " + toString(geoConvHelper.getOffsetBase()));
623  WRITE_MESSAGE(" Converted boundary : " + toString(geoConvHelper.getConvBoundary()));
624  WRITE_MESSAGE("-----------------------------------------------------");
626  // report on very large networks
627  if (MAX2(geoConvHelper.getConvBoundary().xmax(), geoConvHelper.getConvBoundary().ymax()) > 1000000 ||
628  MIN2(geoConvHelper.getConvBoundary().xmin(), geoConvHelper.getConvBoundary().ymin()) < -1000000) {
629  WRITE_WARNING("Network contains very large coordinates and will probably flicker in the GUI. Check for outlying nodes and make sure the network is shifted to the coordinate origin");
630  }
631 }
632 
633 
634 /*
635 void
636 NBNetBuilder::computeSingleNode(NBNode* node, OptionsCont& oc, const std::set<std::string>& explicitTurnarounds, bool mayAddOrRemove) {
637  // for a single node do the following:
638  // sortEdges
639  // computeLaneShapes
640  // computeNodeShapes
641  // computeEdgeShapes
642 }
643 */
644 
645 
646 void
647 NBNetBuilder::moveToOrigin(GeoConvHelper& geoConvHelper, bool lefthand) {
648  long before = PROGRESS_BEGIN_TIME_MESSAGE("Moving network to origin");
649  Boundary boundary = geoConvHelper.getConvBoundary();
650  const double x = -boundary.xmin();
651  const double y = -(lefthand ? boundary.ymax() : boundary.ymin());
652  //if (lefthand) {
653  // y = boundary.ymax();
654  //}
655  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
656  (*i).second->reshiftPosition(x, y);
657  }
658  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
659  (*i).second->reshiftPosition(x, y);
660  }
661  for (std::map<std::string, NBDistrict*>::const_iterator i = myDistrictCont.begin(); i != myDistrictCont.end(); ++i) {
662  (*i).second->reshiftPosition(x, y);
663  }
664  for (std::map<std::string, NBPTStop*>::const_iterator i = myPTStopCont.begin(); i != myPTStopCont.end(); ++i) {
665  (*i).second->reshiftPosition(x, y);
666  }
667  geoConvHelper.moveConvertedBy(x, y);
668  PROGRESS_TIME_MESSAGE(before);
669 }
670 
671 
672 void
674  // mirror the network along the X-axis
675  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
676  (*i).second->mirrorX();
677  }
678  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
679  (*i).second->mirrorX();
680  }
681  for (std::map<std::string, NBDistrict*>::const_iterator i = myDistrictCont.begin(); i != myDistrictCont.end(); ++i) {
682  (*i).second->mirrorX();
683  }
684  for (std::map<std::string, NBPTStop*>::const_iterator i = myPTStopCont.begin(); i != myPTStopCont.end(); ++i) {
685  (*i).second->mirrorX();
686  }
687 }
688 
689 
690 bool
691 NBNetBuilder::transformCoordinate(Position& from, bool includeInBoundary, GeoConvHelper* from_srs) {
692  Position orig(from);
693  bool ok = true;
695  && GeoConvHelper::getLoaded().usingGeoProjection()
696  && from_srs != nullptr
697  && from_srs->usingGeoProjection()
698  && *from_srs != GeoConvHelper::getLoaded()) {
699  from_srs->cartesian2geo(from);
700  ok &= GeoConvHelper::getLoaded().x2cartesian(from, false);
701  }
702  ok &= GeoConvHelper::getProcessing().x2cartesian(from, includeInBoundary);
703  if (ok) {
704  const NBHeightMapper& hm = NBHeightMapper::get();
705  if (hm.ready()) {
706  if (from_srs != nullptr && from_srs->usingGeoProjection()) {
707  from_srs->cartesian2geo(orig);
708  }
709  from.setz(hm.getZ(orig));
710  }
711  }
712  return ok;
713 }
714 
715 
716 bool
717 NBNetBuilder::transformCoordinates(PositionVector& from, bool includeInBoundary, GeoConvHelper* from_srs) {
718  const double maxLength = OptionsCont::getOptions().getFloat("geometry.max-segment-length");
719  if (maxLength > 0 && from.size() > 1) {
720  // transformation to cartesian coordinates must happen before we can check segment length
721  PositionVector copy = from;
722  for (int i = 0; i < (int) from.size(); i++) {
723  transformCoordinate(copy[i], false);
724  }
725  addGeometrySegments(from, copy, maxLength);
726  }
727  bool ok = true;
728  for (int i = 0; i < (int) from.size(); i++) {
729  ok = ok && transformCoordinate(from[i], includeInBoundary, from_srs);
730  }
731  return ok;
732 }
733 
734 int
735 NBNetBuilder::addGeometrySegments(PositionVector& from, const PositionVector& cartesian, const double maxLength) {
736  // check lengths and insert new points where needed (in the original
737  // coordinate system)
738  int inserted = 0;
739  for (int i = 0; i < (int)cartesian.size() - 1; i++) {
740  Position start = from[i + inserted];
741  Position end = from[i + inserted + 1];
742  double length = cartesian[i].distanceTo(cartesian[i + 1]);
743  const Position step = (end - start) * (maxLength / length);
744  int steps = 0;
745  while (length > maxLength) {
746  length -= maxLength;
747  steps++;
748  from.insert(from.begin() + i + inserted + 1, start + (step * steps));
749  inserted++;
750  }
751  }
752  return inserted;
753 }
754 
755 
756 bool
758  // see GNELoadThread::fillOptions
759  return OptionsCont::getOptions().exists("new");
760 }
761 
762 
763 /****************************************************************************/
#define DEG2RAD(x)
Definition: GeomHelper.h:35
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:278
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:276
#define PROGRESS_BEGIN_TIME_MESSAGE(msg)
Definition: MsgHandler.h:281
#define PROGRESS_TIME_MESSAGE(before)
Definition: MsgHandler.h:282
#define PROGRESS_DONE_MESSAGE()
Definition: MsgHandler.h:280
#define PROGRESS_BEGIN_MESSAGE(msg)
Definition: MsgHandler.h:279
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_PEDESTRIAN
pedestrian
TrafficLightType
T MIN2(T a, T b)
Definition: StdDefs.h:73
T MAX2(T a, T b)
Definition: StdDefs.h:79
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:77
double ymin() const
Returns minimum y-coordinate.
Definition: Boundary.cpp:129
double xmin() const
Returns minimum x-coordinate.
Definition: Boundary.cpp:117
double ymax() const
Returns maximum y-coordinate.
Definition: Boundary.cpp:135
double xmax() const
Returns maximum x-coordinate.
Definition: Boundary.cpp:123
double getZRange() const
Returns the elevation range of the boundary (z-axis)
Definition: Boundary.cpp:165
static methods for processing the coordinates conversion for the current net
Definition: GeoConvHelper.h:53
static GeoConvHelper & getProcessing()
the coordinate transformation to use for input conversion and processing
Definition: GeoConvHelper.h:84
void setConvBoundary(const Boundary &boundary)
sets the converted boundary
bool x2cartesian(Position &from, bool includeInBoundary=true)
Converts the given coordinate into a cartesian and optionally update myConvBoundary.
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
void moveConvertedBy(double x, double y)
Shifts the converted boundary by the given amounts.
const Boundary & getOrigBoundary() const
Returns the original boundary.
static GeoConvHelper & getLoaded()
the coordinate transformation that was loaded fron an input file
Definition: GeoConvHelper.h:89
static int getNumLoaded()
Definition: GeoConvHelper.h:93
const Position getOffsetBase() const
Returns the network base.
static void computeFinal(bool lefthand=false)
compute the location attributes which will be used for output based on the loaded location data,...
bool usingGeoProjection() const
Returns whether a transformation from geo to metric coordinates will be performed.
const Boundary & getConvBoundary() const
Returns the converted boundary.
std::map< std::string, NBDistrict * >::const_iterator begin() const
Returns the pointer to the begin of the stored districts.
std::map< std::string, NBDistrict * >::const_iterator end() const
Returns the pointer to the end of the stored districts.
std::map< std::string, NBEdge * >::const_iterator begin() const
Returns the pointer to the begin of the stored edges.
Definition: NBEdgeCont.h:183
void computeEdgeShapes(double smoothElevationThreshold=-1)
Computes the shapes of all edges stored in the container.
Definition: NBEdgeCont.cpp:924
void removeUnwishedEdges(NBDistrictCont &dc)
Removes unwished edges (not in keep-edges)
Definition: NBEdgeCont.cpp:729
const std::set< EdgeSet > getRoundabouts() const
Returns the determined roundabouts.
void computeEdge2Edges(bool noLeftMovers)
Computes for each edge the approached edges.
Definition: NBEdgeCont.cpp:811
int guessRoundabouts()
Determines which edges belong to roundabouts and increases their priority.
void sortOutgoingLanesConnections()
Sorts all lanes of all edges within the container by their direction.
Definition: NBEdgeCont.cpp:803
void appendRailwayTurnarounds(const NBPTStopCont &sc)
Appends turnarounds to all bidiRail edges with stops.
Definition: NBEdgeCont.cpp:902
std::map< std::string, NBEdge * >::const_iterator end() const
Returns the pointer to the end of the stored edges.
Definition: NBEdgeCont.h:191
void recheckPostProcessConnections()
Try to set any stored connections.
void checkGeometries(const double maxAngle, const double minRadius, bool fix, bool fixRailways, bool silent=false)
Definition: NBEdgeCont.cpp:781
void recheckLanes()
Rechecks whether all lanes have a successor for each of the stored edges.
Definition: NBEdgeCont.cpp:827
void reduceGeometries(const double minDist)
Definition: NBEdgeCont.cpp:773
void splitGeometry(NBDistrictCont &dc, NBNodeCont &nc)
Splits edges into multiple if they have a complex geometry.
Definition: NBEdgeCont.cpp:746
void computeLanes2Edges()
Computes for each edge which lanes approach the next edges.
Definition: NBEdgeCont.cpp:819
void generateStreetSigns()
assigns street signs to edges based on toNode types
void guessOpposites()
Sets opposite lane information for geometrically close edges.
void markRoundabouts()
mark edge priorities and prohibit turn-arounds for all roundabout edges
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
Definition: NBEdgeCont.cpp:78
int joinLanes(SVCPermissions perms)
join adjacent lanes with the given permissions
void checkOverlap(double threshold, double zThreshold) const
check whether edges overlap
void appendTurnarounds(bool noTLSControlled, bool noFringe, bool onlyDeadends, bool onlyTurnlane, bool noGeometryLike)
Appends turnarounds to all edges stored in the container.
Definition: NBEdgeCont.cpp:886
void computeLaneShapes()
Computes the shapes of all lanes of all edges stored in the container.
Definition: NBEdgeCont.cpp:948
int joinTramEdges(NBDistrictCont &dc, NBPTLineCont &lc, double maxDist)
join tram edges into adjacent lanes
int guessSpecialLanes(SUMOVehicleClass svc, double width, double minSpeed, double maxSpeed, bool fromPermissions, const std::string &excludeOpt)
add sidwalks to edges within the given limits or permissions and return the number of edges affected
int remapIDs(bool numericaIDs, bool reservedIDs, const std::string &prefix, NBPTStopCont &sc)
remap node IDs accoring to options –numerical-ids and –reserved-ids
void checkGrade(double threshold) const
check whether edges are to steep
static void setDefaultConnectionLength(double length)
Definition: NBEdge.h:360
static void computeEdgePriorities(NBNodeCont &nc)
Computes edge priorities within a node.
Set z-values for all network positions based on data from a height map.
double getZ(const Position &geo) const
returns height for the given geo coordinate (WGS84)
static const NBHeightMapper & get()
return the singleton instance (maybe 0)
bool ready() const
returns whether the NBHeightMapper has data
void mirrorX()
mirror the network along the X-axis
NBNetBuilder()
Constructor.
NBTrafficLightLogicCont myTLLCont
The used container for traffic light logics.
Definition: NBNetBuilder.h:247
static bool transformCoordinates(PositionVector &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
void moveToOrigin(GeoConvHelper &geoConvHelper, bool lefthand)
shift network so its lower left corner is at 0,0
bool myNetworkHaveCrossings
flag to indicate that network has crossings
Definition: NBNetBuilder.h:264
NBDistrictCont myDistrictCont
The used container for districts.
Definition: NBNetBuilder.h:250
static int addGeometrySegments(PositionVector &from, const PositionVector &cartesian, const double maxLength)
insertion geometry points to ensure maximum segment length between points
NBPTLineCont myPTLineCont
The used container for pt stops.
Definition: NBNetBuilder.h:256
NBEdgeCont myEdgeCont
The used container for edges.
Definition: NBNetBuilder.h:244
NBParkingCont myParkingCont
Definition: NBNetBuilder.h:258
~NBNetBuilder()
Destructor.
NBTypeCont myTypeCont
The used container for street types.
Definition: NBNetBuilder.h:241
NBPTStopCont myPTStopCont
The used container for pt stops.
Definition: NBNetBuilder.h:253
static bool transformCoordinate(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
void compute(OptionsCont &oc, const std::set< std::string > &explicitTurnarounds=std::set< std::string >(), bool mayAddOrRemove=true)
Performs the network building steps.
NBNodeCont myNodeCont
The used container for nodes.
Definition: NBNetBuilder.h:238
static bool runningNetedit()
whether netbuilding takes place in the context of NETEDIT
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
Definition: NBNodeCont.h:113
void avoidOverlap()
fix overlap
Definition: NBNodeCont.cpp:455
void recheckGuessedTLS(NBTrafficLightLogicCont &tlc)
recheck myGuessedTLS after node logics are computed
void computeKeepClear()
compute keepClear status for all connections
void addJoinExclusion(const std::vector< std::string > &ids, bool check=false)
Definition: NBNodeCont.cpp:576
int joinLoadedClusters(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
Joins loaded junction clusters (see NIXMLNodesHandler)
Definition: NBNodeCont.cpp:633
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
Definition: NBNodeCont.cpp:119
void joinTLS(NBTrafficLightLogicCont &tlc, double maxdist)
Builds clusters of tls-controlled junctions and joins the control if possible.
int removeUnwishedNodes(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc, NBPTStopCont &sc, NBPTLineCont &lc, NBParkingCont &pc, bool removeGeometryNodes)
Removes "unwished" nodes.
Definition: NBNodeCont.cpp:381
void removeComponents(NBDistrictCont &dc, NBEdgeCont &ec, const int numKeep)
Checks the network for weak connectivity and removes all but the largest components....
Definition: NBNodeCont.cpp:323
void computeLogics2(const NBEdgeCont &ec, OptionsCont &oc)
compute right-of-way logic for all lane-to-lane connections
void printBuiltNodesStatistics() const
Prints statistics about built nodes.
void removeIsolatedRoads(NBDistrictCont &dc, NBEdgeCont &ec)
Removes sequences of edges that are not connected with a junction. Simple roads without junctions som...
Definition: NBNodeCont.cpp:235
void setAsTLControlled(NBNode *node, NBTrafficLightLogicCont &tlc, TrafficLightType type, std::string id="")
Sets the given node as being controlled by a tls.
void joinSimilarEdges(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
Joins edges connecting the same nodes.
Definition: NBNodeCont.cpp:190
void computeLogics(const NBEdgeCont &ec)
build the list of outgoing edges and lanes
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
Definition: NBNodeCont.h:118
void computeNodeShapes(double mismatchThreshold=-1)
Compute the junction shape for this node.
void guessTLs(OptionsCont &oc, NBTrafficLightLogicCont &tlc)
Guesses which junctions or junction clusters shall be controlled by tls.
int guessFringe()
guess and mark fringe nodes
int joinJunctions(double maxDist, NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc, NBPTStopCont &sc)
Joins junctions that are very close together.
Definition: NBNodeCont.cpp:658
void computeLanes2Lanes()
divides the incoming lanes on outgoing lanes
void removeSelfLoops(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tc)
Removes self-loop edges (edges where the source and the destination node are the same)
Definition: NBNodeCont.cpp:178
int joinSameJunctions(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
Joins junctions with the same coordinates regardless of topology.
Definition: NBNodeCont.cpp:771
int remapIDs(bool numericaIDs, bool reservedIDs, const std::string &prefix)
remap node IDs accoring to options –numerical-ids and –reserved-ids
Represents a single node (junction) during network building.
Definition: NBNode.h:66
static void computeNodeTypes(NBNodeCont &nc, NBTrafficLightLogicCont &tlc)
Computes node types.
static void validateRailCrossings(NBNodeCont &nc, NBTrafficLightLogicCont &tlc)
Checks rail_crossing for validity.
static void sortNodesEdges(NBNodeCont &nc, bool useNodeShape=false)
Sorts a node's edges clockwise regarding driving direction.
std::set< std::string > & getServedPTStops()
void process(NBEdgeCont &ec, NBPTStopCont &sc)
void fixBidiStops(const NBEdgeCont &ec)
select the correct stop on superposed rail edges
int cleanupDeleted(NBEdgeCont &cont)
remove stops on non existing (removed) edges
const std::map< std::string, NBPTStop * > & getStops() const
Definition: NBPTStopCont.h:64
void postprocess(std::set< std::string > &usedStops)
std::map< std::string, NBPTStop * >::const_iterator begin() const
Returns the pointer to the begin of the stored pt stops.
Definition: NBPTStopCont.h:53
void localizePTStops(NBEdgeCont &cont)
void alignIdSigns()
void findAccessEdgesForRailStops(NBEdgeCont &cont, double maxRadius, int maxCount, double accessFactor)
int generateBidiStops(NBEdgeCont &cont)
duplicate stops for superposed rail edges and return the number of generated stops
void assignLanes(NBEdgeCont &cont)
std::map< std::string, NBPTStop * >::const_iterator end() const
Returns the pointer to the end of the stored pt stops.
Definition: NBPTStopCont.h:60
static void analyzeTopology(NBNetBuilder &nb)
Computes highway on-/off-ramps (if wished)
static void repairTopology(NBNetBuilder &nb)
static void assignDirectionPriority(NBNetBuilder &nb)
static void makeAllBidi(NBNetBuilder &nb)
static void computeRamps(NBNetBuilder &nb, OptionsCont &oc, bool mayAddOrRemove)
Computes highway on-/off-ramps (if wished)
static void reportWarnings()
reports warnings if any occurred
Definition: NBRequest.cpp:1031
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
void setOpenDriveSignalParameters()
set OpenDRIVE signal reference parameters after all link indices are known
std::pair< int, int > computeLogics(OptionsCont &oc)
Computes the traffic light logics using the stored definitions and stores the results.
void setTLControllingInformation(const NBEdgeCont &ec, const NBNodeCont &nc)
Informs the edges about being controlled by a tls.
static void computeTurnDirections(NBNodeCont &nc, bool warn=true)
Computes turnaround destinations for all edges (if exist)
void setEdgeTypeDefaults(int defaultNumLanes, double defaultLaneWidth, double defaultSpeed, int defaultPriority, SVCPermissions defaultPermissions)
Sets the default values.
Definition: NBTypeCont.cpp:158
A storage for options typed value containers)
Definition: OptionsCont.h:89
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
bool exists(const std::string &name) const
Returns the information whether the named option is known.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
void resetWritable()
Resets all options to be writeable.
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
void setz(double z)
set position z
Definition: Position.h:79
A list of positions.
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
T get(const std::string &str) const
static long getCurrentMillis()
Returns the current time in milliseconds.
Definition: SysUtils.cpp:39