SUMO - Simulation of Urban MObility
GNENetElement.h
Go to the documentation of this file.
1 /****************************************************************************/
7 // A abstract class for net elements
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 #ifndef GNENetElement_h
21 #define GNENetElement_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <string>
34 #include <utility>
35 #include <vector>
36 #include <netbuild/NBConnection.h>
37 #include <netbuild/NBEdge.h>
38 #include <netbuild/NBNode.h>
39 #include <utils/geom/Boundary.h>
40 #include <utils/geom/Position.h>
49 
50 #include "GNEAttributeCarrier.h"
51 
52 // ===========================================================================
53 // class definitions
54 // ===========================================================================
55 
57 public:
65  GNENetElement(GNENet* net, const std::string& id, GUIGlObjectType type, SumoXMLTag tag, GUIIcon icon);
66 
69 
72  virtual void updateGeometry() = 0;
73 
75  GNENet* getNet() const;
76 
81  virtual const std::string& getParentName() const;
82 
91 
100 
105  virtual Boundary getCenteringBoundary() const = 0;
106 
111  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
113 
116  /* @brief method for getting the Attribute of an XML key
117  * @param[in] key The attribute key
118  * @return string with the value associated to key
119  */
120  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
121 
122  /* @brief method for setting the attribute and letting the object perform additional changes
123  * @param[in] key The attribute key
124  * @param[in] value The new value
125  * @param[in] undoList The undoList on which to register changes
126  */
127  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
128 
129  /* @brief method for checking if the key and their conrrespond attribute are valids
130  * @param[in] key The attribute key
131  * @param[in] value The value asociated to key key
132  * @return true if the value is valid, false in other case
133  */
134  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
136 
137 protected:
140 
141 private:
143  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
144 
147 
150 };
151 
152 
153 #endif
154 
155 /****************************************************************************/
156 
SumoXMLTag
Numbers representing SUMO-XML - element names.
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:43
Stores the information about how to visualize structures.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:88
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 (if any)
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:48
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)=0
Returns an own parameter window.
~GNENetElement()
Destructor.
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.
virtual void updateGeometry()=0
update pre-computed geometry information
GNENetElement & operator=(const GNENetElement &)
Invalidated assignment operator.
The popup menu of a globject.
virtual std::string getAttribute(SumoXMLAttr key) const =0
GNENetElement(GNENet *net, const std::string &id, GUIGlObjectType type, SumoXMLTag tag, GUIIcon icon)
Constructor.
A window containing a gl-object&#39;s parameter.