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-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 // Abstract class for Shapes uses in netedit
16 /****************************************************************************/
17 #ifndef GNEShape_h
18 #define GNEShape_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 
28 
29 
30 // ===========================================================================
31 // class definitions
32 // ===========================================================================
33 
34 class GNEShape : public GNEAttributeCarrier {
35 public:
41  GNEShape(GNENet* net, SumoXMLTag tag, bool movementBlocked);
42 
44  ~GNEShape();
45 
49  virtual void updateGeometry(bool updateGrid) = 0;
50 
54  virtual void writeShape(OutputDevice& device) = 0;
55 
57  virtual Position getPositionInView() const = 0;
58 
60  virtual GUIGlID getGlID() const = 0;
61 
63  GNENet* getNet() const;
64 
66  bool isMovementBlocked() const;
67 
69  void draw(const Position& pos, double layer, double size = 0.5) const;
70 
74  virtual void startGeometryMoving() = 0;
75 
77  virtual void endGeometryMoving() = 0;
79 
82 
91 
100 
102  virtual Boundary getCenteringBoundary() const = 0;
103 
108  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
110 
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 
172 
173 private:
175  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
176 
178  virtual void mouseOverObject(const GUIVisualizationSettings& s) const = 0;
179 
181  GNEShape(const GNEShape&) = delete;
182 
184  GNEShape& operator=(const GNEShape&) = delete;
185 };
186 
187 
188 #endif
189 
190 /****************************************************************************/
191 
void draw(const Position &pos, double layer, double size=0.5) const
draw lock icon
Definition: GNEShape.cpp:61
SumoXMLTag
Numbers representing SUMO-XML - element names.
virtual void startGeometryMoving()=0
GNEShape & operator=(const GNEShape &)=delete
Invalidated assignment operator.
Boundary myMovingGeometryBoundary
boundary used during moving of elements
Definition: GNEShape.h:168
Stores the information about how to visualize structures.
virtual std::string getAttribute(SumoXMLAttr key) const =0
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
Definition: GNEShape.cpp:128
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:77
virtual Position getPositionInView() const =0
Returns position of additional in view.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
GNEShape(GNENet *net, SumoXMLTag tag, bool movementBlocked)
Constructor.
Definition: GNEShape.cpp:38
virtual Boundary getCenteringBoundary() const =0
Returns the boundary to which the view shall be centered in order to show the object.
virtual void setGenericParametersStr(const std::string &value)=0
set generic parameters in string format
GNENet * myNet
the net to inform about updates
Definition: GNEShape.h:165
virtual void writeShape(OutputDevice &device)=0
writte shape element into a xml file
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
void selectAttributeCarrier(bool changeFlag=true)
Definition: GNEShape.cpp:96
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEShape.cpp:140
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
bool myBlockMovement
flag to block movement
Definition: GNEShape.h:171
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
virtual void mouseOverObject(const GUIVisualizationSettings &s) const =0
method for check if mouse is over objects
Definition: GNEShape.cpp:146
bool isMovementBlocked() const
return true if movement is blocked
Definition: GNEShape.cpp:55
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 std::string getGenericParametersStr() const =0
return generic parameters in string format
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEShape.cpp:134
virtual std::vector< std::pair< std::string, std::string > > getGenericParameters() const =0
return generic parameters as vector of pairs format
unsigned int GUIGlID
Definition: GUIGlObject.h:43
virtual void endGeometryMoving()=0
begin movement (used when user click over edge to start a movement, to avoid problems with problems w...
virtual void updateGeometry(bool updateGrid)=0
update pre-computed geometry information
GNENet * getNet() const
get Net in which this element is placed
Definition: GNEShape.cpp:49
The popup menu of a globject.
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEShape.cpp:112
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:64
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:45