-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathAnalysis.h
More file actions
163 lines (140 loc) · 5.97 KB
/
Analysis.h
File metadata and controls
163 lines (140 loc) · 5.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/**
* \file Analysis.h
* \date Oct 10, 2014
* \version v0.7
* \copyright <2009-2015> Forschungszentrum Jülich GmbH. All rights reserved.
*
* \section License
* This file is part of JuPedSim.
*
* JuPedSim is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* JuPedSim is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with JuPedSim. If not, see <http://www.gnu.org/licenses/>.
*
* \section Description
* The Analysis class represents a process of analyzing groups of pedestrian
* trajectories from experiment or simulation. Different measurement methods
* can be used and are defined by various parameters and functions.
*
*
**/
#ifndef ANALYSIS_H_
#define ANALYSIS_H_
#include "general/ArgumentParser.h"
#include "tinyxml/tinyxml.h"
#include "geometry/Building.h"
#include "IO/OutputHandler.h"
#include "general/Macros.h"
#include "methods/PedData.h"
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/adapted/c_array.hpp>
#include <boost/geometry/geometries/ring.hpp>
using namespace boost::geometry;
typedef model::d2::point_xy<double, cs::cartesian> point_2d;
typedef model::polygon<point_2d> polygon_2d;
typedef model::ring<point_2d> ring;
typedef std::vector<polygon_2d > polygon_list;
typedef boost::geometry::model::segment<boost::geometry::model::d2::point_xy<double> > segment;
#include <map>
#include <vector>
extern OutputHandler* Log;
class Analysis
{
public:
Analysis();
virtual ~Analysis();
void InitArgs(ArgumentParser *args);
std::map<int, polygon_2d> ReadGeometry(const fs::path& geometryFile, const std::vector<MeasurementArea_B*>& areas);
/**
* Run the analysis for different files.
* @param file
* @param path
* @return
*/
int RunAnalysis(const fs::path& file, const fs::path& path);
/**
* return the base name from the string.
* // file.txt ---> file
* @param str
*/
std::string GetBasename(const std::string& str);
/**
* extract the filename from the path
* // c:\\windows\\winhelp.exe ---> winhelp.exe
* @param str
*/
std::string GetFilename(const std::string& str);
/**
* create a file and the directory structure if needed.
* @param filename
* @return
*/
static FILE* CreateFile(const std::string& filename);
private:
Building* _building;
//polygon_2d _geoPoly;
std::map<int, polygon_2d> _geoPolyMethodD;
std::map<int, polygon_2d> _geoPolyMethodI;
double _grid_size_X; // the size of the grid
double _grid_size_Y;
double _lowVertexX; // LOWest vertex of the geometry (x coordinate)
double _lowVertexY; // LOWest vertex of the geometry (y coordinate)
double _highVertexX; // Highest vertex of the geometry
double _highVertexY;
int _deltaF; // half of the time interval that used to calculate instantaneous velocity of ped i.
std::vector<int> _deltaT; // the time interval to calculate the classic flow
bool _DoesUseMethodA; // Method A (Zhang2011a)
bool _DoesUseMethodB; // Method B (Zhang2011a)
bool _DoesUseMethodC; // Method C //calculate and save results of classic in separate file
bool _DoesUseMethodD; // Method D--Voronoi method
bool _DoesUseMethodI; // Method I--Voronoi method modified
// no measurement are)
std::vector<int> _StartFramesMethodD;
std::vector<int> _StopFramesMethodD;
std::vector<int> _StartFramesMethodI;
std::vector<int> _StopFramesMethodI;
std::vector<bool> _IndividualFDFlags;
bool _cutByCircle; //Adjust whether cut each original voronoi cell by a circle
double _cutRadius;
int _circleEdges;
bool _getProfile; // Whether make field analysis or not
bool _outputGraph; // Whether output the data for plot the voronoi diagram each frame
bool _plotGraph; // Whether plot the voronoi diagram each
// frame. if (outputGraph==true)
bool _plotIndex; // Whether plot the voronoi diagram each
// frame with index of pedesrians
// if (outputGraph==true and _polotGraph==true)
std::vector<bool> _plotTimeseriesA;
std::vector<bool> _plotTimeseriesC;
std::vector<bool> _plotTimeseriesD;
std::vector<bool> _plotTimeseriesI;
bool _isOneDimensional;
bool _calcIndividualFD; //Adjust whether analyze the individual density and velocity of each pedestrian in stationary state (ALWAYS VORONOI-BASED)
std::string _vComponent; // to mark whether x, y or x and y coordinate are used when calculating the velocity
bool _IgnoreBackwardMovement;
fs::path _projectRootDir;
fs::path _scriptsLocation;
fs::path _outputLocation;
fs::path _geometryFileName;
FileFormat _trajFormat; // format of the trajectory file
std::vector<MeasurementArea_L*> _areaForMethod_A;
std::vector<MeasurementArea_B*> _areaForMethod_B;
std::vector<MeasurementArea_B*> _areaForMethod_C;
std::vector<MeasurementArea_B*> _areaForMethod_D;
std::vector<MeasurementArea_B*> _areaForMethod_I; // we still need to know
// the zpos of the
// measurement are, even
// if we don't use its polygon
};
#endif /*ANALYSIS_H_*/