Eclipse SUMO - Simulation of Urban MObility
GNEMeanData.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // Class for representing MeanData
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
24 
25 
26 // ===========================================================================
27 // class definitions
28 // ===========================================================================
34 
35 public:
37  GNEMeanData(GNENet* net, SumoXMLTag tag, const std::string& id);
38 
40  GNEMeanData(GNENet* net, SumoXMLTag tag, std::string ID, std::string file, SUMOTime period,
41  SUMOTime begin, SUMOTime end, const bool trackVehicles, const std::vector<SumoXMLAttr>& writtenAttributes,
42  const bool aggregate, const std::vector<std::string>& edges, const std::string& edgeFile,
43  std::string excludeEmpty, const bool withInternal, const std::vector<std::string>& detectPersons,
44  const double minSamples, const double maxTravelTime, const std::vector<std::string>& vTypes, const double speedThreshold);
45 
47  ~GNEMeanData();
48 
52  void writeMeanData(OutputDevice& device) const;
53 
56 
58  const GUIGlObject* getGUIGlObject() const;
59 
61  void updateGeometry();
62 
65 
68 
70  bool checkDrawFromContour() const;
71 
73  bool checkDrawToContour() const;
74 
76  bool checkDrawRelatedContour() const;
77 
79  bool checkDrawOverContour() const;
80 
82  bool checkDrawDeleteContour() const;
83 
85  bool checkDrawSelectContour() const;
86 
88  bool checkDrawMoveContour() const;
89 
91 
94  /* @brief method for getting the Attribute of an XML key
95  * @param[in] key The attribute key
96  * @return string with the value associated to key
97  */
98  std::string getAttribute(SumoXMLAttr key) const;
99 
100  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
101  * @param[in] key The attribute key
102  * @return double with the value associated to key
103  */
104  double getAttributeDouble(SumoXMLAttr key) const;
105 
111  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
112 
118  bool isValid(SumoXMLAttr key, const std::string& value);
119 
121  std::string getPopUpID() const;
122 
124  std::string getHierarchyName() const;
126 
128  const Parameterised::Map& getACParametersMap() const;
129 
130 protected:
132  std::string myID;
133 
135  std::string myFile;
136 
139 
142 
145 
147  bool myTrackVehicles = false;
148 
150  std::vector<SumoXMLAttr> myWrittenAttributes;
151 
153  bool myAggregate = false;
154 
156  std::vector<std::string> myEdges;
157 
159  std::string myEdgeFile;
160 
162  std::string myExcludeEmpty;
163 
165  bool myWithInternal = false;
166 
168  std::vector<std::string> myDetectPersons;
169 
171  double myMinSamples = 0;
172 
174  double myMaxTravelTime = 0;
175 
177  std::vector<std::string> myVTypes;
178 
180  double mySpeedThreshold = 0;
181 
182 private:
184  void setAttribute(SumoXMLAttr key, const std::string& value);
185 
187  GNEMeanData(const GNEMeanData&) = delete;
188 
190  GNEMeanData& operator=(const GNEMeanData&) = delete;
191 };
192 
193 /****************************************************************************/
long long int SUMOTime
Definition: GUI.h:35
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
An Element which don't belong to GNENet but has influence in the simulation.
Definition: GNEMeanData.h:33
SUMOTime myBegin
begin
Definition: GNEMeanData.h:141
double myMinSamples
minSamples
Definition: GNEMeanData.h:171
std::string myExcludeEmpty
exclude empty
Definition: GNEMeanData.h:162
std::string myEdgeFile
edge file
Definition: GNEMeanData.h:159
bool checkDrawOverContour() const
check if draw over contour (orange)
SUMOTime myEnd
end
Definition: GNEMeanData.h:144
bool myAggregate
whether the data for all edges shall be aggregated
Definition: GNEMeanData.h:153
bool checkDrawDeleteContour() const
check if draw delete contour (pink/white)
GNEMeanData & operator=(const GNEMeanData &)=delete
Invalidated assignment operator.
bool checkDrawSelectContour() const
check if draw select contour (blue)
std::vector< std::string > myDetectPersons
detect persons
Definition: GNEMeanData.h:168
GNEMeanData(GNENet *net, SumoXMLTag tag, const std::string &id)
Default constructor.
Definition: GNEMeanData.cpp:44
std::vector< std::string > myVTypes
VTypes.
Definition: GNEMeanData.h:177
const Parameterised::Map & getACParametersMap() const
get parameters map
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform data set changes
SUMOTime myPeriod
period
Definition: GNEMeanData.h:138
std::vector< SumoXMLAttr > myWrittenAttributes
bit mask for checking attributes to be written
Definition: GNEMeanData.h:150
std::string myFile
filename
Definition: GNEMeanData.h:135
double getAttributeDouble(SumoXMLAttr key) const
std::string myID
id
Definition: GNEMeanData.h:132
double mySpeedThreshold
speed threshold
Definition: GNEMeanData.h:180
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
std::vector< std::string > myEdges
list of edges
Definition: GNEMeanData.h:156
GNEMeanData(const GNEMeanData &)=delete
Invalidated copy constructor.
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
bool checkDrawFromContour() const
check if draw from contour (green)
void updateGeometry()
update pre-computed geometry information
bool myWithInternal
width internal
Definition: GNEMeanData.h:165
bool myTrackVehicles
Whether vehicles are tracked.
Definition: GNEMeanData.h:147
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
bool checkDrawToContour() const
check if draw from contour (magenta)
std::string getAttribute(SumoXMLAttr key) const
Position getPositionInView() const
Returns element position in view.
bool checkDrawRelatedContour() const
check if draw related contour (cyan)
bool checkDrawMoveContour() const
check if draw move contour (red)
double myMaxTravelTime
max travel time
Definition: GNEMeanData.h:174
~GNEMeanData()
Destructor.
Definition: GNEMeanData.cpp:86
void writeMeanData(OutputDevice &device) const
write meanData element into a xml file
Definition: GNEMeanData.cpp:90
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37