Eclipse 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-2019 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 /****************************************************************************/
14 // Abstract class for Shapes uses in netedit
15 /****************************************************************************/
16 #ifndef GNEShape_h
17 #define GNEShape_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 
28 
29 
30 // ===========================================================================
31 // class definitions
32 // ===========================================================================
33 
35 public:
51  GNEShape(GNENet* net, SumoXMLTag tag, bool movementBlocked,
52  const std::vector<GNEEdge*>& parentEdges,
53  const std::vector<GNELane*>& parentLanes,
54  const std::vector<GNEShape*>& parentShapes,
55  const std::vector<GNEAdditional*>& parentAdditionals,
56  const std::vector<GNEDemandElement*>& parentDemandElements,
57  const std::vector<GNEEdge*>& childEdges,
58  const std::vector<GNELane*>& childLanes,
59  const std::vector<GNEShape*>& childShapes,
60  const std::vector<GNEAdditional*>& childAdditionals,
61  const std::vector<GNEDemandElement*>& childDemandElements);
62 
64  ~GNEShape();
65 
67  virtual std::string generateChildID(SumoXMLTag childTag) = 0;
68 
72  virtual void writeShape(OutputDevice& device) = 0;
73 
75  virtual GUIGlID getGlID() const = 0;
76 
78  GNENet* getNet() const;
79 
81  bool isMovementBlocked() const;
82 
84  void draw(const Position& pos, double layer, double size = 0.5) const;
85 
89  virtual void startGeometryMoving() = 0;
90 
92  virtual void endGeometryMoving() = 0;
93 
97  virtual void updateGeometry() = 0;
98 
100  virtual Position getPositionInView() const = 0;
101 
103  virtual Boundary getCenteringBoundary() const = 0;
104 
106 
109 
118 
127 
132  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
134 
138  void selectAttributeCarrier(bool changeFlag = true);
139 
141  void unselectAttributeCarrier(bool changeFlag = true);
142 
144  bool isAttributeCarrierSelected() const;
145 
147  bool drawUsingSelectColor() const;
148 
149  /* @brief method for getting the Attribute of an XML key
150  * @param[in] key The attribute key
151  * @return string with the value associated to key
152  */
153  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
154 
155  /* @brief method for setting the attribute and letting the object perform additional changes
156  * @param[in] key The attribute key
157  * @param[in] value The new value
158  * @param[in] undoList The undoList on which to register changes
159  */
160  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
161 
162  /* @brief method for checking if the key and their conrrespond attribute are valids
163  * @param[in] key The attribute key
164  * @param[in] value The value asociated to key key
165  * @return true if the value is valid, false in other case
166  */
167  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
168 
169  /* @brief method for enable attribute
170  * @param[in] key The attribute key
171  * @param[in] undoList The undoList on which to register changes
172  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
173  */
174  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
175 
176  /* @brief method for enable attribute
177  * @param[in] key The attribute key
178  * @param[in] undoList The undoList on which to register changes
179  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
180  */
181  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
182 
183  /* @brief method for check if the value for certain attribute is set
184  * @param[in] key The attribute key
185  */
186  virtual bool isAttributeEnabled(SumoXMLAttr key) const = 0;
187 
189  std::string getPopUpID() const;
190 
192  std::string getHierarchyName() const;
194 
195 protected:
198 
201 
204 
205 private:
207  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
208 
210  void setEnabledAttribute(const int enabledAttributes);
211 
213  virtual const GUIGlObject* getGUIGlObject() const = 0;
214 
216  GNEShape(const GNEShape&) = delete;
217 
219  GNEShape& operator=(const GNEShape&) = delete;
220 };
221 
222 
223 #endif
224 
225 /****************************************************************************/
226 
GNEShape::myMovingGeometryBoundary
Boundary myMovingGeometryBoundary
boundary used during moving of elements
Definition: GNEShape.h:200
GNEShape::getPositionInView
virtual Position getPositionInView() const =0
Returns position of additional in view.
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition: GUIParameterTableWindow.h:62
GNEShape::disableAttribute
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEShape.cpp:160
GNEShape::getPopUpMenu
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)=0
Returns an own popup-menu.
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
GNEShape::~GNEShape
~GNEShape()
Destructor.
Definition: GNEShape.cpp:57
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
GNEShape::getGUIGlObject
virtual const GUIGlObject * getGUIGlObject() const =0
get GUIGlObject associated to this GNEShape
GNEShape::generateChildID
virtual std::string generateChildID(SumoXMLTag childTag)=0
gererate a new ID for an element child
GNEShape::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
Definition: GNEShape.cpp:108
GNENet
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:77
GNEShape::getCenteringBoundary
virtual Boundary getCenteringBoundary() const =0
Returns the boundary to which the view shall be centered in order to show the object.
GNEHierarchicalParentElements.h
GNEHierarchicalChildElements.h
GNEShape::writeShape
virtual void writeShape(OutputDevice &device)=0
writte shape element into a xml file
GNEShape::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEShape.cpp:172
GNEShape::setEnabledAttribute
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEShape.cpp:178
GNEShape::startGeometryMoving
virtual void startGeometryMoving()=0
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:47
GNEShape::isValid
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
GNEShape::isMovementBlocked
bool isMovementBlocked() const
return true if movement is blocked
Definition: GNEShape.cpp:67
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:41
GNEHierarchicalChildElements
An special type of Attribute carrier that owns hierarchical elements.
Definition: GNEHierarchicalChildElements.h:45
GNEShape::operator=
GNEShape & operator=(const GNEShape &)=delete
Invalidated assignment operator.
GNEShape::GNEShape
GNEShape(GNENet *net, SumoXMLTag tag, bool movementBlocked, const std::vector< GNEEdge * > &parentEdges, const std::vector< GNELane * > &parentLanes, const std::vector< GNEShape * > &parentShapes, const std::vector< GNEAdditional * > &parentAdditionals, const std::vector< GNEDemandElement * > &parentDemandElements, const std::vector< GNEEdge * > &childEdges, const std::vector< GNELane * > &childLanes, const std::vector< GNEShape * > &childShapes, const std::vector< GNEAdditional * > &childAdditionals, const std::vector< GNEDemandElement * > &childDemandElements)
Constructor.
Definition: GNEShape.cpp:38
GNEShape::drawGL
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
GNEShape::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEShape.cpp:166
GNEShape::getParameterWindow
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)=0
Returns an own parameter window.
GNEShape
Definition: GNEShape.h:34
GNEShape::myNet
GNENet * myNet
the net to inform about updates
Definition: GNEShape.h:197
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GNEShape::drawUsingSelectColor
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
Definition: GNEShape.cpp:144
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GNEShape::getNet
GNENet * getNet() const
get Net in which this element is placed
Definition: GNEShape.cpp:61
GUIGlObject
Definition: GUIGlObject.h:65
GNEShape::myBlockMovement
bool myBlockMovement
flag to block movement
Definition: GNEShape.h:203
GNEShape::getGlID
virtual GUIGlID getGlID() const =0
Returns the numerical id of the object.
GUIMainWindow
Definition: GUIMainWindow.h:46
GUIGlID
unsigned int GUIGlID
Definition: GUIGlObject.h:42
GNEShape::setAttribute
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
GNEShape::updateGeometry
virtual void updateGeometry()=0
update pre-computed geometry information
GNEHierarchicalParentElements
An special type of Attribute carrier that owns hierarchical elements.
Definition: GNEHierarchicalParentElements.h:49
GNEShape::draw
void draw(const Position &pos, double layer, double size=0.5) const
draw lock icon
Definition: GNEShape.cpp:73
config.h
GNEShape::isAttributeEnabled
virtual bool isAttributeEnabled(SumoXMLAttr key) const =0
GNEShape::endGeometryMoving
virtual void endGeometryMoving()=0
begin movement (used when user click over edge to start a movement, to avoid problems with problems w...
GNEShape::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEShape.cpp:154
GNEUndoList
Definition: GNEUndoList.h:48
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
GNEAttributeCarrier
Definition: GNEAttributeCarrier.h:54
GNEShape::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEShape.cpp:123
GNEShape::getAttribute
virtual std::string getAttribute(SumoXMLAttr key) const =0
GNEShape::isAttributeCarrierSelected
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
Definition: GNEShape.cpp:138