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