49 typedef enum SLOPE_TYPE {
59 typedef enum UPDATE_TYPE {
74 DEMObject(
const size_t& ncols_in,
const size_t& nrows_in,
83 const size_t& i_nx,
const size_t& i_ny,
84 const size_t& i_ncols,
const size_t& i_nrows,
92 void update(
const std::string& algorithm);
99 double getHorizon(
const size_t& ix1,
const size_t& iy1,
const double&
bearing)
const;
101 void getHorizon(
const Coords& point,
const double& increment, std::vector< std::pair<double,double> >& horizon)
const;
135 double getTanMaxSlope(
const double& tan_local_slope,
const double& dmax,
const double&
bearing,
const size_t& i,
const size_t& j)
const;
136 void CalculateAziSlopeCurve(
slope_type algorithm);
137 double CalculateAspect(
const double& o_Nx,
const double& o_Ny,
const double& o_Nz,
const double& o_slope,
const double no_slope=
Cst::PI);
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);
143 double getCurvature(
double A[4][4]);
145 double steepestGradient(
double A[4][4]);
146 double lineGradient(
const double& A1,
const double& A2,
const double& A3);
147 double fillMissingGradient(
const double& delta1,
const double& delta2);
148 void surfaceGradient(
double& dx_sum,
double& dy_sum,
double A[4][4]);
149 double avgHeight(
const double& z1,
const double &z2,
const double& z3);
150 void getNeighbours(
const size_t i,
const size_t j,
double A[4][4]);
151 double safeGet(
const int i,
const int j);
153 double max_shade_distance;
156 size_t slope_failures;
157 size_t curvature_failures;
surface normal vector using the two triangle method (Corripio, 2003) and eight-neighbor algorithm (Ho...
Definition: DEMObject.h:54
no updates at all
Definition: DEMObject.h:60
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:194
Simplified, lat/lon only.
Definition: DEMObject.h:69
const DEMObject operator+(const double &rhs) const
Definition: DEMObject.cc:1021
four nearest neighbors (Fleming and Hoffer, 1979). It seems to be the same as (Zevenbergen and Thorne...
Definition: DEMObject.h:51
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:248
DEMObject & operator/=(const double &rhs)
Definition: DEMObject.cc:1105
update the curvatures
Definition: DEMObject.h:63
int getDefaultAlgorithm() const
Get the default slope calculation algorithm.
Definition: DEMObject.cc:289
double min_slope
Definition: DEMObject.h:45
const DEMObject operator*(const double &rhs) const
Definition: DEMObject.cc:1081
maximum downhill slope method (Dunn and Hickey, 1998)
Definition: DEMObject.h:52
bool operator!=(const DEMObject &in) const
Operator that tests for inequality.
Definition: DEMObject.cc:1139
update the slopes
Definition: DEMObject.h:61
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:41
DEMObject & operator+=(const double &rhs)
Definition: DEMObject.cc:1015
slope_type
Keywords for slope computation algorithm.
Definition: DEMObject.h:49
whatever algorithm that has been defined as default
Definition: DEMObject.h:50
double getHorizon(const size_t &ix1, const size_t &iy1, const double &bearing) const
Returns the tangente of the horizon from a given point looking toward a given bearing.
Definition: DEMObject.cc:434
A class to handle geographic coordinate systems. This class offers an easy way to transparently conve...
Definition: Coords.h:81
friend std::iostream & operator>>(std::iostream &is, DEMObject &dem)
Definition: DEMObject.cc:974
FORMATS
Keywords for selecting the toString formats.
Definition: DEMObject.h:67
Array2D< double > slope
Definition: DEMObject.h:41
Array2D< double > Nx
Definition: DEMObject.h:44
double min_altitude
Definition: DEMObject.h:45
const DEMObject operator/(const double &rhs) const
Definition: DEMObject.cc:1111
eight neighbor algorithm (Horn, 1981) as used by ArcGIS. It seems to be the same as (Corripio...
Definition: DEMObject.h:53
discretized azimuth directions (angles for N, NE, etc) and slope rounded to nearest integer ...
Definition: DEMObject.h:55
Array2D< double > Ny
Definition: DEMObject.h:44
void printFailures()
Prints the list of points that have an elevation different than nodata but no slope or curvature Such...
Definition: DEMObject.cc:320
Array2D< double > Nz
Definition: DEMObject.h:44
DEMObject & operator*=(const double &rhs)
Definition: DEMObject.cc:1075
update the normals
Definition: DEMObject.h:62
bool operator==(const DEMObject &in) const
Operator that tests for equality.
Definition: DEMObject.cc:1135
DEMObject & operator-=(const double &rhs)
Definition: DEMObject.cc:1045
A class to represent DEMs and automatically compute some properties. This class stores elevation grid...
Definition: DEMObject.h:39
friend std::iostream & operator<<(std::iostream &os, const DEMObject &dem)
Definition: DEMObject.cc:951
const DEMObject operator-(const double &rhs) const
Definition: DEMObject.cc:1051
void setDefaultAlgorithm(const slope_type &i_algorithm)
Sets the default slope calculation algorithm.
Definition: DEMObject.cc:276
A class to represent 2D Grids. Typical application as DEM or Landuse Model.
Definition: Grid2DObject.h:37
const double PI
Definition: Meteoconst.h:71
double max_curvature
Definition: DEMObject.h:46
update_type
Keywords for automatic update of parameters. They can be combined with "|".
Definition: DEMObject.h:59
double getCellSkyViewFactor(const size_t &ii, const size_t &jj) const
Compute the sky view factors for the terrain radiation based on the DEM. This is based on Manners...
Definition: DEMObject.cc:512
double max_slope
Definition: DEMObject.h:46
const std::string toString() const
Definition: Grid2DObject.cc:430
DEMObject & operator=(const Grid2DObject &)
Assignement operator.
void updateAllMinMax()
Recomputes the min/max of altitude, slope and curvature It return +/- std::numeric_limits<double>\:\:...
Definition: DEMObject.cc:296
Array2D< double > azi
Definition: DEMObject.h:42
double bearing(std::string bearing_str)
Converts a string bearing to a compass bearing.
Definition: IOUtils.cc:70
double min_curvature
Definition: DEMObject.h:45
Grid2DObject getHillshade(const double &elev=38., const double &azimuth=0.) const
Computes the hillshade for the dem This "fake illumination" method is used to better show the relief ...
Definition: DEMObject.cc:398
Array2D< double > curvature
Definition: DEMObject.h:43
double max_altitude
Definition: DEMObject.h:46
void sanitize()
Clean up the DEM Object When computing the slope and curvature, it is possible to get points where th...
Definition: DEMObject.cc:368
Provide all the usually necessary information.
Definition: DEMObject.h:68
int getUpdatePpt() const
Get the properties that will be calculated by the object when updating.
Definition: DEMObject.cc:202