Eclipse SUMO - Simulation of Urban MObility
GNEEdgeTemplate.h
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 #pragma once
21 #include <config.h>
22 
24 
25 // ===========================================================================
26 // class declarations
27 // ===========================================================================
28 class GNEEdge;
29 class GNELaneTemplate;
30 
31 // ===========================================================================
32 // class definitions
33 // ===========================================================================
35 
36 public:
38  GNEEdgeTemplate(const GNEEdge* edge);
39 
42 
45 
47  const std::vector<GNELaneTemplate*>& getLaneTemplates() const;
48 
50  void updateLaneTemplates();
51 
55  const std::string& getID() const;
56 
59 
61  void updateGeometry();
62 
64 
67  /* @brief method for getting the Attribute of an XML key
68  * @param[in] key The attribute key
69  * @return string with the value associated to key
70  */
71  std::string getAttribute(SumoXMLAttr key) const;
72 
73  /* @brief method for setting the attribute and letting the object perform additional changes
74  * @param[in] key The attribute key
75  * @param[in] value The new value
76  * @param[in] undoList The undoList on which to register changes
77  */
78  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
79 
80  /* @brief method for check if new value for certain attribute is valid
81  * @param[in] key The attribute key
82  * @param[in] value The new value
83  */
84  bool isValid(SumoXMLAttr key, const std::string& value);
85 
86  /* @brief method for enable attribute
87  * @param[in] key The attribute key
88  * @param[in] undoList The undoList on which to register changes
89  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
90  */
91  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
92 
93  /* @brief method for disable attribute
94  * @param[in] key The attribute key
95  * @param[in] undoList The undoList on which to register changes
96  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
97  */
98  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
99 
100  /* @brief method for check if the value for certain attribute is set
101  * @param[in] key The attribute key
102  */
103  bool isAttributeEnabled(SumoXMLAttr key) const;
104 
105  /* @brief method for check if the value for certain attribute is computed (for example, due a network recomputing)
106  * @param[in] key The attribute key
107  */
108  bool isAttributeComputed(SumoXMLAttr key) const;
109 
111  std::string getPopUpID() const;
112 
114  std::string getHierarchyName() const;
115 
117 
119  const std::map<std::string, std::string>& getACParametersMap() const;
120 
121 protected:
123  const GNEEdge* myEdge;
124 
126  std::vector<GNELaneTemplate*> myLaneTemplates;
127 
128 private:
130  void setAttribute(SumoXMLAttr key, const std::string& value);
131 
133  void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters);
134 
136  GNEEdgeTemplate(const GNEEdgeTemplate& s) = delete;
137 
140 };
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
bool isAttributeEnabled(SumoXMLAttr key) const
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
~GNEEdgeTemplate()
Destructor.
GNEEdgeTemplate(const GNEEdgeTemplate &s)=delete
invalidated copy constructor
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
GNEEdgeTemplate & operator=(const GNEEdgeTemplate &s)=delete
invalidated assignment operator
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)