Eclipse SUMO - Simulation of Urban MObility
GNENetworkElement.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 // A abstract class for network elements
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
27 #include <netedit/GNEMoveElement.h>
28 
29 
30 // ===========================================================================
31 // class declarations
32 // ===========================================================================
33 
34 class GNEAdditional;
35 class GNEDemandElement;
36 
37 // ===========================================================================
38 // class definitions
39 // ===========================================================================
40 
42 
43 public:
58  GNENetworkElement(GNENet* net, const std::string& id, GUIGlObjectType type, SumoXMLTag tag,
59  const std::vector<GNEJunction*>& junctionParents,
60  const std::vector<GNEEdge*>& edgeParents,
61  const std::vector<GNELane*>& laneParents,
62  const std::vector<GNEAdditional*>& additionalParents,
63  const std::vector<GNEShape*>& shapeParents,
64  const std::vector<GNETAZElement*>& TAZElementParents,
65  const std::vector<GNEDemandElement*>& demandElementParents,
66  const std::vector<GNEGenericData*>& genericDataParents);
67 
69  virtual ~GNENetworkElement();
70 
75 
77  const std::string& getID() const;
78 
81 
83  void setShapeEdited(const bool value);
84 
86  bool isShapeEdited() const;
87 
91  virtual void updateGeometry() = 0;
92 
94  virtual Position getPositionInView() const = 0;
96 
99 
108 
117 
119  virtual double getExaggeration(const GUIVisualizationSettings& s) const = 0;
120 
123 
125  virtual void updateCenteringBoundary(const bool updateGrid) = 0;
126 
131  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
133 
136  /* @brief method for getting the Attribute of an XML key
137  * @param[in] key The attribute key
138  * @return string with the value associated to key
139  */
140  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
141 
142  /* @brief method for setting the attribute and letting the object perform additional changes
143  * @param[in] key The attribute key
144  * @param[in] value The new value
145  * @param[in] undoList The undoList on which to register changes
146  */
147  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
148 
149  /* @brief method for checking if the key and their conrrespond attribute are valids
150  * @param[in] key The attribute key
151  * @param[in] value The value asociated to key key
152  * @return true if the value is valid, false in other case
153  */
154  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
155 
156  /* @brief method for enable attribute
157  * @param[in] key The attribute key
158  * @param[in] undoList The undoList on which to register changes
159  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
160  */
161  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
162 
163  /* @brief method for disable attribute
164  * @param[in] key The attribute key
165  * @param[in] undoList The undoList on which to register changes
166  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
167  */
168  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
169 
170  /* @brief method for check if the value for certain attribute is set
171  * @param[in] key The attribute key
172  */
173  virtual bool isAttributeEnabled(SumoXMLAttr key) const = 0;
174 
176  std::string getPopUpID() const;
177 
179  std::string getHierarchyName() const;
181 
183  virtual const std::map<std::string, std::string>& getACParametersMap() const = 0;
184 
185 protected:
188 
191 
192 private:
194  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
195 
197  void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters);
198 
201 
204 };
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
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
An Element which don't belongs to GNENet but has influency in the simulation.
move element
move operation
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
GNENetworkElement(const GNENetworkElement &)=delete
Invalidated copy constructor.
virtual bool isAttributeEnabled(SumoXMLAttr key) const =0
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
virtual std::string getAttribute(SumoXMLAttr key) const =0
virtual double getExaggeration(const GUIVisualizationSettings &s) const =0
return exaggeration asociated with this GLObject
GNENetworkElement & operator=(const GNENetworkElement &)=delete
Invalidated assignment operator.
void setShapeEdited(const bool value)
set shape edited
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 GNEMoveOperation * getMoveOperation()=0
get move operation
bool myShapeEdited
flag to check if element shape is being edited
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
GNENetworkElement(GNENet *net, const std::string &id, 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)
Constructor.
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
virtual Position getPositionInView() const =0
Returns position of hierarchical element in view.
virtual void updateGeometry()=0
update pre-computed geometry information
virtual const std::map< std::string, std::string > & getACParametersMap() const =0
get parameters map
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
bool isShapeEdited() const
check if shape is being edited
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
virtual ~GNENetworkElement()
Destructor.
virtual void updateCenteringBoundary(const bool updateGrid)=0
update centering boundary (implies change in RTREE)
virtual void setAttribute(SumoXMLAttr key, const std::string &value)=0
set attribute after validation
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
const std::string & getID() const
get ID
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)=0
Returns an own popup-menu.
Boundary myBoundary
object boundary
The popup menu of a globject.
A window containing a gl-object's parameter.
Stores the information about how to visualize structures.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37