SummaryFunctions.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file SummaryFunctions.h
22 
23  \brief A set of functions to calculate the statistic summary from a set of values.
24  */
25 
26 #ifndef __TERRALIB_STATISTICAL_CORE_INTERNAL_SUMMARYFUNCTIONS_H
27 #define __TERRALIB_STATISTICAL_CORE_INTERNAL_SUMMARYFUNCTIONS_H
28 
29 //Terralib
30 #include "Config.h"
31 #include "Enums.h"
35 
36 // STL
37 #include <map>
38 #include <string>
39 #include <vector>
40 
41 namespace te
42 {
43  namespace da { class DataSource; }
44 
45  namespace stat
46  {
47  /*! Fills the summary statistics structure from a set of categorical values.
48 
49  \param values a vector of categorical values. Do not pass empty.
50  \param ss to return the statistical summary.
51  \param nullVal a value to be considered as non-value or invalid value.
52  */
53  TESTATEXPORT void GetStringStatisticalSummary(std::vector<std::string>& values, te::stat::StringStatisticalSummary& ss, const std::string& nullValue);
54 
55  /*! Fills the summary statistics structure from a set of categorical values.
56 
57  \param values a vector of categorical values. Do not pass empty.
58  \param ss to return the statistical summary.
59  */
61 
62  /*! Fills the summary statistics structure from a set of numerical values.
63 
64  \param values a vector of numerical values. Do not pass empty.
65  \param ss to return the statistical summary.
66  \param nullVal a value to be considered as non-value or invalid value.
67  */
68  TESTATEXPORT void GetNumericStatisticalSummary(std::vector<double>& values, te::stat::NumericStatisticalSummary& ss, double nullValue);
69 
70  /*! Fills the summary statistics structure from a set of numerical values.
71 
72  \param values a vector of numerical values. Do not pass empty.
73  \param ss to return the statistical summary.
74  */
76 
77  /*! Fills the summary statistics structure from a set of numerical values.
78 
79  \param values a map of numerical values as key and number of occurrence as value. Do not pass empty.
80  \param ss to return the statistical summary.
81  */
83 
84  /*! Fills the summary statistics structure from a set of numerical complex values.
85 
86  \param values a vector of numerical values. Do not pass empty.
87  \param ss to return the statistical summary.
88  */
90 
91  /*! Fills the percentage of each class by area.
92 
93  \param values a map of numerical values as key and number of occurrence as value. Do not pass empty.
94  \param resolutionX a raster horizontal (x-axis) resolution.
95  \param resolutionY a raster vertical (y-axis) resolution.
96  \param area area of a geometry that intersects the raster.
97  \param ss to return the percentage of each class by area.
98 
99  */
100  TESTATEXPORT void GetPercentOfEachClassByArea(std::map<double, int>& values,
101  double& resolutionX,
102  double& resolutionY,
103  double& area,
105 
106  /*! Fills the total by class
107 
108  \param values a map of numerical values as key and number of occurrence as value. Do not pass empty.
109  \param resolutionX a raster horizontal (x-axis) resolution.
110  \param resolutionY a raster vertical (y-axis) resolution.
111  \param area area of a geometry that intersects the raster.
112  \param ss to return the totalarea by class.
113 
114  */
115  TESTATEXPORT void GetTotalAreaByClass(std::map<double, int>& values,
116  double& resolutionX,
117  double& resolutionY,
118  double& area,
120 
121  /*! Returns the mode of set of numerical values.
122 
123  \param values a reference to a set of numerical values. Do not pass empty.
124  \param ss to return the mode (most frequent value).
125  */
126  TESTATEXPORT void Mode(const std::vector<double>& values,
128 
129  /*! Returns the mode of set of categorical values.
130 
131  \param values a reference to a set of categorical values;
132  \param ss to return the mode (most frequent value).
133  */
134  TESTATEXPORT void Mode(const std::vector<std::string>& values,
136 
137 
138  /*! Fills the summary statistics structure of a given categorical property from a dataset.
139 
140  \param inDataset a dataset name.
141  \param inDatasource a pointer to a datasource. Do not pass null.
142  \param propName the name of the property to be summarized.
143  \param ss to return the statistical summary.
144  */
145  TESTATEXPORT void GetStringStatisticalSummaryQuery(const std::string& inDataset,
146  te::da::DataSource* inDatasource,
147  const std::string& propName,
149 
150  /*! Fills the summary statistics structure of a given numerical property from a dataset.
151 
152  \param inDataset a dataset name.
153  \param inDatasource a pointer to a datasource. Do not pass null.
154  \param propName the name of the property to be summarized.
155  \param ss to return the statistical summary.
156  */
157  TESTATEXPORT void GetNumericStatisticalSummaryQuery(const std::string& inDataset,
158  te::da::DataSource* inDatasource,
159  const std::string& propName,
161 
162  } // end namespace stat
163 } // end namespace te
164 
165 #endif // __TERRALIB_STATISTICAL_CORE_INTERNAL_SUMMARYFUNCTIONS_H
166 
te
TerraLib.
Definition: AddressGeocodingOp.h:52
TESTATEXPORT
#define TESTATEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
te::stat::GetTotalAreaByClass
TESTATEXPORT void GetTotalAreaByClass(std::map< double, int > &values, double &resolutionX, double &resolutionY, double &area, te::stat::NumericStatisticalSummary &ss)
te::stat::Mode
TESTATEXPORT void Mode(const std::vector< double > &values, te::stat::NumericStatisticalSummary &ss)
NumericStatisticalSummary.h
te::stat::GetNumericComplexStatisticalSummary
TESTATEXPORT void GetNumericComplexStatisticalSummary(std::vector< std::complex< double > > &values, te::stat::NumericStatisticalComplexSummary &ss)
te::stat::GetPercentOfEachClassByArea
TESTATEXPORT void GetPercentOfEachClassByArea(std::map< double, int > &values, double &resolutionX, double &resolutionY, double &area, te::stat::NumericStatisticalSummary &ss)
NumericStatisticalComplexSummary.h
te::stat::GetStringStatisticalSummaryQuery
TESTATEXPORT void GetStringStatisticalSummaryQuery(const std::string &inDataset, te::da::DataSource *inDatasource, const std::string &propName, te::stat::StringStatisticalSummary &ss)
Enums.h
Enumerations of XML module.
te::stat::NumericStatisticalComplexSummary
Definition: NumericStatisticalComplexSummary.h:47
te::stat::GetNumericStatisticalSummaryQuery
TESTATEXPORT void GetNumericStatisticalSummaryQuery(const std::string &inDataset, te::da::DataSource *inDatasource, const std::string &propName, te::stat::NumericStatisticalSummary &ss)
te::stat::NumericStatisticalSummary
A structure to hold the set of statistics from a set of numerical values.
Definition: NumericStatisticalSummary.h:47
te::stat::GetNumericStatisticalSummary
TESTATEXPORT void GetNumericStatisticalSummary(std::vector< double > &values, te::stat::NumericStatisticalSummary &ss, double nullValue)
te::stat::StringStatisticalSummary
A structure to hold the set of statistics from a set of categorical (sample) values.
Definition: StringStatisticalSummary.h:46
te::da::DataSource
An abstract class for data providers like a DBMS, Web Services or a regular file.
Definition: DataSource.h:120
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
te::stat::GetStringStatisticalSummary
TESTATEXPORT void GetStringStatisticalSummary(std::vector< std::string > &values, te::stat::StringStatisticalSummary &ss, const std::string &nullValue)
StringStatisticalSummary.h