Eclipse SUMO - Simulation of Urban MObility
NBAlgorithms_Ramps.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2012-2019 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 /****************************************************************************/
15 // Algorithms for highway on-/off-ramps computation
16 /****************************************************************************/
17 #ifndef NBAlgorithms_Ramps_h
18 #define NBAlgorithms_Ramps_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <vector>
27 
28 
29 // ===========================================================================
30 // class declarations
31 // ===========================================================================
32 class NBNetBuilder;
33 class OptionsCont;
34 class NBNode;
35 class NBEdgeCont;
36 class NBDistrictCont;
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
42 // ---------------------------------------------------------------------------
43 // NBAlgorithms_Ramps
44 // ---------------------------------------------------------------------------
45 /* @class NBRampsComputer
46  * @brief Computes highway on-/off-ramps (if wished)
47  */
49 public:
54  static void computeRamps(NBNetBuilder& nb, OptionsCont& oc);
55 
57  static const std::string ADDED_ON_RAMP_EDGE;
58 
59 private:
67  static bool mayNeedOnRamp(NBNode* cur, double minHighwaySpeed, double maxRampSpeed,
68  const std::set<std::string>& noramps);
69 
70 
78  static bool mayNeedOffRamp(NBNode* cur, double minHighwaySpeed, double maxRampSpeed,
79  const std::set<std::string>& noramps);
80 
81 
91  static void buildOnRamp(NBNode* cur, NBNodeCont& nc, NBEdgeCont& ec, NBDistrictCont& dc, double rampLength, bool dontSplit, bool addLanes);
92 
93 
103  static void buildOffRamp(NBNode* cur, NBNodeCont& nc, NBEdgeCont& ec, NBDistrictCont& dc, double rampLength, bool dontSplit);
104 
105 
106  static void getOnRampEdges(NBNode* n, NBEdge** potHighway, NBEdge** potRamp, NBEdge** other);
107  static void getOffRampEdges(NBNode* n, NBEdge** potHighway, NBEdge** potRamp, NBEdge** other);
108  static bool determinedBySpeed(NBEdge** potHighway, NBEdge** potRamp);
109  static bool determinedByLaneNumber(NBEdge** potHighway, NBEdge** potRamp);
110 
124  static bool fulfillsRampConstraints(NBEdge* potHighway, NBEdge* potRamp, NBEdge* other, double minHighwaySpeed, double maxRampSpeed,
125  const std::set<std::string>& noramps);
126 
127 
132  static void moveRampRight(NBEdge* ramp, int addedLanes);
133 
135  static bool hasWrongMode(NBEdge* edge);
136 
138  static void patchRampGeometry(NBEdge* potRamp, NBEdge* first, NBEdge* potHighway, bool onRamp);
139 };
140 
141 
142 #endif
143 
144 /****************************************************************************/
145 
NBRampsComputer::mayNeedOnRamp
static bool mayNeedOnRamp(NBNode *cur, double minHighwaySpeed, double maxRampSpeed, const std::set< std::string > &noramps)
Determines whether the given node may be an on-ramp begin.
Definition: NBAlgorithms_Ramps.cpp:140
NBRampsComputer::ADDED_ON_RAMP_EDGE
static const std::string ADDED_ON_RAMP_EDGE
suffix for newly generated on-ramp edges
Definition: NBAlgorithms_Ramps.h:57
NBEdgeCont
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:60
NBNetBuilder
Instance responsible for building networks.
Definition: NBNetBuilder.h:109
NBRampsComputer::getOnRampEdges
static void getOnRampEdges(NBNode *n, NBEdge **potHighway, NBEdge **potRamp, NBEdge **other)
Definition: NBAlgorithms_Ramps.cpp:402
NBRampsComputer::mayNeedOffRamp
static bool mayNeedOffRamp(NBNode *cur, double minHighwaySpeed, double maxRampSpeed, const std::set< std::string > &noramps)
Determines whether the given node may be an off-ramp end.
Definition: NBAlgorithms_Ramps.cpp:152
NBRampsComputer::moveRampRight
static void moveRampRight(NBEdge *ramp, int addedLanes)
Moves the ramp to the right, as new lanes were added.
Definition: NBAlgorithms_Ramps.cpp:361
NBRampsComputer::hasWrongMode
static bool hasWrongMode(NBEdge *edge)
whether the edge has a mode that does not indicate a ramp edge
Definition: NBAlgorithms_Ramps.cpp:530
NBRampsComputer::buildOnRamp
static void buildOnRamp(NBNode *cur, NBNodeCont &nc, NBEdgeCont &ec, NBDistrictCont &dc, double rampLength, bool dontSplit, bool addLanes)
Builds an on-ramp starting at the given node.
Definition: NBAlgorithms_Ramps.cpp:164
NBDistrictCont
A container for districts.
Definition: NBDistrictCont.h:52
NBNodeCont
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:59
NBEdge
The representation of a single edge during network building.
Definition: NBEdge.h:91
NBRampsComputer::determinedBySpeed
static bool determinedBySpeed(NBEdge **potHighway, NBEdge **potRamp)
Definition: NBAlgorithms_Ramps.cpp:378
NBRampsComputer::buildOffRamp
static void buildOffRamp(NBNode *cur, NBNodeCont &nc, NBEdgeCont &ec, NBDistrictCont &dc, double rampLength, bool dontSplit)
Builds an off-ramp ending at the given node.
Definition: NBAlgorithms_Ramps.cpp:269
NBRampsComputer::determinedByLaneNumber
static bool determinedByLaneNumber(NBEdge **potHighway, NBEdge **potRamp)
Definition: NBAlgorithms_Ramps.cpp:390
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
NBRampsComputer::patchRampGeometry
static void patchRampGeometry(NBEdge *potRamp, NBEdge *first, NBEdge *potHighway, bool onRamp)
shift ramp geometry to merge smoothly with the motorway
Definition: NBAlgorithms_Ramps.cpp:545
NBRampsComputer::getOffRampEdges
static void getOffRampEdges(NBNode *n, NBEdge **potHighway, NBEdge **potRamp, NBEdge **other)
Definition: NBAlgorithms_Ramps.cpp:426
NBRampsComputer
Definition: NBAlgorithms_Ramps.h:48
config.h
NBRampsComputer::computeRamps
static void computeRamps(NBNetBuilder &nb, OptionsCont &oc)
Computes highway on-/off-ramps (if wished)
Definition: NBAlgorithms_Ramps.cpp:51
NBNode
Represents a single node (junction) during network building.
Definition: NBNode.h:67
NBRampsComputer::fulfillsRampConstraints
static bool fulfillsRampConstraints(NBEdge *potHighway, NBEdge *potRamp, NBEdge *other, double minHighwaySpeed, double maxRampSpeed, const std::set< std::string > &noramps)
Checks whether an on-/off-ramp can be bult here.
Definition: NBAlgorithms_Ramps.cpp:464