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 
25 #include "GNEAdditional.h"
26 
27 // ===========================================================================
28 // class definitions
29 // ===========================================================================
34 class GNEDetector : public GNEAdditional {
35 
36 public:
50  GNEDetector(const std::string& id, GNEViewNet* viewNet, GUIGlObjectType type, SumoXMLTag tag, double pos, double freq, const std::string& filename, const std::string& vehicleTypes, const std::string& name, bool friendlyPos, bool blockMovement);
51 
64  GNEDetector(GNEAdditional* additionalParent, GNEViewNet* viewNet, GUIGlObjectType type, SumoXMLTag tag, double pos, double freq, const std::string& filename, const std::string& name, bool friendlyPos, bool blockMovement);
65 
67  ~GNEDetector();
68 
72  virtual bool isAdditionalValid() const = 0;
73 
75  virtual std::string getAdditionalProblem() const = 0;
76 
78  virtual void fixAdditionalProblem() = 0;
80 
82  virtual GNELane* getLane() const = 0;
83 
85  double getPositionOverLane() const;
86 
89 
92  virtual void moveGeometry(const Position& offset) = 0;
93 
97  virtual void commitGeometryMoving(GNEUndoList* undoList) = 0;
98 
100  virtual void updateGeometry(bool updateGrid) = 0;
101 
103  Position getPositionInView() const;
105 
108 
111  std::string getParentName() const;
112 
117  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
119 
122  /* @brief method for getting the Attribute of an XML key
123  * @param[in] key The attribute key
124  * @return string with the value associated to key
125  */
126  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
127 
128  /* @brief method for setting the attribute and letting the object perform additional changes
129  * @param[in] key The attribute key
130  * @param[in] value The new value
131  * @param[in] undoList The undoList on which to register changes
132  */
133  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
134 
135  /* @brief method for checking if the key and their conrrespond attribute are valids
136  * @param[in] key The attribute key
137  * @param[in] value The value asociated to key key
138  * @return true if the value is valid, false in other case
139  */
140  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
141 
143  std::string getPopUpID() const;
144 
146  std::string getHierarchyName() const;
148 
149 protected:
152 
154  double myFreq;
155 
157  std::string myFilename;
158 
160  std::string myVehicleTypes;
161 
164 
165 private:
167  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
168 
170  const Position& getPosition() const = delete;
171 
173  void setPosition(const Position& pos) = delete;
174 };
175 
176 #endif
177 
178 /****************************************************************************/
SumoXMLTag
Numbers representing SUMO-XML - element names.
double getPositionOverLane() const
get position over lane
Definition: GNEDetector.cpp:57
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEDetector.cpp:75
GUIGlObjectType
virtual bool isAdditionalValid() const =0
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
Stores the information about how to visualize structures.
virtual GNELane * getLane() const =0
get lane
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:154
virtual std::string getAdditionalProblem() const =0
return a string with the current additional problem (must be reimplemented in all detector childs) ...
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.
~GNEDetector()
Destructor.
Definition: GNEDetector.cpp:53
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEDetector.cpp:87
void setPosition(const Position &pos)=delete
Invalidate set new position in the view.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEDetector.cpp:63
std::string myVehicleTypes
attribute vehicle types
Definition: GNEDetector.h:160
virtual void moveGeometry(const Position &offset)=0
change the position of the element geometry without saving in undoList
bool myFriendlyPosition
Flag for friendly position.
Definition: GNEDetector.h:163
std::string myFilename
The path to the output file.
Definition: GNEDetector.h:157
virtual void updateGeometry(bool updateGrid)=0
update pre-computed geometry information
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
GNEDetector(const std::string &id, GNEViewNet *viewNet, GUIGlObjectType type, SumoXMLTag tag, double pos, double freq, const std::string &filename, const std::string &vehicleTypes, const std::string &name, bool friendlyPos, bool blockMovement)
Constructor.
Definition: GNEDetector.cpp:32
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
virtual void commitGeometryMoving(GNEUndoList *undoList)=0
commit geometry changes in the attributes of an element after use of moveGeometry(...)
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEDetector.cpp:81
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
method for checking if the key and their conrrespond attribute are valids
double myPositionOverLane
position of detector over Lane
Definition: GNEDetector.h:151
virtual std::string getAttribute(SumoXMLAttr key) const =0
virtual void fixAdditionalProblem()=0
fix additional problem (must be reimplemented in all detector childs)