Slope.h
Go to the documentation of this file.
1 /*!
2 \file terralib/mnt/core/Slope.h
3 
4 \brief This file contains a class to generate a Slope grid.
5 Adapted from SPRING
6 */
7 
8 #ifndef __TERRALIB_MNT_INTERNAL_SLOPE_H
9 #define __TERRALIB_MNT_INTERNAL_SLOPE_H
10 
11 // Terralib Includes
12 #include "Config.h"
13 #include "Enums.h"
14 #include "Tin.h"
15 
16 
17 #include "../../dataaccess/dataset/DataSet.h"
18 #include "../../dataaccess/dataset/DataSetType.h"
19 #include "../../dataaccess/datasource/DataSource.h"
20 
21 namespace te
22 {
23  namespace mnt
24  {
25  class TEMNTEXPORT Slope : public Tin
26  {
27  public:
28  Slope();
29  ~Slope();
30 
32  std::string inDsetName,
33  std::unique_ptr<te::da::DataSetType> inDsetType);
34 
35  void setOutput(std::map<std::string, std::string> &dsinfo);
36 
37  void setParams(double resx, double resy, char gradtype, char slopetype, int srid, double dummy);
38 
39  bool run();
40 
41  private:
42 
43  /*!
44  \brief Method that calculates a gradient value (slope or aspect) in a given triangle
45  \param nodesid is a pointer to the triangle node identifications
46  \param gradtype is the type of gradient ('s' slope or 'a' aspect)
47  \param slopetype is the type of slope ('g' degree or 'p' percentage)
48  \return the calculated gradient z value
49  */
50  double TriangleGradient(int32_t *nodesid, char gradtype, char slopetype);
51 
52  /*!
53  \brief METHOD TO CALCULATE GRADIENT VECTOR COMPONENTS IN THE POINT L,C OF THE GRID
54  \param raster input grid
55  \param l and c are the line and column of the input grid
56  \param dzdx and dzdy are values of the first derivatives of z in the x and y directions at location l,c
57  \return true when the gradient is evaluated
58  \return false when the gradient could not be evaluated
59  */
60  bool CalcGradientRst(std::unique_ptr<te::rst::Raster> &raster, unsigned l, unsigned c, double& dzdx, double& dzdy);
61 
62  protected:
63 
65  std::string m_inDsetName;
66  std::unique_ptr<te::da::DataSetType> m_inDsetType;
67 
68  std::map<std::string, std::string> m_dsinfo;
69  char m_gradtype, m_slopetype;
70 
71  mntType m_inputType; //!< Input type (TIN, GRID)
72 
73  double m_tol;
74  double m_min, m_max;
75  double m_dx, m_dy;
76  double m_dummy;
77  };
78  }
79 }
80 #endif //__TERRALIB_MNT_INTERNAL_SLOPE_H
This file contains a class to define a TIN. Adapted from SPRING.
bool CalcGradientRst(std::unique_ptr< te::rst::Raster > &raster, unsigned l, unsigned c, double &dzdx, double &dzdy)
METHOD TO CALCULATE GRADIENT VECTOR COMPONENTS IN THE POINT L,C OF THE GRID.
double m_max
Definition: Slope.h:74
double TriangleGradient(int32_t *nodesid, char gradtype, char slopetype)
Method that calculates a gradient value (slope or aspect) in a given triangle.
mntType m_inputType
Input type (TIN, GRID)
Definition: Slope.h:71
std::string m_inDsetName
Definition: Slope.h:65
void setInput(te::da::DataSourcePtr inDsrc, std::string inDsetName, std::unique_ptr< te::da::DataSetType > inDsetType)
std::unique_ptr< te::da::DataSetType > m_inDsetType
Definition: Slope.h:66
void setParams(double resx, double resy, char gradtype, char slopetype, int srid, double dummy)
void setOutput(std::map< std::string, std::string > &dsinfo)
te::da::DataSourcePtr m_inDsrc
Definition: Slope.h:64
double m_tol
Definition: Slope.h:73
char m_gradtype
Definition: Slope.h:69
double m_dummy
Definition: Slope.h:76
std::map< std::string, std::string > m_dsinfo
Definition: Slope.h:68
double m_dx
Definition: Slope.h:75
Class to define TIN strutures.
Definition: Tin.h:277
boost::shared_ptr< DataSource > DataSourcePtr
Definition: DataSource.h:1449
mntType
Definition: Enums.h:79
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.