Eclipse SUMO - Simulation of Urban MObility
GNEEdgeTemplate.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-2024 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 /****************************************************************************/
18 // Template for edges
19 /****************************************************************************/
20 #include <config.h>
21 
23 
24 #include "GNEEdgeTemplate.h"
25 #include "GNELaneTemplate.h"
26 
27 // ===========================================================================
28 // members methods
29 // ===========================================================================
30 
32  GNEAttributeCarrier(SUMO_TAG_EDGE, edge->getNet()),
33  myEdge(edge) {
34  // update lane templates
36 }
37 
38 
40  for (const auto& laneTemplate : myLaneTemplates) {
41  delete laneTemplate;
42  }
43 }
44 
45 
48  return nullptr;
49 }
50 
51 
52 const std::vector<GNELaneTemplate*>&
54  return myLaneTemplates;
55 }
56 
57 
58 void
60  // first remove all laneTemplates
61  for (const auto& laneTemplate : myLaneTemplates) {
62  delete laneTemplate;
63  }
64  myLaneTemplates.clear();
65  // now set new laneTemplates
66  for (const auto& lane : myEdge->getLanes()) {
67  myLaneTemplates.push_back(new GNELaneTemplate(lane));
68  }
69 }
70 
71 
74  return nullptr;
75 }
76 
77 
78 const GUIGlObject*
80  return nullptr;
81 }
82 
83 
84 void
86  throw InvalidArgument("cannot be called in templates");
87 }
88 
89 
90 bool
92  return false;
93 }
94 
95 
96 bool
98  return false;
99 }
100 
101 
102 bool
104  return false;
105 }
106 
107 
108 bool
110  return false;
111 }
112 
113 
114 bool
116  return false;
117 }
118 
119 
120 bool
122  return false;
123 }
124 
125 
126 bool
128  return false;
129 }
130 
131 
132 std::string
134  return myEdge->getAttribute(key);
135 }
136 
137 
140  return myEdge->getAttributePositionVector(key);
141 }
142 
143 
144 void
145 GNEEdgeTemplate::setAttribute(SumoXMLAttr /*key*/, const std::string& /*value*/, GNEUndoList* /*undoList*/) {
146  throw InvalidArgument("cannot be called in templates");
147 }
148 
149 
150 bool
151 GNEEdgeTemplate::isValid(SumoXMLAttr /*key*/, const std::string& /*value*/) {
152  throw InvalidArgument("cannot be called in templates");
153 }
154 
155 
156 bool
158  // All attributes are disabled in templates
159  return false;
160 }
161 
162 
163 std::string
165  return myEdge->getPopUpID();
166 }
167 
168 
169 std::string
171  return myEdge->getHierarchyName();
172 }
173 
174 
175 const Parameterised::Map&
177  return myEdge->getACParametersMap();
178 }
179 
180 // ===========================================================================
181 // private
182 // ===========================================================================
183 
184 void
185 GNEEdgeTemplate::setAttribute(SumoXMLAttr /*key*/, const std::string& /*value*/) {
186  throw InvalidArgument("cannot be called in templates");
187 }
188 
189 /****************************************************************************/
@ SUMO_TAG_EDGE
begin/end of the description of an edge
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition: GNEEdge.cpp:1090
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEEdge.cpp:1108
PositionVector getAttributePositionVector(SumoXMLAttr key) const
Definition: GNEEdge.cpp:1202
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition: GNEEdge.cpp:1498
bool isAttributeEnabled(SumoXMLAttr key) const
~GNEEdgeTemplate()
Destructor.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
GNEEdgeTemplate(const GNEEdge *edge)
Constructor.
const GNEEdge * myEdge
pointer to original edge
bool checkDrawToContour() const
check if draw from contour (magenta)
std::string getAttribute(SumoXMLAttr key) const
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
PositionVector getAttributePositionVector(SumoXMLAttr key) const
const std::vector< GNELaneTemplate * > & getLaneTemplates() const
get vector with the lane templates of this edge
bool checkDrawFromContour() const
check if draw from contour (green)
bool checkDrawMoveContour() const
check if draw move contour (red)
bool checkDrawOverContour() const
check if draw over contour (orange)
GNEHierarchicalElement * getHierarchicalElement()
get GNEHierarchicalElement associated with this AttributeCarrier
void updateGeometry()
update pre-computed geometry information
const Parameterised::Map & getACParametersMap() const
get parameters map
bool checkDrawSelectContour() const
check if draw select contour (blue)
bool checkDrawDeleteContour() const
check if draw delete contour (pink/white)
bool checkDrawRelatedContour() const
check if draw related contour (cyan)
bool isValid(SumoXMLAttr key, const std::string &value)
void updateLaneTemplates()
update lane templates
std::vector< GNELaneTemplate * > myLaneTemplates
vector with the lane templates of this edge
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
A list of positions.