50 typedef enum SLOPE_TYPE {
60 typedef enum UPDATE_TYPE {
76 DEMObject(
const size_t& ncols_in,
const size_t& nrows_in,
const Coords& llcorner_in,
const double& init);
78 DEMObject(
const size_t& ncols_in,
const size_t& nrows_in,
87 const size_t& i_nx,
const size_t& i_ny,
88 const size_t& i_ncols,
const size_t& i_nrows,
98 void update(
const std::string& algorithm);
135 void CalculateAziSlopeCurve(
slope_type algorithm);
136 static double CalculateAzimuth(
const double& o_Nx,
const double& o_Ny,
const double& o_Nz,
const double& o_slope,
const double& no_slope=0.);
137 double getCurvature(
double A[4][4],
const double& scale=
IOUtils::nodata);
138 void CalculateHick(
double A[4][4],
double& o_slope,
double& o_Nx,
double& o_Ny,
double& o_Nz);
139 void CalculateFleming(
double A[4][4],
double& o_slope,
double& o_Nx,
double& o_Ny,
double& o_Nz);
140 void CalculateHorn(
double A[4][4],
double& o_slope,
double& o_Nx,
double& o_Ny,
double& o_Nz);
141 void CalculateCorripio(
double A[4][4],
double& o_slope,
double& o_Nx,
double& o_Ny,
double& o_Nz);
142 void (
DEMObject::*CalculateSlope)(
double A[4][4],
double& o_slope,
double& o_Nx,
double& o_Ny,
double& o_Nz);
144 static double steepestGradient(
const double& i_cellsize,
double A[4][4]);
145 static double lineGradient(
const double& A1,
const double& A2,
const double& A3);
146 static double fillMissingGradient(
const double& delta1,
const double& delta2);
147 static void surfaceGradient(
double& dx_sum,
double& dy_sum,
double A[4][4]);
148 static double avgHeight(
const double& z1,
const double &z2,
const double& z3);
149 void getNeighbours(
const size_t& i,
const size_t& j,
double A[4][4],
const double& scale=
IOUtils::nodata)
const;
150 double safeGet(
const int& i,
const int& j)
const;
152 double max_shade_distance;
153 double curvature_scale;
156 size_t slope_failures;
157 size_t curvature_failures;
A class to handle geographic coordinate systems. This class offers an easy way to transparently conve...
Definition: Coords.h:83
A class to represent DEMs and automatically compute some properties. This class stores elevation grid...
Definition: DEMObject.h:40
DEMObject & operator-=(const double &rhs)
Definition: DEMObject.cc:960
DEMObject & operator*=(const double &rhs)
Definition: DEMObject.cc:990
DEMObject & operator/=(const double &rhs)
Definition: DEMObject.cc:1020
double min_curvature
Definition: DEMObject.h:46
int getDefaultAlgorithm() const
Get the default slope calculation algorithm.
Definition: DEMObject.cc:340
FORMATS
Keywords for selecting the toString formats.
Definition: DEMObject.h:69
@ SHORT
Simplified, lat/lon only.
Definition: DEMObject.h:71
@ FULL
Provide all the usually necessary information.
Definition: DEMObject.h:70
void updateAllMinMax()
Recomputes the min/max of altitude, slope and curvature It returns +/- std::numeric_limits<double> ::...
Definition: DEMObject.cc:348
Array2D< double > Nz
Definition: DEMObject.h:45
slope_type
Keywords for slope computation algorithm.
Definition: DEMObject.h:50
@ HORN
eight neighbor algorithm (Horn, 1981) as used by ArcGIS. It seems to be the same as (Corripio,...
Definition: DEMObject.h:54
@ DFLT
whatever algorithm that has been defined as default
Definition: DEMObject.h:51
@ FLEM
four nearest neighbors (Fleming and Hoffer, 1979). It seems to be the same as (Zevenbergen and Thorne...
Definition: DEMObject.h:52
@ D8
discretized azimuth directions (angles for N, NE, etc) and slope rounded to nearest integer
Definition: DEMObject.h:56
@ HICK
maximum downhill slope method (Dunn and Hickey, 1998)
Definition: DEMObject.h:53
@ CORR
surface normal vector using the two triangle method (Corripio, 2003) and eight-neighbor algorithm (Ho...
Definition: DEMObject.h:55
void setCurvatureScale(const double &in_curvature_scale)
Set the curvature length scale for calculating curvature.
Definition: DEMObject.cc:229
void update(const std::string &algorithm)
Force the computation of the local slope, azimuth, normal vector and curvature. It has to be called m...
Definition: DEMObject.cc:275
const DEMObject operator+(const double &rhs) const
Definition: DEMObject.cc:936
bool operator==(const DEMObject &in) const
Operator that tests for equality.
Definition: DEMObject.cc:1050
double max_curvature
Definition: DEMObject.h:47
Array2D< double > Nx
Definition: DEMObject.h:45
double max_slope
Definition: DEMObject.h:47
friend std::istream & operator>>(std::istream &is, DEMObject &dem)
Definition: DEMObject.cc:888
void printFailures()
Prints the list of points that have an elevation different than nodata but no slope or curvature Such...
Definition: DEMObject.cc:368
DEMObject & operator+=(const double &rhs)
Definition: DEMObject.cc:930
Array2D< double > Ny
Definition: DEMObject.h:45
Array2D< double > curvature
Definition: DEMObject.h:44
DEMObject & operator=(const Grid2DObject &)
Assignement operator.
const DEMObject operator/(const double &rhs) const
Definition: DEMObject.cc:1026
const DEMObject operator-(const double &rhs) const
Definition: DEMObject.cc:966
void sanitize()
Clean up the DEM Object When computing the slope and curvature, it is possible to get points where th...
Definition: DEMObject.cc:419
int getUpdatePpt() const
Get the properties that will be calculated by the object when updating.
Definition: DEMObject.cc:222
const DEMObject operator*(const double &rhs) const
Definition: DEMObject.cc:996
update_type
Keywords for automatic update of parameters. They can be combined with "|".
Definition: DEMObject.h:60
@ SLOPE
update the slopes
Definition: DEMObject.h:62
@ UPDATE_UNSET
property not set
Definition: DEMObject.h:65
@ NO_UPDATE
no updates at all
Definition: DEMObject.h:61
@ NORMAL
update the normals
Definition: DEMObject.h:63
@ CURVATURE
update the curvatures
Definition: DEMObject.h:64
bool operator!=(const DEMObject &in) const
Operator that tests for inequality.
Definition: DEMObject.cc:1054
DEMObject(const slope_type &i_algorithm=DFLT)
Default constructor. Initializes all variables to 0, except lat/long which are initialized to IOUtils...
Definition: DEMObject.cc:42
void setDefaultAlgorithm(const std::string &i_algorithm)
Sets the default slope calculation algorithm.
Definition: DEMObject.cc:303
Array2D< double > slope
Definition: DEMObject.h:42
double min_altitude
Definition: DEMObject.h:46
double max_altitude
Definition: DEMObject.h:47
double min_slope
Definition: DEMObject.h:46
void setUpdatePpt(const update_type &in_update_flag)
Set the properties that will be calculated by the object when updating The following properties can b...
Definition: DEMObject.cc:214
friend std::ostream & operator<<(std::ostream &os, const DEMObject &dem)
Definition: DEMObject.cc:864
Array2D< double > azi
Definition: DEMObject.h:43
A class to represent 2D Grids. Typical application as DEM or Landuse Model.
Definition: Grid2DObject.h:42
const std::string toString() const
Definition: Grid2DObject.cc:583
const double nodata
This is the internal nodata value.
Definition: IOUtils.h:75