Loading...
Searching...
No Matches
CalculateGrid.h
Go to the documentation of this file.
1
2/*!
3\file terralib/mnt/core/CalculateGrid.h
4
5\brief This file contains a class to calculate retangular grid from Samples.
6Adapted from SPRING
7
8*/
9
10#ifndef __TERRALIB_MNT_INTERNAL_CALCULATEGRID_H
11#define __TERRALIB_MNT_INTERNAL_CALCULATEGRID_H
12
13// Terralib Includes
14#include "Config.h"
15#include "Enums.h"
16
17#include "../../dataaccess/dataset/DataSet.h"
18#include "../../dataaccess/dataset/DataSetType.h"
19#include "../../dataaccess/datasource/DataSource.h"
20
21#include "../../raster/Raster.h"
22#include "../../sam.h"
23
24
27
28//MITASOVA PARAMETERS
29#define mitasovaMINPOINTS 50
30#define mitasovaTENSION 40.
31#define mitasovaSMOOTH 0.100000
32
33namespace te
34{
35 namespace mnt
36 {
37
39 {
40 public:
41 /*! \brief Default constructor. */
43
45
46 /*!
47 \brief Calculate GRID
48 \ return true or false.
49 */
50 bool run();
51
52 /*!
53 \brief It sets the Datasource that is being used to generate TIN.
54 \param inDsrc The datasource being used.
55 \param inDsetName datasource name
56 \param inDsetType input DataSetType
57 \param type Input type: Sample or Isoline
58 */
60 std::string inDsetName,
61 std::unique_ptr<te::da::DataSetType> inDsetType,
62 InputType type);
63
64 /*!
65 \brief It sets the Datasource that is being used to save TIN.
66 */
67 void setOutput(std::map<std::string, std::string> &dsinfo);
68
69 /*!
70 \brief It sets the parameters that is being used to save TIN.
71 \param resx, resy resolution X and Y.
72 \param gt interpolator
73 */
74 void setParams(const std::string &attriso, const std::string &attrpt, double resx, double resy, Interpolator gt, double rad, int pow);
75
76 /*! Function used to set the Spatial Reference System ID */
77 void setSRID(int srid);
78
79 /*! Function used to set the envelope parameter */
81
82 std::unique_ptr<te::rst::Raster> Initialize(bool spline, unsigned int &nro_neighb, double &rx1, double &ry2, unsigned int &outputWidth, unsigned int &outputHeight);
83
84 /*!
85 \brief Interpolates the z value of the pg point3d.
86 \ This method interpolates the z value of the pg point3d using the
87 \ information on the current partition, the dist double vector and
88 \param pg: points to an point3d whose z value must be calculated
89 \param points: vector that contains points from point pg to the partition points
90 \param distq: points to a double vector that contains distance values from point pg to the partition points.
91 */
92 void Interpolation(te::gm::Point& pg, std::vector<te::gm::Point>& points, std::vector<double>& distq);
93
94 /*!
95 \brief Interpolates the z value of the pg point3d using an weighted average by quadrant.
96 \ Implements the interpolator that uses the average, weighted by the inverse
97 \ square distance, of the nearest neighbours by quadrant.*/
98 double Interpwq(te::gm::Point& pg, std::vector<te::gm::Point>& points, std::vector<double>& distq);
99
100 /*!
101 \brief Interpolates the z value of the pg point3d using an weighted average by quadrant and by z values.
102 \ Implements the interpolator tha uses the average, weighted by the inverse
103 \ square distance, of the nearest neighbours by z values and by quadrant.
104 \ This method accepts no repeated z values in the interpolation.*/
105 double Interpwqz(te::gm::Point& pg, std::vector<te::gm::Point>& points, std::vector<double>& distq);
106
107 /*!
108 \brief Method to calculate a grid from a vector of samples using a Spline (GRASS) fitting algorithm
109 \return true when the z grid value is succesfully evaluated
110 \return false when a z grid value could not be evaluated or some error is encountered
111 */
113
114 /*!
115 \brief Method to calculate a grid from a vector of samples using a Spline (Mitasova) fitting algorithm
116 \return true when the z grid value is succesfully evaluated
117 \return false when a z grid value could not be evaluated or some error is encountered
118 */
120
121 double getMin() { return m_min; }
122 double getMax() { return m_max; }
123
124 protected:
125
126 int m_srid; //!< Attribute with spatial reference information
127 te::gm::Envelope m_env; //!< Attribute used to restrict the area to generate the raster.
128
131 std::unique_ptr<te::da::DataSetType> m_inDsetType_sample;
132
135 std::unique_ptr<te::da::DataSetType> m_inDsetType_point;
136
137 std::string m_atrZ_sample; //!< Attribute used to calculate grid
138 std::string m_atrZ_point; //!< Attribute used to calculate grid
139
140 std::map<std::string, std::string> m_dsinfo; //!<
141
142 double m_resx, m_resy; //!< grid resolution in X and Y
143 Interpolator m_inter; //!< selected interpolation method
144 double m_radius; //!< radius
145 int m_power; //!< power
146 int m_tension; //!< the tension spline factor considered in the spline fitting process
147 int m_smoothM; //!< smooth factor used
148
150
151 double m_tolerance; //!< tolerance used to simplify lines
152 double m_nodatavalue; //!< no data value
153
155 std::vector<std::pair<te::gm::Coord2D, te::gm::Point> > m_dataset; //!<
156
157 double m_min, m_max; //!< Output DTM limits
158 }; //class CalculateGrid
159
160 } //mnt
161} //te
162
163#endif
te::sam::kdtree::AdaptativeIndex< KD_ADAPTATIVE_NODE > KD_ADAPTATIVE_TREE
te::sam::kdtree::AdaptativeNode< te::gm::Coord2D, std::vector< te::gm::Point >, te::gm::Point > KD_ADAPTATIVE_NODE
An Envelope defines a 2D rectangular region.
Definition Envelope.h:52
A point with x and y coordinate values.
Definition Point.h:51
te::da::DataSourcePtr m_inDsrc_sample
double Interpwqz(te::gm::Point &pg, std::vector< te::gm::Point > &points, std::vector< double > &distq)
Interpolates the z value of the pg point3d using an weighted average by quadrant and by z values....
int m_smoothM
smooth factor used
Interpolator m_inter
selected interpolation method
std::unique_ptr< te::rst::Raster > Initialize(bool spline, unsigned int &nro_neighb, double &rx1, double &ry2, unsigned int &outputWidth, unsigned int &outputHeight)
double m_nodatavalue
no data value
te::gm::Envelope m_env
Attribute used to restrict the area to generate the raster.
void setInput(te::da::DataSourcePtr inDsrc, std::string inDsetName, std::unique_ptr< te::da::DataSetType > inDsetType, InputType type)
It sets the Datasource that is being used to generate TIN.
std::string m_inDsetName_point
KD_ADAPTATIVE_TREE * m_adaptativeTree
void setSRID(int srid)
std::unique_ptr< te::da::DataSetType > m_inDsetType_sample
int m_tension
the tension spline factor considered in the spline fitting process
bool GenerateGridSplineGrass()
Method to calculate a grid from a vector of samples using a Spline (GRASS) fitting algorithm.
void setParams(const std::string &attriso, const std::string &attrpt, double resx, double resy, Interpolator gt, double rad, int pow)
It sets the parameters that is being used to save TIN.
std::vector< std::pair< te::gm::Coord2D, te::gm::Point > > m_dataset
std::string m_atrZ_point
Attribute used to calculate grid.
void setEnvelope(te::gm::Envelope &env)
std::map< std::string, std::string > m_dsinfo
std::string m_inDsetName_sample
double m_max
Output DTM limits.
void Interpolation(te::gm::Point &pg, std::vector< te::gm::Point > &points, std::vector< double > &distq)
Interpolates the z value of the pg point3d. \ This method interpolates the z value of the pg point3d ...
CalculateGrid()
Default constructor.
te::rst::Raster * m_rst
double Interpwq(te::gm::Point &pg, std::vector< te::gm::Point > &points, std::vector< double > &distq)
Interpolates the z value of the pg point3d using an weighted average by quadrant. \ Implements the in...
int m_srid
Attribute with spatial reference information.
bool GenerateGridSplineMitasova()
Method to calculate a grid from a vector of samples using a Spline (Mitasova) fitting algorithm.
te::da::DataSourcePtr m_inDsrc_point
std::unique_ptr< te::da::DataSetType > m_inDsetType_point
std::string m_atrZ_sample
Attribute used to calculate grid.
double m_tolerance
tolerance used to simplify lines
void setOutput(std::map< std::string, std::string > &dsinfo)
It sets the Datasource that is being used to save TIN.
bool run()
Calculate GRID \ return true or false.
An abstract class for raster data strucutures.
Definition Raster.h:72
A class that represents a two dimensional K-d Tree (2-d Tree) that store data-elements into the leafs...
Definition Index.h:375
A class that represents an Kd-tree node.
Definition Node.h:207
boost::shared_ptr< DataSource > DataSourcePtr
Interpolator
Definition Enums.h:55
InputType
Input types.
Definition Enums.h:49
TerraLib.
#define TEMNTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition Config.h:41
Proxy configuration file for TerraView (see terraview_config.h).
Enumerations of XML module.