Eclipse 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-2019 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:
51  GNEDetector(const std::string& id, GNEViewNet* viewNet, GUIGlObjectType type, SumoXMLTag tag, double pos, SUMOTime freq, const std::string& filename,
52  const std::string& vehicleTypes, const std::string& name, bool friendlyPos, bool blockMovement, const std::vector<GNELane*>& laneParents);
53 
67  GNEDetector(GNEAdditional* additionalParent, GNEViewNet* viewNet, GUIGlObjectType type, SumoXMLTag tag, double pos, SUMOTime freq, const std::string& filename,
68  const std::string& name, bool friendlyPos, bool blockMovement, const std::vector<GNELane*>& laneParents);
69 
71  ~GNEDetector();
72 
76  virtual bool isAdditionalValid() const = 0;
77 
79  virtual std::string getAdditionalProblem() const = 0;
80 
82  virtual void fixAdditionalProblem() = 0;
84 
86  GNELane* getLane() const;
87 
89  double getPositionOverLane() const;
90 
92  double getGeometryPositionOverLane() const;
93 
96 
99  virtual void moveGeometry(const Position& offset) = 0;
100 
104  virtual void commitGeometryMoving(GNEUndoList* undoList) = 0;
105 
107  virtual void updateGeometry() = 0;
108 
110  Position getPositionInView() const;
111 
115 
118 
121  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;
151 
153  std::string getPopUpID() const;
154 
156  std::string getHierarchyName() const;
158 
159 protected:
162 
165 
167  std::string myFilename;
168 
170  std::string myVehicleTypes;
171 
174 
175 private:
177  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
178 
180  const Position& getPosition() const = delete;
181 
183  void setPosition(const Position& pos) = delete;
184 };
185 
186 #endif
187 
188 /****************************************************************************/
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
GNEAdditional.h
GNEDetector::commitGeometryMoving
virtual void commitGeometryMoving(GNEUndoList *undoList)=0
commit geometry changes in the attributes of an element after use of moveGeometry(....
GNEDetector::~GNEDetector
~GNEDetector()
Destructor.
Definition: GNEDetector.cpp:58
GNEDetector::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEDetector.cpp:74
GNEDetector::getPositionOverLane
double getPositionOverLane() const
get position over lane
Definition: GNEDetector.cpp:62
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
GNEDetector::isAdditionalValid
virtual bool isAdditionalValid() const =0
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
GNEDetector::moveGeometry
virtual void moveGeometry(const Position &offset)=0
change the position of the element geometry without saving in undoList
GNEViewNet
Definition: GNEViewNet.h:43
GNEDetector::myPositionOverLane
double myPositionOverLane
position of detector over Lane
Definition: GNEDetector.h:161
GNEDetector::fixAdditionalProblem
virtual void fixAdditionalProblem()=0
fix additional problem (must be reimplemented in all detector children)
GNEDetector::myFriendlyPosition
bool myFriendlyPosition
Flag for friendly position.
Definition: GNEDetector.h:173
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:42
GNEDetector::getPosition
const Position & getPosition() const =delete
Invalidate return position of additional.
GNEDetector::getGeometryPositionOverLane
double getGeometryPositionOverLane() const
get position over lane that is applicable to the shape
Definition: GNEDetector.cpp:90
GUIGlObjectType
GUIGlObjectType
Definition: GUIGlObjectTypes.h:40
GNEDetector::updateGeometry
virtual void updateGeometry()=0
update pre-computed geometry information
GNEDetector::getParentName
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEDetector.cpp:102
GNEDetector::myVehicleTypes
std::string myVehicleTypes
attribute vehicle types
Definition: GNEDetector.h:170
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
GNEDetector::getLane
GNELane * getLane() const
get lane
Definition: GNEDetector.cpp:68
GNEDetector
Definition: GNEDetector.h:34
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GNEDetector::isValid
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
method for checking if the key and their conrrespond attribute are valids
GNEDetector::setAttribute
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform additional changes
GNEDetector::getAttribute
virtual std::string getAttribute(SumoXMLAttr key) const =0
GNEDetector::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEDetector.cpp:114
GNEDetector::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEDetector.cpp:80
GNEDetector::setPosition
void setPosition(const Position &pos)=delete
Invalidate set new position in the view.
GNEDetector::myFilename
std::string myFilename
The path to the output file.
Definition: GNEDetector.h:167
GNEDetector::myFreq
SUMOTime myFreq
The aggregation period the values the detector collects shall be summed up.
Definition: GNEDetector.h:164
GNEDetector::GNEDetector
GNEDetector(const std::string &id, GNEViewNet *viewNet, GUIGlObjectType type, SumoXMLTag tag, double pos, SUMOTime freq, const std::string &filename, const std::string &vehicleTypes, const std::string &name, bool friendlyPos, bool blockMovement, const std::vector< GNELane * > &laneParents)
Constructor.
Definition: GNEDetector.cpp:34
GNEDetector::drawGL
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
GNEUndoList
Definition: GNEUndoList.h:49
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:373
GNEDetector::getAdditionalProblem
virtual std::string getAdditionalProblem() const =0
return a string with the current additional problem (must be reimplemented in all detector children)
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
GNEDetector::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEDetector.cpp:108