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
52const std::vector<GNELaneTemplate*>&
54 return myLaneTemplates;
55}
56
57
58void
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
78void
80 throw InvalidArgument("cannot be called in templates");
81}
82
83
84std::string
86 return myEdge->getAttribute(key);
87}
88
89
90void
91GNEEdgeTemplate::setAttribute(SumoXMLAttr /*key*/, const std::string& /*value*/, GNEUndoList* /*undoList*/) {
92 throw InvalidArgument("cannot be called in templates");
93}
94
95
96bool
97GNEEdgeTemplate::isValid(SumoXMLAttr /*key*/, const std::string& /*value*/) {
98 throw InvalidArgument("cannot be called in templates");
99}
100
101
102bool
104 // All attributes are disabled in templates
105 return false;
106}
107
108
109std::string
111 return myEdge->getPopUpID();
112}
113
114
115std::string
117 return myEdge->getHierarchyName();
118}
119
120
123 return myEdge->getACParametersMap();
124}
125
126// ===========================================================================
127// private
128// ===========================================================================
129
130void
131GNEEdgeTemplate::setAttribute(SumoXMLAttr /*key*/, const std::string& /*value*/) {
132 throw InvalidArgument("cannot be called in templates");
133}
134
135/****************************************************************************/
@ 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:839
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEEdge.cpp:857
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition: GNEEdge.cpp:1217
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
std::string getAttribute(SumoXMLAttr key) const
GUIGlObject * getGUIGlObject()
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
const Parameterised::Map & getACParametersMap() const
get parameters map
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