Eclipse SUMO - Simulation of Urban MObility
GNEOverheadWire.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-2024 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 //
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 #include "GNEAdditional.h"
23 
24 
25 // ===========================================================================
26 // class definitions
27 // ===========================================================================
33 
34 public:
36  GNEOverheadWire(GNENet* net);
37 
51  GNEOverheadWire(const std::string& id, std::vector<GNELane*> lanes, GNEAdditional* substation, GNENet* net,
52  const double startPos, const double endPos, const bool friendlyPos,
53  const std::vector<std::string>& forbiddenInnerLanes, const Parameterised::Map& parameters);
54 
57 
62 
65 
69  void writeAdditional(OutputDevice& device) const;
70 
72  bool isAdditionalValid() const;
73 
75  std::string getAdditionalProblem() const;
76 
78  void fixAdditionalProblem();
79 
81 
84 
86  bool checkDrawMoveContour() const;
87 
89 
91  void updateGeometry();
92 
95 
97  void updateCenteringBoundary(const bool updateGrid);
98 
100  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
101 
104 
109  void drawGL(const GUIVisualizationSettings& s) const;
110 
112 
115 
117  void computePathElement();
118 
124  void drawLanePartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const;
125 
131  void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const;
132 
134 
137 
138  /* @brief method for getting the Attribute of an XML key
139  * @param[in] key The attribute key
140  * @return string with the value associated to key
141  */
142  std::string getAttribute(SumoXMLAttr key) const;
143 
144  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
145  * @param[in] key The attribute key
146  * @return double with the value associated to key
147  */
148  double getAttributeDouble(SumoXMLAttr key) const;
149 
151  const Parameterised::Map& getACParametersMap() const;
152 
153  /* @brief method for setting the attribute and letting the object perform additional changes
154  * @param[in] key The attribute key
155  * @param[in] value The new value
156  * @param[in] undoList The undoList on which to register changes
157  */
158  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
159 
160  /* @brief method for checking if the key and their correspond attribute are valids
161  * @param[in] key The attribute key
162  * @param[in] value The value associated to key key
163  * @return true if the value is valid, false in other case
164  */
165  bool isValid(SumoXMLAttr key, const std::string& value);
166 
168  std::string getPopUpID() const;
169 
171  std::string getHierarchyName() const;
172 
174 
175 protected:
177  double myStartPos;
178 
180  double myEndPos;
181 
184 
186  std::vector<std::string> myForbiddenInnerLanes;
187 
188 private:
190  void setAttribute(SumoXMLAttr key, const std::string& value);
191 
193  void setMoveShape(const GNEMoveResult& moveResult);
194 
196  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
197 
199  double getStartGeometryPositionOverLane() const;
200 
202  double getEndGeometryPositionOverLane() const;
203 
206 
209 };
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
An Element which don't belong to GNENet but has influence in the simulation.
Definition: GNEAdditional.h:49
move operation
move result
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
void updateGeometry()
update pre-computed geometry information
void fixAdditionalProblem()
fix additional problem
GNEOverheadWire & operator=(const GNEOverheadWire &)=delete
Invalidated assignment operator.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
~GNEOverheadWire()
Destructor.
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their correspondent attribute are valids
void writeAdditional(OutputDevice &device) const
write additional element into a xml file
double myEndPos
end position over lane
bool checkDrawMoveContour() const
check if draw move contour (red)
const Parameterised::Map & getACParametersMap() const
get parameters map
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void computePathElement()
compute pathElement
GNEMoveOperation * getMoveOperation()
get move operation
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Position getPositionInView() const
Returns position of additional in view.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
double myStartPos
start position over lane
double getAttributeDouble(SumoXMLAttr key) const
GNEOverheadWire(GNENet *net)
default Constructor
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over lane.
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over junction.
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
GNEOverheadWire(const GNEOverheadWire &)=delete
Invalidated copy constructor.
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
std::string getAdditionalProblem() const
return a string with the current additional problem
std::string getAttribute(SumoXMLAttr key) const
bool myFriendlyPosition
friendly position
std::vector< std::string > myForbiddenInnerLanes
forbidden inner lanes
bool isAdditionalValid() const
check if current additional is valid to be written into XML
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37