Eclipse SUMO - Simulation of Urban MObility
GNEDetectorE2.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 //
16 /****************************************************************************/
17 #ifndef GNEDetectorE2_h
18 #define GNEDetectorE2_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 
25 #include "GNEDetector.h"
26 
27 
28 // ===========================================================================
29 // class definitions
30 // ===========================================================================
35 class GNEDetectorE2 : public GNEDetector {
36 
37 public:
54  GNEDetectorE2(const std::string& id, GNELane* lane, GNEViewNet* viewNet, double pos, double length, SUMOTime freq, const std::string& filename, const std::string& vehicleTypes,
55  const std::string& name, SUMOTime timeThreshold, double speedThreshold, double jamThreshold, bool friendlyPos, bool blockMovement);
56 
73  GNEDetectorE2(const std::string& id, std::vector<GNELane*> lanes, GNEViewNet* viewNet, double pos, double endPos, SUMOTime freq, const std::string& filename, const std::string& vehicleTypes,
74  const std::string& name, SUMOTime timeThreshold, double speedThreshold, double jamThreshold, bool friendlyPos, bool blockMovement);
75 
78 
82  bool isAdditionalValid() const;
83 
85  std::string getAdditionalProblem() const;
86 
88  void fixAdditionalProblem();
90 
92  double getLength() const;
93 
96 
99 
102  void moveGeometry(const Position& offset);
103 
107  void commitGeometryMoving(GNEUndoList* undoList);
108 
110  void updateGeometry();
112 
115 
119  void drawGL(const GUIVisualizationSettings& s) const;
121 
124  /* @brief method for getting the Attribute of an XML key
125  * @param[in] key The attribute key
126  * @return string with the value associated to key
127  */
128  std::string getAttribute(SumoXMLAttr key) const;
129 
130  /* @brief method for setting the attribute and letting the object perform additional changes
131  * @param[in] key The attribute key
132  * @param[in] value The new value
133  * @param[in] undoList The undoList on which to register changes
134  */
135  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
136 
137  /* @brief method for checking if the key and their correspond attribute are valids
138  * @param[in] key The attribute key
139  * @param[in] value The value asociated to key key
140  * @return true if the value is valid, false in other case
141  */
142  bool isValid(SumoXMLAttr key, const std::string& value);
144 
145 protected:
147  double myLength;
148 
151 
154 
157 
160 
162  bool myE2valid;
163 
164 private:
166  void setAttribute(SumoXMLAttr key, const std::string& value);
167 
169  GNEDetectorE2(const GNEDetectorE2&) = delete;
170 
172  GNEDetectorE2& operator=(const GNEDetectorE2&) = delete;
173 };
174 
175 #endif
176 /****************************************************************************/
GNEDetectorE2::checkE2MultilaneIntegrity
void checkE2MultilaneIntegrity()
check if E2 is valid (all of their lanes are connected, it must called after every operation which in...
Definition: GNEDetectorE2.cpp:371
GNEDetectorE2
Definition: GNEDetectorE2.h:35
GNEDetectorE2::isAdditionalValid
bool isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
Definition: GNEDetectorE2.cpp:71
GNEDetectorE2::myLength
double myLength
E2 detector length.
Definition: GNEDetectorE2.h:147
GNEDetectorE2::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEDetectorE2.cpp:501
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
GNEDetectorE2::myTimeThreshold
SUMOTime myTimeThreshold
The time-based threshold that describes how much time has to pass until a vehicle is recognized as ha...
Definition: GNEDetectorE2.h:153
GNEDetectorE2::fixAdditionalProblem
void fixAdditionalProblem()
fix additional problem
Definition: GNEDetectorE2.cpp:141
GNEViewNet
Definition: GNEViewNet.h:43
GNEDetectorE2::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEDetectorE2.cpp:232
GNEDetectorE2::myJamThreshold
double myJamThreshold
The minimum distance to the next standing vehicle in order to make this vehicle count as a participan...
Definition: GNEDetectorE2.h:159
GNEDetectorE2::getLength
double getLength() const
get length of E2 Detector
Definition: GNEDetectorE2.cpp:365
GNEDetectorE2::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEDetectorE2.cpp:249
GNEDetectorE2::myE2valid
bool myE2valid
flag to check if E2 multilane is valid or invalid
Definition: GNEDetectorE2.h:162
GNEDetector
Definition: GNEDetector.h:34
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GNEDetectorE2::operator=
GNEDetectorE2 & operator=(const GNEDetectorE2 &)=delete
Invalidated assignment operator.
GNEDetectorE2::mySpeedThreshold
double mySpeedThreshold
The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting.
Definition: GNEDetectorE2.h:156
GNEDetectorE2::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEDetectorE2.cpp:574
GNEDetectorE2::setAttribute
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
Definition: GNEDetectorE2.cpp:543
GNEDetector.h
GNEDetectorE2::myEndPositionOverLane
double myEndPositionOverLane
end position over lane (only for Multilane E2 detectors)
Definition: GNEDetectorE2.h:150
GNEDetectorE2::getAdditionalProblem
std::string getAdditionalProblem() const
return a string with the current additional problem
Definition: GNEDetectorE2.cpp:97
GNEDetectorE2::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEDetectorE2.cpp:392
GNEUndoList
Definition: GNEUndoList.h:49
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
GNEDetectorE2::~GNEDetectorE2
~GNEDetectorE2()
Destructor.
Definition: GNEDetectorE2.cpp:66
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:373
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
GNEDetectorE2::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEDetectorE2.cpp:195
GNEDetectorE2::GNEDetectorE2
GNEDetectorE2(const std::string &id, GNELane *lane, GNEViewNet *viewNet, double pos, double length, SUMOTime freq, const std::string &filename, const std::string &vehicleTypes, const std::string &name, SUMOTime timeThreshold, double speedThreshold, double jamThreshold, bool friendlyPos, bool blockMovement)
Constructor for Single-Lane E2 detectors.
Definition: GNEDetectorE2.cpp:41