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 {}
68 
69 
71 
72 
73 void
75  // apply options to type control
76  myTypeCont.setDefaults(oc.getInt("default.lanenumber"), oc.getFloat("default.speed"), oc.getInt("default.priority"));
77  // apply options to edge control
79  // apply options to traffic light logics control
81 }
82 
83 
84 void
86  const std::set<std::string>& explicitTurnarounds,
87  bool removeElements) {
89 
90 
91  // MODIFYING THE SETS OF NODES AND EDGES
92 
93  // Removes edges that are connecting the same node
94  PROGRESS_BEGIN_MESSAGE("Removing self-loops");
97  //
98  if (oc.exists("remove-edges.isolated") && oc.getBool("remove-edges.isolated")) {
99  PROGRESS_BEGIN_MESSAGE("Finding isolated roads");
102  }
103  //
104  if (oc.exists("keep-edges.postload") && oc.getBool("keep-edges.postload")) {
105  if (oc.isSet("keep-edges.explicit") || oc.isSet("keep-edges.input-file")) {
106  PROGRESS_BEGIN_MESSAGE("Removing unwished edges");
109  }
110  }
111  // join junctions (may create new "geometry"-nodes so it needs to come before removing these
112  if (oc.exists("junctions.join-exclude") && oc.isSet("junctions.join-exclude")) {
113  myNodeCont.addJoinExclusion(oc.getStringVector("junctions.join-exclude"));
114  }
116  if (oc.getBool("junctions.join")) {
117  PROGRESS_BEGIN_MESSAGE("Joining junction clusters");
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
123  myNodeCont.computeNodeShapes(oc.getBool("lefthand"));
125  // preliminary roundabout computations to avoid destroying roundabouts
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  numJoined += myNodeCont.joinJunctions(oc.getFloat("junctions.join-dist"), myDistrictCont, myEdgeCont, myTLLCont);
139  // reset geometry to avoid influencing subsequent steps (ramps.guess)
140  myEdgeCont.computeLaneShapes();
142  }
143  if (numJoined > 0) {
144  // bit of a misnomer since we're already done
145  WRITE_MESSAGE(" Joined " + toString(numJoined) + " junction cluster(s).");
146  }
147  //
148  if (removeElements) {
149  unsigned int no = 0;
150  const bool removeGeometryNodes = oc.exists("geometry.remove") && oc.getBool("geometry.remove");
151  PROGRESS_BEGIN_MESSAGE("Removing empty nodes" + std::string(removeGeometryNodes ? " and geometry nodes" : ""));
154  WRITE_MESSAGE(" " + toString(no) + " nodes removed.");
155  }
156 
157  // MOVE TO ORIGIN
158  // compute new boundary after network modifications have taken place
159  Boundary boundary;
160  for (std::map<std::string, NBNode*>::const_iterator it = myNodeCont.begin(); it != myNodeCont.end(); ++it) {
161  boundary.add(it->second->getPosition());
162  }
163  for (std::map<std::string, NBEdge*>::const_iterator it = myEdgeCont.begin(); it != myEdgeCont.end(); ++it) {
164  boundary.add(it->second->getGeometry().getBoxBoundary());
165  }
166  geoConvHelper.setConvBoundary(boundary);
167 
168  if (!oc.getBool("offset.disable-normalization") && oc.isDefault("offset.x") && oc.isDefault("offset.y")) {
169  moveToOrigin(geoConvHelper);
170  }
171  geoConvHelper.computeFinal(); // information needed for location element fixed at this point
172 
173  if (oc.exists("geometry.min-dist") && oc.isSet("geometry.min-dist")) {
174  PROGRESS_BEGIN_MESSAGE("Reducing geometries");
175  myEdgeCont.reduceGeometries(oc.getFloat("geometry.min-dist"));
177  }
178  // @note: removing geometry can create similar edges so joinSimilarEdges must come afterwards
179  // @note: likewise splitting can destroy similarities so joinSimilarEdges must come before
180  if (removeElements) {
181  PROGRESS_BEGIN_MESSAGE("Joining similar edges");
185  }
186  //
187  if (oc.exists("geometry.split") && oc.getBool("geometry.split")) {
188  PROGRESS_BEGIN_MESSAGE("Splitting geometry edges");
191  }
192  // turning direction
193  PROGRESS_BEGIN_MESSAGE("Computing turning directions");
196  // correct edge geometries to avoid overlap
198  // guess ramps
199  if ((oc.exists("ramps.guess") && oc.getBool("ramps.guess")) || (oc.exists("ramps.set") && oc.isSet("ramps.set"))) {
200  PROGRESS_BEGIN_MESSAGE("Guessing and setting on-/off-ramps");
204  }
205  // guess sidewalks
206  if (oc.getBool("sidewalks.guess") || oc.getBool("sidewalks.guess.from-permissions")) {
207  const int sidewalks = myEdgeCont.guessSidewalks(oc.getFloat("default.sidewalk-width"),
208  oc.getFloat("sidewalks.guess.min-speed"),
209  oc.getFloat("sidewalks.guess.max-speed"),
210  oc.getBool("sidewalks.guess.from-permissions"));
211  WRITE_MESSAGE("Guessed " + toString(sidewalks) + " sidewalks.");
212  }
213 
214  // check whether any not previously setable connections may be set now
216  //
217  if (oc.exists("geometry.max-angle")) {
219  oc.getFloat("geometry.max-angle"),
220  oc.getFloat("geometry.min-radius"),
221  oc.getBool("geometry.min-radius.fix"));
222  }
223 
224  // GEOMETRY COMPUTATION
225  //
226  PROGRESS_BEGIN_MESSAGE("Sorting nodes' edges");
230  //
231  PROGRESS_BEGIN_MESSAGE("Computing node shapes");
232  if (oc.exists("geometry.junction-mismatch-threshold")) {
233  myNodeCont.computeNodeShapes(oc.getBool("lefthand"), oc.getFloat("geometry.junction-mismatch-threshold"));
234  } else {
235  myNodeCont.computeNodeShapes(oc.getBool("lefthand"));
236  }
238  //
239  PROGRESS_BEGIN_MESSAGE("Computing edge shapes");
242  // resort edges based on the node and edge shapes
245 
246  // APPLY SPEED MODIFICATIONS
247  if (oc.exists("speed.offset")) {
248  const SUMOReal speedOffset = oc.getFloat("speed.offset");
249  const SUMOReal speedFactor = oc.getFloat("speed.factor");
250  if (speedOffset != 0 || speedFactor != 1) {
251  PROGRESS_BEGIN_MESSAGE("Applying speed modifications");
252  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
253  (*i).second->setSpeed(-1, (*i).second->getSpeed() * speedFactor + speedOffset);
254  }
256  }
257  }
258 
259  // CONNECTIONS COMPUTATION
260  //
261  PROGRESS_BEGIN_MESSAGE("Computing node types");
264  //
265  bool buildCrossingsAndWalkingAreas = false;
266  if (oc.getBool("crossings.guess")) {
267  buildCrossingsAndWalkingAreas = true;
268  int crossings = 0;
269  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
270  crossings += (*i).second->guessCrossings();
271  }
272  WRITE_MESSAGE("Guessed " + toString(crossings) + " pedestrian crossings.");
273  }
274  if (!oc.getBool("no-internal-links") && !buildCrossingsAndWalkingAreas) {
275  // recheck whether we had crossings in the input
276  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
277  if (i->second->getCrossings().size() > 0) {
278  buildCrossingsAndWalkingAreas = true;
279  break;
280  }
281  }
282  }
283  //
284  PROGRESS_BEGIN_MESSAGE("Computing priorities");
287  //
288  PROGRESS_BEGIN_MESSAGE("Computing approached edges");
289  myEdgeCont.computeEdge2Edges(oc.getBool("no-left-connections"));
291  //
292  if (oc.getBool("roundabouts.guess")) {
293  PROGRESS_BEGIN_MESSAGE("Guessing and setting roundabouts");
296  }
298  //
299  PROGRESS_BEGIN_MESSAGE("Computing approaching lanes");
300  myEdgeCont.computeLanes2Edges(buildCrossingsAndWalkingAreas);
302  //
303  PROGRESS_BEGIN_MESSAGE("Dividing of lanes on approached lanes");
304  myNodeCont.computeLanes2Lanes(buildCrossingsAndWalkingAreas);
307  //
308  PROGRESS_BEGIN_MESSAGE("Processing turnarounds");
309  if (!oc.getBool("no-turnarounds")) {
310  myEdgeCont.appendTurnarounds(oc.getBool("no-turnarounds.tls"));
311  } else {
312  myEdgeCont.appendTurnarounds(explicitTurnarounds, oc.getBool("no-turnarounds.tls"));
313  }
315  //
316  PROGRESS_BEGIN_MESSAGE("Rechecking of lane endings");
317  myEdgeCont.recheckLanes(buildCrossingsAndWalkingAreas);
319 
320 
321  // GUESS TLS POSITIONS
322  PROGRESS_BEGIN_MESSAGE("Assigning nodes to traffic lights");
323  if (oc.isSet("tls.set")) {
324  std::vector<std::string> tlControlledNodes = oc.getStringVector("tls.set");
326  for (std::vector<std::string>::const_iterator i = tlControlledNodes.begin(); i != tlControlledNodes.end(); ++i) {
327  NBNode* node = myNodeCont.retrieve(*i);
328  if (node == 0) {
329  WRITE_WARNING("Building a tl-logic for node '" + *i + "' is not possible." + "\n The node '" + *i + "' is not known.");
330  } else {
332  }
333  }
334  }
337  //
338  if (oc.getBool("tls.join")) {
339  PROGRESS_BEGIN_MESSAGE("Joining traffic light nodes");
340  myNodeCont.joinTLS(myTLLCont, oc.getFloat("tls.join-dist"));
342  }
343 
344 
345  // COMPUTING RIGHT-OF-WAY AND TRAFFIC LIGHT PROGRAMS
346  //
347  PROGRESS_BEGIN_MESSAGE("Computing traffic light control information");
350  //
351  PROGRESS_BEGIN_MESSAGE("Computing node logics");
354  //
355  PROGRESS_BEGIN_MESSAGE("Computing traffic light logics");
356  std::pair<unsigned int, unsigned int> numbers = myTLLCont.computeLogics(myEdgeCont, oc);
358  std::string progCount = "";
359  if (numbers.first != numbers.second) {
360  progCount = "(" + toString(numbers.second) + " programs) ";
361  }
362  WRITE_MESSAGE(" " + toString(numbers.first) + " traffic light(s) " + progCount + "computed.");
363  //
364  if (oc.isSet("street-sign-output")) {
365  PROGRESS_BEGIN_MESSAGE("Generating street signs");
368  }
369 
370  // FINISHING INNER EDGES
371  if (!oc.getBool("no-internal-links")) {
372  PROGRESS_BEGIN_MESSAGE("Building inner edges");
373  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
374  (*i).second->sortOutgoingConnectionsByIndex();
375  }
376  // walking areas shall only be built if crossings are wished as well
377  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
378  (*i).second->buildInnerEdges(buildCrossingsAndWalkingAreas);
379  }
381  }
382 
383 
384  // report
385  WRITE_MESSAGE("-----------------------------------------------------");
386  WRITE_MESSAGE("Summary:");
388  WRITE_MESSAGE(" Network boundaries:");
389  WRITE_MESSAGE(" Original boundary : " + toString(geoConvHelper.getOrigBoundary()));
390  WRITE_MESSAGE(" Applied offset : " + toString(geoConvHelper.getOffsetBase()));
391  WRITE_MESSAGE(" Converted boundary : " + toString(geoConvHelper.getConvBoundary()));
392  WRITE_MESSAGE("-----------------------------------------------------");
394  // report on very large networks
395  if (MAX2(geoConvHelper.getConvBoundary().xmax(), geoConvHelper.getConvBoundary().ymax()) > 1000000 ||
396  MIN2(geoConvHelper.getConvBoundary().xmin(), geoConvHelper.getConvBoundary().ymin()) < -1000000) {
397  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");
398  }
399 }
400 
401 
402 void
404  PROGRESS_BEGIN_MESSAGE("Moving network to origin");
405  Boundary boundary = geoConvHelper.getConvBoundary();
406  const SUMOReal x = -boundary.xmin();
407  const SUMOReal y = -boundary.ymin();
408  for (std::map<std::string, NBNode*>::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) {
409  (*i).second->reshiftPosition(x, y);
410  }
411  for (std::map<std::string, NBEdge*>::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) {
412  (*i).second->reshiftPosition(x, y);
413  }
414  for (std::map<std::string, NBDistrict*>::const_iterator i = myDistrictCont.begin(); i != myDistrictCont.end(); ++i) {
415  (*i).second->reshiftPosition(x, y);
416  }
417  geoConvHelper.moveConvertedBy(x, y);
419 }
420 
421 
422 bool
423 NBNetBuilder::transformCoordinates(Position& from, bool includeInBoundary, GeoConvHelper* from_srs) {
424  Position orig(from);
425  bool ok = GeoConvHelper::getProcessing().x2cartesian(from, includeInBoundary);
426  if (ok) {
427  const NBHeightMapper& hm = NBHeightMapper::get();
428  if (hm.ready()) {
429  if (from_srs != 0 && from_srs->usingGeoProjection()) {
430  from_srs->cartesian2geo(orig);
431  }
432  SUMOReal z = hm.getZ(orig);
433  from = Position(from.x(), from.y(), z);
434  }
435  }
436  return ok;
437 }
438 
439 
440 bool
441 NBNetBuilder::transformCoordinates(PositionVector& from, bool includeInBoundary, GeoConvHelper* from_srs) {
442  const SUMOReal maxLength = OptionsCont::getOptions().getFloat("geometry.max-segment-length");
443  if (maxLength > 0 && from.size() > 1) {
444  // transformation to cartesian coordinates must happen before we can check segment length
445  PositionVector copy = from;
446  for (int i = 0; i < (int) from.size(); i++) {
447  transformCoordinates(copy[i], false);
448  }
449  // check lengths and insert new points where needed (in the original
450  // coordinate system)
451  int inserted = 0;
452  for (int i = 0; i < (int)copy.size() - 1; i++) {
453  Position start = from[i + inserted];
454  Position end = from[i + inserted + 1];
455  SUMOReal length = copy[i].distanceTo(copy[i + 1]);
456  const Position step = (end - start) * (maxLength / length);
457  int steps = 0;
458  while (length > maxLength) {
459  length -= maxLength;
460  steps++;
461  from.insertAt(i + inserted + 1, start + (step * steps));
462  inserted++;
463  }
464  }
465  // now perform the transformation again so that height mapping can be
466  // performed for the new points
467  }
468  bool ok = true;
469  for (int i = 0; i < (int) from.size(); i++) {
470  ok = ok && transformCoordinates(from[i], includeInBoundary, from_srs);
471  }
472  return ok;
473 }
474 
475 /****************************************************************************/
void moveToOrigin(GeoConvHelper &geoConvHelper)
shift network so its lower left corner is at 0,0
NBNetBuilder()
Constructor.
NBTypeCont myTypeCont
The used container for street types.
Definition: NBNetBuilder.h:232
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 ...
Definition: NBEdgeCont.cpp:994
void joinSimilarEdges(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
Joins edges connecting the same nodes.
Definition: NBNodeCont.cpp:179
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:167
void sortOutgoingLanesConnections()
Sorts all lanes of all edges within the container by their direction.
Definition: NBEdgeCont.cpp:570
void markRoundabouts()
mark edge priorities and prohibit turn-arounds for all roundabout edges
Definition: NBEdgeCont.cpp:930
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
void computeNodeShapes(bool leftHand, SUMOReal mismatchThreshold=-1)
Compute the junction shape for this node.
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:244
void addJoinExclusion(const std::vector< std::string > &ids, bool check=false)
Definition: NBNodeCont.cpp:426
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:323
const std::set< EdgeSet > getRoundabouts() const
Returns the determined roundabouts.
Definition: NBEdgeCont.cpp:912
void insertAt(int index, const Position &p)
SUMOReal 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 removeElements=true)
Performs the network building steps.
unsigned int joinJunctions(SUMOReal maxDist, NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
Joins junctions that are very close together.
Definition: NBNodeCont.cpp:484
~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:74
void generateStreetSigns()
assigns street signs to edges based on toNode types
Definition: NBEdgeCont.cpp:956
void recheckPostProcessConnections()
Try to set any stored connections.
Definition: NBEdgeCont.cpp:748
void guessTLs(OptionsCont &oc, NBTrafficLightLogicCont &tlc)
Guesses which junctions or junction clusters shall be controlled by tls.
Definition: NBNodeCont.cpp:793
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:375
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
void computeLanes2Lanes(const bool buildCrossingsAndWalkingAreas)
divides the incoming lanes on outgoing lanes
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:67
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
void checkGeometries(const SUMOReal maxAngle, const SUMOReal minRadius, bool fix)
Definition: NBEdgeCont.cpp:551
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)
static void computeFinal()
compute the location attributes which will be used for output based on the loaded location data...
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:773
void reduceGeometries(const SUMOReal minDist)
Definition: NBEdgeCont.cpp:543
void computeLanes2Edges(const bool buildCrossingsAndWalkingAreas)
Computes for each edge which lanes approach the next edges.
Definition: NBEdgeCont.cpp:586
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
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:515
void joinTLS(NBTrafficLightLogicCont &tlc, SUMOReal maxdist)
Builds clusters of tls-controlled junctions and joins the control if possible.
Definition: NBNodeCont.cpp:945
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.
void guessRoundabouts()
Determines which edges belong to roundabouts and increases their priority.
Definition: NBEdgeCont.cpp:820
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:84
void setDefaults(int defaultNoLanes, SUMOReal defaultSpeed, int defaultPriority)
Sets the default values.
Definition: NBTypeCont.cpp:50
NBEdgeCont myEdgeCont
The used container for edges.
Definition: NBNetBuilder.h:235
unsigned int joinLoadedClusters(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
Joins loaded junction clusters (see NIXMLNodesHandler)
Definition: NBNodeCont.cpp:460
void computeEdge2Edges(bool noLeftMovers)
Computes for each edge the approached edges.
Definition: NBEdgeCont.cpp:578
void computeLaneShapes()
Computes the shapes of all lanes of all edges stored in the container.
Definition: NBEdgeCont.cpp:626
NBTrafficLightLogicCont myTLLCont
The used container for traffic light logics.
Definition: NBNetBuilder.h:238
static void computeTurnDirections(NBNodeCont &nc)
Computes turnaround destinations for all edges (if exist)
T MIN2(T a, T b)
Definition: StdDefs.h:68
#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:532
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
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.
Definition: NBNodeCont.cpp:991
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)
void appendTurnarounds(bool noTLSControlled)
Appends turnarounds to all edges stored in the container.
Definition: NBEdgeCont.cpp:602
static void computeNodeTypes(NBNodeCont &nc)
Computes node types.
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:229
SUMOReal y() const
Returns the y-position.
Definition: Position.h:68
A storage for options typed value containers)
Definition: OptionsCont.h:108
void recheckLanes(const bool buildCrossingsAndWalkingAreas)
Rechecks whether all lanes have a successor for each of the stored edges.
Definition: NBEdgeCont.cpp:594
void computeEdgeShapes()
Computes the shapes of all edges stored in the container.
Definition: NBEdgeCont.cpp:618
Represents a single node (junction) during network building.
Definition: NBNode.h:75
T get(const std::string &str) const
NBDistrictCont myDistrictCont
The used container for districts.
Definition: NBNetBuilder.h:241
#define SUMOReal
Definition: config.h:218
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:108
#define PROGRESS_DONE_MESSAGE()
Definition: MsgHandler.h:203
void printBuiltNodesStatistics() const
Prints statistics about built nodes.
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:229
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.
TrafficLightType
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
static void sortNodesEdges(NBNodeCont &nc, bool leftHand, bool useNodeShape=false)
Sorts a node's edges clockwise regarding driving direction.