SUMO - Simulation of Urban MObility
NBNetBuilder.cpp
Go to the documentation of this file.
1 /****************************************************************************/
12 // Instance responsible for building networks
13 /****************************************************************************/
14 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
15 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
16 /****************************************************************************/
17 //
18 // This file is part of SUMO.
19 // SUMO is free software: you can redistribute it and/or modify
20 // it under the terms of the GNU General Public License as published by
21 // the Free Software Foundation, either version 3 of the License, or
22 // (at your option) any later version.
23 //
24 /****************************************************************************/
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <string>
37 #include <fstream>
38 #include "NBNetBuilder.h"
39 #include "NBNodeCont.h"
40 #include "NBEdgeCont.h"
42 #include "NBDistrictCont.h"
43 #include "NBDistrict.h"
44 #include "NBRequest.h"
45 #include "NBTypeCont.h"
51 #include <utils/common/SysUtils.h>
52 #include <utils/common/ToString.h>
54 #include "NBAlgorithms.h"
55 #include "NBAlgorithms_Ramps.h"
56 #include "NBHeightMapper.h"
57 
58 
59 // ===========================================================================
60 // method definitions
61 // ===========================================================================
63  myEdgeCont(myTypeCont),
64  myHaveLoadedNetworkWithoutInternalEdges(false),
65  myNetworkHaveCrossings(false) {
66 }
67 
68 
70 
71 
72 void
74  // apply options to type control
75  myTypeCont.setDefaults(oc.getInt("default.lanenumber"), oc.getFloat("default.lanewidth"), oc.getFloat("default.speed"),
76  oc.getInt("default.priority"), parseVehicleClasses("", oc.getString("default.disallow")));
77  // apply options to edge control
79  // apply options to traffic light logics control
81 }
82 
83 
84 void
85 NBNetBuilder::compute(OptionsCont& oc, const std::set<std::string>& explicitTurnarounds, bool mayAddOrRemove) {
87 
88  const bool lefthand = oc.getBool("lefthand");
89  if (lefthand) {
90  mirrorX();
91  };
92 
93  // MODIFYING THE SETS OF NODES AND EDGES
94 
95  // Removes edges that are connecting the same node
96  long before = SysUtils::getCurrentMillis();
97  PROGRESS_BEGIN_MESSAGE("Removing self-loops");
99  PROGRESS_TIME_MESSAGE(before);
100  //
101  if (oc.exists("remove-edges.isolated") && oc.getBool("remove-edges.isolated")) {
102  before = SysUtils::getCurrentMillis();
103  PROGRESS_BEGIN_MESSAGE("Finding isolated roads");
105  PROGRESS_TIME_MESSAGE(before);
106  }
107  //
108  if (oc.exists("keep-edges.postload") && oc.getBool("keep-edges.postload")) {
109  if (oc.isSet("keep-edges.explicit") || oc.isSet("keep-edges.input-file")) {
110  before = SysUtils::getCurrentMillis();
111  PROGRESS_BEGIN_MESSAGE("Removing unwished edges");
113  PROGRESS_TIME_MESSAGE(before);
114  }
115  }
116  if (oc.getBool("junctions.join") || (oc.exists("ramps.guess") && oc.getBool("ramps.guess"))) {
117  // preliminary geometry computations to determine the length of edges
118  // This depends on turning directions and sorting of edge list
119  // in case junctions are joined geometry computations have to be repeated
120  // preliminary roundabout computations to avoid damaging roundabouts via junctions.join or ramps.guess
126  if (oc.getBool("roundabouts.guess")) {
128  }
129  const std::set<EdgeSet>& roundabouts = myEdgeCont.getRoundabouts();
130  for (std::set<EdgeSet>::const_iterator it_round = roundabouts.begin();
131  it_round != roundabouts.end(); ++it_round) {
132  std::vector<std::string> nodeIDs;
133  for (EdgeSet::const_iterator it_edge = it_round->begin(); it_edge != it_round->end(); ++it_edge) {
134  nodeIDs.push_back((*it_edge)->getToNode()->getID());
135  }
136  myNodeCont.addJoinExclusion(nodeIDs);
137  }
138  }
139  // join junctions (may create new "geometry"-nodes so it needs to come before removing these
140  if (oc.exists("junctions.join-exclude") && oc.isSet("junctions.join-exclude")) {
141  myNodeCont.addJoinExclusion(oc.getStringVector("junctions.join-exclude"));
142  }
144  if (oc.getBool("junctions.join")) {
145  before = SysUtils::getCurrentMillis();
146  PROGRESS_BEGIN_MESSAGE("Joining junction clusters");
147  numJoined += myNodeCont.joinJunctions(oc.getFloat("junctions.join-dist"), myDistrictCont, myEdgeCont, myTLLCont);
148  PROGRESS_TIME_MESSAGE(before);
149  }
150  if (oc.getBool("junctions.join") || (oc.exists("ramps.guess") && oc.getBool("ramps.guess"))) {
151  // reset geometry to avoid influencing subsequent steps (ramps.guess)
153  }
154  if (numJoined > 0) {
155  // bit of a misnomer since we're already done
156  WRITE_MESSAGE(" Joined " + toString(numJoined) + " junction cluster(s).");
157  }
158  //
159  if (mayAddOrRemove) {
160  int no = 0;
161  const bool removeGeometryNodes = oc.exists("geometry.remove") && oc.getBool("geometry.remove");
162  before = SysUtils::getCurrentMillis();
163  PROGRESS_BEGIN_MESSAGE("Removing empty nodes" + std::string(removeGeometryNodes ? " and geometry nodes" : ""));
164  // removeUnwishedNodes needs turnDirections. @todo: try to call this less often
167  PROGRESS_TIME_MESSAGE(before);
168  WRITE_MESSAGE(" " + toString(no) + " nodes removed.");
169  }
170 
171  // MOVE TO ORIGIN
172  // compute new boundary after network modifications have taken place
173  Boundary boundary;
174  for (std::map<std::string, NBNode*>::const_iterator it = myNodeCont.begin(); it != myNodeCont.end(); ++it) {
175  boundary.add(it->second->getPosition());
176  }
177  for (std::map<std::string, NBEdge*>::const_iterator it = myEdgeCont.begin(); it != myEdgeCont.end(); ++it) {
178  boundary.add(it->second->getGeometry().getBoxBoundary());
179  }
180  geoConvHelper.setConvBoundary(boundary);
181 
182  if (!oc.getBool("offset.disable-normalization") && oc.isDefault("offset.x") && oc.isDefault("offset.y")) {
183  moveToOrigin(geoConvHelper, lefthand);
184  }
185  geoConvHelper.computeFinal(lefthand); // information needed for location element fixed at this point
186 
187  if (oc.exists("geometry.min-dist") && !oc.isDefault("geometry.min-dist")) {
188  before = SysUtils::getCurrentMillis();
189  PROGRESS_BEGIN_MESSAGE("Reducing geometries");
190  myEdgeCont.reduceGeometries(oc.getFloat("geometry.min-dist"));
191  PROGRESS_TIME_MESSAGE(before);
192  }
193  // @note: removing geometry can create similar edges so joinSimilarEdges must come afterwards
194  // @note: likewise splitting can destroy similarities so joinSimilarEdges must come before
195  if (mayAddOrRemove && oc.getBool("edges.join")) {
196  before = SysUtils::getCurrentMillis();
197  PROGRESS_BEGIN_MESSAGE("Joining similar edges");
199  PROGRESS_TIME_MESSAGE(before);
200  }
201  if (oc.getBool("opposites.guess")) {
202  PROGRESS_BEGIN_MESSAGE("guessing opposite direction edges");
205  }
206  //
207  if (mayAddOrRemove && oc.exists("geometry.split") && oc.getBool("geometry.split")) {
208  before = SysUtils::getCurrentMillis();
209  PROGRESS_BEGIN_MESSAGE("Splitting geometry edges");
211  PROGRESS_TIME_MESSAGE(before);
212  }
213  // turning direction
214  before = SysUtils::getCurrentMillis();
215  PROGRESS_BEGIN_MESSAGE("Computing turning directions");
217  PROGRESS_TIME_MESSAGE(before);
218  // correct edge geometries to avoid overlap
220  // guess ramps
221  if (mayAddOrRemove) {
222  if ((oc.exists("ramps.guess") && oc.getBool("ramps.guess")) || (oc.exists("ramps.set") && oc.isSet("ramps.set"))) {
223  before = SysUtils::getCurrentMillis();
224  PROGRESS_BEGIN_MESSAGE("Guessing and setting on-/off-ramps");
227  PROGRESS_TIME_MESSAGE(before);
228  }
229  }
230  // guess sidewalks
231  if (oc.getBool("sidewalks.guess") || oc.getBool("sidewalks.guess.from-permissions")) {
232  const int sidewalks = myEdgeCont.guessSidewalks(oc.getFloat("default.sidewalk-width"),
233  oc.getFloat("sidewalks.guess.min-speed"),
234  oc.getFloat("sidewalks.guess.max-speed"),
235  oc.getBool("sidewalks.guess.from-permissions"));
236  WRITE_MESSAGE("Guessed " + toString(sidewalks) + " sidewalks.");
237  }
238 
239  // check whether any not previously setable connections may be set now
241 
242  // remap ids if wished
243  int numChangedEdges = myEdgeCont.remapIDs(oc.getBool("numerical-ids"), oc.isSet("reserved-ids"));
244  int numChangedNodes = myNodeCont.remapIDs(oc.getBool("numerical-ids"), oc.isSet("reserved-ids"));
245  if (numChangedEdges + numChangedNodes > 0) {
246  WRITE_MESSAGE("Remapped " + toString(numChangedEdges) + " edge IDs and " + toString(numChangedNodes) + " node IDs.");
247  }
248 
249  //
250  if (oc.exists("geometry.max-angle")) {
252  DEG2RAD(oc.getFloat("geometry.max-angle")),
253  oc.getFloat("geometry.min-radius"),
254  oc.getBool("geometry.min-radius.fix"));
255  }
256 
257  // GEOMETRY COMPUTATION
258  //
259  before = SysUtils::getCurrentMillis();
260  PROGRESS_BEGIN_MESSAGE("Sorting nodes' edges");
262  PROGRESS_TIME_MESSAGE(before);
264  //
265  before = SysUtils::getCurrentMillis();
266  PROGRESS_BEGIN_MESSAGE("Computing node shapes");
267  if (oc.exists("geometry.junction-mismatch-threshold")) {
268  myNodeCont.computeNodeShapes(oc.getFloat("geometry.junction-mismatch-threshold"));
269  } else {
271  }
272  PROGRESS_TIME_MESSAGE(before);
273  //
274  before = SysUtils::getCurrentMillis();
275  PROGRESS_BEGIN_MESSAGE("Computing edge shapes");
277  PROGRESS_TIME_MESSAGE(before);
278  // resort edges based on the node and edge shapes
281 
282  // APPLY SPEED MODIFICATIONS
283  if (oc.exists("speed.offset")) {
284  const double speedOffset = oc.getFloat("speed.offset");
285  const double speedFactor = oc.getFloat("speed.factor");
286  if (speedOffset != 0 || speedFactor != 1) {
287  const double speedMin = oc.getFloat("speed.minimum");
288  before = SysUtils::getCurrentMillis();
289  PROGRESS_BEGIN_MESSAGE("Applying speed modifications");
290  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
291  (*i).second->setSpeed(-1, MAX2((*i).second->getSpeed() * speedFactor + speedOffset, speedMin));
292  }
293  PROGRESS_TIME_MESSAGE(before);
294  }
295  }
296 
297  // CONNECTIONS COMPUTATION
298  //
299  before = SysUtils::getCurrentMillis();
300  PROGRESS_BEGIN_MESSAGE("Computing node types");
302  PROGRESS_TIME_MESSAGE(before);
303  //
304  myNetworkHaveCrossings = false;
305  if (oc.getBool("crossings.guess")) {
306  myNetworkHaveCrossings = true;
307  int crossings = 0;
308  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
309  crossings += (*i).second->guessCrossings();
310  }
311  WRITE_MESSAGE("Guessed " + toString(crossings) + " pedestrian crossings.");
312  }
313  if (!myNetworkHaveCrossings) {
314  // recheck whether we had crossings in the input
315  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
316  if (i->second->getCrossings().size() > 0) {
317  myNetworkHaveCrossings = true;
318  break;
319  }
320  }
321  }
322 
323  if (oc.isDefault("no-internal-links") && !myNetworkHaveCrossings && myHaveLoadedNetworkWithoutInternalEdges) {
324  oc.set("no-internal-links", "true");
325  } else if (!mayAddOrRemove && myNetworkHaveCrossings) {
326  // crossings added via netedit
327  oc.resetWritable();
328  oc.set("no-internal-links", "false");
329  }
330 
331  //
332  before = SysUtils::getCurrentMillis();
333  PROGRESS_BEGIN_MESSAGE("Computing priorities");
335  PROGRESS_TIME_MESSAGE(before);
336  //
337  before = SysUtils::getCurrentMillis();
338  PROGRESS_BEGIN_MESSAGE("Computing approached edges");
339  myEdgeCont.computeEdge2Edges(oc.getBool("no-left-connections"));
340  PROGRESS_TIME_MESSAGE(before);
341  //
342  if (oc.getBool("roundabouts.guess")) {
343  before = SysUtils::getCurrentMillis();
344  PROGRESS_BEGIN_MESSAGE("Guessing and setting roundabouts");
345  const int numGuessed = myEdgeCont.guessRoundabouts();
346  if (numGuessed > 0) {
347  WRITE_MESSAGE(" Guessed " + toString(numGuessed) + " roundabout(s).");
348  }
349  PROGRESS_TIME_MESSAGE(before);
350  }
352  //
353  before = SysUtils::getCurrentMillis();
354  PROGRESS_BEGIN_MESSAGE("Computing approaching lanes");
356  PROGRESS_TIME_MESSAGE(before);
357  //
358  before = SysUtils::getCurrentMillis();
359  PROGRESS_BEGIN_MESSAGE("Dividing of lanes on approached lanes");
362  PROGRESS_TIME_MESSAGE(before);
363  //
364  before = SysUtils::getCurrentMillis();
365  PROGRESS_BEGIN_MESSAGE("Processing turnarounds");
366  if (!oc.getBool("no-turnarounds")) {
367  myEdgeCont.appendTurnarounds(oc.getBool("no-turnarounds.tls"));
368  } else {
369  myEdgeCont.appendTurnarounds(explicitTurnarounds, oc.getBool("no-turnarounds.tls"));
370  }
371  PROGRESS_TIME_MESSAGE(before);
372  //
373  before = SysUtils::getCurrentMillis();
374  PROGRESS_BEGIN_MESSAGE("Rechecking of lane endings");
376  PROGRESS_TIME_MESSAGE(before);
377 
378  if (myNetworkHaveCrossings && !oc.getBool("no-internal-links")) {
379  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
380  i->second->buildCrossingsAndWalkingAreas();
381  }
382  }
383 
384  // GUESS TLS POSITIONS
385  before = SysUtils::getCurrentMillis();
386  PROGRESS_BEGIN_MESSAGE("Assigning nodes to traffic lights");
387  if (oc.isSet("tls.set")) {
388  std::vector<std::string> tlControlledNodes = oc.getStringVector("tls.set");
390  for (std::vector<std::string>::const_iterator i = tlControlledNodes.begin(); i != tlControlledNodes.end(); ++i) {
391  NBNode* node = myNodeCont.retrieve(*i);
392  if (node == 0) {
393  WRITE_WARNING("Building a tl-logic for junction '" + *i + "' is not possible." + "\n The junction '" + *i + "' is not known.");
394  } else {
396  }
397  }
398  }
400  PROGRESS_TIME_MESSAGE(before);
401  //
402  if (oc.getBool("tls.join")) {
403  before = SysUtils::getCurrentMillis();
404  PROGRESS_BEGIN_MESSAGE("Joining traffic light nodes");
405  myNodeCont.joinTLS(myTLLCont, oc.getFloat("tls.join-dist"));
406  PROGRESS_TIME_MESSAGE(before);
407  }
408 
409 
410  // COMPUTING RIGHT-OF-WAY AND TRAFFIC LIGHT PROGRAMS
411  //
412  before = SysUtils::getCurrentMillis();
413  PROGRESS_BEGIN_MESSAGE("Computing traffic light control information");
415  PROGRESS_TIME_MESSAGE(before);
416  //
417  before = SysUtils::getCurrentMillis();
418  PROGRESS_BEGIN_MESSAGE("Computing node logics");
420  PROGRESS_TIME_MESSAGE(before);
421  //
422  before = SysUtils::getCurrentMillis();
423  PROGRESS_BEGIN_MESSAGE("Computing traffic light logics");
424  std::pair<int, int> numbers = myTLLCont.computeLogics(oc);
425  PROGRESS_TIME_MESSAGE(before);
426  std::string progCount = "";
427  if (numbers.first != numbers.second) {
428  progCount = "(" + toString(numbers.second) + " programs) ";
429  }
430  WRITE_MESSAGE(" " + toString(numbers.first) + " traffic light(s) " + progCount + "computed.");
431  //
432  if (oc.isSet("street-sign-output")) {
433  before = SysUtils::getCurrentMillis();
434  PROGRESS_BEGIN_MESSAGE("Generating street signs");
436  PROGRESS_TIME_MESSAGE(before);
437  }
438 
439  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
440  (*i).second->sortOutgoingConnectionsByIndex();
441  }
442  // FINISHING INNER EDGES
443  if (!oc.getBool("no-internal-links")) {
444  before = SysUtils::getCurrentMillis();
445  PROGRESS_BEGIN_MESSAGE("Building inner edges");
446  // walking areas shall only be built if crossings are wished as well
447  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
448  (*i).second->buildInnerEdges();
449  }
450  PROGRESS_TIME_MESSAGE(before);
451  }
452  // PATCH NODE SHAPES
453  if (oc.getFloat("junctions.scurve-stretch") > 0) {
454  // @note: nodes have collected correction hints in buildInnerEdges()
455  before = SysUtils::getCurrentMillis();
456  PROGRESS_BEGIN_MESSAGE("stretching junctions to smooth geometries");
460  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
461  (*i).second->buildInnerEdges();
462  }
463  PROGRESS_TIME_MESSAGE(before);
464  }
465  if (lefthand) {
466  mirrorX();
467  };
468 
469  if (oc.exists("geometry.check-overlap") && oc.getFloat("geometry.check-overlap") > 0) {
470  before = SysUtils::getCurrentMillis();
471  PROGRESS_BEGIN_MESSAGE("Checking overlapping edges");
472  myEdgeCont.checkOverlap(oc.getFloat("geometry.check-overlap"), oc.getFloat("geometry.check-overlap.vertical-threshold"));
473  PROGRESS_TIME_MESSAGE(before);
474  }
475  if (oc.exists("geometry.max-grade") && oc.getFloat("geometry.max-grade") > 0 && geoConvHelper.getConvBoundary().getZRange() > 0) {
476  before = SysUtils::getCurrentMillis();
477  PROGRESS_BEGIN_MESSAGE("Checking edge grade");
478  // user input is in %
479  myEdgeCont.checkGrade(oc.getFloat("geometry.max-grade") / 100);
480  PROGRESS_TIME_MESSAGE(before);
481  }
482  if (oc.exists("ptstop-output") && oc.isSet("ptstop-output")) {
483  before = SysUtils::getCurrentMillis();
484  PROGRESS_BEGIN_MESSAGE("Processing public transport stops");
486  PROGRESS_TIME_MESSAGE(before);
487  }
488 
489  // report
490  WRITE_MESSAGE("-----------------------------------------------------");
491  WRITE_MESSAGE("Summary:");
493  WRITE_MESSAGE(" Network boundaries:");
494  WRITE_MESSAGE(" Original boundary : " + toString(geoConvHelper.getOrigBoundary()));
495  WRITE_MESSAGE(" Applied offset : " + toString(geoConvHelper.getOffsetBase()));
496  WRITE_MESSAGE(" Converted boundary : " + toString(geoConvHelper.getConvBoundary()));
497  WRITE_MESSAGE("-----------------------------------------------------");
499  // report on very large networks
500  if (MAX2(geoConvHelper.getConvBoundary().xmax(), geoConvHelper.getConvBoundary().ymax()) > 1000000 ||
501  MIN2(geoConvHelper.getConvBoundary().xmin(), geoConvHelper.getConvBoundary().ymin()) < -1000000) {
502  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");
503  }
504 }
505 
506 
507 void
508 NBNetBuilder::computeSingleNode(NBNode* node, OptionsCont& oc, const std::set<std::string>& explicitTurnarounds, bool mayAddOrRemove) {
509 
510  GeoConvHelper& geoConvHelper = GeoConvHelper::getProcessing();
511 
512  const bool lefthand = oc.getBool("lefthand");
513  if (lefthand) {
514  mirrorX();
515  };
516 
517  // MODIFYING THE SETS OF NODES AND EDGES
518 
519  // Removes edges that are connecting the same node
521  //
522  if (oc.exists("remove-edges.isolated") && oc.getBool("remove-edges.isolated")) {
524  }
525  //
526  if (oc.exists("keep-edges.postload") && oc.getBool("keep-edges.postload")) {
527  if (oc.isSet("keep-edges.explicit") || oc.isSet("keep-edges.input-file")) {
529  }
530  }
531  if (oc.getBool("junctions.join") || (oc.exists("ramps.guess") && oc.getBool("ramps.guess"))) {
532  // preliminary geometry computations to determine the length of edges
533  // This depends on turning directions and sorting of edge list
534  // in case junctions are joined geometry computations have to be repeated
535  // preliminary roundabout computations to avoid damaging roundabouts via junctions.join or ramps.guess
537  node->sortEdges(false);
539  node->computeNodeShape(-1);
541  if (oc.getBool("roundabouts.guess")) {
543  }
544  const std::set<EdgeSet>& roundabouts = myEdgeCont.getRoundabouts();
545  for (std::set<EdgeSet>::const_iterator it_round = roundabouts.begin();
546  it_round != roundabouts.end(); ++it_round) {
547  std::vector<std::string> nodeIDs;
548  for (EdgeSet::const_iterator it_edge = it_round->begin(); it_edge != it_round->end(); ++it_edge) {
549  nodeIDs.push_back((*it_edge)->getToNode()->getID());
550  }
551  myNodeCont.addJoinExclusion(nodeIDs);
552  }
553  }
554  // join junctions (may create new "geometry"-nodes so it needs to come before removing these
555  if (oc.exists("junctions.join-exclude") && oc.isSet("junctions.join-exclude")) {
556  myNodeCont.addJoinExclusion(oc.getStringVector("junctions.join-exclude"));
557  }
559  if (oc.getBool("junctions.join")) {
560  numJoined += myNodeCont.joinJunctions(oc.getFloat("junctions.join-dist"), myDistrictCont, myEdgeCont, myTLLCont);
561  }
562  if (oc.getBool("junctions.join") || (oc.exists("ramps.guess") && oc.getBool("ramps.guess"))) {
563  // reset geometry to avoid influencing subsequent steps (ramps.guess)
565  }
566  //
567  if (mayAddOrRemove) {
568  const bool removeGeometryNodes = oc.exists("geometry.remove") && oc.getBool("geometry.remove");
569  // removeUnwishedNodes needs turnDirections. @todo: try to call this less often
572  }
573 
574  // MOVE TO ORIGIN
575  // compute new boundary after network modifications have taken place
576  Boundary boundary;
577  boundary.add(node->getPosition());
578  for (std::map<std::string, NBEdge*>::const_iterator it = myEdgeCont.begin(); it != myEdgeCont.end(); ++it) {
579  boundary.add(it->second->getGeometry().getBoxBoundary());
580  }
581  geoConvHelper.setConvBoundary(boundary);
582 
583  if (!oc.getBool("offset.disable-normalization") && oc.isDefault("offset.x") && oc.isDefault("offset.y")) {
584  moveToOrigin(geoConvHelper, lefthand);
585  }
586  geoConvHelper.computeFinal(lefthand); // information needed for location element fixed at this point
587 
588  if (oc.exists("geometry.min-dist") && !oc.isDefault("geometry.min-dist")) {
589  myEdgeCont.reduceGeometries(oc.getFloat("geometry.min-dist"));
590  }
591  // @note: removing geometry can create similar edges so joinSimilarEdges must come afterwards
592  // @note: likewise splitting can destroy similarities so joinSimilarEdges must come before
593  if (mayAddOrRemove && oc.getBool("edges.join")) {
595  }
596  if (oc.getBool("opposites.guess")) {
598  }
599  //
600  if (mayAddOrRemove && oc.exists("geometry.split") && oc.getBool("geometry.split")) {
602  }
603  // turning direction
605  // correct edge geometries to avoid overlap
606  node->avoidOverlap();
607  // guess ramps
608  if (mayAddOrRemove) {
609  if ((oc.exists("ramps.guess") && oc.getBool("ramps.guess")) || (oc.exists("ramps.set") && oc.isSet("ramps.set"))) {
610  node->sortEdges(false);
612  }
613  }
614  // guess sidewalks
615  if (oc.getBool("sidewalks.guess") || oc.getBool("sidewalks.guess.from-permissions")) {
616  myEdgeCont.guessSidewalks(oc.getFloat("default.sidewalk-width"),
617  oc.getFloat("sidewalks.guess.min-speed"),
618  oc.getFloat("sidewalks.guess.max-speed"),
619  oc.getBool("sidewalks.guess.from-permissions"));
620  }
621 
622  // check whether any not previously setable connections may be set now
624 
625  // remap ids if wished
626  myEdgeCont.remapIDs(oc.getBool("numerical-ids"), oc.isSet("reserved-ids"));
627  myNodeCont.remapIDs(oc.getBool("numerical-ids"), oc.isSet("reserved-ids"));
628 
629  //
630  if (oc.exists("geometry.max-angle")) {
632  DEG2RAD(oc.getFloat("geometry.max-angle")),
633  oc.getFloat("geometry.min-radius"),
634  oc.getBool("geometry.min-radius.fix"));
635  }
636 
637  // GEOMETRY COMPUTATION
638  //
639  node->sortEdges(false);
641  //
642  if (oc.exists("geometry.junction-mismatch-threshold")) {
643  node->computeNodeShape(oc.getFloat("geometry.junction-mismatch-threshold"));
644  } else {
645  node->computeNodeShape(-1);
646  }
647  //
649  // resort edges based on the node and edge shapes
650  node->sortEdges(true);
652 
653  // APPLY SPEED MODIFICATIONS
654  if (oc.exists("speed.offset")) {
655  const double speedOffset = oc.getFloat("speed.offset");
656  const double speedFactor = oc.getFloat("speed.factor");
657  if (speedOffset != 0 || speedFactor != 1) {
658  const double speedMin = oc.getFloat("speed.minimum");
659  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
660  (*i).second->setSpeed(-1, MAX2((*i).second->getSpeed() * speedFactor + speedOffset, speedMin));
661  }
662  }
663  }
664 
665  // CONNECTIONS COMPUTATION
666  //
668  //
669  myNetworkHaveCrossings = false;
670  if (oc.getBool("crossings.guess")) {
671  myNetworkHaveCrossings = true;
672  int crossings = 0;
673  crossings += node->guessCrossings();
674  }
675  if (!myNetworkHaveCrossings) {
676  // recheck whether we had crossings in the input
677  if (node->getCrossings().size() > 0) {
678  myNetworkHaveCrossings = true;
679  }
680  }
681 
682  if (oc.isDefault("no-internal-links") && !myNetworkHaveCrossings && myHaveLoadedNetworkWithoutInternalEdges) {
683  oc.set("no-internal-links", "true");
684  } else if (!mayAddOrRemove && myNetworkHaveCrossings) {
685  // crossings added via netedit
686  oc.resetWritable();
687  oc.set("no-internal-links", "false");
688  }
689 
690  //
692  //
693  myEdgeCont.computeEdge2Edges(oc.getBool("no-left-connections"));
694  //
695  if (oc.getBool("roundabouts.guess")) {
697  }
699  //
701  //
702  node->computeLanes2Lanes();
704  //
705  if (!oc.getBool("no-turnarounds")) {
706  myEdgeCont.appendTurnarounds(oc.getBool("no-turnarounds.tls"));
707  } else {
708  myEdgeCont.appendTurnarounds(explicitTurnarounds, oc.getBool("no-turnarounds.tls"));
709  }
710  //
712 
713  if (myNetworkHaveCrossings && !oc.getBool("no-internal-links")) {
715  }
716 
717  // GUESS TLS POSITIONS
718  if (oc.isSet("tls.set")) {
719  std::vector<std::string> tlControlledNodes = oc.getStringVector("tls.set");
721  for (std::vector<std::string>::const_iterator i = tlControlledNodes.begin(); i != tlControlledNodes.end(); ++i) {
722  if (node != 0) {
724  }
725  }
726  }
728  //
729  if (oc.getBool("tls.join")) {
730  myNodeCont.joinTLS(myTLLCont, oc.getFloat("tls.join-dist"));
731  }
732 
733  // COMPUTING RIGHT-OF-WAY AND TRAFFIC LIGHT PROGRAMS
734  //
736  //
737  node->computeLogic(myEdgeCont, oc);
738  //
739  std::pair<int, int> numbers = myTLLCont.computeLogics(oc);
740  std::string progCount = "";
741  if (numbers.first != numbers.second) {
742  progCount = "(" + toString(numbers.second) + " programs) ";
743  }
744  //
745  if (oc.isSet("street-sign-output")) {
747  }
748 
749  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
750  (*i).second->sortOutgoingConnectionsByIndex();
751  }
752  // FINISHING INNER EDGES
753  if (!oc.getBool("no-internal-links")) {
754  // walking areas shall only be built if crossings are wished as well
755  node->buildInnerEdges();
756  }
757  // PATCH NODE SHAPES
758  if (oc.getFloat("junctions.scurve-stretch") > 0) {
759  // @note: nodes have collected correction hints in buildInnerEdges()
761  node->computeNodeShape(-1);
763  node->buildInnerEdges();
764  }
765  if (lefthand) {
766  mirrorX();
767  };
768 
769  if (oc.exists("geometry.check-overlap") && oc.getFloat("geometry.check-overlap") > 0) {
770  myEdgeCont.checkOverlap(oc.getFloat("geometry.check-overlap"), oc.getFloat("geometry.check-overlap.vertical-threshold"));
771  }
772  if (oc.exists("geometry.max-grade") && oc.getFloat("geometry.max-grade") > 0 && geoConvHelper.getConvBoundary().getZRange() > 0) {
773  // user input is in %
774  myEdgeCont.checkGrade(oc.getFloat("geometry.max-grade") / 100);
775  }
776  if (oc.exists("ptstop-output") && oc.isSet("ptstop-output")) {
778  }
779 }
780 
781 
782 void
783 NBNetBuilder::moveToOrigin(GeoConvHelper& geoConvHelper, bool lefthand) {
784  long before = SysUtils::getCurrentMillis();
785  PROGRESS_BEGIN_MESSAGE("Moving network to origin");
786  Boundary boundary = geoConvHelper.getConvBoundary();
787  const double x = -boundary.xmin();
788  const double y = -(lefthand ? boundary.ymax() : boundary.ymin());
789  //if (lefthand) {
790  // y = boundary.ymax();
791  //}
792  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
793  (*i).second->reshiftPosition(x, y);
794  }
795  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
796  (*i).second->reshiftPosition(x, y);
797  }
798  for (std::map<std::string, NBDistrict*>::const_iterator i = myDistrictCont.begin(); i != myDistrictCont.end(); ++i) {
799  (*i).second->reshiftPosition(x, y);
800  }
801  for (std::map<std::string, NBPTStop*>::const_iterator i = myPTStopCont.begin(); i != myPTStopCont.end(); ++i) {
802  (*i).second->reshiftPostion(x, y);
803  }
804  geoConvHelper.moveConvertedBy(x, y);
805  PROGRESS_TIME_MESSAGE(before);
806 }
807 
808 
809 void
811  // mirror the network along the X-axis
812  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
813  (*i).second->mirrorX();
814  }
815  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
816  (*i).second->mirrorX();
817  }
818  for (std::map<std::string, NBDistrict*>::const_iterator i = myDistrictCont.begin(); i != myDistrictCont.end(); ++i) {
819  (*i).second->mirrorX();
820  }
821 }
822 
823 
824 bool
825 NBNetBuilder::transformCoordinate(Position& from, bool includeInBoundary, GeoConvHelper* from_srs) {
826  Position orig(from);
827  bool ok = GeoConvHelper::getProcessing().x2cartesian(from, includeInBoundary);
828  if (ok) {
829  const NBHeightMapper& hm = NBHeightMapper::get();
830  if (hm.ready()) {
831  if (from_srs != 0 && from_srs->usingGeoProjection()) {
832  from_srs->cartesian2geo(orig);
833  }
834  double z = hm.getZ(orig);
835  from = Position(from.x(), from.y(), z);
836  }
837  }
838  return ok;
839 }
840 
841 
842 bool
843 NBNetBuilder::transformCoordinates(PositionVector& from, bool includeInBoundary, GeoConvHelper* from_srs) {
844  const double maxLength = OptionsCont::getOptions().getFloat("geometry.max-segment-length");
845  if (maxLength > 0 && from.size() > 1) {
846  // transformation to cartesian coordinates must happen before we can check segment length
847  PositionVector copy = from;
848  for (int i = 0; i < (int) from.size(); i++) {
849  transformCoordinate(copy[i], false);
850  }
851  // check lengths and insert new points where needed (in the original
852  // coordinate system)
853  int inserted = 0;
854  for (int i = 0; i < (int)copy.size() - 1; i++) {
855  Position start = from[i + inserted];
856  Position end = from[i + inserted + 1];
857  double length = copy[i].distanceTo(copy[i + 1]);
858  const Position step = (end - start) * (maxLength / length);
859  int steps = 0;
860  while (length > maxLength) {
861  length -= maxLength;
862  steps++;
863  from.insert(from.begin() + i + inserted + 1, start + (step * steps));
864  inserted++;
865  }
866  }
867  // now perform the transformation again so that height mapping can be
868  // performed for the new points
869  }
870  bool ok = true;
871  for (int i = 0; i < (int) from.size(); i++) {
872  ok = ok && transformCoordinate(from[i], includeInBoundary, from_srs);
873  }
874  return ok;
875 }
876 
877 /****************************************************************************/
NBNetBuilder()
Constructor.
NBTypeCont myTypeCont
The used container for street types.
Definition: NBNetBuilder.h:229
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
Definition: NBNodeCont.cpp:106
void joinSimilarEdges(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
Joins edges connecting the same nodes.
Definition: NBNodeCont.cpp:177
NBPTStopCont myPTStopCont
The used container for pt stops.
Definition: NBNetBuilder.h:241
double ymin() const
Returns minimum y-coordinate.
Definition: Boundary.cpp:138
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:165
double xmax() const
Returns maximum x-coordinate.
Definition: Boundary.cpp:132
void sortOutgoingLanesConnections()
Sorts all lanes of all edges within the container by their direction.
Definition: NBEdgeCont.cpp:608
void markRoundabouts()
mark edge priorities and prohibit turn-arounds for all roundabout edges
void setConvBoundary(const Boundary &boundary)
sets the converted boundary
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
void resetWritable()
Resets all options to be writeable.
static bool transformCoordinate(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
Definition: NBNodeCont.h:114
void reduceGeometries(const double minDist)
Definition: NBEdgeCont.cpp:581
void addJoinExclusion(const std::vector< std::string > &ids, bool check=false)
Definition: NBNodeCont.cpp:446
const Boundary & getConvBoundary() const
Returns the converted boundary.
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
Definition: NBNodeCont.h:119
int removeUnwishedNodes(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc, bool removeGeometryNodes)
Removes "unwished" nodes.
Definition: NBNodeCont.cpp:316
void mirrorX()
mirror the network along the X-axis
void joinTLS(NBTrafficLightLogicCont &tlc, double maxdist)
Builds clusters of tls-controlled junctions and joins the control if possible.
int guessRoundabouts()
Determines which edges belong to roundabouts and increases their priority.
Definition: NBEdgeCont.cpp:921
static void computeFinal(bool lefthand=false)
compute the location attributes which will be used for output based on the loaded location data...
~NBNetBuilder()
Destructor.
static GeoConvHelper & getProcessing()
the coordinate transformation to use for input conversion and processing
Definition: GeoConvHelper.h:98
bool x2cartesian(Position &from, bool includeInBoundary=true)
double y() const
Returns the y-position.
Definition: Position.h:68
std::map< std::string, NBDistrict * >::const_iterator end() const
Returns the pointer to the end of the stored districts.
bool usingGeoProjection() const
Returns whether a transformation from geo to metric coordinates will be performed.
const std::vector< Crossing > & getCrossings() const
return this junctions pedestrian crossings
Definition: NBNode.h:620
void guessOpposites()
Sets opposite lane information for geometrically close edges.
Definition: NBEdgeCont.cpp:779
double x() const
Returns the x-position.
Definition: Position.h:63
int joinLoadedClusters(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
Joins loaded junction clusters (see NIXMLNodesHandler)
Definition: NBNodeCont.cpp:480
T MAX2(T a, T b)
Definition: StdDefs.h:70
const Boundary & getOrigBoundary() const
Returns the original boundary.
static void computeSingleNodeType(NBNode *node)
Computes a single node type.
void generateStreetSigns()
assigns street signs to edges based on toNode types
void recheckPostProcessConnections()
Try to set any stored connections.
Definition: NBEdgeCont.cpp:844
static bool transformCoordinates(PositionVector &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
void guessTLs(OptionsCont &oc, NBTrafficLightLogicCont &tlc)
Guesses which junctions or junction clusters shall be controlled by tls.
Definition: NBNodeCont.cpp:839
std::map< std::string, NBEdge * >::const_iterator end() const
Returns the pointer to the end of the stored edges.
Definition: NBEdgeCont.h:198
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
void avoidOverlap()
fix overlap
Definition: NBNodeCont.cpp:386
std::map< std::string, NBDistrict * >::const_iterator begin() const
Returns the pointer to the begin of the stored districts.
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
static void sortNodesEdges(NBNodeCont &nc, bool useNodeShape=false)
Sorts a node&#39;s edges clockwise regarding driving direction.
void computeLanes2Edges()
Computes for each edge which lanes approach the next edges.
Definition: NBEdgeCont.cpp:624
void moveConvertedBy(double x, double y)
Shifts the converted boundary by the given amounts.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
void sortEdges(bool useNodeShape)
sort all edge containers for this node
Definition: NBNode.cpp:2719
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:65
void checkGeometries(const double maxAngle, const double minRadius, bool fix)
Definition: NBEdgeCont.cpp:589
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
void checkOverlap(double threshold, double zThreshold) const
check whether edges overlap
void computeLogics(const NBEdgeCont &ec, OptionsCont &oc)
build the list of outgoing edges and lanes
void checkGrade(double threshold) const
check whether edges are to steep
static const NBHeightMapper & get()
return the singleton instance (maybe 0)
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
static void reportWarnings()
reports warnings if any occured
Definition: NBRequest.cpp:774
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
#define PROGRESS_TIME_MESSAGE(before)
Definition: MsgHandler.h:204
void computeLanes2Lanes()
computes the connections of lanes to edges
Definition: NBNode.cpp:813
void computeNodeShape(double mismatchThreshold)
Compute the junction shape for this node.
Definition: NBNode.cpp:781
std::map< std::string, NBPTStop * >::const_iterator begin() const
Returns the pointer to the begin of the stored pt stops.
Definition: NBPTStopCont.h:48
std::map< std::string, NBEdge * >::const_iterator begin() const
Returns the pointer to the begin of the stored edges.
Definition: NBEdgeCont.h:190
static methods for processing the coordinates conversion for the current net
Definition: GeoConvHelper.h:60
void computeLanes2Lanes()
divides the incoming lanes on outgoing lanes
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:56
void buildCrossingsAndWalkingAreas(bool discardInvalid=true)
build crossings, and walkingareas. Also removes invalid loaded crossings if wished ...
Definition: NBNode.cpp:2008
void removeUnwishedEdges(NBDistrictCont &dc)
Removes unwished edges (not in keep-edges)
Definition: NBEdgeCont.cpp:553
void computeSingleNode(NBNode *node, OptionsCont &oc, const std::set< std::string > &explicitTurnarounds=std::set< std::string >(), bool mayAddOrRemove=true)
Performs the network building steps only for a single Node.
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
void setDefaults(int defaultNumLanes, double defaultLaneWidth, double defaultSpeed, int defaultPriority, SVCPermissions defaultPermissions)
Sets the default values.
Definition: NBTypeCont.cpp:47
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
static void computeEdgePriorities(NBNodeCont &nc)
Computes edge priorities within a node.
A list of positions.
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
Definition: NBEdgeCont.cpp:78
NBEdgeCont myEdgeCont
The used container for edges.
Definition: NBNetBuilder.h:232
T get(const std::string &str) const
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool myNetworkHaveCrossings
flag to indicate that network has crossings
Definition: NBNetBuilder.h:247
void computeEdge2Edges(bool noLeftMovers)
Computes for each edge the approached edges.
Definition: NBEdgeCont.cpp:616
void computeLaneShapes()
Computes the shapes of all lanes of all edges stored in the container.
Definition: NBEdgeCont.cpp:684
NBTrafficLightLogicCont myTLLCont
The used container for traffic light logics.
Definition: NBNetBuilder.h:235
bool exists(const std::string &name) const
Returns the information whether the named option is known.
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
T MIN2(T a, T b)
Definition: StdDefs.h:64
double xmin() const
Returns minimum x-coordinate.
Definition: Boundary.cpp:126
void computeNodeShapes(double mismatchThreshold=-1)
Compute the junction shape for this node.
#define PROGRESS_BEGIN_MESSAGE(msg)
Definition: MsgHandler.h:202
void splitGeometry(NBNodeCont &nc)
Splits edges into multiple if they have a complex geometry.
Definition: NBEdgeCont.cpp:570
const std::set< EdgeSet > getRoundabouts() const
Returns the determined roundabouts.
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
int joinJunctions(double maxDist, NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
Joins junctions that are very close together.
Definition: NBNodeCont.cpp:504
#define DEG2RAD(x)
Definition: GeomHelper.h:45
std::map< std::string, NBPTStop * >::const_iterator end() const
Returns the pointer to the end of the stored pt stops.
Definition: NBPTStopCont.h:56
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
static void computeTurnDirectionsForNode(NBNode *node, bool warn)
Computes turnaround destinations for all incoming edges of the given nodes (if any) ...
void avoidOverlap()
fix overlap
Definition: NBNode.cpp:2683
void process(NBEdgeCont &cont)
void setAsTLControlled(NBNode *node, NBTrafficLightLogicCont &tlc, TrafficLightType type, std::string id="")
Sets the given node as being controlled by a tls.
int guessSidewalks(double width, double minSpeed, double maxSpeed, bool fromPermissions)
add sidwalks to edges within the given limits or permissions and return the number of edges affected ...
static void computeRamps(NBNetBuilder &nb, OptionsCont &oc)
Computes highway on-/off-ramps (if wished)
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
int removeSelfLoops(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tc)
Removes edges which are both incoming and outgoing into this node.
Definition: NBNode.cpp:379
static void computeEdgePrioritiesSingleNode(NBNode *node)
Computes edge priorities within a single node.
void appendTurnarounds(bool noTLSControlled)
Appends turnarounds to all edges stored in the container.
Definition: NBEdgeCont.cpp:660
int remapIDs(bool numericaIDs, bool reservedIDs)
remap node IDs accoring to options –numerical-ids and –reserved-ids
static void computeNodeTypes(NBNodeCont &nc)
Computes node types.
void moveToOrigin(GeoConvHelper &geoConvHelper, bool lefthand)
shift network so its lower left corner is at 0,0
void buildInnerEdges()
build internal lanes, pedestrian crossings and walking areas
Definition: NBNode.cpp:2031
void removeIsolatedRoads(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tc)
Removes sequences of edges that are not connected with a junction. Simple roads without junctions som...
Definition: NBNodeCont.cpp:222
A storage for options typed value containers)
Definition: OptionsCont.h:99
const Position getOffsetBase() const
Returns the network base.
void computeEdgeShapes()
Computes the shapes of all edges stored in the container.
Definition: NBEdgeCont.cpp:676
const Position & getPosition() const
Definition: NBNode.h:232
Represents a single node (junction) during network building.
Definition: NBNode.h:75
static void computeTurnDirections(NBNodeCont &nc, bool warn=true)
Computes turnaround destinations for all edges (if exist)
int guessCrossings()
guess pedestrian crossings and return how many were guessed
Definition: NBNode.cpp:1787
NBDistrictCont myDistrictCont
The used container for districts.
Definition: NBNetBuilder.h:238
void printBuiltNodesStatistics() const
Prints statistics about built nodes.
double getZ(const Position &geo) const
returns height for the given geo coordinate (WGS84)
void compute(OptionsCont &oc, const std::set< std::string > &explicitTurnarounds=std::set< std::string >(), bool mayAddOrRemove=true)
Performs the network building steps.
void computeLogic(const NBEdgeCont &ec, OptionsCont &oc)
computes the node&#39;s type, logic and traffic light
Definition: NBNode.cpp:718
void recheckLanes()
Rechecks whether all lanes have a successor for each of the stored edges.
Definition: NBEdgeCont.cpp:632
static long getCurrentMillis()
Returns the current time in milliseconds.
Definition: SysUtils.cpp:46
#define PROGRESS_DONE_MESSAGE()
Definition: MsgHandler.h:203
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:86
bool myHaveLoadedNetworkWithoutInternalEdges
whether a .net.xml without internal edges was loaded
Definition: NBNetBuilder.h:244
double ymax() const
Returns maximum y-coordinate.
Definition: Boundary.cpp:144
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:201
double getZRange() const
Returns the elevation range of the boundary (z-axis)
Definition: Boundary.cpp:174
int remapIDs(bool numericaIDs, bool reservedIDs)
remap node IDs accoring to options –numerical-ids and –reserved-ids
NBNodeCont myNodeCont
The used container for nodes.
Definition: NBNetBuilder.h:226
void setTLControllingInformation(const NBEdgeCont &ec, const NBNodeCont &nc)
Informs the edges about being controlled by a tls.
std::pair< int, int > computeLogics(OptionsCont &oc)
Computes the traffic light logics using the stored definitions and stores the results.
bool ready() const
returns whether the NBHeightMapper has data
Set z-values for all network positions based on data from a height map.
TrafficLightType