Eclipse SUMO - Simulation of Urban MObility
GNELaneTemplate.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 lanes
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
24 
25 // ===========================================================================
26 // class definitions
27 // ===========================================================================
29 
30 public:
32  GNELaneTemplate(const GNELane* lane);
33 
36 
39 
43  const std::string& getID() const;
44 
47 
49  void updateGeometry();
50 
52 
55  /* @brief method for getting the Attribute of an XML key
56  * @param[in] key The attribute key
57  * @return string with the value associated to key
58  */
59  std::string getAttribute(SumoXMLAttr key) const;
60 
61  /* @brief method for setting the attribute and letting the object perform additional changes
62  * @param[in] key The attribute key
63  * @param[in] value The new value
64  * @param[in] undoList The undoList on which to register changes
65  */
66  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
67 
68  /* @brief method for check if new value for certain attribute is valid
69  * @param[in] key The attribute key
70  * @param[in] value The new value
71  */
72  bool isValid(SumoXMLAttr key, const std::string& value);
73 
74  /* @brief method for enable attribute
75  * @param[in] key The attribute key
76  * @param[in] undoList The undoList on which to register changes
77  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
78  */
79  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
80 
81  /* @brief method for disable attribute
82  * @param[in] key The attribute key
83  * @param[in] undoList The undoList on which to register changes
84  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
85  */
86  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
87 
88  /* @brief method for check if the value for certain attribute is set
89  * @param[in] key The attribute key
90  */
91  bool isAttributeEnabled(SumoXMLAttr key) const;
92 
93  /* @brief method for check if the value for certain attribute is computed (for example, due a network recomputing)
94  * @param[in] key The attribute key
95  */
96  bool isAttributeComputed(SumoXMLAttr key) const;
97 
99  std::string getPopUpID() const;
100 
102  std::string getHierarchyName() const;
103 
105 
107  const std::map<std::string, std::string>& getACParametersMap() const;
108 
109 protected:
111  const GNELane* myLane;
112 
113 private:
115  void setAttribute(SumoXMLAttr key, const std::string& value);
116 
118  void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters);
119 
121  GNELaneTemplate(const GNELaneTemplate& s) = delete;
122 
125 };
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
const GNELane * myLane
pointer to original lane
~GNELaneTemplate()
Destructor.
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
GNELaneTemplate & operator=(const GNELaneTemplate &s)=delete
invalidated assignment operator
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
void updateGeometry()
update pre-computed geometry information
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
bool isValid(SumoXMLAttr key, const std::string &value)
bool isAttributeComputed(SumoXMLAttr key) const
void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
GNELaneTemplate(const GNELane *lane)
Constructor.
GNEHierarchicalElement * getHierarchicalElement()
get GNEHierarchicalElement associated with this AttributeCarrier
GNELaneTemplate(const GNELaneTemplate &s)=delete
invalidated copy constructor
const std::string & getID() const
return ID of object
bool isAttributeEnabled(SumoXMLAttr key) const
std::string getAttribute(SumoXMLAttr key) const
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)