SUMO - Simulation of Urban MObility
NBAlgorithms.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2012-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
16 // Algorithms for network computation
17 /****************************************************************************/
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <sstream>
26 #include <iostream>
27 #include <cassert>
28 #include <algorithm>
30 #include <utils/common/ToString.h>
32 #include "NBEdge.h"
33 #include "NBOwnTLDef.h"
35 #include "NBNodeCont.h"
36 #include "NBTypeCont.h"
37 #include "NBNode.h"
38 #include "NBAlgorithms.h"
39 
40 
41 // ===========================================================================
42 // method definitions
43 // ===========================================================================
44 // ---------------------------------------------------------------------------
45 // NBTurningDirectionsComputer
46 // ---------------------------------------------------------------------------
47 void
49  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
50  computeTurnDirectionsForNode(i->second, warn);
51  }
52 }
53 
54 void
56  const std::vector<NBEdge*>& incoming = node->getIncomingEdges();
57  const std::vector<NBEdge*>& outgoing = node->getOutgoingEdges();
58  // reset turning directions since this may be called multiple times
59  for (std::vector<NBEdge*>::const_iterator k = incoming.begin(); k != incoming.end(); ++k) {
60  (*k)->setTurningDestination(nullptr);
61  }
62  std::vector<Combination> combinations;
63  for (std::vector<NBEdge*>::const_iterator j = outgoing.begin(); j != outgoing.end(); ++j) {
64  NBEdge* outedge = *j;
65  for (std::vector<NBEdge*>::const_iterator k = incoming.begin(); k != incoming.end(); ++k) {
66  NBEdge* e = *k;
67  // @todo: check whether NBHelpers::relAngle is properly defined and whether it should really be used, here
68  const double signedAngle = NBHelpers::normRelAngle(e->getAngleAtNode(node), outedge->getAngleAtNode(node));
69  if (signedAngle > 0 && signedAngle < 177 && e->getGeometry().back().distanceTo2D(outedge->getGeometry().front()) < POSITION_EPS) {
70  // backwards curving edges can only be turnaround when there are
71  // non-default endpoints
72  continue;
73  }
74  double angle = fabs(signedAngle);
75  // std::cout << "incoming=" << e->getID() << " outgoing=" << outedge->getID() << " relAngle=" << NBHelpers::relAngle(e->getAngleAtNode(node), outedge->getAngleAtNode(node)) << "\n";
76  if (e->getFromNode() == outedge->getToNode() && angle > 120) {
77  // they connect the same nodes; should be the turnaround direction
78  // we'll assign a maximum number
79  //
80  // @todo: indeed, we have observed some pathological intersections
81  // see "294831560" in OSM/adlershof. Here, several edges are connecting
82  // same nodes. We have to do the angle check before...
83  //
84  // @todo: and well, there are some other as well, see plain import
85  // of delphi_muenchen (elmar), intersection "59534191". Not that it would
86  // be realistic in any means; we will warn, here.
87  angle += 360;
88  }
89  if (angle < 160) {
90  continue;
91  }
92  Combination c;
93  c.from = e;
94  c.to = outedge;
95  c.angle = angle;
96  combinations.push_back(c);
97  }
98  }
99  // sort combinations so that the ones with the highest angle are at the begin
100  std::sort(combinations.begin(), combinations.end(), combination_by_angle_sorter());
101  std::set<NBEdge*> seen;
102  for (std::vector<Combination>::const_iterator j = combinations.begin(); j != combinations.end(); ++j) {
103  if (seen.find((*j).from) != seen.end() || seen.find((*j).to) != seen.end()) {
104  // do not regard already set edges
105  if ((*j).angle > 360 && warn) {
106  WRITE_WARNING("Ambiguity in turnarounds computation at junction '" + node->getID() + "'.");
107  warn = false;
108  }
109  continue;
110  }
111  // mark as seen
112  seen.insert((*j).from);
113  seen.insert((*j).to);
114  // set turnaround information
115  bool onlyPossible = (*j).from->getConnections().size() != 0 && !(*j).from->isConnectedTo((*j).to);
116  //std::cout << " setTurningDestination from=" << (*j).from->getID() << " to=" << (*j).to->getID() << " onlyPossible=" << onlyPossible << "\n";
117  (*j).from->setTurningDestination((*j).to, onlyPossible);
118  }
119 }
120 
121 
122 // ---------------------------------------------------------------------------
123 // NBNodesEdgesSorter
124 // ---------------------------------------------------------------------------
125 void
127  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
128  i->second->sortEdges(useNodeShape);
129  }
130 }
131 
132 
133 void
135  const std::vector<NBEdge*>::iterator& i1,
136  const std::vector<NBEdge*>::iterator& i2) {
137  NBEdge* e1 = *i1;
138  NBEdge* e2 = *i2;
139  // @todo: The difference between "isTurningDirectionAt" and "isTurnaround"
140  // is not nice. Maybe we could get rid of it if we would always mark edges
141  // as turnarounds, even if they do not have to be added, as mentioned in
142  // notes on NBTurningDirectionsComputer::computeTurnDirectionsForNode
143  if (e2->getToNode() == n && e2->isTurningDirectionAt(e1)) {
144  std::swap(*i1, *i2);
145  }
146 }
147 
148 
149 // ---------------------------------------------------------------------------
150 // NBNodeTypeComputer
151 // ---------------------------------------------------------------------------
152 void
154  validateRailCrossings(nc, tlc);
155  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
156  NBNode* n = (*i).second;
157  // the type may already be set from the data
158  if (n->myType != NODETYPE_UNKNOWN && n->myType != NODETYPE_DEAD_END) {
159  continue;
160  }
161  // check whether the node is a waterway node. Set to unregulated by default
162  bool waterway = true;
163  for (EdgeVector::const_iterator i = n->getEdges().begin(); i != n->getEdges().end(); ++i) {
164  if (!isWaterway((*i)->getPermissions())) {
165  waterway = false;
166  break;
167  }
168  }
169  if (waterway && (n->myType == NODETYPE_UNKNOWN || n->myType == NODETYPE_DEAD_END)) {
171  continue;
172  }
173 
174  // check whether the junction is not a real junction
175  if (n->myIncomingEdges.size() == 1) {
177  continue;
178  }
179  // @todo "isSimpleContinuation" should be revalidated
180  if (n->isSimpleContinuation()) {
182  continue;
183  }
184  // determine the type
186  for (EdgeVector::const_iterator i = n->myIncomingEdges.begin(); i != n->myIncomingEdges.end(); i++) {
187  for (EdgeVector::const_iterator j = i + 1; j != n->myIncomingEdges.end(); j++) {
188  // @todo "getOppositeIncoming" should probably be refactored into something the edge knows
189  if (n->getOppositeIncoming(*j) == *i && n->myIncomingEdges.size() > 2) {
190  continue;
191  }
192  // @todo check against a legal document
193  // @todo figure out when NODETYPE_PRIORITY_STOP is appropriate
194  const double s1 = (*i)->getSpeed() * (double) 3.6;
195  const double s2 = (*j)->getSpeed() * (double) 3.6;
196  const int p1 = (*i)->getPriority();
197  const int p2 = (*j)->getPriority();
198  if (fabs(s1 - s2) > (double) 9.5 || MAX2(s1, s2) >= (double) 49. || p1 != p2) {
199  type = NODETYPE_PRIORITY;
200  break;
201  }
202  }
203  }
204  // save type
205  n->myType = type;
206  }
207 }
208 
209 
210 void
212  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
213  NBNode* n = (*i).second;
214  if (n->myType == NODETYPE_RAIL_CROSSING) {
215  // check if it really is a rail crossing
216  int numRailway = 0;
217  int numNonRailway = 0;
218  int numNonRailwayNonPed = 0;
219  for (NBEdge* e : n->getIncomingEdges()) {
220  if ((e->getPermissions() & ~SVC_RAIL_CLASSES) != 0) {
221  numNonRailway++;
222  if (e->getPermissions() != SVC_PEDESTRIAN) {
223  numNonRailwayNonPed++;
224  }
225  } else if ((e->getPermissions() & SVC_RAIL_CLASSES) != 0) {
226  numRailway++;
227  }
228  }
229  for (NBEdge* e : n->getOutgoingEdges()) {
230  if (e->getPermissions() == SVC_PEDESTRIAN) {
231  numNonRailway++;
232  }
233  }
234  if (numNonRailway == 0 || numRailway == 0) {
235  // not a crossing (maybe unregulated or rail_signal)
237  } else if (numNonRailwayNonPed > 2) {
238  // does not look like a rail crossing (roads in conflict). maybe a traffic light?
239  WRITE_WARNING("Converting invalid rail_crossing to traffic_light at junction '" + n->getID() + "'");
241  NBTrafficLightDefinition* tlDef = new NBOwnTLDef(n->getID(), n, 0, type);
243  if (!tlc.insert(tlDef)) {
244  // actually, nothing should fail here
245  n->removeTrafficLight(tlDef);
247  delete tlDef;
248  WRITE_WARNING("Could not allocate tls '" + n->getID() + "'.");
249  }
250  }
251  }
252  }
253 }
254 
255 
256 bool
258  int numRailway = 0;
259  int numNonRailway = 0;
260  for (NBEdge* e : n->getIncomingEdges()) {
261  if ((e->getPermissions() & ~SVC_RAIL_CLASSES) != 0) {
262  numNonRailway++;
263  } else if ((e->getPermissions() & SVC_RAIL_CLASSES) != 0) {
264  numRailway++;
265  }
266  }
267  return numRailway > 0 && numNonRailway == 0;
268 }
269 
270 // ---------------------------------------------------------------------------
271 // NBEdgePriorityComputer
272 // ---------------------------------------------------------------------------
273 void
275  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
276  computeEdgePrioritiesSingleNode((*i).second);
277  }
278 }
279 
280 
281 void
283  // preset all junction's edge priorities to zero
284  for (EdgeVector::iterator j = node->myAllEdges.begin(); j != node->myAllEdges.end(); ++j) {
285  (*j)->setJunctionPriority(node, NBEdge::MINOR_ROAD);
286  }
287  node->markBentPriority(false);
288  // check if the junction is not a real junction
289  if (node->myIncomingEdges.size() == 1 && node->myOutgoingEdges.size() == 1) {
290  return;
291  }
292  // compute the priorities on junction when needed
293  if (node->getType() != NODETYPE_RIGHT_BEFORE_LEFT) {
294  if (node->getRightOfWay() == RIGHT_OF_WAY_EDGEPRIORITY) {
295  for (NBEdge* e : node->getIncomingEdges()) {
296  e->setJunctionPriority(node, e->getPriority());
297  }
298  } else {
299  setPriorityJunctionPriorities(*node);
300  }
301  }
302 }
303 
304 
305 void
307  if (n.myIncomingEdges.size() == 0 || n.myOutgoingEdges.size() == 0) {
308  return;
309  }
310  EdgeVector incoming = n.myIncomingEdges;
311  EdgeVector outgoing = n.myOutgoingEdges;
312  // what we do want to have is to extract the pair of roads that are
313  // the major roads for this junction
314  // let's get the list of incoming edges with the highest priority
315  std::sort(incoming.begin(), incoming.end(), NBContHelper::edge_by_priority_sorter());
316  EdgeVector bestIncoming;
317  NBEdge* best = incoming[0];
318  while (incoming.size() > 0 && samePriority(best, incoming[0])) {
319  bestIncoming.push_back(*incoming.begin());
320  incoming.erase(incoming.begin());
321  }
322  // now, let's get the list of best outgoing
323  assert(outgoing.size() != 0);
324  sort(outgoing.begin(), outgoing.end(), NBContHelper::edge_by_priority_sorter());
325  EdgeVector bestOutgoing;
326  best = outgoing[0];
327  while (outgoing.size() > 0 && samePriority(best, outgoing[0])) { //->getPriority()==best->getPriority()) {
328  bestOutgoing.push_back(*outgoing.begin());
329  outgoing.erase(outgoing.begin());
330  }
331  // special case: user input makes mainDirection unambiguous
332  const bool mainDirectionExplicit = (
333  bestIncoming.size() == 1 && n.myIncomingEdges.size() <= 2
334  && (incoming.size() == 0 || bestIncoming[0]->getPriority() > incoming[0]->getPriority())
335  && bestOutgoing.size() == 1 && n.myOutgoingEdges.size() <= 2
336  && (outgoing.size() == 0 || bestOutgoing[0]->getPriority() > outgoing[0]->getPriority())
337  && !bestIncoming[0]->isTurningDirectionAt(bestOutgoing[0]));
338  // now, let's compute for each of the best incoming edges
339  // the incoming which is most opposite
340  // the outgoing which is most opposite
341  EdgeVector::iterator i;
342  std::map<NBEdge*, NBEdge*> counterIncomingEdges;
343  std::map<NBEdge*, NBEdge*> counterOutgoingEdges;
344  incoming = n.myIncomingEdges;
345  outgoing = n.myOutgoingEdges;
346  for (i = bestIncoming.begin(); i != bestIncoming.end(); ++i) {
347  std::sort(incoming.begin(), incoming.end(), NBContHelper::edge_opposite_direction_sorter(*i, &n, true));
348  counterIncomingEdges[*i] = *incoming.begin();
349  std::sort(outgoing.begin(), outgoing.end(), NBContHelper::edge_opposite_direction_sorter(*i, &n, true));
350  counterOutgoingEdges[*i] = *outgoing.begin();
351  }
352  //std::cout << "n=" << n.getID() << " best=" << best->getID() << " bestIncoming=" << toString(bestIncoming) << "\n incoming=" << toString(incoming) << "\n outgoing=" << toString(outgoing) << "\n mainExplicit=" << mainDirectionExplicit << " counterBest=" << counterIncomingEdges.find(bestIncoming[0])->second->getID() << "\n";
353  // ok, let's try
354  // 1) there is one best incoming road
355  if (bestIncoming.size() == 1) {
356  // let's mark this road as the best
357  NBEdge* best1 = extractAndMarkFirst(n, bestIncoming);
358  if (!mainDirectionExplicit && counterIncomingEdges.find(best1) != counterIncomingEdges.end()) {
359  // ok, look, what we want is the opposit of the straight continuation edge
360  // but, what if such an edge does not exist? By now, we'll determine it
361  // geometrically
362  NBEdge* s = counterIncomingEdges.find(best1)->second;
363  const double minAngleDiff = GeomHelper::getMinAngleDiff(best1->getAngleAtNode(&n), s->getAngleAtNode(&n));
364  if (minAngleDiff > 180 - 45
365  || (minAngleDiff > 75 && s->getPriority() == best1->getPriority() && hasDifferentPriorities(incoming, best1))) {
367  }
368  }
369  markBestParallel(n, best1, nullptr);
370  assert(bestOutgoing.size() != 0);
371  // mark the best outgoing as the continuation
372  sort(bestOutgoing.begin(), bestOutgoing.end(), NBContHelper::edge_similar_direction_sorter(best1));
373  // assign extra priority if the priorities are unambiguous (regardless of geometry)
374  NBEdge* bestOut = extractAndMarkFirst(n, bestOutgoing);
375  if (!mainDirectionExplicit && counterOutgoingEdges.find(bestOut) != counterOutgoingEdges.end()) {
376  NBEdge* s = counterOutgoingEdges.find(bestOut)->second;
377  if (GeomHelper::getMinAngleDiff(bestOut->getAngleAtNode(&n), s->getAngleAtNode(&n)) > 180 - 45) {
378  s->setJunctionPriority(&n, 1);
379  }
380  }
381  n.markBentPriority(n.getDirection(best1, bestOut) != LINKDIR_STRAIGHT);
382  return;
383  }
384 
385  // ok, what we want to do in this case is to determine which incoming
386  // has the best continuation...
387  // This means, when several incoming roads have the same priority,
388  // we want a (any) straight connection to be more priorised than a turning
389  double bestAngle = 0;
390  NBEdge* bestFirst = nullptr;
391  NBEdge* bestSecond = nullptr;
392  bool hadBest = false;
393  for (i = bestIncoming.begin(); i != bestIncoming.end(); ++i) {
394  EdgeVector::iterator j;
395  NBEdge* t1 = *i;
396  double angle1 = t1->getAngleAtNode(&n) + 180;
397  if (angle1 >= 360) {
398  angle1 -= 360;
399  }
400  for (j = i + 1; j != bestIncoming.end(); ++j) {
401  NBEdge* t2 = *j;
402  double angle2 = t2->getAngleAtNode(&n) + 180;
403  if (angle2 >= 360) {
404  angle2 -= 360;
405  }
406  double angle = GeomHelper::getMinAngleDiff(angle1, angle2);
407  if (!hadBest || angle > bestAngle) {
408  bestAngle = angle;
409  bestFirst = *i;
410  bestSecond = *j;
411  hadBest = true;
412  }
413  }
414  }
415  bestFirst->setJunctionPriority(&n, 1);
416  sort(bestOutgoing.begin(), bestOutgoing.end(), NBContHelper::edge_similar_direction_sorter(bestFirst));
417  if (bestOutgoing.size() != 0) {
418  extractAndMarkFirst(n, bestOutgoing);
419  }
420  bestSecond->setJunctionPriority(&n, 1);
421  sort(bestOutgoing.begin(), bestOutgoing.end(), NBContHelper::edge_similar_direction_sorter(bestSecond));
422  if (bestOutgoing.size() != 0) {
423  extractAndMarkFirst(n, bestOutgoing);
424  }
425  n.markBentPriority(GeomHelper::getMinAngleDiff(bestFirst->getAngleAtNode(&n), bestSecond->getAngleAtNode(&n)) < 135);
426  markBestParallel(n, bestFirst, bestSecond);
427 }
428 
429 void
430 NBEdgePriorityComputer::markBestParallel(const NBNode& n, NBEdge* bestFirst, NBEdge* bestSecond) {
431  // edges running parallel to the main direction should also be prioritised
432  const double a1 = bestFirst->getAngleAtNode(&n);
433  const double a2 = bestSecond == nullptr ? a1 : bestSecond->getAngleAtNode(&n);
434  SVCPermissions p1 = bestFirst->getPermissions();
435  SVCPermissions p2 = bestSecond == nullptr ? p1 : bestSecond->getPermissions();
436  for (NBEdge* e : n.getIncomingEdges()) {
437  // @note: this rule might also apply if there are common permissions but
438  // then we would not further rules to resolve the priority between the best edge and its parallel edge
439  SVCPermissions perm = e->getPermissions();
440  if (((GeomHelper::getMinAngleDiff(e->getAngleAtNode(&n), a1) < 10
441  || GeomHelper::getMinAngleDiff(e->getAngleAtNode(&n), a2) < 10))
442  && (p1 & perm) == 0 && (p2 & perm) == 0) {
443  e->setJunctionPriority(&n, 1);
444  }
445  }
446 }
447 
448 
449 NBEdge*
450 NBEdgePriorityComputer::extractAndMarkFirst(NBNode& n, std::vector<NBEdge*>& s, int prio) {
451  if (s.size() == 0) {
452  return nullptr;
453  }
454  NBEdge* ret = s.front();
455  s.erase(s.begin());
456  ret->setJunctionPriority(&n, prio);
457  return ret;
458 }
459 
460 
461 bool
462 NBEdgePriorityComputer::samePriority(const NBEdge* const e1, const NBEdge* const e2) {
463  if (e1 == e2) {
464  return true;
465  }
466  if (e1->getPriority() != e2->getPriority()) {
467  return false;
468  }
469  if ((int) e1->getSpeed() != (int) e2->getSpeed()) {
470  return false;
471  }
472  return (int) e1->getNumLanes() == (int) e2->getNumLanes();
473 }
474 
475 
476 bool
478  if (edges.size() < 2) {
479  return false;
480  }
481  int prio = edges[0] == excluded ? edges[1]->getPriority() : edges[0]->getPriority();
482  for (auto e : edges) {
483  if (e != excluded && e->getPriority() != prio) {
484  return true;
485  }
486  }
487  return false;
488 }
489 
490 
492  // reorder based on getAngleAtNodeToCenter
493  myOrdering = ordering;
494  sort(myOrdering.begin(), myOrdering.end(), NBContHelper::edge_by_angle_to_nodeShapeCentroid_sorter(node));
495  // let the first edge remain the first
496  rotate(myOrdering.begin(), std::find(myOrdering.begin(), myOrdering.end(), ordering.front()), myOrdering.end());
497 }
498 
499 
500 /****************************************************************************/
501 
static double getMinAngleDiff(double angle1, double angle2)
Returns the minimum distance (clockwise/counter-clockwise) between both angles.
Definition: GeomHelper.cpp:161
static void validateRailCrossings(NBNodeCont &nc, NBTrafficLightLogicCont &tlc)
Checks rail_crossing for validity.
is a pedestrian
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
Definition: NBNodeCont.h:116
static void markBestParallel(const NBNode &n, NBEdge *bestFirst, NBEdge *bestSecond)
set priority for edges that are parallel to the best edges
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
Definition: NBNodeCont.h:121
static double normRelAngle(double angle1, double angle2)
ensure that reverse relAngles (>=179.999) always count as turnarounds (-180)
Definition: NBHelpers.cpp:60
SumoXMLNodeType myType
The type of the junction.
Definition: NBNode.h:808
A container for traffic light definitions and built programs.
int getPriority() const
Returns the priority of the edge.
Definition: NBEdge.h:427
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
The representation of a single edge during network building.
Definition: NBEdge.h:65
Class to sort edges by their angle in relation to the given edge.
Definition: NBContHelper.h:171
The base class for traffic light logic definitions.
void markBentPriority(bool isBent)
mark whether a priority road turns at this node
Definition: NBNode.h:738
T MAX2(T a, T b)
Definition: StdDefs.h:76
const std::string & getID() const
Returns the id.
Definition: Named.h:78
void removeTrafficLight(NBTrafficLightDefinition *tlDef)
Removes the given traffic light from this node.
Definition: NBNode.cpp:347
static void sortNodesEdges(NBNodeCont &nc, bool useNodeShape=false)
Sorts a node&#39;s edges clockwise regarding driving direction.
Stores the information about the angle between an incoming ("from") and an outgoing ("to") edge...
Definition: NBAlgorithms.h:68
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:241
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
const EdgeVector & getOutgoingEdges() const
Returns this node&#39;s outgoing edges (The edges which start at this node)
Definition: NBNode.h:255
The link is a straight direction.
static bool hasDifferentPriorities(const EdgeVector &edges, const NBEdge *excluded)
return whether the priorite attribute can be used to distinguish the edges
EdgeVector myAllEdges
Vector of incoming and outgoing edges.
Definition: NBNode.h:796
static void swapWhenReversed(const NBNode *const n, const std::vector< NBEdge *>::iterator &i1, const std::vector< NBEdge *>::iterator &i2)
Assures correct order for same-angle opposite-direction edges.
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:420
classes which drive on tracks
static void computeEdgePriorities(NBNodeCont &nc)
Computes edge priorities within a node.
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permission is a waterway edge.
static bool isRailwayNode(NBNode *n)
whether the given node only has rail edges
T get(const std::string &str) const
const EdgeVector & getEdges() const
Returns all edges which participate in this node (Edges that start or end at this node) ...
Definition: NBNode.h:260
#define POSITION_EPS
Definition: config.h:172
double getAngleAtNode(const NBNode *const node) const
Returns the angle of the edge&#39;s geometry at the given node.
Definition: NBEdge.cpp:1801
crossing_by_junction_angle_sorter(const NBNode *node, const EdgeVector &ordering)
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:3331
EdgeVector myIncomingEdges
Vector of incoming edges.
Definition: NBNode.h:790
static void computeTurnDirectionsForNode(NBNode *node, bool warn)
Computes turnaround destinations for all incoming edges of the given nodes (if any) ...
static bool samePriority(const NBEdge *const e1, const NBEdge *const e2)
Returns whether both edges have the same priority.
LinkDirection getDirection(const NBEdge *const incoming, const NBEdge *const outgoing, bool leftHand=false) const
Returns the representation of the described stream&#39;s direction.
Definition: NBNode.cpp:1764
double getSpeed() const
Returns the speed allowed on this edge.
Definition: NBEdge.h:514
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:622
RightOfWay getRightOfWay() const
Returns hint on how to compute right of way.
Definition: NBNode.h:282
EdgeVector myOutgoingEdges
Vector of outgoing edges.
Definition: NBNode.h:793
static void computeEdgePrioritiesSingleNode(NBNode *node)
Computes edge priorities within a single node.
const EdgeVector & getIncomingEdges() const
Returns this node&#39;s incoming edges (The edges which yield in this node)
Definition: NBNode.h:250
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:34
void setJunctionPriority(const NBNode *const node, int prio)
Sets the junction priority of the edge.
Definition: NBEdge.cpp:1791
SumoXMLNodeType getType() const
Returns the type of this node.
Definition: NBNode.h:267
bool isTurningDirectionAt(const NBEdge *const edge) const
Returns whether the given edge is the opposite direction to this edge.
Definition: NBEdge.cpp:2684
Represents a single node (junction) during network building.
Definition: NBNode.h:68
static void computeTurnDirections(NBNodeCont &nc, bool warn=true)
Computes turnaround destinations for all edges (if exist)
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
static NBEdge * extractAndMarkFirst(NBNode &n, std::vector< NBEdge *> &s, int prio=1)
Sets the priorites in case of a priority junction.
NBEdge * getOppositeIncoming(NBEdge *e) const
returns the opposite incoming edge of certain edge
Definition: NBNode.cpp:1399
Sorts "Combination"s by decreasing angle.
Definition: NBAlgorithms.h:78
static void setPriorityJunctionPriorities(NBNode &n)
Sets the priorites in case of a priority junction.
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:434
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:60
static void computeNodeTypes(NBNodeCont &nc, NBTrafficLightLogicCont &tlc)
Computes node types.
A traffic light logics which must be computed (only nodes/edges are given)
Definition: NBOwnTLDef.h:47
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:441
bool isSimpleContinuation(bool checkLaneNumbers=true) const
check if node is a simple continuation
Definition: NBNode.cpp:447
TrafficLightType