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