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-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // A abstract class to define common parameters of detectors placed over lanes
16 /****************************************************************************/
17 #ifndef GNEDetector_h
18 #define GNEDetector_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include "GNEAdditional.h"
27 
28 // ===========================================================================
29 // class definitions
30 // ===========================================================================
35 class GNEDetector : public GNEAdditional {
36 
37 public:
52  GNEDetector(const std::string& id, GNEViewNet* viewNet, GUIGlObjectType type, SumoXMLTag tag, GNELane* lane, double pos, double freq, const std::string& filename, const std::string& vehicleTypes, const std::string& name, bool friendlyPos, bool blockMovement);
53 
67  GNEDetector(GNEAdditional* additionalParent, GNEViewNet* viewNet, GUIGlObjectType type, SumoXMLTag tag, GNELane* lane, double pos, double freq, const std::string& filename, const std::string& name, bool friendlyPos, bool blockMovement);
68 
70  ~GNEDetector();
71 
73  virtual bool isDetectorPositionFixed() const = 0;
74 
76  GNELane* getLane() const;
77 
79  double getPositionOverLane() const;
80 
83 
87  void moveGeometry(const Position& oldPos, const Position& offset);
88 
93  void commitGeometryMoving(const Position& oldPos, GNEUndoList* undoList);
94 
96  virtual void updateGeometry(bool updateGrid) = 0;
97 
101 
104 
107  std::string getParentName() const;
108 
113  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
115 
118  /* @brief method for getting the Attribute of an XML key
119  * @param[in] key The attribute key
120  * @return string with the value associated to key
121  */
122  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
123 
124  /* @brief method for setting the attribute and letting the object perform additional changes
125  * @param[in] key The attribute key
126  * @param[in] value The new value
127  * @param[in] undoList The undoList on which to register changes
128  */
129  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
130 
131  /* @brief method for checking if the key and their conrrespond attribute are valids
132  * @param[in] key The attribute key
133  * @param[in] value The value asociated to key key
134  * @return true if the value is valid, false in other case
135  */
136  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
137 
139  std::string getPopUpID() const;
140 
142  std::string getHierarchyName() const;
144 
145 protected:
148 
151 
153  double myFreq;
154 
156  std::string myFilename;
157 
159  std::string myVehicleTypes;
160 
163 
164 private:
166  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
167 
169  const Position& getPosition() const = delete;
170 
172  void setPosition(const Position& pos) = delete;
173 };
174 
175 #endif
176 
177 /****************************************************************************/
SumoXMLTag
Numbers representing SUMO-XML - element names.
double getPositionOverLane() const
get position over lane
Definition: GNEDetector.cpp:85
std::string getParentName() const
Returns the name of the parent object.
GUIGlObjectType
Stores the information about how to visualize structures.
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:153
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:47
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:75
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
void setPosition(const Position &pos)=delete
Invalidate set new position in the view.
GNEDetector(const std::string &id, GNEViewNet *viewNet, GUIGlObjectType type, SumoXMLTag tag, GNELane *lane, double pos, double freq, const std::string &filename, const std::string &vehicleTypes, const std::string &name, bool friendlyPos, bool blockMovement)
Constructor.
Definition: GNEDetector.cpp:52
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:39
Position getPositionInView() const
Returns position of additional in view.
std::string myVehicleTypes
attribute vehicle types
Definition: GNEDetector.h:159
bool myFriendlyPosition
Flag for friendly position.
Definition: GNEDetector.h:162
std::string myFilename
The path to the output file.
Definition: GNEDetector.h:156
virtual void updateGeometry(bool updateGrid)=0
update pre-computed geometry information
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:53
GNELane * myLane
The lane in which this detector is placed.
Definition: GNEDetector.h:147
GNELane * getLane() const
get lane
Definition: GNEDetector.cpp:79
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
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:91
double myPositionOverLane
position of detector over Lane
Definition: GNEDetector.h:150
virtual std::string getAttribute(SumoXMLAttr key) const =0