Eclipse 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-2022 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
20// This class computes shapes of junctions
21/****************************************************************************/
22#pragma once
23#include <config.h>
24
26
27
28// ===========================================================================
29// class definitions
30// ===========================================================================
31class NBNode;
32class NBEdge;
33
34
35// ===========================================================================
36// class declarations
37// ===========================================================================
43public:
45 NBNodeShapeComputer(const NBNode& node);
46
49
51 const PositionVector compute();
52
54 double getRadius() const {
55 return myRadius;
56 }
57
58private:
59 typedef std::map<NBEdge*, PositionVector> GeomsMap;
60
66 const PositionVector computeNodeShapeDefault(bool simpleContinuation);
67
80
82 void computeEdgeBoundaries(const EdgeVector& edges,
83 GeomsMap& geomsCCW,
84 GeomsMap& geomsCW);
85
95 void joinSameDirectionEdges(const EdgeVector& edges, std::map<NBEdge*, std::set<NBEdge*> >& same);
96
104 const EdgeVector& all,
105 std::map<NBEdge*, std::set<NBEdge*> >& same,
106 GeomsMap& geomsCCW,
107 GeomsMap& geomsCW);
108
118 const Position& begPoint, const Position& endPoint, int cornerDetail);
119
130 static void initNeighbors(const EdgeVector& edges, const EdgeVector::const_iterator& current,
131 GeomsMap& geomsCW,
132 GeomsMap& geomsCCW,
133 EdgeVector::const_iterator& cwi,
134 EdgeVector::const_iterator& ccwi,
135 double& cad,
136 double& ccad);
137
139 bool badIntersection(const NBEdge* e1, const NBEdge* e2, double distance);
140
142 double closestIntersection(const PositionVector& geom1, const PositionVector& geom2, double offset);
143
145 bool needsLargeTurn(NBEdge* e1, NBEdge* e2,
146 std::map<NBEdge*, std::set<NBEdge*> >& same) const;
147
149 double getDefaultRadius(const OptionsCont& oc);
150
152 static double getExtraWidth(const NBEdge* e, SVCPermissions exclude);
153
154private:
157
159 double myRadius;
160
162
163private:
166
167};
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:42
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:92
Represents a single node (junction) during network building.
Definition: NBNode.h:66
This class computes shapes of junctions.
PositionVector getSmoothCorner(PositionVector begShape, PositionVector endShape, const Position &begPoint, const Position &endPoint, int cornerDetail)
Compute smoothed corner shape.
double closestIntersection(const PositionVector &geom1, const PositionVector &geom2, double offset)
return the intersection point closest to the given offset
NBNodeShapeComputer & operator=(const NBNodeShapeComputer &s)
Invalidated assignment operator.
const PositionVector computeNodeShapeSmall()
Computes the node geometry using normals.
double myRadius
the computed node radius
EdgeVector computeUniqueDirectionList(const EdgeVector &all, std::map< NBEdge *, std::set< NBEdge * > > &same, GeomsMap &geomsCCW, GeomsMap &geomsCW)
Joins edges.
void computeEdgeBoundaries(const EdgeVector &edges, GeomsMap &geomsCCW, GeomsMap &geomsCW)
compute clockwise/counter-clockwise edge boundaries
double getRadius() const
get computed radius for node
std::map< NBEdge *, PositionVector > GeomsMap
NBNodeShapeComputer(const NBNode &node)
Constructor.
const PositionVector compute()
Computes the shape of the assigned junction.
~NBNodeShapeComputer()
Destructor.
bool badIntersection(const NBEdge *e1, const NBEdge *e2, double distance)
const 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.
void joinSameDirectionEdges(const EdgeVector &edges, std::map< NBEdge *, std::set< NBEdge * > > &same)
Joins edges and computes ccw/cw boundaries.
double getDefaultRadius(const OptionsCont &oc)
determine the default radius appropriate for the current junction
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.
bool needsLargeTurn(NBEdge *e1, NBEdge *e2, std::map< NBEdge *, std::set< NBEdge * > > &same) const
whether the given edges (along with those in the same direction) requires a large turning radius
static const SVCPermissions SVC_LARGE_TURN
static double getExtraWidth(const NBEdge *e, SVCPermissions exclude)
compute with of rightmost lanes that exlude the given permissions
A storage for options typed value containers)
Definition: OptionsCont.h:89
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
A list of positions.