SUMO - Simulation of Urban MObility
GNEDetectorE3.h
Go to the documentation of this file.
1 /****************************************************************************/
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 GNEDetectorE3_h
21 #define GNEDetectorE3_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 
39 class GNELane;
40 class GNEDetectorEntry;
41 class GNEDetectorExit;
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
50 class GNEDetectorE3 : public GNEAdditional {
52  friend class GNEChange_Additional;
53 
54 public:
64  GNEDetectorE3(const std::string& id, GNEViewNet* viewNet, Position pos, double freq, const std::string& filename, const double timeThreshold, double speedThreshold);
65 
68 
71  void updateGeometry();
72 
75 
77  void moveAdditionalGeometry(double offsetx, double offsety);
78 
80  void commmitAdditionalGeometryMoved(double oldPosx, double oldPosy, GNEUndoList* undoList);
81 
85  void writeAdditional(OutputDevice& device) const;
86 
88  std::string generateEntryID();
89 
91  std::string generateExitID();
92 
94  void addEntryChild(GNEDetectorEntry* entry);
95 
98 
100  void addExitChild(GNEDetectorExit* exit);
101 
103  void removeExitChild(GNEDetectorExit* exit);
104 
106  int getNumberOfEntryChilds() const;
107 
109  int getNumberOfExitChilds() const;
110 
115  const std::string& getParentName() const;
116 
121  void drawGL(const GUIVisualizationSettings& s) const;
123 
126  /* @brief method for getting the Attribute of an XML key
127  * @param[in] key The attribute key
128  * @return string with the value associated to key
129  */
130  std::string getAttribute(SumoXMLAttr key) const;
131 
132  /* @brief method for setting the attribute and letting the object perform additional changes
133  * @param[in] key The attribute key
134  * @param[in] value The new value
135  * @param[in] undoList The undoList on which to register changes
136  */
137  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
138 
139  /* @brief method for checking if the key and their conrrespond attribute are valids
140  * @param[in] key The attribute key
141  * @param[in] value The value asociated to key key
142  * @return true if the value is valid, false in other case
143  */
144  bool isValid(SumoXMLAttr key, const std::string& value);
146 
147 protected:
149  double myFreq;
150 
152  std::string myFilename;
153 
156 
159 
161  std::vector<GNEDetectorEntry*> myGNEDetectorEntrys;
162 
164  std::vector<GNEDetectorExit*> myGNEDetectorExits;
165 
166 private:
168  void setAttribute(SumoXMLAttr key, const std::string& value);
169 
172 
175 
178 };
179 
180 #endif
181 /****************************************************************************/
double mySpeedThreshold
The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting...
const std::string & getParentName() const
Returns the name of the parent object (if any)
void moveAdditionalGeometry(double offsetx, double offsety)
change the position of the E3 geometry
void commmitAdditionalGeometryMoved(double oldPosx, double oldPosy, GNEUndoList *undoList)
updated geometry changes in the attributes of additional
GNEDetectorE3(const std::string &id, GNEViewNet *viewNet, Position pos, double freq, const std::string &filename, const double timeThreshold, double speedThreshold)
GNEDetectorE3 Constructor.
std::string getAttribute(SumoXMLAttr key) const
Position getPositionInView() const
Returns position of detector E3 in view.
Stores the information about how to visualize structures.
void addExitChild(GNEDetectorExit *exit)
add an Exit child
double myTimeThreshold
The time-based threshold that describes how much time has to pass until a vehicle is recognized as ha...
std::vector< GNEDetectorEntry * > myGNEDetectorEntrys
vector with the GNEDetectorE3EntryExits of the detector
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:54
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
int getNumberOfEntryChilds() const
get number of entry childs
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
void updateGeometry()
update pre-computed geometry information
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
std::vector< GNEDetectorExit * > myGNEDetectorExits
vector with the GNEDetectorE3EntryExits of the detector
void updateGeometryConnections()
update Connection&#39;s geometry
std::string generateEntryID()
gererate a new ID for an Entry detector child
GNEDetectorE3 & operator=(const GNEDetectorE3 &)
Invalidated assignment operator.
void writeAdditional(OutputDevice &device) const
writte additionals element into a xml file
double myFreq
frequency of E3 detector
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:62
~GNEDetectorE3()
GNEDetectorE3 6Destructor.
int getNumberOfExitChilds() const
get number of exit childs
void addEntryChild(GNEDetectorEntry *entry)
add an Entry child
void removeEntryChild(GNEDetectorEntry *entry)
delete an Entry child
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
std::string generateExitID()
gererate a new ID for an Exit detector child
void removeExitChild(GNEDetectorExit *exit)
delete an Exit child
std::string myFilename
fielname of E3 detector
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...