SUMO - Simulation of Urban MObility
GNEAdditional.h
Go to the documentation of this file.
1 /****************************************************************************/
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
10 // Copyright (C) 2001-2013 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 GNEAdditional_h
21 #define GNEAdditional_h
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <string>
34 #include <vector>
38 
39 #include "GNEAttributeCarrier.h"
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 
46 class PositionVector;
47 class GNEEdge;
48 class GNELane;
49 class GNENet;
50 class GNEViewNet;
51 class GNEAdditionalSet;
53 
54 // ===========================================================================
55 // class definitions
56 // ===========================================================================
57 
64 public:
73  GNEAdditional(const std::string& id, GNEViewNet* viewNet, Position pos, SumoXMLTag tag, GNEAdditionalSet* additionalSetParent = NULL, bool blocked = false);
74 
77 
85  virtual void moveAdditional(SUMOReal posx, SUMOReal posy, GNEUndoList* undoList) = 0;
86 
89  virtual void updateGeometry() = 0;
90 
92  virtual Position getPositionInView() const = 0;
93 
96  virtual void openAdditionalDialog();
97 
99  const std::string& getAdditionalID() const;
100 
102  GNEViewNet* getViewNet() const;
103 
105  PositionVector getShape() const;
106 
108  bool isAdditionalBlocked() const;
109 
111  bool isAdditionalInspectionable() const;
112 
114  bool isAdditionalSelectable() const;
115 
117  bool isAdditionalMovable() const;
118 
119  // @brief Check if additional item is selected
120  bool isAdditionalSelected() const;
121 
124 
126  void setAdditionalID(const std::string& id);
127 
129  void setBlocked(bool value);
130 
133  void setPositionInView(const Position& pos);
134 
138  virtual void writeAdditional(OutputDevice& device, const std::string& currentDirectory) = 0;
139 
142  virtual GNEEdge* getEdge() const;
143 
146  virtual GNELane* getLane() const;
147 
150  virtual void removeEdgeReference();
151 
154  virtual void removeLaneReference();
155 
160  virtual const std::string& getParentName() const = 0;
161 
170 
179 
185 
190  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
192 
195  /* @brief method for getting the Attribute of an XML key
196  * @param[in] key The attribute key
197  * @return string with the value associated to key
198  */
199  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
200 
201  /* @brief method for setting the attribute and letting the object perform additional changes
202  * @param[in] key The attribute key
203  * @param[in] value The new value
204  * @param[in] undoList The undoList on which to register changes
205  */
206  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
207 
208  /* @brief method for checking if the key and their conrrespond attribute are valids
209  * @param[in] key The attribute key
210  * @param[in] value The value asociated to key key
211  * @return true if the value is valid, false in other case
212  */
213  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
215 
216 protected:
219 
223 
227 
230 
234 
238 
241 
245  std::vector<SUMOReal> myShapeRotations;
246 
248  std::vector<SUMOReal> myShapeLengths;
250 
253 
258  void setBlockIconRotation(GNELane* lane = NULL);
259 
261  void drawLockIcon(SUMOReal size = 0.5) const;
262 
265 
268 
272 
274  bool myBlocked;
275 
278 
281 
283  bool myMovable;
284 
285 private:
287  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
288 
291 
294 };
295 
296 #endif
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
virtual void openAdditionalDialog()
open Additional Dialog
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
SumoXMLTag
Numbers representing SUMO-XML - element names.
GNEAdditionalSet * getAdditionalSetParent() const
get additionalSet parent, or NULL if don&#39;t belongs to an additionalSet
PositionVector getShape() const
Returns additional element&#39;s shape.
Stores the information about how to visualize structures.
bool myRotationLefthand
rotation depending of the option "Lefthand"
virtual const std::string & getParentName() const =0
Returns the name of the parent object (if any)
bool isAdditionalSelected() const
Dialog to edit sequences, parameters, etc.. of Additionals.
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:86
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:54
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void setBlocked(bool value)
Block or unblock additional element(i.e. cannot be moved with mouse)
GNEAdditionalDialog * myAdditionalDialog
pointer to additional dialog
An Element wich group additionalSet elements.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
virtual std::string getAttribute(SumoXMLAttr key) const =0
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
RGBColor myBaseColorSelected
base color selected (Default blue)
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which additional element is located.
std::vector< SUMOReal > myShapeLengths
The lengths of the shape parts.
virtual GNEEdge * getEdge() const
get edge of additional, or NULL if additional isn&#39;t placed over an edge
SUMOReal myBlockIconRotation
The rotation of the block icon.
virtual GNELane * getLane() const
get lane of additional, or NULL if additional isn&#39;t placed over a Lane
bool myMovable
boolean to check if additional element is movable (with the mouse). By default true ...
const std::string & getAdditionalID() const
returns the ID of additional
GNEAdditional(const std::string &id, GNEViewNet *viewNet, Position pos, SumoXMLTag tag, GNEAdditionalSet *additionalSetParent=NULL, bool blocked=false)
Constructor.
PositionVector myShape
The shape of the additional element.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
A list of positions.
void setBlockIconRotation(GNELane *lane=NULL)
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
void drawLockIcon(SUMOReal size=0.5) const
draw lock icon
void setAdditionalID(const std::string &id)
set the ID of additional
~GNEAdditional()
Destructor.
Position myBlockIconOffset
The offSet of the block icon.
GNEAdditional & operator=(const GNEAdditional &)
Invalidated assignment operator.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:54
bool myBlocked
boolean to check if additional element is blocked (i.e. cannot be moved with mouse) ...
GNEAdditionalSet * myAdditionalSetParent
pointer to additional set parent, if belong to set
virtual void removeLaneReference()
if additional is placed over a lane, remove it reference
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:63
RGBColor myBaseColor
base color (Default green)
The popup menu of a globject.
std::vector< SUMOReal > myShapeRotations
bool isAdditionalBlocked() const
Check if additional item is currently blocked (i.e. cannot be moved with mouse)
virtual void removeEdgeReference()
if additional is placed over an edge, remove it reference
bool mySelectable
boolean to check if additional element is selectable (With GNESelectorFrame). By default true ...
virtual void writeAdditional(OutputDevice &device, const std::string &currentDirectory)=0
writte additional element into a xml file
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
Position myPosition
The position in which this additional element is located.
#define SUMOReal
Definition: config.h:213
void setPositionInView(const Position &pos)
set new position in the view
virtual void updateGeometry()=0
update pre-computed geometry information
bool myInspectionable
boolean to check if additional element is inspectionable (With GNEInspectorFrame). By default true
bool isAdditionalSelectable() const
check if additional element is selectable (With GNESelectorFrame)
bool isAdditionalInspectionable() const
check if additional element is inspectionable (With GNEInspectorFrame)
A window containing a gl-object&#39;s parameter.
Position myBlockIconPosition
position of the block icon
virtual void moveAdditional(SUMOReal posx, SUMOReal posy, GNEUndoList *undoList)=0
change the position of the additional geometry
bool isAdditionalMovable() const
check if additional element is movable
virtual Position getPositionInView() const =0
Returns position of additional in view.