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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
14 // A abstract class for net elements
15 /****************************************************************************/
16 #ifndef GNENetElement_h
17 #define GNENetElement_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
27 #include <netedit/GNEGeometry.h>
30 
31 
32 // ===========================================================================
33 // class declarations
34 // ===========================================================================
35 
36 class GNEAdditional;
37 class GNEDemandElement;
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
42 
44 
45 public:
52  GNENetElement(GNENet* net, const std::string& id, GUIGlObjectType type, SumoXMLTag tag);
53 
56 
58  virtual std::string generateChildID(SumoXMLTag childTag) = 0;
59 
63  virtual void updateGeometry() = 0;
64 
66  virtual Position getPositionInView() const = 0;
68 
70  GNENet* getNet() const;
71 
74 
83 
92 
94  virtual Boundary getCenteringBoundary() const = 0;
95 
100  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
102 
105 
107  void selectAttributeCarrier(bool changeFlag = true);
108 
110  void unselectAttributeCarrier(bool changeFlag = true);
111 
113  bool isAttributeCarrierSelected() const;
114 
116  bool drawUsingSelectColor() const;
117 
118  /* @brief method for getting the Attribute of an XML key
119  * @param[in] key The attribute key
120  * @return string with the value associated to key
121  */
122  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
123 
124  /* @brief method for setting the attribute and letting the object perform additional changes
125  * @param[in] key The attribute key
126  * @param[in] value The new value
127  * @param[in] undoList The undoList on which to register changes
128  */
129  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
130 
131  /* @brief method for checking if the key and their conrrespond attribute are valids
132  * @param[in] key The attribute key
133  * @param[in] value The value asociated to key key
134  * @return true if the value is valid, false in other case
135  */
136  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
137 
138  /* @brief method for enable attribute
139  * @param[in] key The attribute key
140  * @param[in] undoList The undoList on which to register changes
141  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
142  */
143  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
144 
145  /* @brief method for disable attribute
146  * @param[in] key The attribute key
147  * @param[in] undoList The undoList on which to register changes
148  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
149  */
150  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
151 
152  /* @brief method for check if the value for certain attribute is set
153  * @param[in] key The attribute key
154  */
155  virtual bool isAttributeEnabled(SumoXMLAttr key) const = 0;
156 
158  std::string getPopUpID() const;
159 
161  std::string getHierarchyName() const;
163 
164 protected:
167 
170 
171 private:
173  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
174 
176  void setEnabledAttribute(const int enabledAttributes);
177 
179  GNENetElement(const GNENetElement&) = delete;
180 
183 };
184 
185 
186 #endif
187 
188 /****************************************************************************/
189 
GUIGlObject.h
GNEDemandElement
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEDemandElement.h:55
GNENetElement::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNENetElement.cpp:99
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition: GUIParameterTableWindow.h:62
GNENetElement::operator=
GNENetElement & operator=(const GNENetElement &)=delete
Invalidated assignment operator.
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
GNENet
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:77
GNEHierarchicalParentElements.h
GNENetElement::updateGeometry
virtual void updateGeometry()=0
update pre-computed geometry information
GNEHierarchicalChildElements.h
GNENetElement::isAttributeEnabled
virtual bool isAttributeEnabled(SumoXMLAttr key) const =0
GNENetElement::~GNENetElement
~GNENetElement()
Destructor.
Definition: GNENetElement.cpp:48
GNENetElement::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNENetElement.cpp:130
GNENetElement::drawUsingSelectColor
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
Definition: GNENetElement.cpp:120
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:47
GNENetElement::setEnabledAttribute
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNENetElement.cpp:166
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:41
GNENetElement::GNENetElement
GNENetElement(const GNENetElement &)=delete
Invalidated copy constructor.
GNEHierarchicalChildElements
An special type of Attribute carrier that owns hierarchical elements.
Definition: GNEHierarchicalChildElements.h:45
GUIGlObjectType
GUIGlObjectType
Definition: GUIGlObjectTypes.h:39
GNENetElement::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNENetElement.cpp:152
GNENetElement::getCenteringBoundary
virtual Boundary getCenteringBoundary() const =0
Returns the boundary to which the view shall be centered in order to show the object.
GNENetElement::drawGL
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GNENetElement::getAttribute
virtual std::string getAttribute(SumoXMLAttr key) const =0
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GNENetElement::generateChildID
virtual std::string generateChildID(SumoXMLTag childTag)=0
gererate a new ID for an element child
Definition: GNENetElement.cpp:52
GNENetElement::isAttributeCarrierSelected
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
Definition: GNENetElement.cpp:114
GNENetElement
Definition: GNENetElement.h:43
GUIGlObject
Definition: GUIGlObject.h:65
GNENetElement::getParameterWindow
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GNENetElement.cpp:64
GNENetElement::isValid
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
GNEGeometry.h
GNENetElement::getPopUpMenu
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)=0
Returns an own popup-menu.
GUIMainWindow
Definition: GUIMainWindow.h:46
GNENetElement::setAttribute
virtual void setAttribute(SumoXMLAttr key, const std::string &value)=0
set attribute after validation
GNENetElement::getNet
GNENet * getNet() const
get Net in which this element is placed
Definition: GNENetElement.cpp:58
GNENetElement::GNENetElement
GNENetElement(GNENet *net, const std::string &id, GUIGlObjectType type, SumoXMLTag tag)
Constructor.
Definition: GNENetElement.cpp:38
GNEHierarchicalParentElements
An special type of Attribute carrier that owns hierarchical elements.
Definition: GNEHierarchicalParentElements.h:49
GNENetElement::disableAttribute
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNENetElement.cpp:136
GNENetElement::myNet
GNENet * myNet
the net to inform about updates
Definition: GNENetElement.h:166
GNENetElement::setAttribute
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
config.h
GNENetElement::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
Definition: GNENetElement.cpp:83
GNEUndoList
Definition: GNEUndoList.h:48
GNENetElement::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNENetElement.cpp:142
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
PositionVector.h
GNEAttributeCarrier
Definition: GNEAttributeCarrier.h:54
GNENetElement::myMovingGeometryBoundary
Boundary myMovingGeometryBoundary
boundary used during moving of elements
Definition: GNENetElement.h:169
GNENetElement::getPositionInView
virtual Position getPositionInView() const =0
Returns position of hierarchical element in view.