Eclipse SUMO - Simulation of Urban MObility
GNEPathElements.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-2020 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 /****************************************************************************/
18 // A abstract class for representation of element paths
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
24 
25 // ===========================================================================
26 // class declaration
27 // ===========================================================================
28 
29 class GNEEdge;
30 class GNELane;
31 class GNEJunction;
32 class GNEAdditional;
33 class GNEDemandElement;
34 class GNEGenericData;
35 
36 // ===========================================================================
37 // class definitions
38 // ===========================================================================
39 
45 
46 public:
48  class PathElement {
49 
50  public:
52  PathElement(GNELane* lane);
53 
55  void updateNextLane(GNELane* lane);
56 
58  GNEJunction* getJunction() const;
59 
61  GNELane* getLane() const;
62 
64  GNELane* getNextLane() const;
65 
66  protected:
69 
72 
73  private:
75  PathElement();
76  };
77 
79  GNEPathElements(GNEAdditional* additionalElement);
80 
82  GNEPathElements(GNEDemandElement* demandElement);
83 
85  GNEPathElements(GNEGenericData* genericData);
86 
89 
91  const std::vector<GNEPathElements::PathElement>& getPath() const;
92 
94  void drawLanePathChildren(const GUIVisualizationSettings& s, const GNELane* lane, const double offset) const;
95 
97  void drawJunctionPathChildren(const GUIVisualizationSettings& s, const GNEJunction* junction, const double offset) const;
98 
99 protected:
101  void calculatePathLanes(SUMOVehicleClass vClass, const bool allowedVClass, GNELane* fromLane, GNELane* toLane, const std::vector<GNEEdge*>& viaEdges);
102 
104  void calculateConsecutivePathLanes(SUMOVehicleClass vClass, const bool allowedVClass, const std::vector<GNEEdge*>& edges);
105 
107  void calculateConsecutivePathLanes(const std::vector<GNELane*>& lanes);
108 
110  void resetPathLanes(SUMOVehicleClass vClass, const bool allowedVClass, GNELane* fromLane, GNELane* toLane, const std::vector<GNEEdge*>& viaEdges);
111 
113  void calculateGenericDataLanePath(const std::vector<GNEEdge*>& edges);
114 
115 private:
118 
121 
124 
126  std::vector<PathElement> myPathElements;
127 
129  void addElements();
130 
132  void removeElements();
133 
135  void updatePathElements();
136 
138  const std::vector<GNEEdge*> calculateFromViaToEdges(GNELane* fromLane, GNELane* toLane, const std::vector<GNEEdge*>& viaEdges);
139 
141  GNEPathElements();
142 
145 
148 };
149 
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
An Element which don't belongs to GNENet but has influency in the simulation.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:49
An Element which don't belongs to GNENet but has influency in the simulation.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
GNELane * myNextLane
nextLane
GNEJunction * getJunction() const
get junction
PathElement()
default constructor
GNELane * getNextLane() const
get next lane
void updateNextLane(GNELane *lane)
update nextLane
GNELane * getLane() const
get lane
An special type of Attribute carrier that owns hierarchical elements.
void calculatePathLanes(SUMOVehicleClass vClass, const bool allowedVClass, GNELane *fromLane, GNELane *toLane, const std::vector< GNEEdge * > &viaEdges)
calculate path lanes (Dijkstra)
GNEGenericData * myGenericData
pointer to generic data
void updatePathElements()
update path element
void calculateGenericDataLanePath(const std::vector< GNEEdge * > &edges)
calculate consecutive path lanes (used by genericdatas)
GNEAdditional * myAdditionalElement
pointer to additional element
GNEPathElements(const GNEPathElements &)=delete
Invalidated copy constructor.
void removeElements()
remove elements
void drawJunctionPathChildren(const GUIVisualizationSettings &s, const GNEJunction *junction, const double offset) const
draw junction path child
void calculateConsecutivePathLanes(SUMOVehicleClass vClass, const bool allowedVClass, const std::vector< GNEEdge * > &edges)
calculate consecutive path lanes (used by routes)
GNEPathElements()
default constructor
const std::vector< GNEPathElements::PathElement > & getPath() const
get path edges
void drawLanePathChildren(const GUIVisualizationSettings &s, const GNELane *lane, const double offset) const
draw lane path child
GNEPathElements & operator=(const GNEPathElements &)=delete
Invalidated assignment operator.
~GNEPathElements()
Destructor.
void addElements()
add elements
GNEDemandElement * myDemandElement
pointer to demand element
void resetPathLanes(SUMOVehicleClass vClass, const bool allowedVClass, GNELane *fromLane, GNELane *toLane, const std::vector< GNEEdge * > &viaEdges)
reset path lanes
const std::vector< GNEEdge * > calculateFromViaToEdges(GNELane *fromLane, GNELane *toLane, const std::vector< GNEEdge * > &viaEdges)
calculate from-via-to edges
std::vector< PathElement > myPathElements
vector of edges used in paths
Stores the information about how to visualize structures.