SUMO - Simulation of Urban MObility
NBNodeShapeComputer.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 // This class computes shapes of junctions
20 /****************************************************************************/
21 #ifndef NBNodeShapeComputer_h
22 #define NBNodeShapeComputer_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
35 
36 
37 // ===========================================================================
38 // class definitions
39 // ===========================================================================
40 class NBNode;
41 class NBEdge;
42 
43 
44 // ===========================================================================
45 // class declarations
46 // ===========================================================================
52 public:
54  NBNodeShapeComputer(const NBNode& node);
55 
58 
61 
62 private:
63  typedef std::map<NBEdge*, PositionVector> GeomsMap;
64 
70  PositionVector computeNodeShapeDefault(bool simpleContinuation);
71 
84 
85 
95  void joinSameDirectionEdges(std::map<NBEdge*, std::set<NBEdge*> >& same,
96  GeomsMap& geomsCCW,
97  GeomsMap& geomsCW);
98 
107  std::map<NBEdge*, std::set<NBEdge*> >& same,
108  GeomsMap& geomsCCW,
109  GeomsMap& geomsCW);
110 
120  const Position& begPoint, const Position& endPoint, int cornerDetail);
121 
132  static void initNeighbors(const EdgeVector& edges, const EdgeVector::const_iterator& current,
133  GeomsMap& geomsCW,
134  GeomsMap& geomsCCW,
135  EdgeVector::const_iterator& cwi,
136  EdgeVector::const_iterator& ccwi,
137  double& cad,
138  double& ccad);
139 
141  bool badIntersection(const NBEdge* e1, const NBEdge* e2,
142  const PositionVector& e1cw, const PositionVector& e2ccw, double distance);
143 
145  double closestIntersection(const PositionVector& geom1, const PositionVector& geom2, double offset);
146 
147 private:
149  const NBNode& myNode;
150 
151 private:
154 
155 };
156 
157 #endif
158 
159 /****************************************************************************/
160 
static void initNeighbors(const EdgeVector &edges, const EdgeVector::const_iterator &current, GeomsMap &geomsCW, GeomsMap &geomsCCW, EdgeVector::const_iterator &cwi, EdgeVector::const_iterator &ccwi, double &cad, double &ccad)
Initialize neighbors and angles.
NBNodeShapeComputer & operator=(const NBNodeShapeComputer &s)
Invalidated assignment operator.
PositionVector getSmoothCorner(PositionVector begShape, PositionVector endShape, const Position &begPoint, const Position &endPoint, int cornerDetail)
Compute smoothed corner shape.
This class computes shapes of junctions.
The representation of a single edge during network building.
Definition: NBEdge.h:70
PositionVector computeNodeShapeDefault(bool simpleContinuation)
Computes the node geometry Edges with the same direction are grouped. Then the node geometry is built...
const NBNode & myNode
The node to compute the geometry for.
std::map< NBEdge *, PositionVector > GeomsMap
bool badIntersection(const NBEdge *e1, const NBEdge *e2, const PositionVector &e1cw, const PositionVector &e2ccw, double distance)
NBNodeShapeComputer(const NBNode &node)
Constructor.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:45
A list of positions.
PositionVector compute()
Computes the shape of the assigned junction.
~NBNodeShapeComputer()
Destructor.
PositionVector computeNodeShapeSmall()
Computes the node geometry using normals.
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:40
void joinSameDirectionEdges(std::map< NBEdge *, std::set< NBEdge *> > &same, GeomsMap &geomsCCW, GeomsMap &geomsCW)
Joins edges and computes ccw/cw boundaries.
Represents a single node (junction) during network building.
Definition: NBNode.h:74
EdgeVector computeUniqueDirectionList(std::map< NBEdge *, std::set< NBEdge *> > &same, GeomsMap &geomsCCW, GeomsMap &geomsCW)
Joins edges and computes ccw/cw boundaries.
double closestIntersection(const PositionVector &geom1, const PositionVector &geom2, double offset)
return the intersection point closest to the given offset