SUMO - Simulation of Urban MObility
GNEShape.h
Go to the documentation of this file.
1 /****************************************************************************/
7 // Abstract class for Shapes uses in netedit
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 GNEShape_h
21 #define GNEShape_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 
56 class GNEShape : public GNEAttributeCarrier {
57 public:
65  GNEShape(GNENet* net, SumoXMLTag tag, GUIIcon icon, bool movementBlocked, bool shapeBlocked);
66 
68  ~GNEShape();
69 
73  virtual void writeShape(OutputDevice& device) = 0;
74 
76  virtual Position getPositionInView() const = 0;
77 
79  GNENet* getNet() const;
80 
82  bool isMovementBlocked() const;
83 
85  bool isShapeBlocked() const;
86 
88  bool isShapeVisible() const;
89 
91  void setShapeVisible(bool visible);
92 
94  void drawLockIcon(const Position& pos, double layer, double size = 0.5) const;
95 
98 
101  virtual const std::string& getParentName() const = 0;
102 
111 
120 
122  virtual Boundary getCenteringBoundary() const = 0;
123 
128  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
130 
133  /* @brief method for getting the Attribute of an XML key
134  * @param[in] key The attribute key
135  * @return string with the value associated to key
136  */
137  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
138 
139  /* @brief method for setting the attribute and letting the object perform additional changes
140  * @param[in] key The attribute key
141  * @param[in] value The new value
142  * @param[in] undoList The undoList on which to register changes
143  */
144  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
145 
146  /* @brief method for checking if the key and their conrrespond attribute are valids
147  * @param[in] key The attribute key
148  * @param[in] value The value asociated to key key
149  * @return true if the value is valid, false in other case
150  */
151  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
153 
154 protected:
157 
160 
163 
166 
167 private:
169  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
170 
172  GNEShape(const GNEShape&) = delete;
173 
175  GNEShape& operator=(const GNEShape&) = delete;
176 };
177 
178 
179 #endif
180 
181 /****************************************************************************/
182 
SumoXMLTag
Numbers representing SUMO-XML - element names.
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:43
virtual const std::string & getParentName() const =0
Returns the name of the parent object.
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
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:92
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
bool isMovementBlocked() const
return true if movement is blocked
Definition: GNEShape.cpp:63
GNENet * myNet
the net to inform about updates
Definition: GNEShape.h:156
virtual void writeShape(OutputDevice &device)=0
writte shape element into a xml file
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
virtual std::string getAttribute(SumoXMLAttr key) const =0
This functions has to be implemented in allGNEAttributeCarrier.
void drawLockIcon(const Position &pos, double layer, double size=0.5) const
draw lock icon
Definition: GNEShape.cpp:87
bool myBlockShape
flag for block shape
Definition: GNEShape.h:162
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
bool myBlockMovement
flag to block movement
Definition: GNEShape.h:159
virtual Boundary getCenteringBoundary() const =0
Returns the boundary to which the view shall be centered in order to show the object.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
void setShapeVisible(bool visible)
set flag to enable or disable if shape is visible
Definition: GNEShape.cpp:81
GNENet * getNet() const
get Net in which this element is placed
Definition: GNEShape.cpp:57
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)=0
Returns an own parameter window.
virtual Position getPositionInView() const =0
Returns position of additional in view.
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
bool myShapeVisible
flag for visible shape
Definition: GNEShape.h:165
bool isShapeBlocked() const
return true if shape is blocked
Definition: GNEShape.cpp:69
The popup menu of a globject.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
bool isShapeVisible() const
check if shape is visible (Was added into view using insertPolygon/POIInView)
Definition: GNEShape.cpp:75
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)=0
Returns an own popup-menu.
A window containing a gl-object&#39;s parameter.
~GNEShape()
Destructor.
Definition: GNEShape.cpp:53