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-2020 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 
24 #include <netedit/GNEGeometry.h>
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, bool blockMovement,
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<GNEShape*>& shapeParents,
69  const std::vector<GNETAZElement*>& TAZElementParents,
70  const std::vector<GNEDemandElement*>& demandElementParents,
71  const std::vector<GNEGenericData*>& genericDataParents);
72 
88  GNETAZElement(GNETAZElement* TAZElementParent, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, bool blockMovement,
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<GNEShape*>& shapeParents,
94  const std::vector<GNETAZElement*>& TAZElementParents,
95  const std::vector<GNEDemandElement*>& demandElementParents,
96  const std::vector<GNEGenericData*>& genericDataParents);
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 Boundary getCenteringBoundary() const = 0;
130 
132  bool isTAZElementBlocked() const;
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 
181  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
182 
188  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
189 
190  /* @brief method for enable attribute
191  * @param[in] key The attribute key
192  * @param[in] undoList The undoList on which to register changes
193  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
194  */
195  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
196 
197  /* @brief method for disable attribute
198  * @param[in] key The attribute key
199  * @param[in] undoList The undoList on which to register changes
200  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
201  */
202  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
203 
204  /* @brief method for check if the value for certain attribute is set
205  * @param[in] key The attribute key
206  */
207  virtual bool isAttributeEnabled(SumoXMLAttr key) const = 0;
208 
210  virtual std::string getPopUpID() const = 0;
211 
213  virtual std::string getHierarchyName() const = 0;
215 
217  const std::map<std::string, std::string>& getACParametersMap() const;
218 
219 protected:
222 
224  bool isValidTAZElementID(const std::string& newID) const;
225 
226 private:
230  virtual bool checkChildTAZElementRestriction() const;
231 
233  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
234 
236  void setEnabledAttribute(const int enabledAttributes);
237 
239  GNETAZElement(const GNETAZElement&) = delete;
240 
243 };
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:40
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.
bool isTAZElementBlocked() const
Check if TAZElement item is currently blocked (i.e. cannot be moved with mouse)
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
GNETAZElement & operator=(const GNETAZElement &)=delete
Invalidated assignment operator.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
bool isValidTAZElementID(const std::string &newID) const
check if a new TAZElement ID is valid
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
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
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
virtual std::string getHierarchyName() const =0
get Hierarchy Name (Used in AC Hierarchy)
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
bool myBlockMovement
boolean to check if TAZElement element is blocked (i.e. cannot be moved with mouse)
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 bool checkChildTAZElementRestriction() const
check restriction with the number of children
virtual bool isAttributeEnabled(SumoXMLAttr key) const =0
GNETAZElement(const std::string &id, GNENet *net, GUIGlObjectType type, SumoXMLTag tag, bool blockMovement, 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)
Constructor.
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:60
An upper class for objects with additional parameters.
Definition: Parameterised.h:39
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
A list of positions.