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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
19 // Instance responsible for building networks
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
29 #include <fstream>
30 #include "NBNetBuilder.h"
31 #include "NBNodeCont.h"
32 #include "NBEdgeCont.h"
34 #include "NBDistrictCont.h"
35 #include "NBDistrict.h"
36 #include "NBRequest.h"
37 #include "NBTypeCont.h"
43 #include <utils/common/SysUtils.h>
44 #include <utils/common/ToString.h>
46 #include "NBAlgorithms.h"
47 #include "NBAlgorithms_Ramps.h"
48 #include "NBAlgorithms_Railway.h"
49 #include "NBHeightMapper.h"
50 
51 
52 // ===========================================================================
53 // method definitions
54 // ===========================================================================
56  myEdgeCont(myTypeCont),
57  myNetworkHaveCrossings(false) {
58 }
59 
60 
62 
63 
64 void
66  // apply options to type control
67  myTypeCont.setDefaults(oc.getInt("default.lanenumber"), oc.getFloat("default.lanewidth"), oc.getFloat("default.speed"),
68  oc.getInt("default.priority"), parseVehicleClasses("", oc.getString("default.disallow")));
69  // apply options to edge control
71  // apply options to traffic light logics control
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"))) {
112  }
114  PROGRESS_TIME_MESSAGE(before);
115  }
116 
117  if (oc.exists("ptline-output") && oc.isSet("ptline-output")) {
118  before = PROGRESS_BEGIN_TIME_MESSAGE("Revising public transport stops based on pt lines");
120  PROGRESS_TIME_MESSAGE(before);
121  }
122 
123  if (oc.exists("ptline-output") && oc.isSet("ptline-output")) {
124  if (oc.exists("ptline-clean-up") && oc.getBool("ptline-clean-up")) {
125  before = PROGRESS_BEGIN_TIME_MESSAGE("Cleaning up public transport stops that are not served by any line");
127  PROGRESS_TIME_MESSAGE(before);
128  } else {
129  int numDeletedStops = myPTStopCont.cleanupDeleted(myEdgeCont);
130  if (numDeletedStops > 0) {
131  WRITE_WARNING("Removed " + toString(numDeletedStops) + " pt stops because they could not be assigned to the network");
132  }
133  }
134  }
135 
136  if (oc.exists("ptstop-output") && oc.isSet("ptstop-output")) {
137  before = PROGRESS_BEGIN_TIME_MESSAGE("Align pt stop id signs with corresponding edge id signs");
139  PROGRESS_TIME_MESSAGE(before);
140  }
141 
142  // analyse and fix railway topology
143  if (oc.exists("railway.topology.all-bidi") && oc.getBool("railway.topology.all-bidi")) {
146  } else if (oc.exists("railway.topology.repair") && oc.getBool("railway.topology.repair")) {
147  // correct railway angles for angle-based connectivity heuristic
149  oc.getFloat("geometry.min-radius"), false,
150  oc.getBool("geometry.min-radius.fix.railways"), true);
153  }
154  if (oc.exists("railway.topology.output") && oc.isSet("railway.topology.output")) {
155  NBTurningDirectionsComputer::computeTurnDirections(myNodeCont, false); // recompute after new edges were added
157  }
158 
159  if (oc.getBool("junctions.join") || (oc.exists("ramps.guess") && oc.getBool("ramps.guess")) || oc.getBool("tls.guess.joining")) {
160  // preliminary geometry computations to determine the length of edges
161  // This depends on turning directions and sorting of edge list
162  // in case junctions are joined geometry computations have to be repeated
163  // preliminary roundabout computations to avoid damaging roundabouts via junctions.join or ramps.guess
169  if (oc.getBool("roundabouts.guess")) {
171  }
172  const std::set<EdgeSet>& roundabouts = myEdgeCont.getRoundabouts();
173  for (std::set<EdgeSet>::const_iterator it_round = roundabouts.begin();
174  it_round != roundabouts.end(); ++it_round) {
175  std::vector<std::string> nodeIDs;
176  for (EdgeSet::const_iterator it_edge = it_round->begin(); it_edge != it_round->end(); ++it_edge) {
177  nodeIDs.push_back((*it_edge)->getToNode()->getID());
178  }
179  myNodeCont.addJoinExclusion(nodeIDs);
180  }
182  }
183  // join junctions (may create new "geometry"-nodes so it needs to come before removing these
184  if (mayAddOrRemove && oc.exists("junctions.join-exclude") && oc.isSet("junctions.join-exclude")) {
185  myNodeCont.addJoinExclusion(oc.getStringVector("junctions.join-exclude"));
186  }
188  if (mayAddOrRemove && oc.getBool("junctions.join")) {
189  before = PROGRESS_BEGIN_TIME_MESSAGE("Joining junction clusters");
190  numJoined += myNodeCont.joinJunctions(oc.getFloat("junctions.join-dist"), myDistrictCont, myEdgeCont, myTLLCont, myPTStopCont);
191  PROGRESS_TIME_MESSAGE(before);
192  }
193  if (oc.getBool("junctions.join") || (oc.exists("ramps.guess") && oc.getBool("ramps.guess"))) {
194  // reset geometry to avoid influencing subsequent steps (ramps.guess)
196  }
197  if (numJoined > 0) {
198  // bit of a misnomer since we're already done
199  WRITE_MESSAGE(" Joined " + toString(numJoined) + " junction cluster(s).");
200  }
201  //
202  if (mayAddOrRemove && oc.exists("join-lanes") && oc.getBool("join-lanes")) {
203  before = PROGRESS_BEGIN_TIME_MESSAGE("Joining lanes");
205  PROGRESS_TIME_MESSAGE(before);
206  WRITE_MESSAGE(" Joined lanes on " + toString(num) + " edges.");
207  }
208  //
209  if (mayAddOrRemove) {
210  int no = 0;
211  const bool removeGeometryNodes = oc.exists("geometry.remove") && oc.getBool("geometry.remove");
212  before = PROGRESS_BEGIN_TIME_MESSAGE("Removing empty nodes" + std::string(removeGeometryNodes ? " and geometry nodes" : ""));
213  // removeUnwishedNodes needs turnDirections. @todo: try to call this less often
216  PROGRESS_TIME_MESSAGE(before);
217  WRITE_MESSAGE(" " + toString(no) + " nodes removed.");
218  }
219 
220  // MOVE TO ORIGIN
221  // compute new boundary after network modifications have taken place
222  Boundary boundary;
223  for (std::map<std::string, NBNode*>::const_iterator it = myNodeCont.begin(); it != myNodeCont.end(); ++it) {
224  boundary.add(it->second->getPosition());
225  }
226  for (std::map<std::string, NBEdge*>::const_iterator it = myEdgeCont.begin(); it != myEdgeCont.end(); ++it) {
227  boundary.add(it->second->getGeometry().getBoxBoundary());
228  }
229  geoConvHelper.setConvBoundary(boundary);
230 
231  if (!oc.getBool("offset.disable-normalization") && oc.isDefault("offset.x") && oc.isDefault("offset.y")) {
232  moveToOrigin(geoConvHelper, lefthand);
233  }
234  geoConvHelper.computeFinal(lefthand); // information needed for location element fixed at this point
235 
236  if (oc.exists("geometry.min-dist") && !oc.isDefault("geometry.min-dist")) {
237  before = PROGRESS_BEGIN_TIME_MESSAGE("Reducing geometries");
238  myEdgeCont.reduceGeometries(oc.getFloat("geometry.min-dist"));
239  PROGRESS_TIME_MESSAGE(before);
240  }
241  // @note: removing geometry can create similar edges so joinSimilarEdges must come afterwards
242  // @note: likewise splitting can destroy similarities so joinSimilarEdges must come before
243  if (mayAddOrRemove && oc.getBool("edges.join")) {
244  before = PROGRESS_BEGIN_TIME_MESSAGE("Joining similar edges");
246  PROGRESS_TIME_MESSAGE(before);
247  }
248  if (oc.getBool("opposites.guess")) {
249  PROGRESS_BEGIN_MESSAGE("guessing opposite direction edges");
252  }
253  //
254  if (mayAddOrRemove && oc.exists("geometry.split") && oc.getBool("geometry.split")) {
255  before = PROGRESS_BEGIN_TIME_MESSAGE("Splitting geometry edges");
257  PROGRESS_TIME_MESSAGE(before);
258  }
259  // turning direction
260  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing turning directions");
262  PROGRESS_TIME_MESSAGE(before);
263  // correct edge geometries to avoid overlap
264  if (oc.exists("geometry.avoid-overlap") && oc.getBool("geometry.avoid-overlap")) {
266  }
267 
268  // GUESS TLS POSITIONS
269  before = PROGRESS_BEGIN_TIME_MESSAGE("Assigning nodes to traffic lights");
270  if (oc.isSet("tls.set")) {
271  std::vector<std::string> tlControlledNodes = oc.getStringVector("tls.set");
273  for (std::vector<std::string>::const_iterator i = tlControlledNodes.begin(); i != tlControlledNodes.end(); ++i) {
274  NBNode* node = myNodeCont.retrieve(*i);
275  if (node == nullptr) {
276  WRITE_WARNING("Building a tl-logic for junction '" + *i + "' is not possible." + "\n The junction '" + *i + "' is not known.");
277  } else {
279  }
280  }
281  }
283  PROGRESS_TIME_MESSAGE(before);
284 
285  // guess ramps (after guessing tls because ramps should not be build at traffic lights)
286  if (mayAddOrRemove) {
287  const bool modifyRamps = (oc.exists("ramps.guess") && oc.getBool("ramps.guess"))
288  || (oc.exists("ramps.set") && oc.isSet("ramps.set"));
289  if (modifyRamps
290  || (oc.exists("ramps.guess-acceleration-lanes") && oc.getBool("ramps.guess-acceleration-lanes"))) {
291  before = SysUtils::getCurrentMillis();
292  if (modifyRamps) {
293  PROGRESS_BEGIN_MESSAGE("Guessing and setting on-/off-ramps");
294  }
297  if (modifyRamps) {
298  PROGRESS_TIME_MESSAGE(before);
299  }
300  }
301  }
302  // guess bike lanes
303  if (mayAddOrRemove && ((oc.getBool("bikelanes.guess") || oc.getBool("bikelanes.guess.from-permissions")))) {
304  const int bikelanes = myEdgeCont.guessSpecialLanes(SVC_BICYCLE, oc.getFloat("default.bikelane-width"),
305  oc.getFloat("bikelanes.guess.min-speed"),
306  oc.getFloat("bikelanes.guess.max-speed"),
307  oc.getBool("bikelanes.guess.from-permissions"),
308  "bikelanes.guess.exclude");
309  WRITE_MESSAGE("Guessed " + toString(bikelanes) + " bike lanes.");
310  }
311 
312  // guess sidewalks
313  if (mayAddOrRemove && ((oc.getBool("sidewalks.guess") || oc.getBool("sidewalks.guess.from-permissions")))) {
314  const int sidewalks = myEdgeCont.guessSpecialLanes(SVC_PEDESTRIAN, oc.getFloat("default.sidewalk-width"),
315  oc.getFloat("sidewalks.guess.min-speed"),
316  oc.getFloat("sidewalks.guess.max-speed"),
317  oc.getBool("sidewalks.guess.from-permissions"),
318  "sidewalks.guess.exclude");
319  WRITE_MESSAGE("Guessed " + toString(sidewalks) + " sidewalks.");
320  }
321 
322  // check whether any not previously setable connections may be set now
324 
325  // remap ids if wished
326  int numChangedEdges = myEdgeCont.remapIDs(oc.getBool("numerical-ids"), oc.isSet("reserved-ids"), oc.getString("prefix"), myPTStopCont);
327  int numChangedNodes = myNodeCont.remapIDs(oc.getBool("numerical-ids"), oc.isSet("reserved-ids"), oc.getString("prefix"));
328  if (numChangedEdges + numChangedNodes > 0) {
329  WRITE_MESSAGE("Remapped " + toString(numChangedEdges) + " edge IDs and " + toString(numChangedNodes) + " node IDs.");
330  }
331 
332  //
333  if (oc.exists("geometry.max-angle")) {
335  DEG2RAD(oc.getFloat("geometry.max-angle")),
336  oc.getFloat("geometry.min-radius"),
337  oc.getBool("geometry.min-radius.fix"),
338  oc.getBool("geometry.min-radius.fix.railways"));
339  }
340 
341  // GEOMETRY COMPUTATION
342  //
343  before = PROGRESS_BEGIN_TIME_MESSAGE("Sorting nodes' edges");
345  PROGRESS_TIME_MESSAGE(before);
347  //
348  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing node shapes");
349  if (oc.exists("geometry.junction-mismatch-threshold")) {
350  myNodeCont.computeNodeShapes(oc.getFloat("geometry.junction-mismatch-threshold"));
351  } else {
353  }
354  PROGRESS_TIME_MESSAGE(before);
355  //
356  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing edge shapes");
357  myEdgeCont.computeEdgeShapes(oc.getBool("geometry.max-grade.fix") ? oc.getFloat("geometry.max-grade") / 100 : -1);
358  PROGRESS_TIME_MESSAGE(before);
359  // resort edges based on the node and edge shapes
362 
363  // APPLY SPEED MODIFICATIONS
364  if (oc.exists("speed.offset")) {
365  const double speedOffset = oc.getFloat("speed.offset");
366  const double speedFactor = oc.getFloat("speed.factor");
367  const double speedMin = oc.getFloat("speed.minimum");
368  if (speedOffset != 0 || speedFactor != 1 || speedMin > 0) {
369  before = PROGRESS_BEGIN_TIME_MESSAGE("Applying speed modifications");
370  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
371  (*i).second->setSpeed(-1, MAX2((*i).second->getSpeed() * speedFactor + speedOffset, speedMin));
372  }
373  PROGRESS_TIME_MESSAGE(before);
374  }
375  }
376 
377  // CONNECTIONS COMPUTATION
378  //
379  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing node types");
381  PROGRESS_TIME_MESSAGE(before);
382  //
383  myNetworkHaveCrossings = oc.getBool("walkingareas");
384  if (mayAddOrRemove && oc.getBool("crossings.guess")) {
385  myNetworkHaveCrossings = true;
386  int crossings = 0;
387  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
388  crossings += (*i).second->guessCrossings();
389  }
390  WRITE_MESSAGE("Guessed " + toString(crossings) + " pedestrian crossings.");
391  }
392  if (!myNetworkHaveCrossings) {
393  // recheck whether we had crossings in the input
394  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
395  if (i->second->getCrossingsIncludingInvalid().size() > 0) {
396  myNetworkHaveCrossings = true;
397  break;
398  }
399  }
400  }
401 
402  if (!mayAddOrRemove && myNetworkHaveCrossings) {
403  // crossings added via netedit
404  oc.resetWritable();
405  oc.set("no-internal-links", "false");
406  }
407 
408  //
409  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing priorities");
411  PROGRESS_TIME_MESSAGE(before);
412  //
413  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing approached edges");
414  myEdgeCont.computeEdge2Edges(oc.getBool("no-left-connections"));
415  PROGRESS_TIME_MESSAGE(before);
416  //
417  if (oc.getBool("roundabouts.guess")) {
418  before = PROGRESS_BEGIN_TIME_MESSAGE("Guessing and setting roundabouts");
419  const int numGuessed = myEdgeCont.guessRoundabouts();
420  if (numGuessed > 0) {
421  WRITE_MESSAGE(" Guessed " + toString(numGuessed) + " roundabout(s).");
422  }
423  PROGRESS_TIME_MESSAGE(before);
424  }
426  //
427  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing approaching lanes");
429  PROGRESS_TIME_MESSAGE(before);
430  //
431  before = PROGRESS_BEGIN_TIME_MESSAGE("Dividing of lanes on approached lanes");
434  PROGRESS_TIME_MESSAGE(before);
435  //
436  before = PROGRESS_BEGIN_TIME_MESSAGE("Processing turnarounds");
437  if (!oc.getBool("no-turnarounds")) {
438  myEdgeCont.appendTurnarounds(oc.getBool("no-turnarounds.tls"), oc.getBool("no-turnarounds.except-deadend"), oc.getBool("no-turnarounds.geometry"));
439  } else {
440  myEdgeCont.appendTurnarounds(explicitTurnarounds, oc.getBool("no-turnarounds.tls"));
441  }
442  if (oc.exists("railway.topology.repair") && oc.getBool("railway.topology.repair")
443  && myPTStopCont.getStops().size() > 0) {
444  // allow direction reversal at all bidi-edges with stops
446  }
447  PROGRESS_TIME_MESSAGE(before);
448  //
449  before = PROGRESS_BEGIN_TIME_MESSAGE("Rechecking of lane endings");
451  PROGRESS_TIME_MESSAGE(before);
452 
453  if (myNetworkHaveCrossings && !oc.getBool("no-internal-links")) {
454  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
455  i->second->buildCrossingsAndWalkingAreas();
456  }
457  } else {
458  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
459  // needed by netedit if the last crossings was deleted from the network
460  // and walkingareas have been invalidated since the last call to compute()
461  i->second->discardWalkingareas();
462  }
463  if (oc.getBool("no-internal-links")) {
464  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
465  i->second->discardAllCrossings(false);
466  }
467  }
468  }
469  // join traffic lights (after building connections)
470  if (oc.getBool("tls.join")) {
471  before = PROGRESS_BEGIN_TIME_MESSAGE("Joining traffic light nodes");
472  myNodeCont.joinTLS(myTLLCont, oc.getFloat("tls.join-dist"));
473  PROGRESS_TIME_MESSAGE(before);
474  }
475 
476  // COMPUTING RIGHT-OF-WAY AND TRAFFIC LIGHT PROGRAMS
477  //
478  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing traffic light control information");
480  PROGRESS_TIME_MESSAGE(before);
481  //
482  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing node logics");
484  PROGRESS_TIME_MESSAGE(before);
485  //
486  before = PROGRESS_BEGIN_TIME_MESSAGE("Computing traffic light logics");
487  std::pair<int, int> numbers = myTLLCont.computeLogics(oc);
488  PROGRESS_TIME_MESSAGE(before);
489  std::string progCount = "";
490  if (numbers.first != numbers.second) {
491  progCount = "(" + toString(numbers.second) + " programs) ";
492  }
493  WRITE_MESSAGE(" " + toString(numbers.first) + " traffic light(s) " + progCount + "computed.");
494  //
495  if (oc.isSet("street-sign-output")) {
496  before = PROGRESS_BEGIN_TIME_MESSAGE("Generating street signs");
498  PROGRESS_TIME_MESSAGE(before);
499  }
500 
501  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
502  (*i).second->sortOutgoingConnectionsByIndex();
503  }
504  // FINISHING INNER EDGES
505  if (!oc.getBool("no-internal-links")) {
506  before = PROGRESS_BEGIN_TIME_MESSAGE("Building inner edges");
507  // walking areas shall only be built if crossings are wished as well
508  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
509  (*i).second->buildInnerEdges();
510  }
511  PROGRESS_TIME_MESSAGE(before);
512  }
513  // PATCH NODE SHAPES
514  if (oc.getFloat("junctions.scurve-stretch") > 0) {
515  // @note: nodes have collected correction hints in buildInnerEdges()
516  before = PROGRESS_BEGIN_TIME_MESSAGE("stretching junctions to smooth geometries");
519  myEdgeCont.computeEdgeShapes(oc.getBool("geometry.max-grade.fix") ? oc.getFloat("geometry.max-grade") / 100 : -1);
520  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
521  (*i).second->buildInnerEdges();
522  }
523  PROGRESS_TIME_MESSAGE(before);
524  }
525  // compute lane-to-lane node logics (require traffic lights and inner edges to be done)
527 
528  if (lefthand) {
529  mirrorX();
530  };
531 
532  if (oc.exists("geometry.check-overlap") && oc.getFloat("geometry.check-overlap") > 0) {
533  before = PROGRESS_BEGIN_TIME_MESSAGE("Checking overlapping edges");
534  myEdgeCont.checkOverlap(oc.getFloat("geometry.check-overlap"), oc.getFloat("geometry.check-overlap.vertical-threshold"));
535  PROGRESS_TIME_MESSAGE(before);
536  }
537  if (geoConvHelper.getConvBoundary().getZRange() > 0 && oc.getFloat("geometry.max-grade") > 0) {
538  before = PROGRESS_BEGIN_TIME_MESSAGE("Checking edge grade");
539  // user input is in %
540  myEdgeCont.checkGrade(oc.getFloat("geometry.max-grade") / 100);
541  PROGRESS_TIME_MESSAGE(before);
542  }
543 
544  //find accesses for pt rail stops and add bidi-stops
545  if (oc.exists("ptstop-output") && oc.isSet("ptstop-output")) {
546  before = SysUtils::getCurrentMillis();
547  const int numBidiStops = myPTStopCont.generateBidiStops(myEdgeCont);
548  PROGRESS_BEGIN_MESSAGE("Find accesses for pt rail stops");
549  double maxRadius = oc.getFloat("railway.access-distance");
550  double accessFactor = oc.getFloat("railway.access-factor");
551  int maxCount = oc.getInt("railway.max-accesses");
552  myPTStopCont.findAccessEdgesForRailStops(myEdgeCont, maxRadius, maxCount, accessFactor);
553  PROGRESS_TIME_MESSAGE(before);
554  if (numBidiStops > 0) {
555  if (oc.exists("ptline-output") && oc.isSet("ptline-output")) {
557  }
558  }
559  }
560 
561  // report
562  WRITE_MESSAGE("-----------------------------------------------------");
563  WRITE_MESSAGE("Summary:");
565  WRITE_MESSAGE(" Network boundaries:");
566  WRITE_MESSAGE(" Original boundary : " + toString(geoConvHelper.getOrigBoundary()));
567  WRITE_MESSAGE(" Applied offset : " + toString(geoConvHelper.getOffsetBase()));
568  WRITE_MESSAGE(" Converted boundary : " + toString(geoConvHelper.getConvBoundary()));
569  WRITE_MESSAGE("-----------------------------------------------------");
571  // report on very large networks
572  if (MAX2(geoConvHelper.getConvBoundary().xmax(), geoConvHelper.getConvBoundary().ymax()) > 1000000 ||
573  MIN2(geoConvHelper.getConvBoundary().xmin(), geoConvHelper.getConvBoundary().ymin()) < -1000000) {
574  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");
575  }
576 }
577 
578 
579 /*
580 void
581 NBNetBuilder::computeSingleNode(NBNode* node, OptionsCont& oc, const std::set<std::string>& explicitTurnarounds, bool mayAddOrRemove) {
582  // for a single node do the following:
583  // sortEdges
584  // computeLaneShapes
585  // computeNodeShapes
586  // computeEdgeShapes
587 }
588 */
589 
590 
591 void
592 NBNetBuilder::moveToOrigin(GeoConvHelper& geoConvHelper, bool lefthand) {
593  long before = PROGRESS_BEGIN_TIME_MESSAGE("Moving network to origin");
594  Boundary boundary = geoConvHelper.getConvBoundary();
595  const double x = -boundary.xmin();
596  const double y = -(lefthand ? boundary.ymax() : boundary.ymin());
597  //if (lefthand) {
598  // y = boundary.ymax();
599  //}
600  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
601  (*i).second->reshiftPosition(x, y);
602  }
603  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
604  (*i).second->reshiftPosition(x, y);
605  }
606  for (std::map<std::string, NBDistrict*>::const_iterator i = myDistrictCont.begin(); i != myDistrictCont.end(); ++i) {
607  (*i).second->reshiftPosition(x, y);
608  }
609  for (std::map<std::string, NBPTStop*>::const_iterator i = myPTStopCont.begin(); i != myPTStopCont.end(); ++i) {
610  (*i).second->reshiftPosition(x, y);
611  }
612  geoConvHelper.moveConvertedBy(x, y);
613  PROGRESS_TIME_MESSAGE(before);
614 }
615 
616 
617 void
619  // mirror the network along the X-axis
620  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
621  (*i).second->mirrorX();
622  }
623  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
624  (*i).second->mirrorX();
625  }
626  for (std::map<std::string, NBDistrict*>::const_iterator i = myDistrictCont.begin(); i != myDistrictCont.end(); ++i) {
627  (*i).second->mirrorX();
628  }
629 }
630 
631 
632 bool
633 NBNetBuilder::transformCoordinate(Position& from, bool includeInBoundary, GeoConvHelper* from_srs) {
634  Position orig(from);
635  bool ok = true;
637  && GeoConvHelper::getLoaded().usingGeoProjection()
638  && from_srs != nullptr
639  && from_srs->usingGeoProjection()
640  && *from_srs != GeoConvHelper::getLoaded()) {
641  from_srs->cartesian2geo(from);
642  ok &= GeoConvHelper::getLoaded().x2cartesian(from, false);
643  }
644  ok &= GeoConvHelper::getProcessing().x2cartesian(from, includeInBoundary);
645  if (ok) {
646  const NBHeightMapper& hm = NBHeightMapper::get();
647  if (hm.ready()) {
648  if (from_srs != nullptr && from_srs->usingGeoProjection()) {
649  from_srs->cartesian2geo(orig);
650  }
651  double z = hm.getZ(orig);
652  from = Position(from.x(), from.y(), z);
653  }
654  }
655  return ok;
656 }
657 
658 
659 bool
660 NBNetBuilder::transformCoordinates(PositionVector& from, bool includeInBoundary, GeoConvHelper* from_srs) {
661  const double maxLength = OptionsCont::getOptions().getFloat("geometry.max-segment-length");
662  if (maxLength > 0 && from.size() > 1) {
663  // transformation to cartesian coordinates must happen before we can check segment length
664  PositionVector copy = from;
665  for (int i = 0; i < (int) from.size(); i++) {
666  transformCoordinate(copy[i], false);
667  }
668  addGeometrySegments(from, copy, maxLength);
669  }
670  bool ok = true;
671  for (int i = 0; i < (int) from.size(); i++) {
672  ok = ok && transformCoordinate(from[i], includeInBoundary, from_srs);
673  }
674  return ok;
675 }
676 
677 int
678 NBNetBuilder::addGeometrySegments(PositionVector& from, const PositionVector& cartesian, const double maxLength) {
679  // check lengths and insert new points where needed (in the original
680  // coordinate system)
681  int inserted = 0;
682  for (int i = 0; i < (int)cartesian.size() - 1; i++) {
683  Position start = from[i + inserted];
684  Position end = from[i + inserted + 1];
685  double length = cartesian[i].distanceTo(cartesian[i + 1]);
686  const Position step = (end - start) * (maxLength / length);
687  int steps = 0;
688  while (length > maxLength) {
689  length -= maxLength;
690  steps++;
691  from.insert(from.begin() + i + inserted + 1, start + (step * steps));
692  inserted++;
693  }
694  }
695  return inserted;
696 }
697 
698 
699 bool
701  // see GNELoadThread::fillOptions
702  return OptionsCont::getOptions().exists("new");
703 }
704 
705 
706 /****************************************************************************/
NBNodeCont::removeUnwishedNodes
int removeUnwishedNodes(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc, NBPTStopCont &sc, NBPTLineCont &lc, NBParkingCont &pc, bool removeGeometryNodes)
Removes "unwished" nodes.
Definition: NBNodeCont.cpp:369
OptionsCont::isSet
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
Definition: OptionsCont.cpp:135
NBNodeTypeComputer::validateRailCrossings
static void validateRailCrossings(NBNodeCont &nc, NBTrafficLightLogicCont &tlc)
Checks rail_crossing for validity.
Definition: NBAlgorithms.cpp:236
NBHeightMapper.h
SVC_PEDESTRIAN
@ SVC_PEDESTRIAN
pedestrian
Definition: SUMOVehicleClass.h:156
OptionsCont::getInt
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
Definition: OptionsCont.cpp:215
ToString.h
Boundary::getZRange
double getZRange() const
Returns the elevation range of the boundary (z-axis)
Definition: Boundary.cpp:166
MIN2
T MIN2(T a, T b)
Definition: StdDefs.h:73
NBNodeCont::computeNodeShapes
void computeNodeShapes(double mismatchThreshold=-1)
Compute the junction shape for this node.
Definition: NBNodeCont.cpp:1709
NBRailwayTopologyAnalyzer::makeAllBidi
static void makeAllBidi(NBNetBuilder &nb)
Definition: NBAlgorithms_Railway.cpp:125
NBNetBuilder::mirrorX
void mirrorX()
mirror the network along the X-axis
Definition: NBNetBuilder.cpp:618
NBNetBuilder::NBNetBuilder
NBNetBuilder()
Constructor.
Definition: NBNetBuilder.cpp:55
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:275
GeoConvHelper::getConvBoundary
const Boundary & getConvBoundary() const
Returns the converted boundary.
Definition: GeoConvHelper.cpp:489
NBHeightMapper::get
static const NBHeightMapper & get()
return the singleton instance (maybe 0)
Definition: NBHeightMapper.cpp:69
PROGRESS_BEGIN_TIME_MESSAGE
#define PROGRESS_BEGIN_TIME_MESSAGE(msg)
Definition: MsgHandler.h:280
NBNetBuilder::myPTStopCont
NBPTStopCont myPTStopCont
The used container for pt stops.
Definition: NBNetBuilder.h:255
NBNodeCont::setAsTLControlled
void setAsTLControlled(NBNode *node, NBTrafficLightLogicCont &tlc, TrafficLightType type, std::string id="")
Sets the given node as being controlled by a tls.
Definition: NBNodeCont.cpp:1628
NBNodeCont::computeLanes2Lanes
void computeLanes2Lanes()
divides the incoming lanes on outgoing lanes
Definition: NBNodeCont.cpp:1645
NBDistrictCont::begin
std::map< std::string, NBDistrict * >::const_iterator begin() const
Returns the pointer to the begin of the stored districts.
Definition: NBDistrictCont.h:81
NBPTStopCont::localizePTStops
void localizePTStops(NBEdgeCont &cont)
Definition: NBPTStopCont.cpp:59
NBPTLineCont::process
void process(NBEdgeCont &ec, NBPTStopCont &sc)
Definition: NBPTLineCont.cpp:57
Boundary::ymin
double ymin() const
Returns minimum y-coordinate.
Definition: Boundary.cpp:130
NBTypeCont::setDefaults
void setDefaults(int defaultNumLanes, double defaultLaneWidth, double defaultSpeed, int defaultPriority, SVCPermissions defaultPermissions)
Sets the default values.
Definition: NBTypeCont.cpp:39
NBNetBuilder::myPTLineCont
NBPTLineCont myPTLineCont
The used container for pt stops.
Definition: NBNetBuilder.h:258
NBNodeCont::end
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
Definition: NBNodeCont.h:120
NBHeightMapper
Set z-values for all network positions based on data from a height map.
Definition: NBHeightMapper.h:57
OptionsCont.h
OptionsCont::resetWritable
void resetWritable()
Resets all options to be writeable.
Definition: OptionsCont.cpp:441
NBNodeCont::guessTLs
void guessTLs(OptionsCont &oc, NBTrafficLightLogicCont &tlc)
Guesses which junctions or junction clusters shall be controlled by tls.
Definition: NBNodeCont.cpp:1386
OptionsCont::set
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
Definition: OptionsCont.cpp:241
NBHeightMapper::ready
bool ready() const
returns whether the NBHeightMapper has data
Definition: NBHeightMapper.cpp:75
NBPTStopCont::begin
std::map< std::string, NBPTStop * >::const_iterator begin() const
Returns the pointer to the begin of the stored pt stops.
Definition: NBPTStopCont.h:50
MsgHandler.h
GeoConvHelper::setConvBoundary
void setConvBoundary(const Boundary &boundary)
sets the converted boundary
Definition: GeoConvHelper.h:142
NBNetBuilder::myTypeCont
NBTypeCont myTypeCont
The used container for street types.
Definition: NBNetBuilder.h:243
NBEdgeCont::applyOptions
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
Definition: NBEdgeCont.cpp:73
NBEdgeCont::checkGrade
void checkGrade(double threshold) const
check whether edges are to steep
Definition: NBEdgeCont.cpp:1559
OptionsCont::getString
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
Definition: OptionsCont.cpp:201
GeoConvHelper::getProcessing
static GeoConvHelper & getProcessing()
the coordinate transformation to use for input conversion and processing
Definition: GeoConvHelper.h:86
TrafficLightType
TrafficLightType
Definition: SUMOXMLDefinitions.h:1197
NBRequest.h
NBNetBuilder::transformCoordinates
static bool transformCoordinates(PositionVector &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
Definition: NBNetBuilder.cpp:660
OptionsCont::exists
bool exists(const std::string &name) const
Returns the information whether the named option is known.
Definition: OptionsCont.cpp:129
NBEdgeCont.h
GeoConvHelper.h
Boundary::xmax
double xmax() const
Returns maximum x-coordinate.
Definition: Boundary.cpp:124
NBNodeCont::begin
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
Definition: NBNodeCont.h:115
NBEdgeCont::computeLaneShapes
void computeLaneShapes()
Computes the shapes of all lanes of all edges stored in the container.
Definition: NBEdgeCont.cpp:899
OptionsCont::getBool
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Definition: OptionsCont.cpp:222
NBNodeCont::removeComponents
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:311
SVC_BICYCLE
@ SVC_BICYCLE
vehicle is a bicycle
Definition: SUMOVehicleClass.h:179
NBNodeCont::avoidOverlap
void avoidOverlap()
fix overlap
Definition: NBNodeCont.cpp:443
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:57
NBEdgePriorityComputer::computeEdgePriorities
static void computeEdgePriorities(NBNodeCont &nc)
Computes edge priorities within a node.
Definition: NBAlgorithms.cpp:299
NBNetBuilder::transformCoordinate
static bool transformCoordinate(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
Definition: NBNetBuilder.cpp:633
NBNodesEdgesSorter::sortNodesEdges
static void sortNodesEdges(NBNodeCont &nc, bool useNodeShape=false)
Sorts a node's edges clockwise regarding driving direction.
Definition: NBAlgorithms.cpp:136
GeoConvHelper::getLoaded
static GeoConvHelper & getLoaded()
the coordinate transformation that was loaded fron an input file
Definition: GeoConvHelper.h:91
PROGRESS_TIME_MESSAGE
#define PROGRESS_TIME_MESSAGE(before)
Definition: MsgHandler.h:281
NBNodeCont::remapIDs
int remapIDs(bool numericaIDs, bool reservedIDs, const std::string &prefix)
remap node IDs accoring to options –numerical-ids and –reserved-ids
Definition: NBNodeCont.cpp:1861
NBEdgeCont::markRoundabouts
void markRoundabouts()
mark edge priorities and prohibit turn-arounds for all roundabout edges
Definition: NBEdgeCont.cpp:1377
PositionVector
A list of positions.
Definition: PositionVector.h:45
GeoConvHelper
static methods for processing the coordinates conversion for the current net
Definition: GeoConvHelper.h:55
NBEdgeCont::remapIDs
int remapIDs(bool numericaIDs, bool reservedIDs, const std::string &prefix, NBPTStopCont &sc)
remap node IDs accoring to options –numerical-ids and –reserved-ids
Definition: NBEdgeCont.cpp:1471
GeoConvHelper::x2cartesian
bool x2cartesian(Position &from, bool includeInBoundary=true)
Converts the given coordinate into a cartesian and optionally update myConvBoundary.
Definition: GeoConvHelper.cpp:326
GeoConvHelper::usingGeoProjection
bool usingGeoProjection() const
Returns whether a transformation from geo to metric coordinates will be performed.
Definition: GeoConvHelper.cpp:281
NBPTLineCont::fixBidiStops
void fixBidiStops(const NBEdgeCont &ec)
select the correct stop on superposed rail edges
Definition: NBPTLineCont.cpp:351
NBDistrict.h
SysUtils::getCurrentMillis
static long getCurrentMillis()
Returns the current time in milliseconds.
Definition: SysUtils.cpp:38
OptionsCont::getStringVector
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
Definition: OptionsCont.cpp:235
GeoConvHelper::moveConvertedBy
void moveConvertedBy(double x, double y)
Shifts the converted boundary by the given amounts.
Definition: GeoConvHelper.cpp:476
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:79
parseVehicleClasses
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
Definition: SUMOVehicleClass.cpp:222
NBEdgeCont::computeLanes2Edges
void computeLanes2Edges()
Computes for each edge which lanes approach the next edges.
Definition: NBEdgeCont.cpp:790
NBTrafficLightLogicCont::applyOptions
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
Definition: NBTrafficLightLogicCont.cpp:56
NBEdgeCont::checkOverlap
void checkOverlap(double threshold, double zThreshold) const
check whether edges overlap
Definition: NBEdgeCont.cpp:1530
NBPTStopCont::alignIdSigns
void alignIdSigns()
Definition: NBPTStopCont.cpp:341
NBNodeCont::removeIsolatedRoads
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:223
Boundary::xmin
double xmin() const
Returns minimum x-coordinate.
Definition: Boundary.cpp:118
NBEdgeCont::generateStreetSigns
void generateStreetSigns()
assigns street signs to edges based on toNode types
Definition: NBEdgeCont.cpp:1403
NBPTLineCont::getServedPTStops
std::set< std::string > & getServedPTStops()
Definition: NBPTLineCont.cpp:345
NBNodeCont::removeSelfLoops
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:166
NBNodeCont::joinSimilarEdges
void joinSimilarEdges(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
Joins edges connecting the same nodes.
Definition: NBNodeCont.cpp:178
SysUtils.h
NBNetBuilder::myNetworkHaveCrossings
bool myNetworkHaveCrossings
flag to indicate that network has crossings
Definition: NBNetBuilder.h:266
NBEdgeCont::guessRoundabouts
int guessRoundabouts()
Determines which edges belong to roundabouts and increases their priority.
Definition: NBEdgeCont.cpp:1157
StringBijection::get
T get(const std::string &str) const
Definition: StringBijection.h:97
NBNetBuilder::myTLLCont
NBTrafficLightLogicCont myTLLCont
The used container for traffic light logics.
Definition: NBNetBuilder.h:249
NBPTStopCont::cleanupDeleted
int cleanupDeleted(NBEdgeCont &cont)
remove stops on non existing (removed) edges
Definition: NBPTStopCont.cpp:299
NBTypeCont.h
NBRailwayTopologyAnalyzer::repairTopology
static void repairTopology(NBNetBuilder &nb)
Definition: NBAlgorithms_Railway.cpp:110
SUMOVehicleClass.h
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
NBEdgeCont::recheckPostProcessConnections
void recheckPostProcessConnections()
Try to set any stored connections.
Definition: NBEdgeCont.cpp:1077
NBNetBuilder.h
NBNetBuilder::applyOptions
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
Definition: NBNetBuilder.cpp:65
NBNodeCont::printBuiltNodesStatistics
void printBuiltNodesStatistics() const
Prints statistics about built nodes.
Definition: NBNodeCont.cpp:1717
GeoConvHelper::getOrigBoundary
const Boundary & getOrigBoundary() const
Returns the original boundary.
Definition: GeoConvHelper.cpp:483
GeoConvHelper::cartesian2geo
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
Definition: GeoConvHelper.cpp:293
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
Position::x
double x() const
Returns the x-position.
Definition: Position.h:56
Boundary::add
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:78
UtilExceptions.h
NBEdgeCont::removeUnwishedEdges
void removeUnwishedEdges(NBDistrictCont &dc)
Removes unwished edges (not in keep-edges)
Definition: NBEdgeCont.cpp:700
GeoConvHelper::getOffsetBase
const Position getOffsetBase() const
Returns the network base.
Definition: GeoConvHelper.cpp:501
NBEdgeCont::recheckLanes
void recheckLanes()
Rechecks whether all lanes have a successor for each of the stored edges.
Definition: NBEdgeCont.cpp:798
NBNodeCont::addJoinExclusion
void addJoinExclusion(const std::vector< std::string > &ids, bool check=false)
Definition: NBNodeCont.cpp:564
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
NBNodeCont::joinTLS
void joinTLS(NBTrafficLightLogicCont &tlc, double maxdist)
Builds clusters of tls-controlled junctions and joins the control if possible.
Definition: NBNodeCont.cpp:1579
NBEdgeCont::splitGeometry
void splitGeometry(NBDistrictCont &dc, NBNodeCont &nc)
Splits edges into multiple if they have a complex geometry.
Definition: NBEdgeCont.cpp:717
NBEdgeCont::appendTurnarounds
void appendTurnarounds(bool noTLSControlled, bool onlyDeadends, bool noGeometryLike)
Appends turnarounds to all edges stored in the container.
Definition: NBEdgeCont.cpp:838
NBAlgorithms_Ramps.h
NBEdgeCont::end
std::map< std::string, NBEdge * >::const_iterator end() const
Returns the pointer to the end of the stored edges.
Definition: NBEdgeCont.h:192
NBPTStopCont::end
std::map< std::string, NBPTStop * >::const_iterator end() const
Returns the pointer to the end of the stored pt stops.
Definition: NBPTStopCont.h:57
NBNodeCont::retrieve
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
Definition: NBNodeCont.cpp:107
DEG2RAD
#define DEG2RAD(x)
Definition: GeomHelper.h:37
OptionsCont::isDefault
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
Definition: OptionsCont.cpp:163
NBEdgeCont::appendRailwayTurnarounds
void appendRailwayTurnarounds(const NBPTStopCont &sc)
Appends turnarounds to all bidiRail edges with stops.
Definition: NBEdgeCont.cpp:854
NBNodeCont::computeLogics
void computeLogics(const NBEdgeCont &ec)
build the list of outgoing edges and lanes
Definition: NBNodeCont.cpp:1654
OptionsCont::getFloat
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
Definition: OptionsCont.cpp:208
NBNetBuilder::moveToOrigin
void moveToOrigin(GeoConvHelper &geoConvHelper, bool lefthand)
shift network so its lower left corner is at 0,0
Definition: NBNetBuilder.cpp:592
NBNodeCont.h
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
NBEdgeCont::sortOutgoingLanesConnections
void sortOutgoingLanesConnections()
Sorts all lanes of all edges within the container by their direction.
Definition: NBEdgeCont.cpp:774
NBPTStopCont::getStops
const std::map< std::string, NBPTStop * > & getStops() const
Definition: NBPTStopCont.h:61
NBNetBuilder::myEdgeCont
NBEdgeCont myEdgeCont
The used container for edges.
Definition: NBNetBuilder.h:246
NBEdgeCont::reduceGeometries
void reduceGeometries(const double minDist)
Definition: NBEdgeCont.cpp:744
NBNetBuilder::myDistrictCont
NBDistrictCont myDistrictCont
The used container for districts.
Definition: NBNetBuilder.h:252
Position::y
double y() const
Returns the y-position.
Definition: Position.h:61
PROGRESS_BEGIN_MESSAGE
#define PROGRESS_BEGIN_MESSAGE(msg)
Definition: MsgHandler.h:278
NBRailwayTopologyAnalyzer::analyzeTopology
static void analyzeTopology(NBNetBuilder &nb)
Computes highway on-/off-ramps (if wished)
Definition: NBAlgorithms_Railway.cpp:104
NBEdgeCont::guessSpecialLanes
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
Definition: NBEdgeCont.cpp:1443
NBDistrictCont.h
PROGRESS_DONE_MESSAGE
#define PROGRESS_DONE_MESSAGE()
Definition: MsgHandler.h:279
NBAlgorithms_Railway.h
GeoConvHelper::computeFinal
static void computeFinal(bool lefthand=false)
compute the location attributes which will be used for output based on the loaded location data,...
Definition: GeoConvHelper.cpp:513
NBEdgeCont::computeEdgeShapes
void computeEdgeShapes(double smoothElevationThreshold=-1)
Computes the shapes of all edges stored in the container.
Definition: NBEdgeCont.cpp:875
SUMOXMLDefinitions::TrafficLightTypes
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
Definition: SUMOXMLDefinitions.h:1392
NBNetBuilder::addGeometrySegments
static int addGeometrySegments(PositionVector &from, const PositionVector &cartesian, const double maxLength)
insertion geometry points to ensure maximum segment length between points
Definition: NBNetBuilder.cpp:678
NBNetBuilder::compute
void compute(OptionsCont &oc, const std::set< std::string > &explicitTurnarounds=std::set< std::string >(), bool mayAddOrRemove=true)
Performs the network building steps.
Definition: NBNetBuilder.cpp:77
NBEdgeCont::joinLanes
int joinLanes(SVCPermissions perms)
join adjacent lanes with the given permissions
Definition: NBEdgeCont.cpp:1588
config.h
NBNodeCont::joinLoadedClusters
int joinLoadedClusters(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
Joins loaded junction clusters (see NIXMLNodesHandler)
Definition: NBNodeCont.cpp:617
NBRampsComputer::computeRamps
static void computeRamps(NBNetBuilder &nb, OptionsCont &oc)
Computes highway on-/off-ramps (if wished)
Definition: NBAlgorithms_Ramps.cpp:51
NBNetBuilder::runningNetedit
static bool runningNetedit()
whether netbuilding takes place in the context of NETEDIT
Definition: NBNetBuilder.cpp:700
NBNetBuilder::myParkingCont
NBParkingCont myParkingCont
Definition: NBNetBuilder.h:260
NBPTStopCont::assignLanes
void assignLanes(NBEdgeCont &cont)
Definition: NBPTStopCont.cpp:94
NBNodeCont::joinJunctions
int joinJunctions(double maxDist, NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc, NBPTStopCont &sc)
Joins junctions that are very close together.
Definition: NBNodeCont.cpp:642
NBTrafficLightLogicCont::setTLControllingInformation
void setTLControllingInformation(const NBEdgeCont &ec, const NBNodeCont &nc)
Informs the edges about being controlled by a tls.
Definition: NBTrafficLightLogicCont.cpp:268
StringTokenizer.h
NBPTStopCont::generateBidiStops
int generateBidiStops(NBEdgeCont &cont)
duplicate stops for superposed rail edges and return the number of generated stops
Definition: NBPTStopCont.cpp:113
NBDistrictCont::end
std::map< std::string, NBDistrict * >::const_iterator end() const
Returns the pointer to the end of the stored districts.
Definition: NBDistrictCont.h:89
NBEdgeCont::guessOpposites
void guessOpposites()
Sets opposite lane information for geometrically close edges.
Definition: NBEdgeCont.cpp:994
NBEdgeCont::checkGeometries
void checkGeometries(const double maxAngle, const double minRadius, bool fix, bool fixRailways, bool silent=false)
Definition: NBEdgeCont.cpp:752
NBTurningDirectionsComputer::computeTurnDirections
static void computeTurnDirections(NBNodeCont &nc, bool warn=true)
Computes turnaround destinations for all edges (if exist)
Definition: NBAlgorithms.cpp:47
NBNode
Represents a single node (junction) during network building.
Definition: NBNode.h:67
NBTrafficLightLogicCont.h
NBEdgeCont::computeEdge2Edges
void computeEdge2Edges(bool noLeftMovers)
Computes for each edge the approached edges.
Definition: NBEdgeCont.cpp:782
NBPTStopCont::postprocess
void postprocess(std::set< std::string > &usedStops)
Definition: NBPTStopCont.cpp:325
NBAlgorithms.h
NBTrafficLightLogicCont::computeLogics
std::pair< int, int > computeLogics(OptionsCont &oc)
Computes the traffic light logics using the stored definitions and stores the results.
Definition: NBTrafficLightLogicCont.cpp:140
SVC_IGNORING
@ SVC_IGNORING
vehicles ignoring classes
Definition: SUMOVehicleClass.h:135
NBPTStopCont::findAccessEdgesForRailStops
void findAccessEdgesForRailStops(NBEdgeCont &cont, double maxRadius, int maxCount, double accessFactor)
Definition: NBPTStopCont.cpp:360
NBHeightMapper::getZ
double getZ(const Position &geo) const
returns height for the given geo coordinate (WGS84)
Definition: NBHeightMapper.cpp:81
NBEdgeCont::begin
std::map< std::string, NBEdge * >::const_iterator begin() const
Returns the pointer to the begin of the stored edges.
Definition: NBEdgeCont.h:184
NBRequest::reportWarnings
static void reportWarnings()
reports warnings if any occurred
Definition: NBRequest.cpp:1011
NBNodeTypeComputer::computeNodeTypes
static void computeNodeTypes(NBNodeCont &nc, NBTrafficLightLogicCont &tlc)
Computes node types.
Definition: NBAlgorithms.cpp:163
WRITE_MESSAGE
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:277
NBEdgeCont::getRoundabouts
const std::set< EdgeSet > getRoundabouts() const
Returns the determined roundabouts.
Definition: NBEdgeCont.cpp:1345
NBNetBuilder::myNodeCont
NBNodeCont myNodeCont
The used container for nodes.
Definition: NBNetBuilder.h:240
Boundary::ymax
double ymax() const
Returns maximum y-coordinate.
Definition: Boundary.cpp:136
NBNodeCont::computeLogics2
void computeLogics2(const NBEdgeCont &ec, OptionsCont &oc)
compute right-of-way logic for all lane-to-lane connections
Definition: NBNodeCont.cpp:1662
NBNetBuilder::~NBNetBuilder
~NBNetBuilder()
Destructor.
Definition: NBNetBuilder.cpp:61
GeoConvHelper::getNumLoaded
static int getNumLoaded()
Definition: GeoConvHelper.h:95