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-2018 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 /****************************************************************************/
15 // A abstract class for net elements
16 /****************************************************************************/
17 #ifndef GNENetElement_h
18 #define GNENetElement_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
28 
29 // ===========================================================================
30 // class declarations
31 // ===========================================================================
32 
33 class GNEAdditional;
34 
35 // ===========================================================================
36 // class definitions
37 // ===========================================================================
38 
40 
41 public:
48  GNENetElement(GNENet* net, const std::string& id, GUIGlObjectType type, SumoXMLTag tag);
49 
52 
56  virtual void updateGeometry(bool updateGrid) = 0;
57 
59  GNENet* getNet() const;
60 
62  void addAdditionalParent(GNEAdditional* additional);
63 
65  void removeAdditionalParent(GNEAdditional* additional);
66 
68  void addAdditionalChild(GNEAdditional* additional);
69 
71  void removeAdditionalChild(GNEAdditional* additional);
72 
74  const std::vector<GNEAdditional*>& getAdditionalParents() const;
75 
77  const std::vector<GNEAdditional*>& getAdditionalChilds() const;
78 
81 
90 
99 
101  virtual Boundary getCenteringBoundary() const = 0;
102 
107  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
109 
112 
114  void selectAttributeCarrier(bool changeFlag = true);
115 
117  void unselectAttributeCarrier(bool changeFlag = true);
118 
120  bool isAttributeCarrierSelected() 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 
143  std::string getPopUpID() const;
144 
146  std::string getHierarchyName() const;
148 
151 
153  virtual std::string getGenericParametersStr() const = 0;
154 
156  virtual std::vector<std::pair<std::string, std::string> > getGenericParameters() const = 0;
157 
159  virtual void setGenericParametersStr(const std::string& value) = 0;
160 
162 
163 protected:
166 
169 
171  std::vector<GNEAdditional*> myFirstAdditionalParents;
172 
174  std::vector<GNEAdditional*> myAdditionalChilds;
175 
176 private:
178  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
179 
181  virtual void mouseOverObject(const GUIVisualizationSettings& s) const = 0;
182 
184  GNENetElement(const GNENetElement&) = delete;
185 
187  GNENetElement& operator=(const GNENetElement&) = delete;
188 };
189 
190 
191 #endif
192 
193 /****************************************************************************/
194 
SumoXMLTag
Numbers representing SUMO-XML - element names.
virtual void setGenericParametersStr(const std::string &value)=0
set generic parameters in string format
GNENet * myNet
the net to inform about updates
GUIGlObjectType
GNENet * getNet() const
get Net in which this element is placed
virtual void updateGeometry(bool updateGrid)=0
update pre-computed geometry information
Stores the information about how to visualize structures.
virtual void mouseOverObject(const GUIVisualizationSettings &s) const =0
method for check if mouse is over objects
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:77
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.
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:42
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.
const std::vector< GNEAdditional * > & getAdditionalParents() const
return vector of additionals that have as Parameter this edge (For example, Rerouters) ...
void addAdditionalParent(GNEAdditional *additional)
add additional child to this edge
void addAdditionalChild(GNEAdditional *additional)
add additional child to this edge
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
void removeAdditionalChild(GNEAdditional *additional)
remove additional child from this edge
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 std::string getGenericParametersStr() const =0
return generic parameters in string format
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
The popup menu of a globject.
virtual std::vector< std::pair< std::string, std::string > > getGenericParameters() const =0
return generic parameters as vector of pairs format
virtual std::string getAttribute(SumoXMLAttr key) const =0
std::vector< GNEAdditional * > myAdditionalChilds
list of Additional Childs of this NetElement
GNENetElement & operator=(const GNENetElement &)=delete
Invalidated assignment operator.
void removeAdditionalParent(GNEAdditional *additional)
remove additional child from this edge
const std::vector< GNEAdditional * > & getAdditionalChilds() const
return vector of additionals that have as Parent this edge (For example, Calibrators) ...
std::vector< GNEAdditional * > myFirstAdditionalParents
list of Additional parents of this NetElement
A window containing a gl-object&#39;s parameter.
bool isAttributeCarrierSelected() const
check if attribute carrier is selected