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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 // A abstract class for net elements
18 /****************************************************************************/
19 #ifndef GNENetElement_h
20 #define GNENetElement_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <string>
33 #include <utility>
34 #include <vector>
35 #include <netbuild/NBConnection.h>
36 #include <netbuild/NBEdge.h>
37 #include <netbuild/NBNode.h>
38 #include <utils/geom/Boundary.h>
39 #include <utils/geom/Position.h>
48 
49 #include "GNEAttributeCarrier.h"
50 
51 // ===========================================================================
52 // class declarations
53 // ===========================================================================
54 
55 class GNEAdditional;
56 
57 // ===========================================================================
58 // class definitions
59 // ===========================================================================
60 
62 
63 public:
71  GNENetElement(GNENet* net, const std::string& id, GUIGlObjectType type, SumoXMLTag tag, GUIIcon icon);
72 
75 
79  virtual void updateGeometry() = 0;
80 
82  GNENet* getNet() const;
83 
85  void addAdditionalParent(GNEAdditional* additional);
86 
88  void removeAdditionalParent(GNEAdditional* additional);
89 
91  void addAdditionalChild(GNEAdditional* additional);
92 
94  void removeAdditionalChild(GNEAdditional* additional);
95 
97  const std::vector<GNEAdditional*>& getAdditionalParents() const;
98 
100  const std::vector<GNEAdditional*>& getAdditionalChilds() const;
101 
104 
107  virtual const std::string& getParentName() const;
108 
117 
126 
128  virtual Boundary getCenteringBoundary() const = 0;
129 
134  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
136 
139  /* @brief method for getting the Attribute of an XML key
140  * @param[in] key The attribute key
141  * @return string with the value associated to key
142  */
143  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
144 
145  /* @brief method for setting the attribute and letting the object perform additional changes
146  * @param[in] key The attribute key
147  * @param[in] value The new value
148  * @param[in] undoList The undoList on which to register changes
149  */
150  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
151 
152  /* @brief method for checking if the key and their conrrespond attribute are valids
153  * @param[in] key The attribute key
154  * @param[in] value The value asociated to key key
155  * @return true if the value is valid, false in other case
156  */
157  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
159 
160 protected:
163 
165  std::vector<GNEAdditional*> myAdditionalParents;
166 
168  std::vector<GNEAdditional*> myAdditionalChilds;
169 
170 private:
172  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
173 
175  GNENetElement(const GNENetElement&) = delete;
176 
178  GNENetElement& operator=(const GNENetElement&) = delete;
179 };
180 
181 
182 #endif
183 
184 /****************************************************************************/
185 
SumoXMLTag
Numbers representing SUMO-XML - element names.
std::vector< GNEAdditional * > myAdditionalParents
list of Additional parents of this NetElement
GNENet * myNet
the net to inform about updates
GUIGlObjectType
GNENet * getNet() const
get Net in which this element is placed
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:42
Stores the information about how to visualize structures.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:91
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 const std::string & getParentName() const
Returns the name of the parent 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:47
~GNENetElement()
Destructor.
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
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.
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:59
The popup menu of a globject.
virtual std::string getAttribute(SumoXMLAttr key) const =0
This functions has to be implemented in all GNEAttributeCarriers.
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) ...
GNENetElement(GNENet *net, const std::string &id, GUIGlObjectType type, SumoXMLTag tag, GUIIcon icon)
Constructor.
A window containing a gl-object&#39;s parameter.