Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/network/GNELaneTemplate.h
185849 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 GNELaneTemplate.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Dec 2021
17
///
18
// Template for lanes
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <netedit/elements/GNEAttributeCarrier.h>
24
25
// ===========================================================================
26
// class definitions
27
// ===========================================================================
28
29
class GNELaneTemplate : public GNEAttributeCarrier {
30
31
public:
32
/// @brief Constructor
33
GNELaneTemplate(const GNELane* lane);
34
35
/// @brief Destructor.
36
~GNELaneTemplate();
37
38
/// @brief methods to retrieve the elements linked to this laneType
39
/// @{
40
41
/// @brief get GNEHierarchicalElement associated with this AttributeCarrier
42
GNEHierarchicalElement* getHierarchicalElement() override;
43
44
/// @brief get GNEMoveElement associated with this laneType
45
GNEMoveElement* getMoveElement() const override;
46
47
/// @brief get parameters associated with this laneType
48
Parameterised* getParameters() override;
49
50
/// @brief get parameters associated with this laneType (constant)
51
const Parameterised* getParameters() const override;
52
53
/// @}
54
55
/// @brief get reference to fileBucket in which save this AC
56
FileBucket* getFileBucket() const override;
57
58
/// @name Function related with graphics
59
/// @{
60
61
/// @brief get GUIGlObject associated with this AttributeCarrier
62
GUIGlObject* getGUIGlObject() override;
63
64
/// @brief get GUIGlObject associated with this AttributeCarrier (constant)
65
const GUIGlObject* getGUIGlObject() const override;
66
67
/// @brief update pre-computed geometry information
68
void updateGeometry() override;
69
70
/// @}
71
72
/// @name Function related with contour drawing
73
/// @{
74
75
/// @brief check if draw from contour (green)
76
bool checkDrawFromContour() const override;
77
78
/// @brief check if draw from contour (magenta)
79
bool checkDrawToContour() const override;
80
81
/// @brief check if draw related contour (cyan)
82
bool checkDrawRelatedContour() const override;
83
84
/// @brief check if draw over contour (orange)
85
bool checkDrawOverContour() const override;
86
87
/// @brief check if draw delete contour (pink/white)
88
bool checkDrawDeleteContour() const override;
89
90
/// @brief check if draw delete contour small (pink/white)
91
bool checkDrawDeleteContourSmall() const override;
92
93
/// @brief check if draw select contour (blue)
94
bool checkDrawSelectContour() const override;
95
96
/// @brief check if draw move contour (red)
97
bool checkDrawMoveContour() const override;
98
99
/// @}
100
101
/// @name Functions related with attributes
102
/// @{
103
/* @brief method for getting the Attribute of an XML key
104
* @param[in] key The attribute key
105
* @return string with the value associated to key
106
*/
107
std::string getAttribute(SumoXMLAttr key) const override;
108
109
/* @brief method for getting the Attribute of an XML key in double format
110
* @param[in] key The attribute key
111
* @return double with the value associated to key
112
*/
113
double getAttributeDouble(SumoXMLAttr key) const override;
114
115
/* @brief method for getting the Attribute of an XML key in position format
116
* @param[in] key The attribute key
117
* @return position with the value associated to key
118
*/
119
Position getAttributePosition(SumoXMLAttr key) const override;
120
121
/* @brief method for getting the Attribute of an XML key in Position format
122
* @param[in] key The attribute key
123
* @return position with the value associated to key
124
*/
125
PositionVector getAttributePositionVector(SumoXMLAttr key) const override;
126
127
/* @brief method for setting the attribute and letting the object perform additional changes
128
* @param[in] key The attribute key
129
* @param[in] value The new value
130
* @param[in] undoList The undoList on which to register changes
131
*/
132
void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
133
134
/* @brief method for check if new value for certain attribute is valid
135
* @param[in] key The attribute key
136
* @param[in] value The new value
137
*/
138
bool isValid(SumoXMLAttr key, const std::string& value) override;
139
140
/* @brief method for check if the value for certain attribute is set
141
* @param[in] key The attribute key
142
*/
143
bool isAttributeEnabled(SumoXMLAttr key) const override;
144
145
/// @brief get PopPup ID (Used in AC Hierarchy)
146
std::string getPopUpID() const override;
147
148
/// @brief get Hierarchy Name (Used in AC Hierarchy)
149
std::string getHierarchyName() const override;
150
151
/// @}
152
153
protected:
154
/// @brief pointer to original lane
155
const GNELane* myLane;
156
157
private:
158
/// @brief set attribute after validation
159
void setAttribute(SumoXMLAttr key, const std::string& value) override;
160
161
/// @brief invalidated copy constructor
162
GNELaneTemplate(const GNELaneTemplate& s) = delete;
163
164
/// @brief invalidated assignment operator
165
GNELaneTemplate& operator=(const GNELaneTemplate& s) = delete;
166
};
167
168