29 #include "../../common/STLUtils.h"
30 #include "../../dataaccess/dataset/DataSet.h"
31 #include "../../geometry/Geometry.h"
32 #include "../../geometry/Coord2D.h"
47 boost::numeric::ublas::matrix<double> matrix(geoData.size(), geoData.size());
50 for(std::size_t i = 0; i < geoData.size(); ++i)
59 for(std::size_t j = i + 1; j < geoData.size(); ++j)
66 double distance = sqrt(pow((coordI.
x - coordJ.
x), 2) + pow((coordI.
y - coordJ.
y), 2));
68 matrix(i, j) = distance;
71 double angle = -( atan ((coordI.
y - coordJ.
y)/(coordI.
x - coordJ.
x)) * (180/3.14) ) + 90.0;
105 double sumSquare = 0.;
107 for(std::size_t t = 0; t < matrix.size1(); ++t)
110 sumSquare += pow(matrix(t,t), 2);
113 mean = sum / (double)matrix.size1();
114 variance = (sumSquare / (double)matrix.size1()) - pow(mean, 2);
132 geoData.push_back(item);
TESAEXPORT te::gm::Coord2D GetCentroidCoord(te::gm::Geometry *geom)
Function used to get centroid coord of a geometry.
An utility struct for representing 2D coordinates.
Utilitary function for spatial analysis module.
TESAEXPORT void SetMainDiagonal(boost::numeric::ublas::matrix< double > &matrix, te::da::DataSet *dataSet, int attrIdx)
Function used to set new values in the matrix main diagonal.
std::vector< te::sa::GeostatisticalDataItem * > GeostatisticalData
TESAEXPORT boost::numeric::ublas::matrix< double > CreateMatrixFromDataSet(te::da::DataSet *dataSet, int attrIdx, int geomIdx)
Function used to create a matrix with values, distance and angle for each element from dataset...
TESAEXPORT void CalculateMoments(const boost::numeric::ublas::matrix< double > &matrix, double &mean, double &variance)
Function used to calculate mean and variance from a matrix.
virtual bool moveNext()=0
It moves the internal pointer to the next item of the collection.
Auxiliary functions used to calculate the geostatistical methods.
virtual std::auto_ptr< te::gm::Geometry > getGeometry(std::size_t i) const =0
Method for retrieving a geometric attribute value.
A dataset is the unit of information manipulated by the data access module of TerraLib.
#define TESAEXPORT
You can use this macro in order to export/import classes and functions from this module.
virtual bool moveBeforeFirst()=0
It moves the internal pointer to a position before the first item in the collection.
te::gm::Geometry * m_geom
TESAEXPORT double GetDataValue(te::dt::AbstractData *ad)
Function used to get the numeric value from a gpm property.
TESAEXPORT te::sa::GeostatisticalData CreateGeostatisticalData(te::da::DataSet *dataSet, int attrIdx, int geomIdx)
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map...
virtual std::auto_ptr< te::dt::AbstractData > getValue(std::size_t i) const
Method for retrieving any other type of data value stored in the data source.