Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/additional/GNEAccess.h
193871 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 GNEAccess.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Jun 2018
17
///
18
//
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include "GNEAdditional.h"
24
25
// ===========================================================================
26
// class declarations
27
// ===========================================================================
28
29
class GNEBusStop;
30
class GNEMoveElementLaneSingle;
31
32
// ===========================================================================
33
// class definitions
34
// ===========================================================================
35
36
class GNEAccess : public GNEAdditional, public Parameterised {
37
38
public:
39
/// @brief Default constructor
40
GNEAccess(GNENet* net);
41
42
/**@brief Constructor
43
* @param[in] id The storage of gl-ids to get the one for this lane representation from
44
* @param[in] busStop GNEBusStop of this Access belongs
45
* @param[in] lane GNELane of this Access belongs
46
* @param[in] pos position of the Access on the lane
47
* @param[in] length The length of the Access in meters.
48
* @param[in] friendlyPos enable or disable friendly positions
49
* @param[in] parameters generic parameters
50
*/
51
GNEAccess(GNEAdditional* busStop, GNELane* lane, const double pos, const std::string& specialPos,
52
const bool friendlyPos, const double length, const Parameterised::Map& parameters);
53
54
/// @brief Destructor
55
~GNEAccess();
56
57
/// @brief methods to retrieve the elements linked to this access
58
/// @{
59
60
/// @brief get GNEMoveElement associated with this access
61
GNEMoveElement* getMoveElement() const override;
62
63
/// @brief get parameters associated with this access
64
Parameterised* getParameters() override;
65
66
/// @brief get parameters associated with this access (constant)
67
const Parameterised* getParameters() const override;
68
69
/// @}
70
71
/// @brief check if Position of Access is fixed
72
bool isAccessPositionFixed() const;
73
74
/// @brief get edge in which this Access is placed
75
GNEEdge* getEdge() const;
76
77
/// @name members and functions relative to write additionals into XML
78
/// @{
79
80
/**@brief write additional element into a xml file
81
* @param[in] device device in which write parameters of additional element
82
*/
83
void writeAdditional(OutputDevice& device) const override;
84
85
/// @brief check if current additional is valid to be written into XML (must be reimplemented in all detector children)
86
bool isAdditionalValid() const override;
87
88
/// @brief return a string with the current additional problem (must be reimplemented in all detector children)
89
std::string getAdditionalProblem() const override;
90
91
/// @brief fix additional problem (must be reimplemented in all detector children)
92
void fixAdditionalProblem() override;
93
94
/// @}
95
96
/// @name Function related with contour drawing
97
/// @{
98
99
/// @brief check if draw move contour (red)
100
bool checkDrawMoveContour() const override;
101
102
/// @}
103
104
/// @name Functions related with geometry of element
105
/// @{
106
107
/// @brief update pre-computed geometry information
108
void updateGeometry() override;
109
110
/// @brief Returns position of additional in view
111
Position getPositionInView() const override;
112
113
/// @brief update centering boundary (implies change in RTREE)
114
void updateCenteringBoundary(const bool updateGrid) override;
115
116
/// @brief split geometry
117
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;
118
119
/// @}
120
121
/// @name inherited from GUIGlObject
122
/// @{
123
124
/// @brief Returns the name (ID) of the parent object
125
std::string getParentName() const override;
126
127
/**@brief Draws the object
128
* @param[in] s The settings for the current view (may influence drawing)
129
* @see GUIGlObject::drawGL
130
*/
131
void drawGL(const GUIVisualizationSettings& s) const override;
132
133
/// @}
134
135
/// @name inherited from GNEAttributeCarrier
136
/// @{
137
138
/* @brief method for getting the Attribute of an XML key
139
* @param[in] key The attribute key
140
* @return string with the value associated to key
141
*/
142
std::string getAttribute(SumoXMLAttr key) const override;
143
144
/* @brief method for getting the Attribute of an XML key in double format
145
* @param[in] key The attribute key
146
* @return double with the value associated to key
147
*/
148
double getAttributeDouble(SumoXMLAttr key) const override;
149
150
/* @brief method for getting the Attribute of an XML key in position format
151
* @param[in] key The attribute key
152
* @return position with the value associated to key
153
*/
154
Position getAttributePosition(SumoXMLAttr key) const override;
155
156
/* @brief method for getting the Attribute of an XML key in positionVector format
157
* @param[in] key The attribute key
158
* @return positionVector with the value associated to key
159
*/
160
PositionVector getAttributePositionVector(SumoXMLAttr key) const override;
161
162
/* @brief method for setting the attribute and letting the object perform additional changes
163
* @param[in] key The attribute key
164
* @param[in] value The new value
165
* @param[in] undoList The undoList on which to register changes
166
*/
167
void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
168
169
/* @brief method for checking if the key and their correspond attribute are valid
170
* @param[in] key The attribute key
171
* @param[in] value The value associated to key key
172
* @return true if the value is valid, false in other case
173
*/
174
bool isValid(SumoXMLAttr key, const std::string& value) override;
175
176
/// @brief get PopPup ID (Used in AC Hierarchy)
177
std::string getPopUpID() const override;
178
179
/// @brief get Hierarchy Name (Used in AC Hierarchy)
180
std::string getHierarchyName() const override;
181
182
/// @}
183
184
protected:
185
/// @brief position over lane
186
double myPosOverLane = 0;
187
188
/// @brief friendly position
189
bool myFriendlyPos = false;
190
191
/// @brief move element lane single
192
GNEMoveElementLaneSingle* myMoveElementLaneSingle = nullptr;
193
194
/// @brief position over lane
195
std::string mySpecialPosition;
196
197
/// @brief Access length
198
double myLength = 0;
199
200
private:
201
/// @brief set attribute after validation
202
void setAttribute(SumoXMLAttr key, const std::string& value) override;
203
204
/// @brief Invalidated copy constructor.
205
GNEAccess(const GNEAccess&) = delete;
206
207
/// @brief Invalidated assignment operator.
208
GNEAccess& operator=(const GNEAccess&) = delete;
209
};
210
211