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.org/sumo
3 // Copyright (C) 2001-2022 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  // now set new laneTemplates
65  for (const auto& lane : myEdge->getLanes()) {
66  myLaneTemplates.push_back(new GNELaneTemplate(lane));
67  }
68 }
69 
70 
71 const std::string&
73  return myEdge->getID();
74 }
75 
76 
79  return nullptr;
80 }
81 
82 
83 void
85  throw InvalidArgument("cannot be called in templates");
86 }
87 
88 
89 std::string
91  return myEdge->getAttribute(key);
92 }
93 
94 
95 void
96 GNEEdgeTemplate::setAttribute(SumoXMLAttr /*key*/, const std::string& /*value*/, GNEUndoList* /*undoList*/) {
97  throw InvalidArgument("cannot be called in templates");
98 }
99 
100 
101 bool
102 GNEEdgeTemplate::isValid(SumoXMLAttr /*key*/, const std::string& /*value*/) {
103  throw InvalidArgument("cannot be called in templates");
104 }
105 
106 void
108  throw InvalidArgument("cannot be called in templates");
109 }
110 
111 
112 void
114  throw InvalidArgument("cannot be called in templates");
115 }
116 
117 
118 bool
120  return false;
121 }
122 
123 
124 bool
126  return false;
127 }
128 
129 
130 std::string
132  return myEdge->getPopUpID();
133 }
134 
135 
136 std::string
138  return myEdge->getHierarchyName();
139 }
140 
141 
142 const std::map<std::string, std::string>&
144  return myEdge->getACParametersMap();
145 }
146 
147 // ===========================================================================
148 // private
149 // ===========================================================================
150 
151 void
152 GNEEdgeTemplate::setAttribute(SumoXMLAttr /*key*/, const std::string& /*value*/) {
153  throw InvalidArgument("cannot be called in templates");
154 }
155 
156 void
157 GNEEdgeTemplate::toogleAttribute(SumoXMLAttr /*key*/, const bool /*value*/, const int /*previousParameters*/) {
158  throw InvalidArgument("cannot be called in templates");
159 }
160 
161 /****************************************************************************/
@ 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:782
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEEdge.cpp:800
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
Definition: GNEEdge.cpp:1132
bool isAttributeEnabled(SumoXMLAttr key) const
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
~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
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
std::string getAttribute(SumoXMLAttr key) const
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
const std::vector< GNELaneTemplate * > & getLaneTemplates() const
get vector with the lane templates of this edge
GNEHierarchicalElement * getHierarchicalElement()
get GNEHierarchicalElement associated with this AttributeCarrier
void updateGeometry()
update pre-computed geometry information
void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
bool isAttributeComputed(SumoXMLAttr key) const
bool isValid(SumoXMLAttr key, const std::string &value)
void updateLaneTemplates()
update lane templates
const std::string & getID() const
return ID of object
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)
const std::string & getID() const
get ID