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.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 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;
52 
53 // ===========================================================================
54 // class definitions
55 // ===========================================================================
56 
63 public:
71  GNEAdditional(const std::string& id, GNEViewNet* viewNet, Position pos, SumoXMLTag tag, GUIIcon icon);
72 
75 
80  void moveAdditionalGeometry(const Position& offset);
81 
88  virtual void moveAdditionalGeometry(double offsetx, double offsety) = 0;
89 
95  void commmitAdditionalGeometryMoved(const Position& oldPos, GNEUndoList* undoList);
96 
104  virtual void commmitAdditionalGeometryMoved(double oldPosx, double oldPosy, GNEUndoList* undoList) = 0;
105 
108  virtual void updateGeometry() = 0;
109 
111  virtual Position getPositionInView() const = 0;
112 
115  virtual void openAdditionalDialog();
116 
118  const std::string& getAdditionalID() const;
119 
121  GNEViewNet* getViewNet() const;
122 
124  PositionVector getShape() const;
125 
127  bool isAdditionalBlocked() const;
128 
130  bool isAdditionalInspectionable() const;
131 
133  bool isAdditionalSelectable() const;
134 
136  bool isAdditionalMovable() const;
137 
138  // @brief Check if additional item is selected
139  bool isAdditionalSelected() const;
140 
142  void setAdditionalID(const std::string& id);
143 
146  void setPositionInView(const Position& pos);
147 
152  virtual void writeAdditional(OutputDevice& device) const = 0;
153 
155  GNEEdge* getEdge() const;
156 
158  GNELane* getLane() const;
159 
163  virtual const std::string& getParentName() const = 0;
164 
173 
182 
188 
193  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
195 
198  /* @brief method for getting the Attribute of an XML key
199  * @param[in] key The attribute key
200  * @return string with the value associated to key
201  */
202  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
203 
209  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
210 
216  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
218 
219 protected:
224  void changeEdge(const std::string& edgeID);
225 
230  void changeLane(const std::string& laneID);
231 
232 protected:
235 
240 
245 
250 
255 
259  std::vector<double> myShapeRotations;
260 
262  std::vector<double> myShapeLengths;
264 
267 
270 
273  void setBlockIconRotation(GNELane* lane = NULL);
274 
276  void drawLockIcon(double size = 0.5) const;
277 
280 
283 
286 
290 
292  bool myBlocked;
293 
296 
299 
301  bool myMovable;
302 
307 
312 
315 
317  std::vector<std::vector<Position> > myConnectionPositions;
318 
319 private:
321  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
322 
325 
328 };
329 
330 #endif
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
method for checking if the key and their conrrespond attribute are valids
virtual void openAdditionalDialog()
open Additional Dialog
GNELane * getLane() const
get lane of additional, or NULL if additional isn&#39;t placed over a Lane
SumoXMLTag
Numbers representing SUMO-XML - element names.
bool isAdditionalBlocked() const
Check if additional item is currently blocked (i.e. cannot be moved with mouse)
const std::string & getAdditionalID() const
returns the ID of additional
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:43
GNELane * myLane
The lane this additional belongs.
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)
Dialog to edit sequences, parameters, etc.. of Additionals.
PositionVector getShape() const
Returns additional element&#39;s shape.
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform additional changes ...
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:88
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:54
void commmitAdditionalGeometryMoved(const Position &oldPos, GNEUndoList *undoList)
updated geometry changes in the attributes of additional
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
GNEAdditionalDialog * myAdditionalDialog
pointer to additional dialog
std::vector< double > myShapeRotations
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
virtual std::string getAttribute(SumoXMLAttr key) const =0
bool isAdditionalInspectionable() const
check if additional element is inspectionable (With GNEInspectorFrame)
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
RGBColor myBaseColorSelected
base color selected (Default blue)
void drawParentAndChildrenConnections() const
draw connections between Parent and childrens
void drawLockIcon(double size=0.5) const
draw lock icon
void changeEdge(const std::string &edgeID)
change edge of additional
bool myMovable
boolean to check if additional element is movable (with the mouse). By default true ...
PositionVector myShape
The shape of the additional element.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
GNEAdditional(const std::string &id, GNEViewNet *viewNet, Position pos, SumoXMLTag tag, GUIIcon icon)
Constructor.
A list of positions.
void setBlockIconRotation(GNELane *lane=NULL)
set Rotation of block Icon
std::vector< std::vector< Position > > myConnectionPositions
Matrix with the Vertex&#39;s positions of connections between Additional Parent an their childs...
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
std::vector< double > myShapeLengths
The lengths of the shape parts.
void setAdditionalID(const std::string &id)
set the ID of additional
~GNEAdditional()
Destructor.
void changeLane(const std::string &laneID)
change lane of additional
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:57
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which additional element is located.
bool isAdditionalSelectable() const
check if additional element is selectable (With GNESelectorFrame)
bool myBlocked
boolean to check if additional element is blocked (i.e. cannot be moved with mouse) ...
void moveAdditionalGeometry(const Position &offset)
change the position of the additional geometry
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:62
bool isAdditionalMovable() const
check if additional element is movable
RGBColor myBaseColor
base color (Default green)
The popup menu of a globject.
bool mySelectable
boolean to check if additional element is selectable (With GNESelectorFrame). By default true ...
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.
void setPositionInView(const Position &pos)
set new position in the view
bool isAdditionalSelected() const
virtual void updateGeometry()=0
update pre-computed geometry information
virtual void writeAdditional(OutputDevice &device) const =0
writte additional element into a xml file
bool myInspectionable
boolean to check if additional element is inspectionable (With GNEInspectorFrame). By default true
GNEEdge * myEdge
The edge this additional belongs.
A window containing a gl-object&#39;s parameter.
double myBlockIconRotation
The rotation of the block icon.
GNEEdge * getEdge() const
get edge of additional, or NULL if additional isn&#39;t placed over an edge
Position myBlockIconPosition
position of the block icon
virtual Position getPositionInView() const =0
Returns position of additional in view.