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 
31  void setInput(te::da::DataSourcePtr inDsrc,
32  std::string inDsetName,
33  std::auto_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::auto_ptr<te::rst::Raster> &raster, unsigned l, unsigned c, double& dzdx, double& dzdy);
61 
62  protected:
63 
65  std::string m_inDsetName;
66  std::auto_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
std::auto_ptr< te::da::DataSetType > m_inDsetType
Definition: Slope.h:66
double m_dy
Definition: Slope.h:75
boost::shared_ptr< DataSource > DataSourcePtr
Definition: DataSource.h:1438
#define TEMNTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:41
te::da::DataSourcePtr m_inDsrc
Definition: Slope.h:64
char m_slopetype
Definition: Slope.h:69
double m_dummy
Definition: Slope.h:76
double m_tol
Definition: Slope.h:73
std::map< std::string, std::string > m_dsinfo
Definition: Slope.h:68
mntType
Definition: Enums.h:78
URI C++ Library.
Class to define TIN strutures.
Definition: Tin.h:276
mntType m_inputType
Input type (TIN, GRID)
Definition: Slope.h:71
double m_min
Definition: Slope.h:74
This file contains a class to define a TIN. Adapted from SPRING.
std::string m_inDsetName
Definition: Slope.h:65
General enumerations.