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-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 highway on-/off-ramps computation
17 /****************************************************************************/
18 #ifndef NBAlgorithms_Ramps_h
19 #define NBAlgorithms_Ramps_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <vector>
28 
29 
30 // ===========================================================================
31 // class declarations
32 // ===========================================================================
33 class NBNetBuilder;
34 class OptionsCont;
35 class NBNode;
36 class NBEdgeCont;
37 class NBDistrictCont;
38 
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
43 // ---------------------------------------------------------------------------
44 // NBAlgorithms_Ramps
45 // ---------------------------------------------------------------------------
46 /* @class NBRampsComputer
47  * @brief Computes highway on-/off-ramps (if wished)
48  */
50 public:
55  static void computeRamps(NBNetBuilder& nb, OptionsCont& oc);
56 
58  static const std::string ADDED_ON_RAMP_EDGE;
59 
60 private:
68  static bool mayNeedOnRamp(NBNode* cur, double minHighwaySpeed, double maxRampSpeed,
69  const std::set<std::string>& noramps);
70 
71 
79  static bool mayNeedOffRamp(NBNode* cur, double minHighwaySpeed, double maxRampSpeed,
80  const std::set<std::string>& noramps);
81 
82 
92  static void buildOnRamp(NBNode* cur, NBNodeCont& nc, NBEdgeCont& ec, NBDistrictCont& dc, double rampLength, bool dontSplit, bool addLanes);
93 
94 
104  static void buildOffRamp(NBNode* cur, NBNodeCont& nc, NBEdgeCont& ec, NBDistrictCont& dc, double rampLength, bool dontSplit);
105 
106 
107  static void getOnRampEdges(NBNode* n, NBEdge** potHighway, NBEdge** potRamp, NBEdge** other);
108  static void getOffRampEdges(NBNode* n, NBEdge** potHighway, NBEdge** potRamp, NBEdge** other);
109  static bool determinedBySpeed(NBEdge** potHighway, NBEdge** potRamp);
110  static bool determinedByLaneNumber(NBEdge** potHighway, NBEdge** potRamp);
111 
125  static bool fulfillsRampConstraints(NBEdge* potHighway, NBEdge* potRamp, NBEdge* other, double minHighwaySpeed, double maxRampSpeed,
126  const std::set<std::string>& noramps);
127 
128 
133  static void moveRampRight(NBEdge* ramp, int addedLanes);
134 
136  static bool hasWrongMode(NBEdge* edge);
137 
139  static void patchRampGeometry(NBEdge* potRamp, NBEdge* first, NBEdge* potHighway, bool onRamp);
140 };
141 
142 
143 #endif
144 
145 /****************************************************************************/
146 
static void patchRampGeometry(NBEdge *potRamp, NBEdge *first, NBEdge *potHighway, bool onRamp)
shift ramp geometry to merge smoothly with the motorway
static bool determinedBySpeed(NBEdge **potHighway, NBEdge **potRamp)
The representation of a single edge during network building.
Definition: NBEdge.h:65
A container for districts.
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.
static void moveRampRight(NBEdge *ramp, int addedLanes)
Moves the ramp to the right, as new lanes were added.
static bool determinedByLaneNumber(NBEdge **potHighway, NBEdge **potRamp)
static const std::string ADDED_ON_RAMP_EDGE
suffix for newly generated on-ramp edges
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.
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.
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.
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:61
static void computeRamps(NBNetBuilder &nb, OptionsCont &oc)
Computes highway on-/off-ramps (if wished)
static void getOffRampEdges(NBNode *n, NBEdge **potHighway, NBEdge **potRamp, NBEdge **other)
static void buildOffRamp(NBNode *cur, NBNodeCont &nc, NBEdgeCont &ec, NBDistrictCont &dc, double rampLength, bool dontSplit)
Builds an off-ramp ending at the given node.
Instance responsible for building networks.
Definition: NBNetBuilder.h:109
A storage for options typed value containers)
Definition: OptionsCont.h:92
Represents a single node (junction) during network building.
Definition: NBNode.h:68
static void getOnRampEdges(NBNode *n, NBEdge **potHighway, NBEdge **potRamp, NBEdge **other)
static bool hasWrongMode(NBEdge *edge)
whether the edge has a mode that does not indicate a ramp edge
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:60