SUMO - Simulation of Urban MObility
GNEDetector.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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 // A abstract class to define common parameters of detectors placed over lanes
18 /****************************************************************************/
19 #ifndef GNEDetector_h
20 #define GNEDetector_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include "GNEAdditional.h"
33 
34 // ===========================================================================
35 // class definitions
36 // ===========================================================================
41 class GNEDetector : public GNEAdditional {
42 
43 public:
56  GNEDetector(const std::string& id, GNEViewNet* viewNet, SumoXMLTag tag, GUIIcon icon, GNELane* lane, double pos, double freq, const std::string& filename, bool friendlyPos, GNEAdditional* additionalParent);
57 
59  ~GNEDetector();
60 
64  virtual void writeAdditional(OutputDevice& device) const = 0;
65 
67  virtual bool isDetectorPositionFixed() const = 0;
68 
70  GNELane* getLane() const;
71 
73  double getAbsolutePositionOverLane() const;
74 
77 
81  void moveGeometry(const Position& oldPos, const Position& offset);
82 
87  void commitGeometryMoving(const Position& oldPos, GNEUndoList* undoList);
88 
90  virtual void updateGeometry() = 0;
91 
95 
98 
101  const std::string& getParentName() const;
102 
107  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
109 
112  /* @brief method for getting the Attribute of an XML key
113  * @param[in] key The attribute key
114  * @return string with the value associated to key
115  */
116  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
117 
118  /* @brief method for setting the attribute and letting the object perform additional changes
119  * @param[in] key The attribute key
120  * @param[in] value The new value
121  * @param[in] undoList The undoList on which to register changes
122  */
123  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
124 
125  /* @brief method for checking if the key and their conrrespond attribute are valids
126  * @param[in] key The attribute key
127  * @param[in] value The value asociated to key key
128  * @return true if the value is valid, false in other case
129  */
130  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
132 
133 protected:
136 
139 
141  double myFreq;
142 
144  std::string myFilename;
145 
148 
149 private:
151  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
152 
154  const Position& getPosition() const = delete;
155 
157  void setPosition(const Position& pos) = delete;
158 };
159 
160 #endif
161 
162 /****************************************************************************/
SumoXMLTag
Numbers representing SUMO-XML - element names.
virtual void writeAdditional(OutputDevice &device) const =0
writte additional element into a xml file
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:42
Stores the information about how to visualize structures.
GNEDetector(const std::string &id, GNEViewNet *viewNet, SumoXMLTag tag, GUIIcon icon, GNELane *lane, double pos, double freq, const std::string &filename, bool friendlyPos, GNEAdditional *additionalParent)
Constructor.
Definition: GNEDetector.cpp:59
const Position & getPosition() const =delete
Invalidate return position of additional.
double myFreq
The aggregation period the values the detector collects shall be summed up.
Definition: GNEDetector.h:141
const std::string & getParentName() const
Returns the name of the parent object.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:53
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform additional changes ...
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void commitGeometryMoving(const Position &oldPos, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
Definition: GNEDetector.cpp:97
~GNEDetector()
Destructor.
Definition: GNEDetector.cpp:70
void setPosition(const Position &pos)=delete
Invalidate set new position in the view.
virtual bool isDetectorPositionFixed() const =0
check if Position of detector is fixed
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:45
Position getPositionInView() const
Returns position of additional in view.
virtual void updateGeometry()=0
update pre-computed geometry information
bool myFriendlyPosition
Flag for friendly position.
Definition: GNEDetector.h:147
std::string myFilename
The path to the output file.
Definition: GNEDetector.h:144
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:59
GNELane * myLane
The lane in which this detector is placed.
Definition: GNEDetector.h:135
GNELane * getLane() const
get lane
Definition: GNEDetector.cpp:74
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
method for checking if the key and their conrrespond attribute are valids
void moveGeometry(const Position &oldPos, const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEDetector.cpp:86
double getAbsolutePositionOverLane() const
get absolute position over Lane
Definition: GNEDetector.cpp:80
double myPositionOverLane
position of detector over Lane
Definition: GNEDetector.h:138
virtual std::string getAttribute(SumoXMLAttr key) const =0
This functions has to be implemented in all GNEAttributeCarriers.