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 
82  void moveAdditionalGeometry(const Position& offset);
83 
90  virtual void moveAdditionalGeometry(SUMOReal offsetx, SUMOReal offsety) = 0;
91 
97  void commmitAdditionalGeometryMoved(const Position& oldPos, GNEUndoList* undoList);
98 
106  virtual void commmitAdditionalGeometryMoved(SUMOReal oldPosx, SUMOReal oldPosy, GNEUndoList* undoList) = 0;
107 
110  virtual void updateGeometry() = 0;
111 
113  virtual Position getPositionInView() const = 0;
114 
117  virtual void openAdditionalDialog();
118 
120  const std::string& getAdditionalID() const;
121 
123  GNEViewNet* getViewNet() const;
124 
126  PositionVector getShape() const;
127 
129  bool isAdditionalBlocked() const;
130 
132  bool isAdditionalInspectionable() const;
133 
135  bool isAdditionalSelectable() const;
136 
138  bool isAdditionalMovable() const;
139 
140  // @brief Check if additional item is selected
141  bool isAdditionalSelected() const;
142 
145 
147  void setAdditionalID(const std::string& id);
148 
151  void setPositionInView(const Position& pos);
152 
156  virtual void writeAdditional(OutputDevice& device, const std::string& currentDirectory) = 0;
157 
159  GNEEdge* getEdge() const;
160 
162  GNELane* getLane() const;
163 
168  virtual const std::string& getParentName() const = 0;
169 
178 
187 
193 
198  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
200 
203  /* @brief method for getting the Attribute of an XML key
204  * @param[in] key The attribute key
205  * @return string with the value associated to key
206  */
207  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
208 
214  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
215 
221  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
223 
224 protected:
229  void changeEdge(const std::string& edgeID);
230 
235  void changeLane(const std::string& laneID);
236 
237 protected:
240 
244 
248 
252 
256 
259 
263  std::vector<SUMOReal> myShapeRotations;
264 
266  std::vector<SUMOReal> myShapeLengths;
268 
271 
276  void setBlockIconRotation(GNELane* lane = NULL);
277 
279  void drawLockIcon(SUMOReal size = 0.5) const;
280 
283 
286 
290 
292  bool myBlocked;
293 
296 
299 
301  bool myMovable;
302 
306 
310 
313 
314 private:
316  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
317 
320 
323 };
324 
325 #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
GNELane * myLane
The lane this additional belongs NULL if additional doesnt&#39; belongs to a lane.
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:87
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:55
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
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
bool isAdditionalInspectionable() const
check if additional element is inspectionable (With GNEInspectorFrame)
GNEAdditionalSet * getAdditionalSetParent() const
get additionalSet parent, or NULL if don&#39;t belongs to an additionalSet
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 changeEdge(const std::string &edgeID)
change edge of additional
std::vector< SUMOReal > myShapeLengths
The lengths of the shape parts.
SUMOReal myBlockIconRotation
The rotation of the block icon.
bool myMovable
boolean to check if additional element is movable (with the mouse). By default true ...
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.
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:55
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
GNEAdditionalSet * myAdditionalSetParent
pointer to additional set parent, if belong to set
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:63
bool isAdditionalMovable() const
check if additional element is movable
RGBColor myBaseColor
base color (Default green)
The popup menu of a globject.
std::vector< SUMOReal > myShapeRotations
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
bool isAdditionalSelected() const
virtual void updateGeometry()=0
update pre-computed geometry information
bool myInspectionable
boolean to check if additional element is inspectionable (With GNEInspectorFrame). By default true
GNEEdge * myEdge
The edge this additional belongs NULL if additional doesnt&#39; belongs to a edge.
A window containing a gl-object&#39;s parameter.
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.