Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/guisim/GUIBusStop.h
193905 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 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() override;
84
85
/// @brief adds an access point to this stop
86
bool addAccess(MSLane* const lane, const double startPos, const double endPos,
87
double length, const MSStoppingPlace::AccessExit exit) override;
88
89
/// @name inherited from GUIGlObject
90
//@{
91
92
/** @brief Returns an own popup-menu
93
*
94
* @param[in] app The application needed to build the popup-menu
95
* @param[in] parent The parent window needed to build the popup-menu
96
* @return The built popup-menu
97
* @see GUIGlObject::getPopUpMenu
98
*/
99
GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) override;
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, GUISUMOAbstractView& parent) override;
111
112
/// @brief return exaggeration associated with this GLObject
113
double getExaggeration(const GUIVisualizationSettings& s) const override;
114
115
/** @brief Returns the boundary to which the view shall be centered in order to show the object
116
*
117
* @return The boundary the object is within
118
* @see GUIGlObject::getCenteringBoundary
119
*/
120
Boundary getCenteringBoundary() const override;
121
122
/// @brief Returns the street name
123
const std::string getOptionalName() const override;
124
125
/// @brief Formats the last free pos value
126
double getCroppedLastFreePos() const;
127
128
/** @brief Draws the object
129
* @param[in] s The settings for the current view (may influence drawing)
130
* @see GUIGlObject::drawGL
131
*/
132
void drawGL(const GUIVisualizationSettings& s) const override;
133
134
//@}
135
136
private:
137
138
139
/// @brief init constants for faster rendering
140
void initShape(PositionVector& fgShape,
141
std::vector<double>& fgShapeRotations, std::vector<double>& fgShapeLengths,
142
Position& fgSignPos, double& fgSignRot, bool secondaryShape = false);
143
144
private:
145
/// @brief The rotations of the shape parts
146
std::vector<double> myFGShapeRotations;
147
std::vector<double> myFGShapeRotations2;
148
149
/// @brief The lengths of the shape parts
150
std::vector<double> myFGShapeLengths;
151
std::vector<double> myFGShapeLengths2;
152
153
/// @brief The shape
154
PositionVector myFGShape;
155
PositionVector myFGShape2;
156
157
/// @brief The position of the sign
158
Position myFGSignPos;
159
Position myFGSignPos2;
160
161
/// @brief The rotation of the sign
162
double myFGSignRot;
163
double myFGSignRot2;
164
165
/// @brief The visual width of the stoppling place
166
double myWidth;
167
168
/// @brief The coordinates of access points
169
PositionVector myAccessCoords;
170
171
RGBColor myEmptyColor;
172
};
173
174