Eclipse SUMO - Simulation of Urban MObility
GNENetElement.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 // A abstract class for net elements
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
25 #include <netedit/GNEGeometry.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:
50  GNENetElement(GNENet* net, const std::string& id, GUIGlObjectType type, SumoXMLTag tag);
51 
54 
56  void updateDottedGeometry(const PositionVector& shape);
57 
59  virtual std::string generateChildID(SumoXMLTag childTag) = 0;
60 
64  virtual void updateGeometry() = 0;
65 
67  virtual void updateDottedContour() = 0;
68 
70  virtual Position getPositionInView() const = 0;
72 
74  GNENet* getNet() const;
75 
78 
87 
96 
98  virtual Boundary getCenteringBoundary() const = 0;
99 
104  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
106 
109 
111  void selectAttributeCarrier(bool changeFlag = true);
112 
114  void unselectAttributeCarrier(bool changeFlag = true);
115 
117  bool isAttributeCarrierSelected() const;
118 
120  bool drawUsingSelectColor() const;
121 
122  /* @brief method for getting the Attribute of an XML key
123  * @param[in] key The attribute key
124  * @return string with the value associated to key
125  */
126  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
127 
128  /* @brief method for setting the attribute and letting the object perform additional changes
129  * @param[in] key The attribute key
130  * @param[in] value The new value
131  * @param[in] undoList The undoList on which to register changes
132  */
133  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
134 
135  /* @brief method for checking if the key and their conrrespond attribute are valids
136  * @param[in] key The attribute key
137  * @param[in] value The value asociated to key key
138  * @return true if the value is valid, false in other case
139  */
140  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
141 
142  /* @brief method for enable attribute
143  * @param[in] key The attribute key
144  * @param[in] undoList The undoList on which to register changes
145  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
146  */
147  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
148 
149  /* @brief method for disable attribute
150  * @param[in] key The attribute key
151  * @param[in] undoList The undoList on which to register changes
152  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
153  */
154  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
155 
156  /* @brief method for check if the value for certain attribute is set
157  * @param[in] key The attribute key
158  */
159  virtual bool isAttributeEnabled(SumoXMLAttr key) const = 0;
160 
162  std::string getPopUpID() const;
163 
165  std::string getHierarchyName() const;
167 
168 protected:
171 
174 
175 private:
177  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
178 
180  void setEnabledAttribute(const int enabledAttributes);
181 
183  GNENetElement(const GNENetElement&) = delete;
184 
186  GNENetElement& operator=(const GNENetElement&) = delete;
187 };
SumoXMLTag
Numbers representing SUMO-XML - element names.
GNENet * myNet
the net to inform about updates
virtual void updateDottedContour()=0
update dotted contour
GUIGlObjectType
GNENet * getNet() const
get Net in which this element is placed
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
virtual std::string generateChildID(SumoXMLTag childTag)=0
gererate a new ID for an element child
Stores the information about how to visualize structures.
An special type of Attribute carrier that owns hierarchical elements.
virtual Position getPositionInView() const =0
Returns position of hierarchical element in view.
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute) ...
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:75
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
void updateDottedGeometry(const PositionVector &shape)
updated dotted geometry
virtual Boundary getCenteringBoundary() const =0
Returns the boundary to which the view shall be centered in order to show the object.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
Boundary myMovingGeometryBoundary
boundary used during moving of elements
~GNENetElement()
Destructor.
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
GNENetElement(GNENet *net, const std::string &id, GUIGlObjectType type, SumoXMLTag tag)
Constructor.
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
A list of positions.
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)=0
Returns an own popup-menu.
void selectAttributeCarrier(bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
virtual void updateGeometry()=0
update pre-computed geometry information
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:46
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
The popup menu of a globject.
virtual std::string getAttribute(SumoXMLAttr key) const =0
virtual bool isAttributeEnabled(SumoXMLAttr key) const =0
GNENetElement & operator=(const GNENetElement &)=delete
Invalidated assignment operator.
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
A window containing a gl-object&#39;s parameter.
An special type of Attribute carrier that owns hierarchical elements.
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
An Element which don&#39;t belongs to GNENet but has influency in the simulation.