SUMO - Simulation of Urban MObility
GNEShape.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 // Abstract class for Shapes uses in netedit
18 /****************************************************************************/
19 #ifndef GNEShape_h
20 #define GNEShape_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 definitions
53 // ===========================================================================
54 
55 class GNEShape : public GNEAttributeCarrier {
56 public:
64  GNEShape(GNENet* net, SumoXMLTag tag, GUIIcon icon, bool movementBlocked, bool shapeBlocked);
65 
67  ~GNEShape();
68 
72  virtual void updateGeometry() = 0;
73 
77  virtual void writeShape(OutputDevice& device) = 0;
78 
80  virtual Position getPositionInView() const = 0;
81 
83  virtual GUIGlID getGlID() const = 0;
84 
86  GNENet* getNet() const;
87 
89  bool isMovementBlocked() const;
90 
92  bool isShapeBlocked() const;
93 
95  void drawLockIcon(const Position& pos, double layer, double size = 0.5) const;
96 
99 
102  virtual const std::string& getParentName() const = 0;
103 
112 
121 
123  virtual Boundary getCenteringBoundary() const = 0;
124 
129  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
131 
134  /* @brief method for getting the Attribute of an XML key
135  * @param[in] key The attribute key
136  * @return string with the value associated to key
137  */
138  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
139 
140  /* @brief method for setting the attribute and letting the object perform additional changes
141  * @param[in] key The attribute key
142  * @param[in] value The new value
143  * @param[in] undoList The undoList on which to register changes
144  */
145  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
146 
147  /* @brief method for checking if the key and their conrrespond attribute are valids
148  * @param[in] key The attribute key
149  * @param[in] value The value asociated to key key
150  * @return true if the value is valid, false in other case
151  */
152  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
154 
155 protected:
158 
161 
164 
165 private:
167  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
168 
170  GNEShape(const GNEShape&) = delete;
171 
173  GNEShape& operator=(const GNEShape&) = delete;
174 };
175 
176 
177 #endif
178 
179 /****************************************************************************/
180 
SumoXMLTag
Numbers representing SUMO-XML - element names.
virtual const std::string & getParentName() const =0
Returns the name of the parent object.
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:42
GNEShape & operator=(const GNEShape &)=delete
Invalidated assignment operator.
Stores the information about how to visualize structures.
GNEShape(GNENet *net, SumoXMLTag tag, GUIIcon icon, bool movementBlocked, bool shapeBlocked)
Constructor.
Definition: GNEShape.cpp:44
virtual std::string getAttribute(SumoXMLAttr key) const =0
This functions has to be implemented in all GNEAttributeCarriers.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:91
virtual Position getPositionInView() const =0
Returns position of additional in view.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
virtual Boundary getCenteringBoundary() const =0
Returns the boundary to which the view shall be centered in order to show the object.
GNENet * myNet
the net to inform about updates
Definition: GNEShape.h:157
virtual void writeShape(OutputDevice &device)=0
writte shape element into a xml file
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:47
void drawLockIcon(const Position &pos, double layer, double size=0.5) const
draw lock icon
Definition: GNEShape.cpp:74
bool myBlockShape
flag for block shape
Definition: GNEShape.h:163
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
bool myBlockMovement
flag to block movement
Definition: GNEShape.h:160
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:45
bool isMovementBlocked() const
return true if movement is blocked
Definition: GNEShape.cpp:62
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
virtual void updateGeometry()=0
update pre-computed geometry information
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)=0
Returns an own parameter window.
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
unsigned int GUIGlID
Definition: GUIGlObject.h:49
GNENet * getNet() const
get Net in which this element is placed
Definition: GNEShape.cpp:56
The popup menu of a globject.
virtual GUIGlID getGlID() const =0
Returns the numerical id of the object.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)=0
Returns an own popup-menu.
bool isShapeBlocked() const
return true if shape is blocked
Definition: GNEShape.cpp:68
A window containing a gl-object&#39;s parameter.
~GNEShape()
Destructor.
Definition: GNEShape.cpp:52