WSF
WsfCoverageMeasureLatLonStats.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2020 Infoscitex, a DCS Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef WSFCOVERAGEMEASURELATLONSTATS_HPP
13#define WSFCOVERAGEMEASURELATLONSTATS_HPP
14
15#include "wsf_coverage_export.h"
16
17#include <string>
18#include <vector>
19
20namespace wsf
21{
22namespace coverage
23{
24
25class Coverage;
26class Measure;
27class Point;
28
38class WSF_COVERAGE_EXPORT MeasureLatLonStats
39{
40public:
42 enum class Projection
43 {
44 cLATITUDE,
45 cLONGITUDE
46 };
47
48 MeasureLatLonStats(const Coverage& aCoverage, const Measure& aMeasure, Projection aProjection, double aMinimumBinSize);
49
51 Projection GetProjection() const { return mProjection; }
52
54 std::string GetProjectionDescription() const;
55
57 std::size_t GetSize() const { return mData.size(); }
58
60 double GetVariable(std::size_t aIndex) const { return mData[aIndex].mVariable; }
61
63 double GetMinValue(std::size_t aIndex) const { return mData[aIndex].mMinimum; }
64
66 double GetMaxValue(std::size_t aIndex) const { return mData[aIndex].mMaximum; }
67
69 double GetMeanValue(std::size_t aIndex) const { return mData[aIndex].mMean; }
70
72 int GetCount(std::size_t aIndex) const { return mData[aIndex].mCount; }
73
74private:
75 int BinIndexFromValue(double aValue) const;
76 double BinValueFromIndex(int aIndex) const;
77 static double ProjectLatitude(const Point& aPoint);
78 static double ProjectLongitude(const Point& aPoint);
79
81 using ProjectorFunction = double (*)(const Point&);
82
84 struct BinData
85 {
86 BinData(double aVariable, double aValue)
87 : mVariable{aVariable}
88 , mMinimum{aValue}
89 , mMaximum{aValue}
90 , mMean{aValue}
91 , mCount{1}
92 {
93 }
94
95 void Accumulate(const BinData& aOther);
96 void Finalize();
97
98 double mVariable;
99 double mMinimum;
100 double mMaximum;
101 double mMean;
102 int mCount;
103 };
104
105 Projection mProjection;
106 double mMinimumBinSize;
107 std::vector<BinData> mData{};
108};
109
110} // namespace coverage
111} // namespace wsf
112
113#endif // WSFCOVERAGEMEASURELATLONSTATS_HPP
Definition WsfCoverage.hpp:57
Definition WsfCoverageMeasureLatLonStats.hpp:39
MeasureLatLonStats(const Coverage &aCoverage, const Measure &aMeasure, Projection aProjection, double aMinimumBinSize)
Definition WsfCoverageMeasureLatLonStats.cpp:28
Projection
The projection direction.
Definition WsfCoverageMeasureLatLonStats.hpp:43
std::size_t GetSize() const
Return the number of projected data points.
Definition WsfCoverageMeasureLatLonStats.hpp:57
double GetMeanValue(std::size_t aIndex) const
Return the mean value of the measured quantity for the given index.
Definition WsfCoverageMeasureLatLonStats.hpp:69
Projection GetProjection() const
Return the projection direction.
Definition WsfCoverageMeasureLatLonStats.hpp:51
int GetCount(std::size_t aIndex) const
Return the number of points that contributed to the mean for the given index.
Definition WsfCoverageMeasureLatLonStats.hpp:72
double GetMaxValue(std::size_t aIndex) const
Return the maximum value of the measured quantity for the given index.
Definition WsfCoverageMeasureLatLonStats.hpp:66
double GetMinValue(std::size_t aIndex) const
Return the minimum value of the measured quantity for the given index.
Definition WsfCoverageMeasureLatLonStats.hpp:63
double GetVariable(std::size_t aIndex) const
Return the latitude or longitude for the given index.
Definition WsfCoverageMeasureLatLonStats.hpp:60
Definition WsfCoverageMeasure.hpp:43
A point in a coverage grid.
Definition WsfCoverageGridPoint.hpp:40
Definition WsfCoverage.cpp:35
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Copyrights Multiple, All Rights Reserved