Eclipse SUMO - Simulation of Urban MObility
GNETAZElement.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 // Abstract class for TAZElements uses in netedit
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
28 
29 // ===========================================================================
30 // class declarations
31 // ===========================================================================
32 
33 class GNEViewNet;
34 class GNENetworkElement;
36 
37 // ===========================================================================
38 // class definitions
39 // ===========================================================================
40 
46 
47 public:
63  GNETAZElement(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag,
64  const std::vector<GNEJunction*>& junctionParents,
65  const std::vector<GNEEdge*>& edgeParents,
66  const std::vector<GNELane*>& laneParents,
67  const std::vector<GNEAdditional*>& additionalParents,
68  const std::vector<GNETAZElement*>& TAZElementParents,
69  const std::vector<GNEDemandElement*>& demandElementParents,
70  const std::vector<GNEGenericData*>& genericDataParents,
71  const std::map<std::string, std::string>& parameters);
72 
88  GNETAZElement(GNETAZElement* TAZElementParent, GNENet* net, GUIGlObjectType type, SumoXMLTag tag,
89  const std::vector<GNEJunction*>& junctionParents,
90  const std::vector<GNEEdge*>& edgeParents,
91  const std::vector<GNELane*>& laneParents,
92  const std::vector<GNEAdditional*>& additionalParents,
93  const std::vector<GNETAZElement*>& TAZElementParents,
94  const std::vector<GNEDemandElement*>& demandElementParents,
95  const std::vector<GNEGenericData*>& genericDataParents,
96  const std::map<std::string, std::string>& parameters);
97 
99  virtual ~GNETAZElement();
100 
102  const std::string& getID() const;
103 
106 
108  std::string generateChildID(SumoXMLTag childTag);
109 
111  virtual const PositionVector& getTAZElementShape() const = 0;
112 
116  virtual void writeTAZElement(OutputDevice& device) const = 0;
117 
120 
122  virtual void updateGeometry() = 0;
123 
125  virtual Position getPositionInView() const = 0;
126 
128  virtual double getExaggeration(const GUIVisualizationSettings& s) const = 0;
129 
131  virtual Boundary getCenteringBoundary() const = 0;
133 
136 
145 
154 
159  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
161 
164  /* @brief method for getting the Attribute of an XML key
165  * @param[in] key The attribute key
166  * @return string with the value associated to key
167  */
168  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
169 
170  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
171  * @param[in] key The attribute key
172  * @return double with the value associated to key
173  */
174  virtual double getAttributeDouble(SumoXMLAttr key) const = 0;
175 
176  /* @brief method for getting the Attribute of an XML key in position format (to avoid unnecessary parse<position>(...) for certain attributes)
177  * @param[in] key The attribute key
178  * @return double with the value associated to key
179  */
180  virtual Position getAttributePosition(SumoXMLAttr key) const = 0;
181 
187  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
188 
194  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
195 
196  /* @brief method for enable attribute
197  * @param[in] key The attribute key
198  * @param[in] undoList The undoList on which to register changes
199  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
200  */
201  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
202 
203  /* @brief method for disable attribute
204  * @param[in] key The attribute key
205  * @param[in] undoList The undoList on which to register changes
206  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
207  */
208  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
209 
210  /* @brief method for check if the value for certain attribute is set
211  * @param[in] key The attribute key
212  */
213  virtual bool isAttributeEnabled(SumoXMLAttr key) const = 0;
214 
215  /* @brief method for check if the value for certain attribute is computed (for example, due a network recomputing)
216  * @param[in] key The attribute key
217  */
218  bool isAttributeComputed(SumoXMLAttr key) const;
219 
221  virtual std::string getPopUpID() const = 0;
222 
224  virtual std::string getHierarchyName() const = 0;
226 
228  const std::map<std::string, std::string>& getACParametersMap() const;
229 
230 private:
234  virtual bool checkChildTAZElementRestriction() const;
235 
237  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
238 
240  void toogleAttribute(SumoXMLAttr key, const bool value);
241 
243  GNETAZElement(const GNETAZElement&) = delete;
244 
246  GNETAZElement& operator=(const GNETAZElement&) = delete;
247 };
GNETAZElement::writeTAZElement
virtual void writeTAZElement(OutputDevice &device) const =0
writte TAZElement element into a xml file
GNETAZElement::disableAttribute
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNETAZElement.cpp:124
GNETAZElement::generateChildID
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition: GNETAZElement.cpp:80
GUIGlObject.h
GNETAZElement::isAttributeComputed
bool isAttributeComputed(SumoXMLAttr key) const
Definition: GNETAZElement.cpp:130
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition: GUIParameterTableWindow.h:60
Parameterised
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:70
GNETAZElement::drawGL
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
GNETAZElement::getID
const std::string & getID() const
get ID
Definition: GNETAZElement.cpp:68
GNETAZElement::getCenteringBoundary
virtual Boundary getCenteringBoundary() const =0
Returns the boundary to which the view shall be centered in order to show the object.
GNETAZElement::getExaggeration
virtual double getExaggeration(const GUIVisualizationSettings &s) const =0
return exaggeration asociated with this GLObject
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
GNETAZElement::getGUIGlObject
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
Definition: GNETAZElement.cpp:74
GNENet
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
GNETAZElement::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNETAZElement.cpp:118
GNEViewNet
Definition: GNEViewNet.h:43
GNETAZElement::isValid
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
method for checking if the key and their conrrespond attribute are valids
GNETAZElement::updateGeometry
virtual void updateGeometry()=0
update pre-computed geometry information
PositionVector
A list of positions.
Definition: PositionVector.h:43
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:45
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:39
GNETAZElement::toogleAttribute
void toogleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNETAZElement.cpp:143
GNETAZElement::getAttribute
virtual std::string getAttribute(SumoXMLAttr key) const =0
GUIGlObjectType
GUIGlObjectType
Definition: GUIGlObjectTypes.h:37
GNETAZElement::getParameterWindow
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GNETAZElement.cpp:90
GNETAZElement::getPositionInView
virtual Position getPositionInView() const =0
Returns position of TAZElement in view.
GNETAZElement::isAttributeEnabled
virtual bool isAttributeEnabled(SumoXMLAttr key) const =0
Parameterised.h
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
GNETAZElement::getACParametersMap
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
Definition: GNETAZElement.cpp:109
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
GNETAZElement::~GNETAZElement
virtual ~GNETAZElement()
Destructor.
Definition: GNETAZElement.cpp:64
GNETAZElement::getAttributePosition
virtual Position getAttributePosition(SumoXMLAttr key) const =0
GUIGeometry.h
GUIGlObject
Definition: GUIGlObject.h:63
GNETAZElement
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNETAZElement.h:45
GNETAZElement::setAttribute
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform TAZElement changes
GUIMainWindow
Definition: GUIMainWindow.h:44
GNEHierarchicalElement.h
GNETAZElement::getAttributeDouble
virtual double getAttributeDouble(SumoXMLAttr key) const =0
GNETAZElement::getPopUpMenu
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)=0
Returns an own popup-menu.
GNETAZElement::GNETAZElement
GNETAZElement(const std::string &id, GNENet *net, GUIGlObjectType type, SumoXMLTag tag, const std::vector< GNEJunction * > &junctionParents, const std::vector< GNEEdge * > &edgeParents, const std::vector< GNELane * > &laneParents, const std::vector< GNEAdditional * > &additionalParents, const std::vector< GNETAZElement * > &TAZElementParents, const std::vector< GNEDemandElement * > &demandElementParents, const std::vector< GNEGenericData * > &genericDataParents, const std::map< std::string, std::string > &parameters)
Constructor.
Definition: GNETAZElement.cpp:34
GNETAZElement::getTAZElementShape
virtual const PositionVector & getTAZElementShape() const =0
get TAZ Shape
GNETAZElement::operator=
GNETAZElement & operator=(const GNETAZElement &)=delete
Invalidated assignment operator.
GNENetworkElement
Definition: GNENetworkElement.h:41
GNETAZElement::getPopUpID
virtual std::string getPopUpID() const =0
get PopPup ID (Used in AC Hierarchy)
GNEHierarchicalElement
Definition: GNEHierarchicalElement.h:37
config.h
GNETAZElement::checkChildTAZElementRestriction
virtual bool checkChildTAZElementRestriction() const
check restriction with the number of children
Definition: GNETAZElement.cpp:136
GNEUndoList
Definition: GNEUndoList.h:42
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:571
GNETAZElement::getHierarchyName
virtual std::string getHierarchyName() const =0
get Hierarchy Name (Used in AC Hierarchy)
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:463
PositionVector.h