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-2022 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.allow"), oc.getString("default.disallow")),
68  SUMOXMLDefinitions::LaneSpreadFunctions.get(oc.getString("default.spreadtype")));
69  // apply options to edge control
71  // apply options to traffic light logics control
73  NBEdge::setDefaultConnectionLength(oc.getFloat("default.connection-length"));
74 }
75 
76 
77 void
78 NBNetBuilder::compute(OptionsCont& oc, const std::set<std::string>& explicitTurnarounds, bool mayAddOrRemove) {
80 
81  const bool lefthand = oc.getBool("lefthand");
82  if (lefthand) {
83  mirrorX();
84  }
85 
86  // MODIFYING THE SETS OF NODES AND EDGES
87  // Removes edges that are connecting the same node
88  long before = PROGRESS_BEGIN_TIME_MESSAGE("Removing self-loops");
90  PROGRESS_TIME_MESSAGE(before);
91  if (mayAddOrRemove && oc.exists("remove-edges.isolated") && oc.getBool("remove-edges.isolated")) {
92  before = PROGRESS_BEGIN_TIME_MESSAGE("Finding isolated roads");
94  PROGRESS_TIME_MESSAGE(before);
95  }
96  if (mayAddOrRemove && oc.exists("keep-edges.components") && oc.getInt("keep-edges.components") > 0) {
97  before = PROGRESS_BEGIN_TIME_MESSAGE("Finding largest components");
98  const bool hasStops = myPTStopCont.size() > 0 && oc.exists("ptstop-output") && oc.isSet("ptstop-output");
99  myNodeCont.removeComponents(myDistrictCont, myEdgeCont, oc.getInt("keep-edges.components"), hasStops);
100  PROGRESS_TIME_MESSAGE(before);
101  }
102  if (mayAddOrRemove && oc.exists("keep-edges.postload") && oc.getBool("keep-edges.postload")) {
103  if (oc.isSet("keep-edges.explicit") || oc.isSet("keep-edges.input-file")) {
104  before = PROGRESS_BEGIN_TIME_MESSAGE("Removing unwished edges");
106  PROGRESS_TIME_MESSAGE(before);
107  }
108  }
109  // Processing pt stops and lines
110  if (oc.exists("ptstop-output") && oc.isSet("ptstop-output")) {
111  before = PROGRESS_BEGIN_TIME_MESSAGE("Processing public transport stops");
112  if (!(oc.exists("ptline-output") && oc.isSet("ptline-output"))
113  && !oc.getBool("ptstop-output.no-bidi")) {
115  }
117  PROGRESS_TIME_MESSAGE(before);
118  if (mayAddOrRemove && oc.exists("keep-edges.components") && oc.getInt("keep-edges.components") > 0) {
119  // post process rail components unless they have stops
121  }
122  }
123 
124  if (oc.exists("ptline-output") && oc.isSet("ptline-output")) {
125  before = PROGRESS_BEGIN_TIME_MESSAGE("Revising public transport stops based on pt lines");
127  PROGRESS_TIME_MESSAGE(before);
128  }
129 
130  if (oc.exists("ptline-output") && oc.isSet("ptline-output")) {
131  if (oc.exists("ptline-clean-up") && oc.getBool("ptline-clean-up")) {
132  before = PROGRESS_BEGIN_TIME_MESSAGE("Cleaning up public transport stops that are not served by any line");
134  PROGRESS_TIME_MESSAGE(before);
135  } else {
136  int numDeletedStops = myPTStopCont.cleanupDeleted(myEdgeCont);
137  if (numDeletedStops > 0) {
138  WRITE_WARNING("Removed " + toString(numDeletedStops) + " pt stops because they could not be assigned to the network");
139  }
140  }
141  }
142 
143  if (oc.exists("ptstop-output") && oc.isSet("ptstop-output") && !oc.getBool("ptstop-output.no-bidi")) {
144  before = PROGRESS_BEGIN_TIME_MESSAGE("Align pt stop id signs with corresponding edge id signs");
146  PROGRESS_TIME_MESSAGE(before);
147  }
148 
149  // analyze and fix railway topology
150  int numAddedBidi = 0;
151  if (oc.exists("railway.topology.all-bidi") && oc.getBool("railway.topology.all-bidi")) {
153  numAddedBidi = NBRailwayTopologyAnalyzer::makeAllBidi(*this);
154  } else if (oc.exists("railway.topology.repair") && oc.getBool("railway.topology.repair")) {
155  // correct railway angles for angle-based connectivity heuristic
157  oc.getFloat("geometry.min-radius"), false,
158  oc.getBool("geometry.min-radius.fix.railways"), true);
160  numAddedBidi = NBRailwayTopologyAnalyzer::repairTopology(*this);
161  }
162  if (numAddedBidi > 0) {
163  // update routes
165  }
166  if (oc.exists("railway.topology.direction-priority") && oc.getBool("railway.topology.direction-priority")) {
167  NBTurningDirectionsComputer::computeTurnDirections(myNodeCont, false); // recompute after new edges were added
169  } else if (oc.exists("railway.topology.extend-priority") && oc.getBool("railway.topology.extend-priority")) {
170  NBTurningDirectionsComputer::computeTurnDirections(myNodeCont, false); // recompute after new edges were added
172  }
173  if (oc.exists("railway.topology.output") && oc.isSet("railway.topology.output")) {
174  NBTurningDirectionsComputer::computeTurnDirections(myNodeCont, false); // recompute after new edges were added
176  }
177 
178 
179  if (mayAddOrRemove && oc.exists("edges.join-tram-dist") && oc.getFloat("edges.join-tram-dist") >= 0) {
180  // should come before joining junctions
181  before = PROGRESS_BEGIN_TIME_MESSAGE("Joining tram edges");
182  int numJoinedTramEdges = myEdgeCont.joinTramEdges(myDistrictCont, myPTStopCont, myPTLineCont, oc.getFloat("edges.join-tram-dist"));
183  PROGRESS_TIME_MESSAGE(before);
184  if (numJoinedTramEdges > 0) {
185  WRITE_MESSAGE(" Joined " + toString(numJoinedTramEdges) + " tram edges into roads.");
186  }
187  }
188  if (oc.getBool("junctions.join")
189  || (oc.exists("ramps.guess") && oc.getBool("ramps.guess"))
190  || oc.getBool("tls.guess.joining")
191  || (oc.exists("tls.guess-signals") && oc.getBool("tls.guess-signals"))) {
192  // preliminary geometry computations to determine the length of edges
193  // This depends on turning directions and sorting of edge list
194  // in case junctions are joined geometry computations have to be repeated
195  // preliminary roundabout computations to avoid damaging roundabouts via junctions.join or ramps.guess
201  if (oc.getBool("roundabouts.guess")) {
203  }
204  const std::set<EdgeSet>& roundabouts = myEdgeCont.getRoundabouts();
205  for (std::set<EdgeSet>::const_iterator it_round = roundabouts.begin();
206  it_round != roundabouts.end(); ++it_round) {
207  std::vector<std::string> nodeIDs;
208  for (EdgeSet::const_iterator it_edge = it_round->begin(); it_edge != it_round->end(); ++it_edge) {
209  nodeIDs.push_back((*it_edge)->getToNode()->getID());
210  }
211  myNodeCont.addJoinExclusion(nodeIDs);
212  }
214  } else if (myEdgeCont.hasGuessedRoundabouts() && oc.getBool("roundabouts.guess")) {
216  }
217  // join junctions (may create new "geometry"-nodes so it needs to come before removing these
218  if (mayAddOrRemove && oc.exists("junctions.join-exclude") && oc.isSet("junctions.join-exclude")) {
219  myNodeCont.addJoinExclusion(oc.getStringVector("junctions.join-exclude"));
220  }
222  if (mayAddOrRemove && oc.getBool("junctions.join")) {
223  before = PROGRESS_BEGIN_TIME_MESSAGE("Joining junction clusters");
224  numJoined += myNodeCont.joinJunctions(oc.getFloat("junctions.join-dist"), myDistrictCont, myEdgeCont, myTLLCont, myPTStopCont);
225  PROGRESS_TIME_MESSAGE(before);
226  }
227  if (numJoined > 0) {
228  WRITE_MESSAGE(" Joined " + toString(numJoined) + " junction cluster(s).");
229  }
230  if (mayAddOrRemove && oc.exists("junctions.join-same") && oc.getBool("junctions.join-same")) {
231  before = PROGRESS_BEGIN_TIME_MESSAGE("Joining junctions with identical coordinates");
233  PROGRESS_TIME_MESSAGE(before);
234  if (numJoined2 > 0) {
235  WRITE_MESSAGE(" Joined " + toString(numJoined2) + " junctions.");
236  }
237  }
238  //
239  if (mayAddOrRemove && oc.exists("join-lanes") && oc.getBool("join-lanes")) {
240  before = PROGRESS_BEGIN_TIME_MESSAGE("Joining lanes");
242  PROGRESS_TIME_MESSAGE(before);
243  WRITE_MESSAGE(" Joined lanes on " + toString(num) + " edges.");
244  }
245  //
246  if (mayAddOrRemove) {
247  const bool removeGeometryNodes = oc.exists("geometry.remove") && oc.getBool("geometry.remove");
248  before = PROGRESS_BEGIN_TIME_MESSAGE("Removing empty nodes" + std::string(removeGeometryNodes ? " and geometry nodes" : ""));
249  // removeUnwishedNodes needs turnDirections. @todo: try to call this less often
252  PROGRESS_TIME_MESSAGE(before);
253  WRITE_MESSAGE(" " + toString(numRemoved) + " nodes removed.");
254  }
255 
256  // MOVE TO ORIGIN
257  // compute new boundary after network modifications have taken place
258  Boundary boundary;
259  for (std::map<std::string, NBNode*>::const_iterator it = myNodeCont.begin(); it != myNodeCont.end(); ++it) {
260  boundary.add(it->second->getPosition());
261  }
262  for (std::map<std::string, NBEdge*>::const_iterator it = myEdgeCont.begin(); it != myEdgeCont.end(); ++it) {
263  boundary.add(it->second->getGeometry().getBoxBoundary());
264  }
265  geoConvHelper.setConvBoundary(boundary);
266 
267  if (!oc.getBool("offset.disable-normalization") && oc.isDefault("offset.x") && oc.isDefault("offset.y")) {
268  moveToOrigin(geoConvHelper, lefthand);
269  }
270  geoConvHelper.computeFinal(lefthand); // information needed for location element fixed at this point
271 
272  if (oc.exists("geometry.min-dist") && !oc.isDefault("geometry.min-dist")) {
273  before = PROGRESS_BEGIN_TIME_MESSAGE("Reducing geometries");
274  myEdgeCont.reduceGeometries(oc.getFloat("geometry.min-dist"));
275  PROGRESS_TIME_MESSAGE(before);
276  }
277  // @note: removing geometry can create similar edges so joinSimilarEdges must come afterwards
278  // @note: likewise splitting can destroy similarities so joinSimilarEdges must come before
279  if (mayAddOrRemove && oc.getBool("edges.join")) {
280  before = PROGRESS_BEGIN_TIME_MESSAGE("Joining similar edges");
281  const bool removeDuplicates = oc.exists("junctions.join-same") && oc.getBool("junctions.join-same");
283  PROGRESS_TIME_MESSAGE(before);
284  }
285  if (oc.getBool("opposites.guess")) {
286  PROGRESS_BEGIN_MESSAGE("guessing opposite direction edges");
289  }
290  //
291  if (mayAddOrRemove && oc.exists("geometry.split") && oc.getBool("geometry.split")) {
292  before = PROGRESS_BEGIN_TIME_MESSAGE("Splitting geometry edges");
294  PROGRESS_TIME_MESSAGE(before);
295  }
296  // turning direction
297  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing turning directions");
299  PROGRESS_TIME_MESSAGE(before);
300  // correct edge geometries to avoid overlap
301  if (oc.exists("geometry.avoid-overlap") && oc.getBool("geometry.avoid-overlap")) {
303  }
304 
305  // GUESS TLS POSITIONS
306  before = PROGRESS_BEGIN_TIME_MESSAGE("Assigning nodes to traffic lights");
307  if (oc.isSet("tls.set")) {
308  std::vector<std::string> tlControlledNodes = oc.getStringVector("tls.set");
310  for (std::vector<std::string>::const_iterator i = tlControlledNodes.begin(); i != tlControlledNodes.end(); ++i) {
311  NBNode* node = myNodeCont.retrieve(*i);
312  if (node == nullptr) {
313  WRITE_WARNING("Building a tl-logic for junction '" + *i + "' is not possible." + "\n The junction '" + *i + "' is not known.");
314  } else {
316  }
317  }
318  }
320  PROGRESS_TIME_MESSAGE(before);
321 
322  // guess ramps (after guessing tls because ramps should not be build at traffic lights)
323  const bool modifyRamps = mayAddOrRemove && (
324  (oc.exists("ramps.guess") && oc.getBool("ramps.guess"))
325  || (oc.exists("ramps.set") && oc.isSet("ramps.set")));
326  if (modifyRamps || (oc.exists("ramps.guess-acceleration-lanes") && oc.getBool("ramps.guess-acceleration-lanes"))) {
327  before = SysUtils::getCurrentMillis();
328  if (modifyRamps) {
329  PROGRESS_BEGIN_MESSAGE("Guessing and setting on-/off-ramps");
330  }
332  NBRampsComputer::computeRamps(*this, oc, mayAddOrRemove);
333  if (modifyRamps) {
334  PROGRESS_TIME_MESSAGE(before);
335  }
336  }
337  // guess bike lanes
338  int addedLanes = 0;
339  if (mayAddOrRemove && ((oc.getBool("bikelanes.guess") || oc.getBool("bikelanes.guess.from-permissions")))) {
340  const int bikelanes = myEdgeCont.guessSpecialLanes(SVC_BICYCLE, oc.getFloat("default.bikelane-width"),
341  oc.getFloat("bikelanes.guess.min-speed"),
342  oc.getFloat("bikelanes.guess.max-speed"),
343  oc.getBool("bikelanes.guess.from-permissions"),
344  "bikelanes.guess.exclude",
345  myTLLCont);
346  WRITE_MESSAGE("Guessed " + toString(bikelanes) + " bike lanes.");
347  addedLanes += bikelanes;
348  }
349 
350  // guess sidewalks
351  if (mayAddOrRemove && ((oc.getBool("sidewalks.guess") || oc.getBool("sidewalks.guess.from-permissions")))) {
352  const int sidewalks = myEdgeCont.guessSpecialLanes(SVC_PEDESTRIAN, oc.getFloat("default.sidewalk-width"),
353  oc.getFloat("sidewalks.guess.min-speed"),
354  oc.getFloat("sidewalks.guess.max-speed"),
355  oc.getBool("sidewalks.guess.from-permissions"),
356  "sidewalks.guess.exclude",
357  myTLLCont);
358  WRITE_MESSAGE("Guessed " + toString(sidewalks) + " sidewalks.");
359  addedLanes += sidewalks;
360  }
361  // re-adapt stop lanes after adding special lanes
362  if (oc.exists("ptstop-output") && oc.isSet("ptstop-output") && addedLanes > 0) {
364  }
365 
366  // check whether any not previously setable connections may be set now
368 
369  // remap ids if wished
370  int numChangedEdges = myEdgeCont.remapIDs(oc.getBool("numerical-ids"), oc.isSet("reserved-ids"), oc.getString("prefix"), myPTStopCont);
371  int numChangedNodes = myNodeCont.remapIDs(oc.getBool("numerical-ids"), oc.isSet("reserved-ids"), oc.getString("prefix"));
372  if (numChangedEdges + numChangedNodes > 0) {
373  WRITE_MESSAGE("Remapped " + toString(numChangedEdges) + " edge IDs and " + toString(numChangedNodes) + " node IDs.");
374  }
375 
376  //
377  if (oc.exists("geometry.max-angle")) {
379  DEG2RAD(oc.getFloat("geometry.max-angle")),
380  oc.getFloat("geometry.min-radius"),
381  oc.getBool("geometry.min-radius.fix"),
382  oc.getBool("geometry.min-radius.fix.railways"));
383  }
384 
385  // GEOMETRY COMPUTATION
386  //
387  before = PROGRESS_BEGIN_TIME_MESSAGE("Sorting nodes' edges");
389  PROGRESS_TIME_MESSAGE(before);
391  //
392  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing node shapes");
393  if (oc.exists("geometry.junction-mismatch-threshold")) {
394  myNodeCont.computeNodeShapes(oc.getFloat("geometry.junction-mismatch-threshold"));
395  } else {
397  }
398  PROGRESS_TIME_MESSAGE(before);
399  //
400  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing edge shapes");
401  myEdgeCont.computeEdgeShapes(oc.getBool("geometry.max-grade.fix") ? oc.getFloat("geometry.max-grade") / 100 : -1);
402  PROGRESS_TIME_MESSAGE(before);
403  // resort edges based on the node and edge shapes
406 
407  // APPLY SPEED MODIFICATIONS
408  if (oc.exists("speed.offset")) {
409  const double speedOffset = oc.getFloat("speed.offset");
410  const double speedFactor = oc.getFloat("speed.factor");
411  const double speedMin = oc.getFloat("speed.minimum");
412  if (speedOffset != 0 || speedFactor != 1 || speedMin > 0) {
413  before = PROGRESS_BEGIN_TIME_MESSAGE("Applying speed modifications");
414  for (const auto& it : myEdgeCont) {
415  NBEdge* const e = it.second;
416  for (int i = 0; i < e->getNumLanes(); i++) {
417  e->setSpeed(i, MAX2(e->getLaneSpeed(i) * speedFactor + speedOffset, speedMin));
418  }
419  }
420  PROGRESS_TIME_MESSAGE(before);
421  }
422  }
423 
424  // CONNECTIONS COMPUTATION
425  //
426  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing node types");
428  PROGRESS_TIME_MESSAGE(before);
429  //
430  myNetworkHaveCrossings = oc.getBool("walkingareas");
431  if (mayAddOrRemove && oc.getBool("crossings.guess")) {
432  myNetworkHaveCrossings = true;
433  int crossings = 0;
434  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
435  crossings += (*i).second->guessCrossings();
436  }
437  WRITE_MESSAGE("Guessed " + toString(crossings) + " pedestrian crossings.");
438  }
439  if (!myNetworkHaveCrossings) {
440  bool haveValidCrossings = false;
441  // recheck whether we had crossings in the input
442  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
443  if (i->second->getCrossings().size() > 0) {
444  myNetworkHaveCrossings = true;
445  haveValidCrossings = true;
446  break;
447  } else if (i->second->getCrossingsIncludingInvalid().size() > 0) {
448  myNetworkHaveCrossings = true;
449  }
450  }
451  if (myNetworkHaveCrossings && !haveValidCrossings) {
452  // initial crossings removed or invalidated, keep walkingareas
453  oc.resetWritable();
454  oc.set("walkingareas", "true");
455  }
456  }
457 
458  if (!mayAddOrRemove && myNetworkHaveCrossings) {
459  // crossings added via netedit
460  oc.resetWritable();
461  oc.set("no-internal-links", "false");
462  }
463 
464  //
465  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing priorities");
467  PROGRESS_TIME_MESSAGE(before);
468  //
469  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing approached edges");
470  myEdgeCont.computeEdge2Edges(oc.getBool("no-left-connections"));
471  PROGRESS_TIME_MESSAGE(before);
472  //
473  if (oc.getBool("roundabouts.guess")) {
474  before = PROGRESS_BEGIN_TIME_MESSAGE("Guessing and setting roundabouts");
475  const int numGuessed = myEdgeCont.guessRoundabouts();
476  if (numGuessed > 0) {
477  WRITE_MESSAGE(" Guessed " + toString(numGuessed) + " roundabout(s).");
478  }
479  PROGRESS_TIME_MESSAGE(before);
480  }
482  //
483  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing approaching lanes");
485  PROGRESS_TIME_MESSAGE(before);
486  //
487  before = PROGRESS_BEGIN_TIME_MESSAGE("Dividing of lanes on approached lanes");
490  PROGRESS_TIME_MESSAGE(before);
491  //
492  if (oc.getBool("fringe.guess")) {
493  before = PROGRESS_BEGIN_TIME_MESSAGE("Guessing Network fringe");
494  const int numGuessed = myNodeCont.guessFringe();
495  if (numGuessed > 0) {
496  WRITE_MESSAGE(" Guessed " + toString(numGuessed) + " fringe nodes.");
497  }
498  PROGRESS_TIME_MESSAGE(before);
499  }
500  //
501  before = PROGRESS_BEGIN_TIME_MESSAGE("Processing turnarounds");
502  if (!oc.getBool("no-turnarounds")) {
504  oc.getBool("no-turnarounds.tls"),
505  oc.getBool("no-turnarounds.fringe"),
506  oc.getBool("no-turnarounds.except-deadend"),
507  oc.getBool("no-turnarounds.except-turnlane"),
508  oc.getBool("no-turnarounds.geometry"));
509  } else {
510  myEdgeCont.appendTurnarounds(explicitTurnarounds, oc.getBool("no-turnarounds.tls"));
511  }
512  if (oc.exists("railway.topology.repair.stop-turn") && oc.getBool("railway.topology.repair.stop-turn")
513  && myPTStopCont.getStops().size() > 0) {
514  // allow direction reversal at all bidi-edges with stops
516  }
517  PROGRESS_TIME_MESSAGE(before);
518  //
519  before = PROGRESS_BEGIN_TIME_MESSAGE("Rechecking of lane endings");
521  PROGRESS_TIME_MESSAGE(before);
522 
523  if (myNetworkHaveCrossings && !oc.getBool("no-internal-links")) {
524  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
525  i->second->buildCrossingsAndWalkingAreas();
526  }
527  } else {
528  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
529  // needed by netedit if the last crossings was deleted from the network
530  // and walkingareas have been invalidated since the last call to compute()
531  i->second->discardWalkingareas();
532  }
533  if (oc.getBool("no-internal-links")) {
534  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
535  i->second->discardAllCrossings(false);
536  }
537  }
538  }
539  // join traffic lights (after building connections)
540  if (oc.getBool("tls.join")) {
541  before = PROGRESS_BEGIN_TIME_MESSAGE("Joining traffic light nodes");
542  myNodeCont.joinTLS(myTLLCont, oc.getFloat("tls.join-dist"));
543  PROGRESS_TIME_MESSAGE(before);
544  }
545 
546  // COMPUTING RIGHT-OF-WAY AND TRAFFIC LIGHT PROGRAMS
547  //
548  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing traffic light control information");
550  if (oc.exists("opendrive-files") && oc.isSet("opendrive-files")) {
552  }
553  PROGRESS_TIME_MESSAGE(before);
554  //
555  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing node logics");
557  PROGRESS_TIME_MESSAGE(before);
558 
559  //
560  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing traffic light logics");
561  std::pair<int, int> numbers = myTLLCont.computeLogics(oc);
562  PROGRESS_TIME_MESSAGE(before);
563  std::string progCount = "";
564  if (numbers.first != numbers.second) {
565  progCount = "(" + toString(numbers.second) + " programs) ";
566  }
567  WRITE_MESSAGE(" " + toString(numbers.first) + " traffic light(s) " + progCount + "computed.");
568 
569  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
570  (*i).second->sortOutgoingConnectionsByIndex();
571  }
572  // FINISHING INNER EDGES
573  if (!oc.getBool("no-internal-links")) {
574  before = PROGRESS_BEGIN_TIME_MESSAGE("Building inner edges");
575  // walking areas shall only be built if crossings are wished as well
576  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
577  (*i).second->buildInnerEdges();
578  }
579  PROGRESS_TIME_MESSAGE(before);
580  }
581  // PATCH NODE SHAPES
582  if (oc.getFloat("junctions.scurve-stretch") > 0) {
583  // @note: nodes have collected correction hints in buildInnerEdges()
584  before = PROGRESS_BEGIN_TIME_MESSAGE("stretching junctions to smooth geometries");
587  myEdgeCont.computeEdgeShapes(oc.getBool("geometry.max-grade.fix") ? oc.getFloat("geometry.max-grade") / 100 : -1);
588  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
589  (*i).second->buildInnerEdges();
590  }
591  PROGRESS_TIME_MESSAGE(before);
592  }
593  // compute lane-to-lane node logics (require traffic lights and inner edges to be done)
595 
596  // remove guessed traffic lights at junctions without conflicts (requires computeLogics2)
598 
599  // compute keepClear status (requires computeLogics2)
601 
602  //
603  if (oc.isSet("street-sign-output")) {
604  before = PROGRESS_BEGIN_TIME_MESSAGE("Generating street signs");
606  PROGRESS_TIME_MESSAGE(before);
607  }
608 
609 
610  if (lefthand != oc.getBool("flip-y-axis")) {
611  mirrorX();
612  };
613 
614  if (oc.exists("geometry.check-overlap") && oc.getFloat("geometry.check-overlap") > 0) {
615  before = PROGRESS_BEGIN_TIME_MESSAGE("Checking overlapping edges");
616  myEdgeCont.checkOverlap(oc.getFloat("geometry.check-overlap"), oc.getFloat("geometry.check-overlap.vertical-threshold"));
617  PROGRESS_TIME_MESSAGE(before);
618  }
619  if (geoConvHelper.getConvBoundary().getZRange() > 0 && oc.getFloat("geometry.max-grade") > 0) {
620  before = PROGRESS_BEGIN_TIME_MESSAGE("Checking edge grade");
621  // user input is in %
622  myEdgeCont.checkGrade(oc.getFloat("geometry.max-grade") / 100);
623  PROGRESS_TIME_MESSAGE(before);
624  }
625 
626  //find accesses for pt rail stops and add bidi-stops
627  if (oc.exists("ptstop-output") && oc.isSet("ptstop-output")) {
628  before = SysUtils::getCurrentMillis();
629  int numBidiStops = 0;
630  if (!oc.getBool("ptstop-output.no-bidi")) {
631  numBidiStops = myPTStopCont.generateBidiStops(myEdgeCont);
632  }
633  PROGRESS_BEGIN_MESSAGE("Find accesses for pt rail stops");
634  double maxRadius = oc.getFloat("railway.access-distance");
635  double accessFactor = oc.getFloat("railway.access-factor");
636  int maxCount = oc.getInt("railway.max-accesses");
637  myPTStopCont.findAccessEdgesForRailStops(myEdgeCont, maxRadius, maxCount, accessFactor);
638  PROGRESS_TIME_MESSAGE(before);
639  if (oc.exists("ptline-output") && oc.isSet("ptline-output")) {
640  if (numBidiStops > 0) {
642  }
644  // ensure that all turning lanes have sufficient permissions
646  }
647  }
648 
649  if (oc.exists("ignore-change-restrictions") && !oc.isDefault("ignore-change-restrictions")) {
650  SVCPermissions ignoring = parseVehicleClasses(oc.getStringVector("ignore-change-restrictions"));
652  }
653 
655  // report on very large networks
656  if (MAX2(geoConvHelper.getConvBoundary().xmax(), geoConvHelper.getConvBoundary().ymax()) > 1000000 ||
657  MIN2(geoConvHelper.getConvBoundary().xmin(), geoConvHelper.getConvBoundary().ymin()) < -1000000) {
658  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");
659  }
660 }
661 
662 
663 /*
664 void
665 NBNetBuilder::computeSingleNode(NBNode* node, OptionsCont& oc, const std::set<std::string>& explicitTurnarounds, bool mayAddOrRemove) {
666  // for a single node do the following:
667  // sortEdges
668  // computeLaneShapes
669  // computeNodeShapes
670  // computeEdgeShapes
671 }
672 */
673 
674 
675 void
676 NBNetBuilder::moveToOrigin(GeoConvHelper& geoConvHelper, bool lefthand) {
677  long before = PROGRESS_BEGIN_TIME_MESSAGE("Moving network to origin");
678  Boundary boundary = geoConvHelper.getConvBoundary();
679  const double x = -boundary.xmin();
680  const double y = -(lefthand ? boundary.ymax() : boundary.ymin());
681  //if (lefthand) {
682  // y = boundary.ymax();
683  //}
684  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
685  (*i).second->reshiftPosition(x, y);
686  }
687  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
688  (*i).second->reshiftPosition(x, y);
689  }
690  for (std::map<std::string, NBDistrict*>::const_iterator i = myDistrictCont.begin(); i != myDistrictCont.end(); ++i) {
691  (*i).second->reshiftPosition(x, y);
692  }
693  for (std::map<std::string, NBPTStop*>::const_iterator i = myPTStopCont.begin(); i != myPTStopCont.end(); ++i) {
694  (*i).second->reshiftPosition(x, y);
695  }
696  geoConvHelper.moveConvertedBy(x, y);
697  PROGRESS_TIME_MESSAGE(before);
698 }
699 
700 
701 void
703  // mirror the network along the X-axis
704  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
705  (*i).second->mirrorX();
706  }
707  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
708  (*i).second->mirrorX();
709  }
710  for (std::map<std::string, NBDistrict*>::const_iterator i = myDistrictCont.begin(); i != myDistrictCont.end(); ++i) {
711  (*i).second->mirrorX();
712  }
713  for (std::map<std::string, NBPTStop*>::const_iterator i = myPTStopCont.begin(); i != myPTStopCont.end(); ++i) {
714  (*i).second->mirrorX();
715  }
716 }
717 
718 
719 bool
720 NBNetBuilder::transformCoordinate(Position& from, bool includeInBoundary, GeoConvHelper* from_srs) {
721  Position orig(from);
722  bool ok = true;
724  && GeoConvHelper::getLoaded().usingGeoProjection()
725  && from_srs != nullptr
726  && from_srs->usingGeoProjection()
727  && *from_srs != GeoConvHelper::getLoaded()) {
728  from_srs->cartesian2geo(from);
729  ok &= GeoConvHelper::getLoaded().x2cartesian(from, false);
730  }
731  ok &= GeoConvHelper::getProcessing().x2cartesian(from, includeInBoundary);
732  if (ok) {
733  const NBHeightMapper& hm = NBHeightMapper::get();
734  if (hm.ready()) {
735  if (from_srs != nullptr && from_srs->usingGeoProjection()) {
736  from_srs->cartesian2geo(orig);
737  }
738  from.setz(hm.getZ(orig));
739  }
740  }
741  return ok;
742 }
743 
744 
745 bool
746 NBNetBuilder::transformCoordinates(PositionVector& from, bool includeInBoundary, GeoConvHelper* from_srs) {
747  const double maxLength = OptionsCont::getOptions().getFloat("geometry.max-segment-length");
748  if (maxLength > 0 && from.size() > 1) {
749  // transformation to cartesian coordinates must happen before we can check segment length
750  PositionVector copy = from;
751  for (int i = 0; i < (int) from.size(); i++) {
752  transformCoordinate(copy[i], false);
753  }
754  addGeometrySegments(from, copy, maxLength);
755  }
756  bool ok = true;
757  for (int i = 0; i < (int) from.size(); i++) {
758  ok = ok && transformCoordinate(from[i], includeInBoundary, from_srs);
759  }
760  return ok;
761 }
762 
763 int
764 NBNetBuilder::addGeometrySegments(PositionVector& from, const PositionVector& cartesian, const double maxLength) {
765  // check lengths and insert new points where needed (in the original
766  // coordinate system)
767  int inserted = 0;
768  for (int i = 0; i < (int)cartesian.size() - 1; i++) {
769  Position start = from[i + inserted];
770  Position end = from[i + inserted + 1];
771  double length = cartesian[i].distanceTo(cartesian[i + 1]);
772  const Position step = (end - start) * (maxLength / length);
773  int steps = 0;
774  while (length > maxLength) {
775  length -= maxLength;
776  steps++;
777  from.insert(from.begin() + i + inserted + 1, start + (step * steps));
778  inserted++;
779  }
780  }
781  return inserted;
782 }
783 
784 
785 bool
787  // see GNELoadThread::fillOptions
788  return OptionsCont::getOptions().exists("new");
789 }
790 
791 
792 /****************************************************************************/
#define DEG2RAD(x)
Definition: GeomHelper.h:35
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:282
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:280
#define PROGRESS_BEGIN_TIME_MESSAGE(msg)
Definition: MsgHandler.h:285
#define PROGRESS_TIME_MESSAGE(before)
Definition: MsgHandler.h:286
#define PROGRESS_DONE_MESSAGE()
Definition: MsgHandler.h:284
#define PROGRESS_BEGIN_MESSAGE(msg)
Definition: MsgHandler.h:283
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
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
TrafficLightType
T MIN2(T a, T b)
Definition: StdDefs.h:74
T MAX2(T a, T b)
Definition: StdDefs.h:80
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
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.
static GeoConvHelper & getLoaded()
the coordinate transformation that was loaded fron an input file
Definition: GeoConvHelper.h:89
static int getNumLoaded()
Definition: GeoConvHelper.h:93
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:927
void removeUnwishedEdges(NBDistrictCont &dc)
Removes unwished edges (not in keep-edges)
Definition: NBEdgeCont.cpp:732
const std::set< EdgeSet > getRoundabouts() const
Returns the determined roundabouts.
void computeEdge2Edges(bool noLeftMovers)
Computes for each edge the approached edges.
Definition: NBEdgeCont.cpp:814
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:806
void appendRailwayTurnarounds(const NBPTStopCont &sc)
Appends turnarounds to all bidiRail edges with stops.
Definition: NBEdgeCont.cpp:905
std::map< std::string, NBEdge * >::const_iterator end() const
Returns the pointer to the end of the stored edges.
Definition: NBEdgeCont.h:191
void updateAllChangeRestrictions(SVCPermissions ignoring)
modify all restrictions on lane changing for edges and connections
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:784
void recheckLanes()
Rechecks whether all lanes have a successor for each of the stored edges.
Definition: NBEdgeCont.cpp:830
void reduceGeometries(const double minDist)
Definition: NBEdgeCont.cpp:776
void splitGeometry(NBDistrictCont &dc, NBNodeCont &nc)
Splits edges into multiple if they have a complex geometry.
Definition: NBEdgeCont.cpp:749
void computeLanes2Edges()
Computes for each edge which lanes approach the next edges.
Definition: NBEdgeCont.cpp:822
int joinTramEdges(NBDistrictCont &dc, NBPTStopCont &sc, NBPTLineCont &lc, double maxDist)
join tram edges into adjacent lanes
void generateStreetSigns()
assigns street signs to edges based on toNode types
bool hasGuessedRoundabouts() const
Definition: NBEdgeCont.h:572
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
int guessSpecialLanes(SUMOVehicleClass svc, double width, double minSpeed, double maxSpeed, bool fromPermissions, const std::string &excludeOpt, NBTrafficLightLogicCont &tlc)
add sidwalks to edges within the given limits or permissions and return the number of edges affected
void appendTurnarounds(bool noTLSControlled, bool noFringe, bool onlyDeadends, bool onlyTurnlane, bool noGeometryLike)
Appends turnarounds to all edges stored in the container.
Definition: NBEdgeCont.cpp:889
void computeLaneShapes()
Computes the shapes of all lanes of all edges stored in the container.
Definition: NBEdgeCont.cpp:951
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
The representation of a single edge during network building.
Definition: NBEdge.h:91
double getLaneSpeed(int lane) const
get lane speed
Definition: NBEdge.cpp:2089
void setSpeed(int lane, double speed)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3953
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:515
static void setDefaultConnectionLength(double length)
Definition: NBEdge.h:385
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
void removeRailComponents(NBDistrictCont &dc, NBEdgeCont &ec, NBPTStopCont &sc)
remove rail components after ptstops are built
Definition: NBNodeCont.cpp:415
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:536
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:657
int joinLoadedClusters(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
Joins loaded junction clusters (see NIXMLNodesHandler)
Definition: NBNodeCont.cpp:713
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:456
void computeLogics2(const NBEdgeCont &ec, OptionsCont &oc)
compute right-of-way logic for all lane-to-lane connections
void joinSimilarEdges(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc, bool removeDuplicates)
Joins edges connecting the same nodes.
Definition: NBNodeCont.cpp:190
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:241
void setAsTLControlled(NBNode *node, NBTrafficLightLogicCont &tlc, TrafficLightType type, std::string id="")
Sets the given node as being controlled by a tls.
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:738
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:856
int remapIDs(bool numericaIDs, bool reservedIDs, const std::string &prefix)
remap node IDs accoring to options –numerical-ids and –reserved-ids
void removeComponents(NBDistrictCont &dc, NBEdgeCont &ec, const int numKeep, bool hasPTStops)
Checks the network for weak connectivity and removes all but the largest components....
Definition: NBNodeCont.cpp:329
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.
void fixPermissions()
ensure that all turn lanes have sufficient permissions
void process(NBEdgeCont &ec, NBPTStopCont &sc, bool routeOnly=false)
std::set< std::string > & getServedPTStops()
void removeInvalidEdges(const NBEdgeCont &ec)
filter out edges that were removed due to –geometry.remove
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:65
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:54
int size() const
Returns the number of pt stops stored in this container.
Definition: NBPTStopCont.h:47
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:61
static int repairTopology(NBNetBuilder &nb)
static void analyzeTopology(NBNetBuilder &nb)
Computes highway on-/off-ramps (if wished)
static int makeAllBidi(NBNetBuilder &nb)
static void extendDirectionPriority(NBNetBuilder &nb, bool fromUniDir)
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:1062
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, LaneSpreadFunction defaultSpreadType)
Sets the default values.
Definition: NBTypeCont.cpp:177
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:37
void setz(double z)
set position z
Definition: Position.h:80
A list of positions.
static StringBijection< LaneSpreadFunction > LaneSpreadFunctions
lane spread functions
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