Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/guisim/GUIOverheadWire.h
169666 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 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 GUIOverheadWire.h
15
/// @author Jakub Sevcik (RICE)
16
/// @author Jan Prikryl (RICE)
17
/// @date 2019-12-15
18
///
19
// The gui-version of a MSOverheadWire
20
/****************************************************************************/
21
#pragma once
22
#include <config.h>
23
24
#include <vector>
25
#include <string>
26
#include <utils/common/Command.h>
27
#include <utils/common/VectorHelper.h>
28
#include <utils/geom/PositionVector.h>
29
#include <microsim/trigger/MSOverheadWire.h>
30
#include <guisim/GUIBusStop.h>
31
#include <utils/gui/globjects/GUIGlObject.h>
32
#include <utils/gui/globjects/GUIGlObject_AbstractAdd.h>
33
#include <utils/gui/globjects/GUIGLObjectPopupMenu.h>
34
#include <utils/geom/Position.h>
35
#include <gui/GUIManipulator.h>
36
37
38
// ===========================================================================
39
// class declarations
40
// ===========================================================================
41
class MSNet;
42
class MSLane;
43
class GUIManipulator;
44
class GUIOverheadWire;
45
class GUIOverheadWireClamp;
46
47
48
// ===========================================================================
49
// class definitions
50
// ===========================================================================
51
/**
52
* @class GUIOverheadWire
53
* @brief GUI for the overhead wire system.
54
*
55
* This gui-version of the overhead wire network extends MSOverheadWire by methods for displaying
56
* and interaction. It also adds a visual representation of an overhead wire clamp.
57
*
58
* @see MSOverheadWire
59
* @see GUIGlObject_AbstractAdd
60
* @see GUIGlObject
61
*/
62
class GUIOverheadWire : public MSOverheadWire, public GUIGlObject_AbstractAdd {
63
public:
64
/** @brief Constructor
65
* @param[in] id The id of the overhead wire segment
66
* @param[in] lane The lane the overhead wire segment is placed on
67
* @param[in] frompos Begin position of the overhead wire segment on the lane
68
* @param[in] topos End position of the overhead wire segment on the lane
69
* @param[in] voltageSource If the segment is the place of the connection of a traction substation
70
*/
71
GUIOverheadWire(const std::string& id, MSLane& lane, double frompos, double topos,
72
bool voltageSource);
73
74
/// @brief Destructor
75
~GUIOverheadWire();
76
77
/// @name inherited from GUIGlObject
78
//@{
79
80
/** @brief Returns an own popup-menu
81
*
82
* @param[in] app The application needed to build the popup-menu
83
* @param[in] parent The parent window needed to build the popup-menu
84
* @return The built popup-menu
85
* @see GUIGlObject::getPopUpMenu
86
*/
87
GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent);
88
89
/** @brief Returns an own parameter window
90
*
91
* Overhead wires have parameter windows showing beginning and end position of the overhead wire.
92
*
93
* @param[in] app The application needed to build the parameter window
94
* @param[in] parent The parent window needed to build the parameter window
95
* @return The built parameter window.
96
* @see GUIGlObject::getParameterWindow
97
*/
98
GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent);
99
100
/// @brief return exaggeration associated with this GLObject
101
double getExaggeration(const GUIVisualizationSettings& s) const;
102
103
/** @brief Returns the boundary to which the view shall be centered in order to show the object
104
*
105
* @return The boundary the object is within
106
* @see GUIGlObject::getCenteringBoundary
107
*/
108
Boundary getCenteringBoundary() const;
109
110
/** @brief Draws the object
111
* @param[in] s The settings for the current view (may influence drawing)
112
* @see GUIGlObject::drawGL
113
*/
114
void drawGL(const GUIVisualizationSettings& s) const;
115
//@}
116
117
private:
118
/// @brief The rotations of the shape parts
119
std::vector<double> myFGShapeRotations;
120
121
/// @brief The lengths of the shape parts
122
std::vector<double> myFGShapeLengths;
123
124
/// @brief The shape
125
PositionVector myFGShape;
126
127
/// @brief The position of the sign
128
Position myFGSignPos;
129
130
/// @brief The rotation of the sign
131
double myFGSignRot;
132
};
133
134
class GUIOverheadWireClamp : public GUIGlObject_AbstractAdd {
135
public:
136
/** @brief Constructor
137
* @param[in] id The id of the overhead wire clamp
138
* @param[in] lane_start The lane, where is the overhead wire segment placed, to the start of which the overhead wire clamp is connected
139
* @param[in] lane_end The lane, where is the overhead wire segment placed, to the end of which the overhead wire clamp is connected
140
* @param[in] topos End position of the overhead wire segment on the lane
141
*/
142
GUIOverheadWireClamp(const std::string& id, MSLane& lane_start, MSLane& lane_end);
143
144
/// @brief Destructor
145
~GUIOverheadWireClamp();
146
147
/// @name inherited from GUIGlObject
148
//@{
149
150
/** @brief Returns an own popup-menu
151
*
152
* @param[in] app The application needed to build the popup-menu
153
* @param[in] parent The parent window needed to build the popup-menu
154
* @return The built popup-menu
155
* @see GUIGlObject::getPopUpMenu
156
*/
157
GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent);
158
159
/** @brief Returns an own parameter window
160
*
161
* Overhead wire clamps do not display anything in their parameter window yet.
162
*
163
* @param[in] app The application needed to build the parameter window
164
* @param[in] parent The parent window needed to build the parameter window
165
* @return The built parameter window
166
* @see GUIGlObject::getParameterWindow
167
*/
168
GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent);
169
170
/// @brief return exaggeration associated with this GLObject
171
double getExaggeration(const GUIVisualizationSettings& s) const;
172
173
/** @brief Returns the boundary to which the view shall be centered in order to show the object
174
*
175
* @return The boundary the object is within
176
* @see GUIGlObject::getCenteringBoundary
177
*/
178
Boundary getCenteringBoundary() const;
179
180
/** @brief Draws the object
181
* @param[in] s The settings for the current view (may influence drawing)
182
* @see GUIGlObject::drawGL
183
*/
184
void drawGL(const GUIVisualizationSettings& s) const;
185
//@}
186
187
private:
188
189
/// @brief The shape
190
PositionVector myFGShape;
191
};
192
193