Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/guisim/GUIBusStop.h
169667 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 GUIBusStop.h
15
/// @author Daniel Krajzewicz
16
/// @author Jakob Erdmann
17
/// @author Michael Behrisch
18
/// @author Johannes Rummel
19
/// @date Wed, 07.12.2005
20
///
21
// A lane area vehicles can halt at (gui-version)
22
/****************************************************************************/
23
#pragma once
24
#include <config.h>
25
26
#include <vector>
27
#include <string>
28
#include <microsim/MSStoppingPlace.h>
29
#include <utils/common/Command.h>
30
#include <utils/common/VectorHelper.h>
31
#include <utils/common/RGBColor.h>
32
#include <utils/geom/PositionVector.h>
33
#include <utils/gui/globjects/GUIGlObject.h>
34
#include <utils/gui/globjects/GUIGlObject_AbstractAdd.h>
35
#include <utils/gui/globjects/GUIGLObjectPopupMenu.h>
36
#include <utils/geom/Position.h>
37
#include <utils/xml/SUMOXMLDefinitions.h>
38
#include <gui/GUIManipulator.h>
39
40
41
// ===========================================================================
42
// class declarations
43
// ===========================================================================
44
class MSNet;
45
class MSLane;
46
class GUIManipulator;
47
48
49
// ===========================================================================
50
// class definitions
51
// ===========================================================================
52
/**
53
* @class GUIBusStop
54
* @brief A lane area vehicles can halt at (gui-version)
55
*
56
* This gui-version of a bus-stop extends MSStoppingPlace by methods for displaying
57
* and interaction.
58
*
59
* @see MSStoppingPlace
60
* @see GUIGlObject_AbstractAdd
61
* @see GUIGlObject
62
*/
63
class GUIBusStop : public MSStoppingPlace, public GUIGlObject_AbstractAdd {
64
public:
65
/** @brief Constructor
66
* @param[in] idStorage The gl-id storage for giving this object an gl-id
67
* @param[in] id The id of the bus stop
68
* @param[in] lines Names of the bus lines that halt on this bus stop
69
* @param[in] lane The lane the bus stop is placed on
70
* @param[in] begPos Begin position of the bus stop on the lane
71
* @param[in] endPos End position of the bus stop on the lane
72
*/
73
GUIBusStop(const std::string& id,
74
SumoXMLTag element,
75
const std::vector<std::string>& lines, MSLane& lane,
76
double frompos, double topos, const std::string name,
77
int personCapacity, double parkingLength, const RGBColor& color, double angle);
78
79
80
/// @brief Destructor
81
~GUIBusStop();
82
83
void finishedLoading();
84
85
/// @brief adds an access point to this stop
86
bool addAccess(MSLane* const lane, const double startPos, const double endPos, double length, const MSStoppingPlace::AccessExit exit);
87
88
/// @name inherited from GUIGlObject
89
//@{
90
91
/** @brief Returns an own popup-menu
92
*
93
* @param[in] app The application needed to build the popup-menu
94
* @param[in] parent The parent window needed to build the popup-menu
95
* @return The built popup-menu
96
* @see GUIGlObject::getPopUpMenu
97
*/
98
GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app,
99
GUISUMOAbstractView& parent);
100
101
/** @brief Returns an own parameter window
102
*
103
* Bus stops have no parameter windows (yet).
104
*
105
* @param[in] app The application needed to build the parameter window
106
* @param[in] parent The parent window needed to build the parameter window
107
* @return The built parameter window (always 0 in this case)
108
* @see GUIGlObject::getParameterWindow
109
*/
110
GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app,
111
GUISUMOAbstractView& parent);
112
113
/// @brief return exaggeration associated with this GLObject
114
double getExaggeration(const GUIVisualizationSettings& s) const;
115
116
/** @brief Returns the boundary to which the view shall be centered in order to show the object
117
*
118
* @return The boundary the object is within
119
* @see GUIGlObject::getCenteringBoundary
120
*/
121
Boundary getCenteringBoundary() const;
122
123
/// @brief Returns the street name
124
const std::string getOptionalName() const;
125
126
/// @brief Formats the last free pos value
127
double getCroppedLastFreePos() const;
128
129
/** @brief Draws the object
130
* @param[in] s The settings for the current view (may influence drawing)
131
* @see GUIGlObject::drawGL
132
*/
133
void drawGL(const GUIVisualizationSettings& s) const;
134
135
//@}
136
137
private:
138
139
140
/// @brief init constants for faster rendering
141
void initShape(PositionVector& fgShape,
142
std::vector<double>& fgShapeRotations, std::vector<double>& fgShapeLengths,
143
Position& fgSignPos, double& fgSignRot, bool secondaryShape = false);
144
145
private:
146
/// @brief The rotations of the shape parts
147
std::vector<double> myFGShapeRotations;
148
std::vector<double> myFGShapeRotations2;
149
150
/// @brief The lengths of the shape parts
151
std::vector<double> myFGShapeLengths;
152
std::vector<double> myFGShapeLengths2;
153
154
/// @brief The shape
155
PositionVector myFGShape;
156
PositionVector myFGShape2;
157
158
/// @brief The position of the sign
159
Position myFGSignPos;
160
Position myFGSignPos2;
161
162
/// @brief The rotation of the sign
163
double myFGSignRot;
164
double myFGSignRot2;
165
166
/// @brief The visual width of the stoppling place
167
double myWidth;
168
169
/// @brief The coordinates of access points
170
PositionVector myAccessCoords;
171
172
RGBColor myEmptyColor;
173
};
174
175