SUMO - Simulation of Urban MObility
GNEDetectorE3.h
Go to the documentation of this file.
1 /****************************************************************************/
7 //
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 
73  void writeAdditional(OutputDevice& device, bool volatileOptionsEnabled) const;
74 
76  std::string generateEntryID();
77 
79  std::string generateExitID();
80 
82  void addEntryChild(GNEDetectorEntry* entry);
83 
86 
88  void addExitChild(GNEDetectorExit* exit);
89 
91  void removeExitChild(GNEDetectorExit* exit);
92 
94  int getNumberOfEntryChilds() const;
95 
97  int getNumberOfExitChilds() const;
98 
101 
105  void moveGeometry(const Position& newPosition);
106 
111  void commitGeometryMoving(const Position& oldPos, GNEUndoList* undoList);
112 
114  void updateGeometry();
115 
117  Position getPositionInView() const;
119 
124  const std::string& getParentName() const;
125 
130  void drawGL(const GUIVisualizationSettings& s) const;
132 
135  /* @brief method for getting the Attribute of an XML key
136  * @param[in] key The attribute key
137  * @return string with the value associated to key
138  */
139  std::string getAttribute(SumoXMLAttr key) const;
140 
141  /* @brief method for setting the attribute and letting the object perform additional changes
142  * @param[in] key The attribute key
143  * @param[in] value The new value
144  * @param[in] undoList The undoList on which to register changes
145  */
146  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
147 
148  /* @brief method for checking if the key and their conrrespond attribute are valids
149  * @param[in] key The attribute key
150  * @param[in] value The value asociated to key key
151  * @return true if the value is valid, false in other case
152  */
153  bool isValid(SumoXMLAttr key, const std::string& value);
155 
156 protected:
159 
161  double myFreq;
162 
164  std::string myFilename;
165 
168 
171 
173  std::vector<GNEDetectorEntry*> myGNEDetectorEntrys;
174 
176  std::vector<GNEDetectorExit*> myGNEDetectorExits;
177 
178 private:
180  void setAttribute(SumoXMLAttr key, const std::string& value);
181 
184 
187 
190 };
191 
192 #endif
193 /****************************************************************************/
double mySpeedThreshold
The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting...
GNEDetectorE3(const std::string &id, GNEViewNet *viewNet, Position pos, double freq, const std::string &filename, const double timeThreshold, double speedThreshold)
GNEDetectorE3 Constructor.
Position myPosition
position of E3 in view
const std::string & getParentName() const
Returns the name of the parent object (if any)
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...
Position getPositionInView() const
Returns position of additional in view.
void writeAdditional(OutputDevice &device, bool volatileOptionsEnabled) const
writte additional element into a xml file
std::vector< GNEDetectorEntry * > myGNEDetectorEntrys
vector with the GNEDetectorE3EntryExits of the detector
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.
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
void moveGeometry(const Position &newPosition)
change the position of the element geometry without saving in undoList
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.
double myFreq
frequency of E3 detector
void commitGeometryMoving(const Position &oldPos, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:62
std::string getAttribute(SumoXMLAttr key) const
This functions has to be implemented in allGNEAttributeCarrier.
~GNEDetectorE3()
GNEDetectorE3 6Destructor.
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
int getNumberOfEntryChilds() const
get number of entry childs
int getNumberOfExitChilds() const
get number of exit childs
void removeExitChild(GNEDetectorExit *exit)
delete an Exit child
std::string myFilename
fielname of E3 detector
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...