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:
64  GNETAZElement(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag,
65  const std::vector<GNEJunction*>& junctionParents,
66  const std::vector<GNEEdge*>& edgeParents,
67  const std::vector<GNELane*>& laneParents,
68  const std::vector<GNEAdditional*>& additionalParents,
69  const std::vector<GNEShape*>& shapeParents,
70  const std::vector<GNETAZElement*>& TAZElementParents,
71  const std::vector<GNEDemandElement*>& demandElementParents,
72  const std::vector<GNEGenericData*>& genericDataParents,
73  const std::map<std::string, std::string>& parameters);
74 
91  GNETAZElement(GNETAZElement* TAZElementParent, GNENet* net, GUIGlObjectType type, SumoXMLTag tag,
92  const std::vector<GNEJunction*>& junctionParents,
93  const std::vector<GNEEdge*>& edgeParents,
94  const std::vector<GNELane*>& laneParents,
95  const std::vector<GNEAdditional*>& additionalParents,
96  const std::vector<GNEShape*>& shapeParents,
97  const std::vector<GNETAZElement*>& TAZElementParents,
98  const std::vector<GNEDemandElement*>& demandElementParents,
99  const std::vector<GNEGenericData*>& genericDataParents,
100  const std::map<std::string, std::string>& parameters);
101 
103  virtual ~GNETAZElement();
104 
106  const std::string& getID() const;
107 
110 
112  std::string generateChildID(SumoXMLTag childTag);
113 
115  virtual const PositionVector& getTAZElementShape() const = 0;
116 
120  virtual void writeTAZElement(OutputDevice& device) const = 0;
121 
124 
126  virtual void updateGeometry() = 0;
127 
129  virtual Position getPositionInView() const = 0;
130 
132  virtual double getExaggeration(const GUIVisualizationSettings& s) const = 0;
133 
135  virtual Boundary getCenteringBoundary() const = 0;
137 
140 
149 
158 
163  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
165 
168  /* @brief method for getting the Attribute of an XML key
169  * @param[in] key The attribute key
170  * @return string with the value associated to key
171  */
172  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
173 
174  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
175  * @param[in] key The attribute key
176  * @return double with the value associated to key
177  */
178  virtual double getAttributeDouble(SumoXMLAttr key) const = 0;
179 
180  /* @brief method for getting the Attribute of an XML key in position format (to avoid unnecessary parse<position>(...) for certain attributes)
181  * @param[in] key The attribute key
182  * @return double with the value associated to key
183  */
184  virtual Position getAttributePosition(SumoXMLAttr key) const = 0;
185 
191  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
192 
198  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
199 
200  /* @brief method for enable attribute
201  * @param[in] key The attribute key
202  * @param[in] undoList The undoList on which to register changes
203  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
204  */
205  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
206 
207  /* @brief method for disable attribute
208  * @param[in] key The attribute key
209  * @param[in] undoList The undoList on which to register changes
210  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
211  */
212  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
213 
214  /* @brief method for check if the value for certain attribute is set
215  * @param[in] key The attribute key
216  */
217  virtual bool isAttributeEnabled(SumoXMLAttr key) const = 0;
218 
219  /* @brief method for check if the value for certain attribute is computed (for example, due a network recomputing)
220  * @param[in] key The attribute key
221  */
222  bool isAttributeComputed(SumoXMLAttr key) const;
223 
225  virtual std::string getPopUpID() const = 0;
226 
228  virtual std::string getHierarchyName() const = 0;
230 
232  const std::map<std::string, std::string>& getACParametersMap() const;
233 
234 private:
238  virtual bool checkChildTAZElementRestriction() const;
239 
241  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
242 
244  void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters);
245 
247  GNETAZElement(const GNETAZElement&) = delete;
248 
251 };
GUIGlObjectType
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNETAZElement.h:45
virtual const PositionVector & getTAZElementShape() const =0
get TAZ Shape
virtual Position getPositionInView() const =0
Returns position of TAZElement in view.
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< GNEShape * > &shapeParents, const std::vector< GNETAZElement * > &TAZElementParents, const std::vector< GNEDemandElement * > &demandElementParents, const std::vector< GNEGenericData * > &genericDataParents, const std::map< std::string, std::string > &parameters)
Constructor.
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
GNETAZElement & operator=(const GNETAZElement &)=delete
Invalidated assignment operator.
void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform TAZElement changes
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
method for checking if the key and their conrrespond attribute are valids
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
const std::string & getID() const
get ID
virtual void updateGeometry()=0
update pre-computed geometry information
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)=0
Returns an own popup-menu.
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
virtual double getAttributeDouble(SumoXMLAttr key) const =0
virtual std::string getHierarchyName() const =0
get Hierarchy Name (Used in AC Hierarchy)
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
virtual ~GNETAZElement()
Destructor.
virtual std::string getPopUpID() const =0
get PopPup ID (Used in AC Hierarchy)
virtual void setAttribute(SumoXMLAttr key, const std::string &value)=0
method for setting the attribute and nothing else (used in GNEChange_Attribute)
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
GNETAZElement(const GNETAZElement &)=delete
Invalidated copy constructor.
virtual void writeTAZElement(OutputDevice &device) const =0
writte TAZElement element into a xml file
virtual double getExaggeration(const GUIVisualizationSettings &s) const =0
return exaggeration asociated with this GLObject
virtual bool checkChildTAZElementRestriction() const
check restriction with the number of children
virtual bool isAttributeEnabled(SumoXMLAttr key) const =0
virtual Position getAttributePosition(SumoXMLAttr key) const =0
bool isAttributeComputed(SumoXMLAttr key) const
virtual std::string getAttribute(SumoXMLAttr key) const =0
virtual Boundary getCenteringBoundary() const =0
Returns the boundary to which the view shall be centered in order to show the object.
The popup menu of a globject.
A window containing a gl-object's parameter.
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
A list of positions.