SUMO - Simulation of Urban MObility
GNEDetector.h
Go to the documentation of this file.
1 /****************************************************************************/
7 // A abstract class to define common parameters of detectors
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 GNEDetector_h
21 #define GNEDetector_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include "GNEAdditional.h"
34 
35 // ===========================================================================
36 // class declarations
37 // ===========================================================================
38 class GNEAdditional;
39 class GNEViewNet;
40 
41 // ===========================================================================
42 // class definitions
43 // ===========================================================================
48 class GNEDetector : public GNEAdditional {
49 public:
61  GNEDetector(const std::string& id, GNEViewNet* viewNet, SumoXMLTag tag, GUIIcon icon, GNELane* lane, double pos, double freq, const std::string& filename, bool friendlyPos);
62 
64  ~GNEDetector();
65 
70  virtual void writeAdditional(OutputDevice& device, bool volatileOptionsEnabled) const = 0;
71 
73  virtual bool isDetectorPositionFixed() const = 0;
74 
76  double getFrequency() const;
77 
79  const std::string& getFilename() const;
80 
85  void setFrequency(const double freq);
86 
90  void setFilename(const std::string& filename);
91 
93  double getAbsolutePositionOverLane() const;
94 
97 
101  void moveGeometry(const Position& newPosition);
102 
107  void commitGeometryMoving(const Position& oldPos, GNEUndoList* undoList);
108 
110  virtual void updateGeometry() = 0;
111 
113  Position getPositionInView() const;
115 
118 
121  const std::string& getParentName() const;
122 
127  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
129 
132  /* @brief method for getting the Attribute of an XML key
133  * @param[in] key The attribute key
134  * @return string with the value associated to key
135  */
136  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
137 
138  /* @brief method for setting the attribute and letting the object perform additional changes
139  * @param[in] key The attribute key
140  * @param[in] value The new value
141  * @param[in] undoList The undoList on which to register changes
142  */
143  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
144 
145  /* @brief method for checking if the key and their conrrespond attribute are valids
146  * @param[in] key The attribute key
147  * @param[in] value The value asociated to key key
148  * @return true if the value is valid, false in other case
149  */
150  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
152 
153 protected:
156 
158  double myFreq;
159 
161  std::string myFilename;
162 
165 
166 private:
168  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
169 
171  const Position& getPosition() const = delete;
172 
174  void setPosition(const Position& pos) = delete;
175 };
176 
177 #endif
178 
179 /****************************************************************************/
SumoXMLTag
Numbers representing SUMO-XML - element names.
const Position & getPosition() const =delete
Invalidate return position of additional.
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:43
Stores the information about how to visualize structures.
double myFreq
The aggregation period the values the detector collects shall be summed up.
Definition: GNEDetector.h:158
GNEDetector(const std::string &id, GNEViewNet *viewNet, SumoXMLTag tag, GUIIcon icon, GNELane *lane, double pos, double freq, const std::string &filename, bool friendlyPos)
Constructor.
Definition: GNEDetector.cpp:62
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:54
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(...)
~GNEDetector()
Destructor.
Definition: GNEDetector.cpp:73
const std::string & getFilename() const
returns the path to the output file
Definition: GNEDetector.cpp:84
virtual bool isDetectorPositionFixed() const =0
check if Position of detector is fixed
void setPosition(const Position &pos)=delete
Invalidate set new position in the view.
virtual void writeAdditional(OutputDevice &device, bool volatileOptionsEnabled) const =0
writte additional element into a xml file
virtual std::string getAttribute(SumoXMLAttr key) const =0
This functions has to be implemented in allGNEAttributeCarrier.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
virtual void updateGeometry()=0
update pre-computed geometry information
const std::string & getParentName() const
Returns the name of the parent object.
double getAbsolutePositionOverLane() const
get absolute position over Lane
bool myFriendlyPosition
Flag for friendly position.
Definition: GNEDetector.h:164
std::string myFilename
The path to the output file.
Definition: GNEDetector.h:161
void setFrequency(const double freq)
Set a new frequency in detector.
Definition: GNEDetector.cpp:90
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:62
void setFilename(const std::string &filename)
Set a new filename in detector.
double getFrequency() const
returns the aggregation period the values the detector collects shall be summed up.
Definition: GNEDetector.cpp:78
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
method for checking if the key and their conrrespond attribute are valids
Position getPositionInView() const
Returns position of additional in view.
double myPositionOverLane
position of detector over Lane
Definition: GNEDetector.h:155
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
void moveGeometry(const Position &newPosition)
change the position of the element geometry without saving in undoList