Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/additional/GNEOverheadWire.h
193964 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2026 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
/****************************************************************************/
14
/// @file GNEOverheadWire.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Nov 2015
17
///
18
//
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include "GNEAdditional.h"
24
25
// ===========================================================================
26
// class declaration
27
// ===========================================================================
28
29
class GNEMoveElementLaneDouble;
30
31
// ===========================================================================
32
// class definitions
33
// ===========================================================================
34
35
class GNEOverheadWire : public GNEAdditional, public Parameterised {
36
37
public:
38
/// @brief default Constructor
39
GNEOverheadWire(GNENet* net);
40
41
/**@brief Constructor for Multi-Lane detectors
42
* @param[in] id The name of the overhead wire
43
* @param[in] net net in which this polygon is placed
44
* @param[in] fileBucket file in which this element is stored
45
* @param[in] lanes vector of lanes Lane of this OverheadWire belongs
46
* @param[in] lane Lane over which the segment is placed
47
* @param[in] substationId Substation to which the circuit is connected
48
* @param[in] laneIDs list of consecutive lanes of the circuit
49
* @param[in] startPos Starting position in the specified lane
50
* @param[in] endPos Ending position in the specified lane
51
* @param[in] friendlyPos enable or disable friendly position
52
* @param[in] forbiddenInnerLanes Inner lanes, where placing of overhead wire is restricted
53
* @param[in] parameters generic parameters
54
*/
55
GNEOverheadWire(const std::string& id, GNENet* net, FileBucket* fileBucket, std::vector<GNELane*> lanes, GNEAdditional* substation,
56
const double startPos, const double endPos, const bool friendlyPos, const std::vector<std::string>& forbiddenInnerLanes,
57
const Parameterised::Map& parameters);
58
59
/// @brief Destructor
60
~GNEOverheadWire();
61
62
/// @brief methods to retrieve the elements linked to this overheadWire
63
/// @{
64
65
/// @brief get GNEMoveElement associated with this overheadWire
66
GNEMoveElement* getMoveElement() const override;
67
68
/// @brief get parameters associated with this overheadWire
69
Parameterised* getParameters() override;
70
71
/// @brief get parameters associated with this overheadWire (constant)
72
const Parameterised* getParameters() const override;
73
74
/// @}
75
76
/// @name members and functions relative to write additionals into XML
77
/// @{
78
79
/**@brief write additional element into a xml file
80
* @param[in] device device in which write parameters of additional element
81
*/
82
void writeAdditional(OutputDevice& device) const override;
83
84
/// @brief check if current additional is valid to be written into XML
85
bool isAdditionalValid() const override;
86
87
/// @brief return a string with the current additional problem
88
std::string getAdditionalProblem() const override;
89
90
/// @brief fix additional problem
91
void fixAdditionalProblem() override;
92
93
/// @}
94
95
/// @name Function related with contour drawing
96
/// @{
97
98
/// @brief check if draw move contour (red)
99
bool checkDrawMoveContour() const override;
100
101
/// @}
102
103
/// @brief update pre-computed geometry information
104
void updateGeometry() override;
105
106
/// @brief Returns position of additional in view
107
Position getPositionInView() const override;
108
109
/// @brief update centering boundary (implies change in RTREE)
110
void updateCenteringBoundary(const bool updateGrid) override;
111
112
/// @brief split geometry
113
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;
114
115
/// @name inherited from GUIGlObject
116
/// @{
117
118
/**@brief Draws the object
119
* @param[in] s The settings for the current view (may influence drawing)
120
* @see GUIGlObject::drawGL
121
*/
122
void drawGL(const GUIVisualizationSettings& s) const override;
123
124
/// @}
125
126
/// @name inherited from GNEPathElement
127
/// @{
128
129
/// @brief compute pathElement
130
void computePathElement() override;
131
132
/**@brief Draws partial object over lane
133
* @param[in] s The settings for the current view (may influence drawing)
134
* @param[in] segment lane segment
135
* @param[in] offsetFront front offset
136
*/
137
void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
138
139
/**@brief Draws partial object over junction
140
* @param[in] s The settings for the current view (may influence drawing)
141
* @param[in] segment junction segment
142
* @param[in] offsetFront front offset
143
*/
144
void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
145
146
/// @}
147
148
/// @name inherited from GNEAttributeCarrier
149
/// @{
150
151
/* @brief method for getting the Attribute of an XML key
152
* @param[in] key The attribute key
153
* @return string with the value associated to key
154
*/
155
std::string getAttribute(SumoXMLAttr key) const override;
156
157
/* @brief method for getting the Attribute of an XML key in double format
158
* @param[in] key The attribute key
159
* @return double with the value associated to key
160
*/
161
double getAttributeDouble(SumoXMLAttr key) const override;
162
163
/* @brief method for getting the Attribute of an XML key in position format
164
* @param[in] key The attribute key
165
* @return position with the value associated to key
166
*/
167
Position getAttributePosition(SumoXMLAttr key) const override;
168
169
/* @brief method for getting the Attribute of an XML key in positionVector format
170
* @param[in] key The attribute key
171
* @return positionVector with the value associated to key
172
*/
173
PositionVector getAttributePositionVector(SumoXMLAttr key) const override;
174
175
/* @brief method for setting the attribute and letting the object perform additional changes
176
* @param[in] key The attribute key
177
* @param[in] value The new value
178
* @param[in] undoList The undoList on which to register changes
179
*/
180
void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
181
182
/* @brief method for checking if the key and their correspond attribute are valids
183
* @param[in] key The attribute key
184
* @param[in] value The value associated to key key
185
* @return true if the value is valid, false in other case
186
*/
187
bool isValid(SumoXMLAttr key, const std::string& value) override;
188
189
/// @brief get PopPup ID (Used in AC Hierarchy)
190
std::string getPopUpID() const override;
191
192
/// @brief get Hierarchy Name (Used in AC Hierarchy)
193
std::string getHierarchyName() const override;
194
195
/// @}
196
197
protected:
198
/// @brief The start position over lane
199
double myStartPosOverLane = 0;
200
201
/// @brief The end position over lane
202
double myEndPosPosOverLane = 0;
203
204
/// @brief Flag for friendly position
205
bool myFriendlyPosition = false;
206
207
/// @brief forbidden inner lanes
208
std::vector<std::string> myForbiddenInnerLanes;
209
210
/// @brif move element lane double
211
GNEMoveElementLaneDouble* myMoveElementLaneDouble = nullptr;
212
213
private:
214
/// @brief set attribute after validation
215
void setAttribute(SumoXMLAttr key, const std::string& value) override;
216
217
/// @brief Invalidated copy constructor.
218
GNEOverheadWire(const GNEOverheadWire&) = delete;
219
220
/// @brief Invalidated assignment operator.
221
GNEOverheadWire& operator=(const GNEOverheadWire&) = delete;
222
};
223
224