Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/additional/GNEBusStop.h
169684 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 GNEBusStop.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Nov 2015
17
///
18
// A class for visualizing busStop geometry (adapted from GUILaneWrapper)
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include "GNEStoppingPlace.h"
24
25
// ===========================================================================
26
// class definitions
27
// ===========================================================================
28
29
class GNEBusStop : public GNEStoppingPlace {
30
31
public:
32
/// @brief default constructor
33
static GNEBusStop* buildBusStop(GNENet* net);
34
35
/// @brief default constructor
36
static GNEBusStop* buildTrainStop(GNENet* net);
37
38
/**@brief parameter constructor for bus stops
39
* @param[in] id busStop ID
40
* @param[in] net pointer to GNENet of this additional element belongs
41
* @param[in] filename file in which this element is stored
42
* @param[in] lane Lane of this StoppingPlace belongs
43
* @param[in] startPos Start position of the StoppingPlace
44
* @param[in] endPos End position of the StoppingPlace
45
* @param[in] name Name of busStop
46
* @param[in] lines lines of the busStop
47
* @param[in] personCapacity larger numbers of persons trying to enter will create an upstream jam on the sidewalk.
48
* @param[in] parkingLength parking length
49
* @param[in] color busStop color
50
* @param[in] friendlyPos enable or disable friendly position
51
* @param[in] angle busStop's angle
52
* @param[in] parameters generic parameters
53
*/
54
static GNEBusStop* buildBusStop(const std::string& id, GNENet* net, const std::string& filename, GNELane* lane,
55
const double startPos, const double endPos, const std::string& name, const std::vector<std::string>& lines,
56
const int personCapacity, const double parkingLength, const RGBColor& color, const bool friendlyPosition,
57
const double angle, const Parameterised::Map& parameters);
58
59
/**@brief parameter constructor for train stops
60
* @param[in] id trainStop ID
61
* @param[in] net pointer to GNENet of this additional element belongs
62
* @param[in] filename file in which this element is stored
63
* @param[in] lane Lane of this StoppingPlace belongs
64
* @param[in] startPos Start position of the StoppingPlace
65
* @param[in] endPos End position of the StoppingPlace
66
* @param[in] name Name of busStop
67
* @param[in] lines lines of the busStop
68
* @param[in] personCapacity larger numbers of persons trying to enter will create an upstream jam on the sidewalk.
69
* @param[in] parkingLength parking length
70
* @param[in] color busStop color
71
* @param[in] friendlyPos enable or disable friendly position
72
* @param[in] angle busStop's angle
73
* @param[in] parameters generic parameters
74
*/
75
static GNEBusStop* buildTrainStop(const std::string& id, GNENet* net, const std::string& filename, GNELane* lane,
76
const double startPos, const double endPos, const std::string& name, const std::vector<std::string>& lines,
77
const int personCapacity, const double parkingLength, const RGBColor& color, const bool friendlyPosition,
78
const double angle, const Parameterised::Map& parameters);
79
80
/// @brief Destructor
81
~GNEBusStop();
82
83
/**@brief write additional element into a xml file
84
* @param[in] device device in which write parameters of additional element
85
*/
86
void writeAdditional(OutputDevice& device) const;
87
88
/// @name Functions related with geometry of element
89
/// @{
90
91
/// @brief update pre-computed geometry information
92
void updateGeometry();
93
94
/// @}
95
96
/// @name inherited from GUIGlObject
97
/// @{
98
/**@brief Draws the object
99
* @param[in] s The settings for the current view (may influence drawing)
100
* @see GUIGlObject::drawGL
101
*/
102
void drawGL(const GUIVisualizationSettings& s) const;
103
104
/// @}
105
106
/// @name inherited from GNEAttributeCarrier
107
/// @{
108
109
/* @brief method for getting the Attribute of an XML key
110
* @param[in] key The attribute key
111
* @return string with the value associated to key
112
*/
113
std::string getAttribute(SumoXMLAttr key) const;
114
115
/* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
116
* @param[in] key The attribute key
117
* @return double with the value associated to key
118
*/
119
double getAttributeDouble(SumoXMLAttr key) const;
120
121
/* @brief method for setting the attribute and letting the object perform additional changes
122
* @param[in] key The attribute key
123
* @param[in] value The new value
124
* @param[in] undoList The undoList on which to register changes
125
*/
126
void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
127
128
/* @brief method for checking if the key and their correspond attribute are valids
129
* @param[in] key The attribute key
130
* @param[in] value The value associated to key key
131
* @return true if the value is valid, false in other case
132
*/
133
bool isValid(SumoXMLAttr key, const std::string& value);
134
135
/// @}
136
137
protected:
138
/// @brief The list of lines that are assigned to this stop
139
std::vector<std::string> myLines;
140
141
/// @brief maximum number of persons that can wait at this stop
142
int myPersonCapacity = 0;
143
144
/// @brief custom space for vehicles that park at this stop
145
double myParkingLength = 0;
146
147
private:
148
/// @brief set attribute after validation
149
void setAttribute(SumoXMLAttr key, const std::string& value);
150
151
/// @brief default constructor
152
GNEBusStop(SumoXMLTag tag, GNENet* net);
153
154
/**@brief parameter Constructor
155
* @param[in] tag busStop or trainStop tag
156
* @param[in] id busStop ID
157
* @param[in] net pointer to GNENet of this additional element belongs
158
* @param[in] filename file in which this element is stored
159
* @param[in] lane Lane of this StoppingPlace belongs
160
* @param[in] startPos Start position of the StoppingPlace
161
* @param[in] endPos End position of the StoppingPlace
162
* @param[in] name Name of busStop
163
* @param[in] lines lines of the busStop
164
* @param[in] personCapacity larger numbers of persons trying to enter will create an upstream jam on the sidewalk.
165
* @param[in] parkingLength parking length
166
* @param[in] color busStop color
167
* @param[in] friendlyPos enable or disable friendly position
168
* @param[in] angle busStop's angle
169
* @param[in] parameters generic parameters
170
*/
171
GNEBusStop(SumoXMLTag tag, const std::string& id, GNENet* net, const std::string& filename,
172
GNELane* lane, const double startPos, const double endPos, const std::string& name,
173
const std::vector<std::string>& lines, const int personCapacity, const double parkingLength,
174
const RGBColor& color, const bool friendlyPosition, const double angle,
175
const Parameterised::Map& parameters);
176
177
/// @brief Invalidated copy constructor.
178
GNEBusStop(const GNEBusStop&) = delete;
179
180
/// @brief Invalidated assignment operator.
181
GNEBusStop& operator=(const GNEBusStop&) = delete;
182
};
183
184