Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/network/GNEEdgeTemplate.cpp
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.cpp
15
/// @author Pablo Alvarez Lopez
16
/// @date Dec 2021
17
///
18
// Template for edges
19
/****************************************************************************/
20
21
#include <netedit/elements/network/GNEEdge.h>
22
23
#include "GNEEdgeTemplate.h"
24
#include "GNELaneTemplate.h"
25
26
// ===========================================================================
27
// members methods
28
// ===========================================================================
29
30
GNEEdgeTemplate::GNEEdgeTemplate(const GNEEdge* edge) :
31
GNEAttributeCarrier(SUMO_TAG_EDGE, edge->getNet()),
32
myEdge(edge) {
33
// update lane templates
34
updateLaneTemplates();
35
}
36
37
38
GNEEdgeTemplate::~GNEEdgeTemplate() {
39
for (const auto& laneTemplate : myLaneTemplates) {
40
delete laneTemplate;
41
}
42
}
43
44
45
GNEHierarchicalElement*
46
GNEEdgeTemplate::getHierarchicalElement() {
47
return nullptr;
48
}
49
50
51
GNEMoveElement*
52
GNEEdgeTemplate::getMoveElement() const {
53
return nullptr;
54
}
55
56
57
Parameterised*
58
GNEEdgeTemplate::getParameters() {
59
return nullptr;
60
}
61
62
63
const Parameterised*
64
GNEEdgeTemplate::getParameters() const {
65
return nullptr;
66
}
67
68
69
FileBucket*
70
GNEEdgeTemplate::getFileBucket() const {
71
return myEdge->getFileBucket();
72
}
73
74
75
const std::vector<GNELaneTemplate*>&
76
GNEEdgeTemplate::getLaneTemplates() const {
77
return myLaneTemplates;
78
}
79
80
81
void
82
GNEEdgeTemplate::updateLaneTemplates() {
83
// first remove all laneTemplates
84
for (const auto& laneTemplate : myLaneTemplates) {
85
delete laneTemplate;
86
}
87
myLaneTemplates.clear();
88
// now set new laneTemplates
89
for (const auto& lane : myEdge->getChildLanes()) {
90
myLaneTemplates.push_back(new GNELaneTemplate(lane));
91
}
92
}
93
94
95
GUIGlObject*
96
GNEEdgeTemplate::getGUIGlObject() {
97
return nullptr;
98
}
99
100
101
const GUIGlObject*
102
GNEEdgeTemplate::getGUIGlObject() const {
103
return nullptr;
104
}
105
106
107
void
108
GNEEdgeTemplate::updateGeometry() {
109
throw InvalidArgument("cannot be called in templates");
110
}
111
112
113
bool
114
GNEEdgeTemplate::checkDrawFromContour() const {
115
return false;
116
}
117
118
119
bool
120
GNEEdgeTemplate::checkDrawToContour() const {
121
return false;
122
}
123
124
125
bool
126
GNEEdgeTemplate::checkDrawRelatedContour() const {
127
return false;
128
}
129
130
131
bool
132
GNEEdgeTemplate::checkDrawOverContour() const {
133
return false;
134
}
135
136
137
bool
138
GNEEdgeTemplate::checkDrawDeleteContour() const {
139
return false;
140
}
141
142
143
bool
144
GNEEdgeTemplate::checkDrawDeleteContourSmall() const {
145
return false;
146
}
147
148
149
bool
150
GNEEdgeTemplate::checkDrawSelectContour() const {
151
return false;
152
}
153
154
155
bool
156
GNEEdgeTemplate::checkDrawMoveContour() const {
157
return false;
158
}
159
160
161
std::string
162
GNEEdgeTemplate::getAttribute(SumoXMLAttr key) const {
163
return myEdge->getAttribute(key);
164
}
165
166
167
double
168
GNEEdgeTemplate::getAttributeDouble(SumoXMLAttr key) const {
169
return myEdge->getAttributeDouble(key);
170
}
171
172
173
Position
174
GNEEdgeTemplate::getAttributePosition(SumoXMLAttr key) const {
175
return getCommonAttributePosition(key);
176
}
177
178
179
PositionVector
180
GNEEdgeTemplate::getAttributePositionVector(SumoXMLAttr key) const {
181
return myEdge->getAttributePositionVector(key);
182
}
183
184
185
void
186
GNEEdgeTemplate::setAttribute(SumoXMLAttr /*key*/, const std::string& /*value*/, GNEUndoList* /*undoList*/) {
187
throw InvalidArgument("cannot be called in templates");
188
}
189
190
191
bool
192
GNEEdgeTemplate::isValid(SumoXMLAttr /*key*/, const std::string& /*value*/) {
193
throw InvalidArgument("cannot be called in templates");
194
}
195
196
197
bool
198
GNEEdgeTemplate::isAttributeEnabled(SumoXMLAttr /*key*/) const {
199
// All attributes are disabled in templates
200
return false;
201
}
202
203
204
std::string
205
GNEEdgeTemplate::getPopUpID() const {
206
return myEdge->getPopUpID();
207
}
208
209
210
std::string
211
GNEEdgeTemplate::getHierarchyName() const {
212
return myEdge->getHierarchyName();
213
}
214
215
// ===========================================================================
216
// private
217
// ===========================================================================
218
219
void
220
GNEEdgeTemplate::setAttribute(SumoXMLAttr /*key*/, const std::string& /*value*/) {
221
throw InvalidArgument("cannot be called in templates");
222
}
223
224
/****************************************************************************/
225
226