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-2015 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 "NBDistribution.h"
45 #include "NBRequest.h"
46 #include "NBTypeCont.h"
51 #include <utils/common/ToString.h>
53 #include "NBAlgorithms.h"
54 #include "NBAlgorithms_Ramps.h"
55 #include "NBHeightMapper.h"
56 
57 #ifdef CHECK_MEMORY_LEAKS
58 #include <foreign/nvwa/debug_new.h>
59 #endif // CHECK_MEMORY_LEAKS
60 
61 
62 // ===========================================================================
63 // method definitions
64 // ===========================================================================
66  myEdgeCont(myTypeCont),
67  myHaveLoadedNetworkWithoutInternalEdges(false)
68 {}
69 
70 
72 
73 
74 void
76  // apply options to type control
77  myTypeCont.setDefaults(oc.getInt("default.lanenumber"), oc.getFloat("default.speed"), oc.getInt("default.priority"));
78  // apply options to edge control
80  // apply options to traffic light logics control
82 }
83 
84 
85 void
87  const std::set<std::string>& explicitTurnarounds,
88  bool removeElements) {
90 
91 
92  const bool lefthand = oc.getBool("lefthand");
93  if (lefthand) {
94  mirrorX();
95  };
96 
97  // MODIFYING THE SETS OF NODES AND EDGES
98 
99  // Removes edges that are connecting the same node
100  PROGRESS_BEGIN_MESSAGE("Removing self-loops");
103  //
104  if (oc.exists("remove-edges.isolated") && oc.getBool("remove-edges.isolated")) {
105  PROGRESS_BEGIN_MESSAGE("Finding isolated roads");
108  }
109  //
110  if (oc.exists("keep-edges.postload") && oc.getBool("keep-edges.postload")) {
111  if (oc.isSet("keep-edges.explicit") || oc.isSet("keep-edges.input-file")) {
112  PROGRESS_BEGIN_MESSAGE("Removing unwished edges");
115  }
116  }
117  if (oc.getBool("junctions.join") || (oc.exists("ramps.guess") && oc.getBool("ramps.guess"))) {
118  // preliminary geometry computations to determine the length of edges
119  // This depends on turning directions and sorting of edge list
120  // in case junctions are joined geometry computations have to be repeated
121  // preliminary roundabout computations to avoid damaging roundabouts via junctions.join or ramps.guess
127  if (oc.getBool("roundabouts.guess")) {
129  }
130  const std::set<EdgeSet>& roundabouts = myEdgeCont.getRoundabouts();
131  for (std::set<EdgeSet>::const_iterator it_round = roundabouts.begin();
132  it_round != roundabouts.end(); ++it_round) {
133  std::vector<std::string> nodeIDs;
134  for (EdgeSet::const_iterator it_edge = it_round->begin(); it_edge != it_round->end(); ++it_edge) {
135  nodeIDs.push_back((*it_edge)->getToNode()->getID());
136  }
137  myNodeCont.addJoinExclusion(nodeIDs);
138  }
139  }
140  // join junctions (may create new "geometry"-nodes so it needs to come before removing these
141  if (oc.exists("junctions.join-exclude") && oc.isSet("junctions.join-exclude")) {
142  myNodeCont.addJoinExclusion(oc.getStringVector("junctions.join-exclude"));
143  }
145  if (oc.getBool("junctions.join")) {
146  PROGRESS_BEGIN_MESSAGE("Joining junction clusters");
147  numJoined += myNodeCont.joinJunctions(oc.getFloat("junctions.join-dist"), myDistrictCont, myEdgeCont, myTLLCont);
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 (removeElements) {
160  unsigned int no = 0;
161  const bool removeGeometryNodes = oc.exists("geometry.remove") && oc.getBool("geometry.remove");
162  PROGRESS_BEGIN_MESSAGE("Removing empty nodes" + std::string(removeGeometryNodes ? " and geometry nodes" : ""));
163  // removeUnwishedNodes needs turnDirections. @todo: try to call this less often
167  WRITE_MESSAGE(" " + toString(no) + " nodes removed.");
168  }
169 
170  // MOVE TO ORIGIN
171  // compute new boundary after network modifications have taken place
172  Boundary boundary;
173  for (std::map<std::string, NBNode*>::const_iterator it = myNodeCont.begin(); it != myNodeCont.end(); ++it) {
174  boundary.add(it->second->getPosition());
175  }
176  for (std::map<std::string, NBEdge*>::const_iterator it = myEdgeCont.begin(); it != myEdgeCont.end(); ++it) {
177  boundary.add(it->second->getGeometry().getBoxBoundary());
178  }
179  geoConvHelper.setConvBoundary(boundary);
180 
181  if (!oc.getBool("offset.disable-normalization") && oc.isDefault("offset.x") && oc.isDefault("offset.y")) {
182  moveToOrigin(geoConvHelper, lefthand);
183  }
184  geoConvHelper.computeFinal(lefthand); // information needed for location element fixed at this point
185 
186  if (oc.exists("geometry.min-dist") && oc.isSet("geometry.min-dist")) {
187  PROGRESS_BEGIN_MESSAGE("Reducing geometries");
188  myEdgeCont.reduceGeometries(oc.getFloat("geometry.min-dist"));
190  }
191  // @note: removing geometry can create similar edges so joinSimilarEdges must come afterwards
192  // @note: likewise splitting can destroy similarities so joinSimilarEdges must come before
193  if (removeElements && oc.getBool("edges.join")) {
194  PROGRESS_BEGIN_MESSAGE("Joining similar edges");
198  }
199  //
200  if (oc.exists("geometry.split") && oc.getBool("geometry.split")) {
201  PROGRESS_BEGIN_MESSAGE("Splitting geometry edges");
204  }
205  // turning direction
206  PROGRESS_BEGIN_MESSAGE("Computing turning directions");
209  // correct edge geometries to avoid overlap
211  // guess ramps
212  if ((oc.exists("ramps.guess") && oc.getBool("ramps.guess")) || (oc.exists("ramps.set") && oc.isSet("ramps.set"))) {
213  PROGRESS_BEGIN_MESSAGE("Guessing and setting on-/off-ramps");
217  }
218  // guess sidewalks
219  if (oc.getBool("sidewalks.guess") || oc.getBool("sidewalks.guess.from-permissions")) {
220  const int sidewalks = myEdgeCont.guessSidewalks(oc.getFloat("default.sidewalk-width"),
221  oc.getFloat("sidewalks.guess.min-speed"),
222  oc.getFloat("sidewalks.guess.max-speed"),
223  oc.getBool("sidewalks.guess.from-permissions"));
224  WRITE_MESSAGE("Guessed " + toString(sidewalks) + " sidewalks.");
225  }
226 
227  // check whether any not previously setable connections may be set now
229  //
230  if (oc.exists("geometry.max-angle")) {
232  DEG2RAD(oc.getFloat("geometry.max-angle")),
233  oc.getFloat("geometry.min-radius"),
234  oc.getBool("geometry.min-radius.fix"));
235  }
236 
237  // GEOMETRY COMPUTATION
238  //
239  PROGRESS_BEGIN_MESSAGE("Sorting nodes' edges");
243  //
244  PROGRESS_BEGIN_MESSAGE("Computing node shapes");
245  if (oc.exists("geometry.junction-mismatch-threshold")) {
246  myNodeCont.computeNodeShapes(oc.getFloat("geometry.junction-mismatch-threshold"));
247  } else {
249  }
251  //
252  PROGRESS_BEGIN_MESSAGE("Computing edge shapes");
255  // resort edges based on the node and edge shapes
258 
259  // APPLY SPEED MODIFICATIONS
260  if (oc.exists("speed.offset")) {
261  const SUMOReal speedOffset = oc.getFloat("speed.offset");
262  const SUMOReal speedFactor = oc.getFloat("speed.factor");
263  if (speedOffset != 0 || speedFactor != 1) {
264  PROGRESS_BEGIN_MESSAGE("Applying speed modifications");
265  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
266  (*i).second->setSpeed(-1, (*i).second->getSpeed() * speedFactor + speedOffset);
267  }
269  }
270  }
271 
272  // CONNECTIONS COMPUTATION
273  //
274  PROGRESS_BEGIN_MESSAGE("Computing node types");
277  //
278  bool haveCrossings = false;
279  if (oc.getBool("crossings.guess")) {
280  haveCrossings = true;
281  int crossings = 0;
282  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
283  crossings += (*i).second->guessCrossings();
284  }
285  WRITE_MESSAGE("Guessed " + toString(crossings) + " pedestrian crossings.");
286  }
287  if (!haveCrossings) {
288  // recheck whether we had crossings in the input
289  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
290  if (i->second->getCrossings().size() > 0) {
291  haveCrossings = true;
292  break;
293  }
294  }
295  }
296 
297  if (oc.isDefault("no-internal-links") && !haveCrossings && myHaveLoadedNetworkWithoutInternalEdges) {
298  oc.set("no-internal-links", "true");
299  }
300 
301  //
302  PROGRESS_BEGIN_MESSAGE("Computing priorities");
305  //
306  PROGRESS_BEGIN_MESSAGE("Computing approached edges");
307  myEdgeCont.computeEdge2Edges(oc.getBool("no-left-connections"));
309  //
310  if (oc.getBool("roundabouts.guess")) {
311  PROGRESS_BEGIN_MESSAGE("Guessing and setting roundabouts");
312  const int numGuessed = myEdgeCont.guessRoundabouts();
313  if (numGuessed > 0) {
314  WRITE_MESSAGE(" Guessed " + toString(numGuessed) + " roundabout(s).");
315  }
317  }
319  //
320  PROGRESS_BEGIN_MESSAGE("Computing approaching lanes");
323  //
324  PROGRESS_BEGIN_MESSAGE("Dividing of lanes on approached lanes");
328  //
329  PROGRESS_BEGIN_MESSAGE("Processing turnarounds");
330  if (!oc.getBool("no-turnarounds")) {
331  myEdgeCont.appendTurnarounds(oc.getBool("no-turnarounds.tls"));
332  } else {
333  myEdgeCont.appendTurnarounds(explicitTurnarounds, oc.getBool("no-turnarounds.tls"));
334  }
336  //
337  PROGRESS_BEGIN_MESSAGE("Rechecking of lane endings");
340 
341  if (haveCrossings && !oc.getBool("no-internal-links")) {
342  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
343  i->second->buildCrossingsAndWalkingAreas();
344  }
345  }
346 
347  // GUESS TLS POSITIONS
348  PROGRESS_BEGIN_MESSAGE("Assigning nodes to traffic lights");
349  if (oc.isSet("tls.set")) {
350  std::vector<std::string> tlControlledNodes = oc.getStringVector("tls.set");
352  for (std::vector<std::string>::const_iterator i = tlControlledNodes.begin(); i != tlControlledNodes.end(); ++i) {
353  NBNode* node = myNodeCont.retrieve(*i);
354  if (node == 0) {
355  WRITE_WARNING("Building a tl-logic for junction '" + *i + "' is not possible." + "\n The junction '" + *i + "' is not known.");
356  } else {
358  }
359  }
360  }
363  //
364  if (oc.getBool("tls.join")) {
365  PROGRESS_BEGIN_MESSAGE("Joining traffic light nodes");
366  myNodeCont.joinTLS(myTLLCont, oc.getFloat("tls.join-dist"));
368  }
369 
370 
371  // COMPUTING RIGHT-OF-WAY AND TRAFFIC LIGHT PROGRAMS
372  //
373  PROGRESS_BEGIN_MESSAGE("Computing traffic light control information");
376  //
377  PROGRESS_BEGIN_MESSAGE("Computing node logics");
380  //
381  PROGRESS_BEGIN_MESSAGE("Computing traffic light logics");
382  std::pair<unsigned int, unsigned int> numbers = myTLLCont.computeLogics(myEdgeCont, oc);
384  std::string progCount = "";
385  if (numbers.first != numbers.second) {
386  progCount = "(" + toString(numbers.second) + " programs) ";
387  }
388  WRITE_MESSAGE(" " + toString(numbers.first) + " traffic light(s) " + progCount + "computed.");
389  //
390  if (oc.isSet("street-sign-output")) {
391  PROGRESS_BEGIN_MESSAGE("Generating street signs");
394  }
395 
396  // FINISHING INNER EDGES
397  if (!oc.getBool("no-internal-links")) {
398  PROGRESS_BEGIN_MESSAGE("Building inner edges");
399  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
400  (*i).second->sortOutgoingConnectionsByIndex();
401  }
402  // walking areas shall only be built if crossings are wished as well
403  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
404  (*i).second->buildInnerEdges();
405  }
407  }
408  if (lefthand) {
409  mirrorX();
410  };
411 
412  // report
413  WRITE_MESSAGE("-----------------------------------------------------");
414  WRITE_MESSAGE("Summary:");
416  WRITE_MESSAGE(" Network boundaries:");
417  WRITE_MESSAGE(" Original boundary : " + toString(geoConvHelper.getOrigBoundary()));
418  WRITE_MESSAGE(" Applied offset : " + toString(geoConvHelper.getOffsetBase()));
419  WRITE_MESSAGE(" Converted boundary : " + toString(geoConvHelper.getConvBoundary()));
420  WRITE_MESSAGE("-----------------------------------------------------");
422  // report on very large networks
423  if (MAX2(geoConvHelper.getConvBoundary().xmax(), geoConvHelper.getConvBoundary().ymax()) > 1000000 ||
424  MIN2(geoConvHelper.getConvBoundary().xmin(), geoConvHelper.getConvBoundary().ymin()) < -1000000) {
425  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");
426  }
427 }
428 
429 
430 void
431 NBNetBuilder::moveToOrigin(GeoConvHelper& geoConvHelper, bool lefthand) {
432  PROGRESS_BEGIN_MESSAGE("Moving network to origin");
433  Boundary boundary = geoConvHelper.getConvBoundary();
434  const SUMOReal x = -boundary.xmin();
435  const SUMOReal y = -(lefthand ? boundary.ymax() : boundary.ymin());
436  //if (lefthand) {
437  // y = boundary.ymax();
438  //}
439  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
440  (*i).second->reshiftPosition(x, y);
441  }
442  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
443  (*i).second->reshiftPosition(x, y);
444  }
445  for (std::map<std::string, NBDistrict*>::const_iterator i = myDistrictCont.begin(); i != myDistrictCont.end(); ++i) {
446  (*i).second->reshiftPosition(x, y);
447  }
448  geoConvHelper.moveConvertedBy(x, y);
450 }
451 
452 
453 void
455  // mirror the network along the X-axis
456  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
457  (*i).second->mirrorX();
458  }
459  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
460  (*i).second->mirrorX();
461  }
462  for (std::map<std::string, NBDistrict*>::const_iterator i = myDistrictCont.begin(); i != myDistrictCont.end(); ++i) {
463  (*i).second->mirrorX();
464  }
465 }
466 
467 
468 bool
469 NBNetBuilder::transformCoordinates(Position& from, bool includeInBoundary, GeoConvHelper* from_srs) {
470  Position orig(from);
471  bool ok = GeoConvHelper::getProcessing().x2cartesian(from, includeInBoundary);
472  if (ok) {
473  const NBHeightMapper& hm = NBHeightMapper::get();
474  if (hm.ready()) {
475  if (from_srs != 0 && from_srs->usingGeoProjection()) {
476  from_srs->cartesian2geo(orig);
477  }
478  SUMOReal z = hm.getZ(orig);
479  from = Position(from.x(), from.y(), z);
480  }
481  }
482  return ok;
483 }
484 
485 
486 bool
487 NBNetBuilder::transformCoordinates(PositionVector& from, bool includeInBoundary, GeoConvHelper* from_srs) {
488  const SUMOReal maxLength = OptionsCont::getOptions().getFloat("geometry.max-segment-length");
489  if (maxLength > 0 && from.size() > 1) {
490  // transformation to cartesian coordinates must happen before we can check segment length
491  PositionVector copy = from;
492  for (int i = 0; i < (int) from.size(); i++) {
493  transformCoordinates(copy[i], false);
494  }
495  // check lengths and insert new points where needed (in the original
496  // coordinate system)
497  int inserted = 0;
498  for (int i = 0; i < (int)copy.size() - 1; i++) {
499  Position start = from[i + inserted];
500  Position end = from[i + inserted + 1];
501  SUMOReal length = copy[i].distanceTo(copy[i + 1]);
502  const Position step = (end - start) * (maxLength / length);
503  int steps = 0;
504  while (length > maxLength) {
505  length -= maxLength;
506  steps++;
507  from.insert(from.begin() + i + inserted + 1, start + (step * steps));
508  inserted++;
509  }
510  }
511  // now perform the transformation again so that height mapping can be
512  // performed for the new points
513  }
514  bool ok = true;
515  for (int i = 0; i < (int) from.size(); i++) {
516  ok = ok && transformCoordinates(from[i], includeInBoundary, from_srs);
517  }
518  return ok;
519 }
520 
521 /****************************************************************************/
NBNetBuilder()
Constructor.
NBTypeCont myTypeCont
The used container for street types.
Definition: NBNetBuilder.h:237
int guessSidewalks(SUMOReal width, SUMOReal minSpeed, SUMOReal maxSpeed, bool fromPermissions)
add sidwalks to edges within the given limits or permissions and return the number of edges affected ...
void joinSimilarEdges(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
Joins edges connecting the same nodes.
Definition: NBNodeCont.cpp:180
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) ...
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:168
void sortOutgoingLanesConnections()
Sorts all lanes of all edges within the container by their direction.
Definition: NBEdgeCont.cpp:576
void markRoundabouts()
mark edge priorities and prohibit turn-arounds for all roundabout edges
Definition: NBEdgeCont.cpp:951
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
void setConvBoundary(const Boundary &boundary)
sets the converted boundary
static bool transformCoordinates(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
NBJoinedEdgesMap myJoinedEdges
Map of joined edges.
Definition: NBNetBuilder.h:249
void addJoinExclusion(const std::vector< std::string > &ids, bool check=false)
Definition: NBNodeCont.cpp:450
bool ready() const
returns whether the NBHeightMapper has data
unsigned int removeUnwishedNodes(NBDistrictCont &dc, NBEdgeCont &ec, NBJoinedEdgesMap &je, NBTrafficLightLogicCont &tlc, bool removeGeometryNodes)
Removes "unwished" nodes.
Definition: NBNodeCont.cpp:319
const std::set< EdgeSet > getRoundabouts() const
Returns the determined roundabouts.
Definition: NBEdgeCont.cpp:933
void mirrorX()
mirror the network along the X-axis
SUMOReal getZ(const Position &geo) const
returns height for the given geo coordinate (WGS84)
int guessRoundabouts()
Determines which edges belong to roundabouts and increases their priority.
Definition: NBEdgeCont.cpp:826
void compute(OptionsCont &oc, const std::set< std::string > &explicitTurnarounds=std::set< std::string >(), bool removeElements=true)
Performs the network building steps.
static void computeFinal(bool lefthand=false)
compute the location attributes which will be used for output based on the loaded location data...
unsigned int joinJunctions(SUMOReal maxDist, NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
Joins junctions that are very close together.
Definition: NBNodeCont.cpp:508
~NBNetBuilder()
Destructor.
SUMOReal ymin() const
Returns minimum y-coordinate.
Definition: Boundary.cpp:124
static GeoConvHelper & getProcessing()
the coordinate transformation to use for input conversion and processing
Definition: GeoConvHelper.h:98
bool x2cartesian(Position &from, bool includeInBoundary=true)
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
SUMOReal xmin() const
Returns minimum x-coordinate.
Definition: Boundary.cpp:112
T MAX2(T a, T b)
Definition: StdDefs.h:79
void generateStreetSigns()
assigns street signs to edges based on toNode types
Definition: NBEdgeCont.cpp:977
void recheckPostProcessConnections()
Try to set any stored connections.
Definition: NBEdgeCont.cpp:754
void guessTLs(OptionsCont &oc, NBTrafficLightLogicCont &tlc)
Guesses which junctions or junction clusters shall be controlled by tls.
Definition: NBNodeCont.cpp:839
SUMOReal getFloat(const std::string &name) const
Returns the SUMOReal-value of the named option (only for Option_Float)
void avoidOverlap()
fix overlap
Definition: NBNodeCont.cpp:390
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:592
SUMOReal x() const
Returns the x-position.
Definition: Position.h:63
SUMOReal xmax() const
Returns maximum x-coordinate.
Definition: Boundary.cpp:118
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:69
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
void checkGeometries(const SUMOReal maxAngle, const SUMOReal minRadius, bool fix)
Definition: NBEdgeCont.cpp:557
void computeLogics(const NBEdgeCont &ec, OptionsCont &oc)
build the list of outgoing edges and lanes
static const NBHeightMapper & get()
return the singleton instance (maybe 0)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
static void reportWarnings()
reports warnings if any occured
Definition: NBRequest.cpp:775
void reduceGeometries(const SUMOReal minDist)
Definition: NBEdgeCont.cpp:549
std::map< std::string, NBEdge * >::const_iterator end() const
Returns the pointer to the end of the stored edges.
Definition: NBEdgeCont.h:198
bool usingGeoProjection() const
Returns whether a transformation from geo to metric coordinates will be performed.
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::map< std::string, NBDistrict * >::const_iterator begin() const
Returns the pointer to the begin of the stored districts.
void removeUnwishedEdges(NBDistrictCont &dc)
Removes unwished edges (not in keep-edges)
Definition: NBEdgeCont.cpp:521
void joinTLS(NBTrafficLightLogicCont &tlc, SUMOReal maxdist)
Builds clusters of tls-controlled junctions and joins the control if possible.
static StringBijection< TrafficLightType > TrafficLightTypes
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
std::map< std::string, NBDistrict * >::const_iterator end() const
Returns the pointer to the end of the stored districts.
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:81
NBEdgeCont myEdgeCont
The used container for edges.
Definition: NBNetBuilder.h:240
unsigned int joinLoadedClusters(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
Joins loaded junction clusters (see NIXMLNodesHandler)
Definition: NBNodeCont.cpp:484
void computeEdge2Edges(bool noLeftMovers)
Computes for each edge the approached edges.
Definition: NBEdgeCont.cpp:584
void computeLaneShapes()
Computes the shapes of all lanes of all edges stored in the container.
Definition: NBEdgeCont.cpp:632
NBTrafficLightLogicCont myTLLCont
The used container for traffic light logics.
Definition: NBNetBuilder.h:243
T MIN2(T a, T b)
Definition: StdDefs.h:73
#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:538
const Position getOffsetBase() const
Returns the network base.
std::pair< unsigned int, unsigned int > computeLogics(NBEdgeCont &ec, OptionsCont &oc)
Computes the traffic light logics using the stored definitions and stores the results.
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
Definition: NBNodeCont.h:135
#define DEG2RAD(x)
Definition: GeomHelper.h:45
const Boundary & getConvBoundary() const
Returns the converted boundary.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:53
std::map< std::string, NBEdge * >::const_iterator begin() const
Returns the pointer to the begin of the stored edges.
Definition: NBEdgeCont.h:190
void setAsTLControlled(NBNode *node, NBTrafficLightLogicCont &tlc, TrafficLightType type, std::string id="")
Sets the given node as being controlled by a tls.
void add(SUMOReal x, SUMOReal y)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:76
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.
void appendTurnarounds(bool noTLSControlled)
Appends turnarounds to all edges stored in the container.
Definition: NBEdgeCont.cpp:608
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 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:225
SUMOReal y() const
Returns the y-position.
Definition: Position.h:68
A storage for options typed value containers)
Definition: OptionsCont.h:108
void computeNodeShapes(SUMOReal mismatchThreshold=-1)
Compute the junction shape for this node.
void computeEdgeShapes()
Computes the shapes of all edges stored in the container.
Definition: NBEdgeCont.cpp:624
Represents a single node (junction) during network building.
Definition: NBNode.h:74
T get(const std::string &str) const
static void computeTurnDirections(NBNodeCont &nc, bool warn=true)
Computes turnaround destinations for all edges (if exist)
NBDistrictCont myDistrictCont
The used container for districts.
Definition: NBNetBuilder.h:246
#define SUMOReal
Definition: config.h:214
SUMOReal ymax() const
Returns maximum y-coordinate.
Definition: Boundary.cpp:130
const Boundary & getOrigBoundary() const
Returns the original boundary.
void init(NBEdgeCont &ec)
Initialises the map using the list of edge names.
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
Definition: NBNodeCont.cpp:109
void recheckLanes()
Rechecks whether all lanes have a successor for each of the stored edges.
Definition: NBEdgeCont.cpp:600
#define PROGRESS_DONE_MESSAGE()
Definition: MsgHandler.h:203
void printBuiltNodesStatistics() const
Prints statistics about built nodes.
bool myHaveLoadedNetworkWithoutInternalEdges
whether a .net.xml without internal edges was loaded
Definition: NBNetBuilder.h:252
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:201
NBNodeCont myNodeCont
The used container for nodes.
Definition: NBNetBuilder.h:234
void setTLControllingInformation(const NBEdgeCont &ec, const NBNodeCont &nc)
Informs the edges about being controlled by a tls.
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
Definition: NBNodeCont.h:127
Set z-values for all network positions based on data from a height map.
void moveConvertedBy(SUMOReal x, SUMOReal y)
Shifts the converted boundary by the given amounts.
bool exists(const std::string &name) const
Returns the information whether the named option is known.
void setDefaults(int defaultNumLanes, SUMOReal defaultSpeed, int defaultPriority)
Sets the default values.
Definition: NBTypeCont.cpp:51
TrafficLightType
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.