WSL/SLF GitLab Repository

Commit f3402ce6 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

First batch of fixes for issue 68 (variable names starting with "_" invalid...

First batch of fixes for issue 68 (variable names starting with "_" invalid for some versions of Visual C++)
parent 8d06097a
......@@ -65,7 +65,7 @@ class A3DIO : public IOInterface {
void read2DStations(const Date& timestamp, std::vector<StationData>& vecStation);
void read2DMeteo(std::vector< std::vector<MeteoData> >&);
void constructMeteo2DFilenames(const Date& _startDate, const Date& _endDate, std::vector<std::string>& _filenames);
void constructMeteo2DFilenames(const Date& i_startDate, const Date& i_endDate, std::vector<std::string>& i_filenames);
bool readMeteoDataLine(std::string& line, MeteoData& tmpdata, std::string filename);
void convertUnits(MeteoData& meteo);
void cleanup() throw();
......
......@@ -46,7 +46,7 @@ template <class T> class Array2DProxy {
}
private:
Array2DProxy(Array2D<T>& _array2D, const unsigned int& _anx) : array2D(_array2D), anx(_anx){}
Array2DProxy(Array2D<T>& i_array2D, const unsigned int& i_anx) : array2D(i_array2D), anx(i_anx){}
Array2D<T>& array2D;
const unsigned int anx;
};
......@@ -80,29 +80,29 @@ template<class T> class Array2D {
/**
* A constructor that can be used to create an Array2D object that is contained in the
* one passed as _array2D argument. The resulting Array2D object is a by value copy of
* a subplane of the plane spanned by the _array2D
* @param _array2D array containing to extract the values from
* @param _nx lower left corner cell X index
* @param _ny lower left corner cell Y index
* @param _ncols number of columns of the new array
* @param _nrows number of rows of the new array
* one passed as i_array2D argument. The resulting Array2D object is a by value copy of
* a subplane of the plane spanned by the i_array2D
* @param i_array2D array containing to extract the values from
* @param i_nx lower left corner cell X index
* @param i_ny lower left corner cell Y index
* @param i_ncols number of columns of the new array
* @param i_nrows number of rows of the new array
*/
Array2D(const Array2D<T>& _array2D, const unsigned int& _nx, const unsigned int& _ny,
const unsigned int& _ncols, const unsigned int& _nrows);
Array2D(const Array2D<T>& i_array2D, const unsigned int& i_nx, const unsigned int& i_ny,
const unsigned int& i_ncols, const unsigned int& i_nrows);
/**
* @brief A method that can be used to cut out a subplane of an existing Array2D object
* that is passed as _array2D argument. The resulting Array2D object is a by value copy of
* a subplane of the plane spanned by the _array2D
* @param _array2D array containing to extract the values from
* @param _nx lower left corner cell X index
* @param _ny lower left corner cell Y index
* @param _ncols number of columns of the new array
* @param _nrows number of rows of the new array
* that is passed as i_array2D argument. The resulting Array2D object is a by value copy of
* a subplane of the plane spanned by the i_array2D
* @param i_array2D array containing to extract the values from
* @param i_nx lower left corner cell X index
* @param i_ny lower left corner cell Y index
* @param i_ncols number of columns of the new array
* @param i_nrows number of rows of the new array
*/
void subset(const Array2D<T>& _array2D, const unsigned int& _nx, const unsigned int& _ny,
const unsigned int& _ncols, const unsigned int& _nrows);
void subset(const Array2D<T>& i_array2D, const unsigned int& i_nx, const unsigned int& i_ny,
const unsigned int& i_ncols, const unsigned int& i_nrows);
void resize(const unsigned int& nx, const unsigned int& ny);
void resize(const unsigned int& nx, const unsigned int& ny, const T& init);
......@@ -202,27 +202,27 @@ template<class T> Array2D<T>::Array2D() {
nx = ny = 0;
}
template<class T> Array2D<T>::Array2D(const Array2D<T>& _array2D, const unsigned int& _nx, const unsigned int& _ny,
const unsigned int& _ncols, const unsigned int& _nrows)
template<class T> Array2D<T>::Array2D(const Array2D<T>& i_array2D, const unsigned int& i_nx, const unsigned int& i_ny,
const unsigned int& i_ncols, const unsigned int& i_nrows)
{
subset(_array2D, _nx, _ny, _ncols, _nrows);
subset(i_array2D, i_nx, i_ny, i_ncols, i_nrows);
}
template<class T> void Array2D<T>::subset(const Array2D<T>& _array2D, const unsigned int& _nx, const unsigned int& _ny,
const unsigned int& _ncols, const unsigned int& _nrows)
template<class T> void Array2D<T>::subset(const Array2D<T>& i_array2D, const unsigned int& i_nx, const unsigned int& i_ny,
const unsigned int& i_ncols, const unsigned int& i_nrows)
{
if (((_nx+_ncols) > _array2D.nx) || ((_ny+_nrows) > _array2D.ny))
if (((i_nx+i_ncols) > i_array2D.nx) || ((i_ny+i_nrows) > i_array2D.ny))
throw IndexOutOfBoundsException("Trying to cut an array to a size bigger than its original size!", AT);
if ((_ncols == 0) || (_nrows == 0)) //the plane to copy has to make sense
if ((i_ncols == 0) || (i_nrows == 0)) //the plane to copy has to make sense
throw IndexOutOfBoundsException("Copying an array into a null sized array!", AT);
resize(_ncols, _nrows); //create new Array2D object
resize(i_ncols, i_nrows); //create new Array2D object
//Copy by value subspace
for (unsigned int jj=0; jj<ny; jj++) {
for (unsigned int ii=0; ii<nx; ii++) {
operator()(ii,jj) = _array2D(_nx+ii, _ny+jj);
operator()(ii,jj) = i_array2D(i_nx+ii, i_ny+jj);
}
}
}
......
......@@ -42,12 +42,12 @@ template <class T> class Array3DProxy2;
template <class T> class Array3DProxy {
public:
friend class Array3D<T>;
Array3DProxy2<T> operator[](const unsigned int& _any) {
return Array3DProxy2<T>(array3D, anx, _any);
Array3DProxy2<T> operator[](const unsigned int& i_any) {
return Array3DProxy2<T>(array3D, anx, i_any);
}
private:
Array3DProxy(Array3D<T>& _array3D, const unsigned int& _anx) : array3D(_array3D), anx(_anx){}
Array3DProxy(Array3D<T>& i_array3D, const unsigned int& i_anx) : array3D(i_array3D), anx(i_anx){}
Array3D<T>& array3D;
const unsigned int anx;
};
......@@ -62,13 +62,13 @@ template <class T> class Array3DProxy {
template <class T> class Array3DProxy2 {
public:
friend class Array3DProxy<T>;
T& operator[](const unsigned int& _anz) {
return array3D(anx, any, _anz);
T& operator[](const unsigned int& i_anz) {
return array3D(anx, any, i_anz);
}
private:
Array3DProxy2(Array3D<T>& _array3D, const unsigned int& _anx,
const unsigned int& _any) : array3D(_array3D), anx(_anx), any(_any){}
Array3DProxy2(Array3D<T>& i_array3D, const unsigned int& i_anx,
const unsigned int& i_any) : array3D(i_array3D), anx(i_anx), any(i_any){}
Array3D<T>& array3D;
const unsigned int anx;
const unsigned int any;
......@@ -89,19 +89,19 @@ template<class T> class Array3D {
/**
* A constructor that can be used to create an Array3D object that is contained in the
* one passed as _array3D argument. The resulting Array3D object is a by value copy of
* a subvolume of the volume spanned by the _array3D
* @param _array3D array containing to extract the values from
* @param _nx lower left corner cell X index
* @param _ny lower left corner cell Y index
* @param _nz lower left corner cell Z index
* @param _ncols number of columns of the new array
* @param _nrows number of rows of the new array
* @param _ndepth number of depths of the new array
* one passed as i_array3D argument. The resulting Array3D object is a by value copy of
* a subvolume of the volume spanned by the i_array3D
* @param i_array3D array containing to extract the values from
* @param i_nx lower left corner cell X index
* @param i_ny lower left corner cell Y index
* @param i_nz lower left corner cell Z index
* @param i_ncols number of columns of the new array
* @param i_nrows number of rows of the new array
* @param i_ndepth number of depths of the new array
*/
Array3D(const Array3D<T>& _array3D,
const unsigned int& _nx, const unsigned int& _ny, const unsigned int& _nz,
const unsigned int& _ncols, const unsigned int& _nrows, const unsigned int& _ndepth);
Array3D(const Array3D<T>& i_array3D,
const unsigned int& i_nx, const unsigned int& i_ny, const unsigned int& i_nz,
const unsigned int& i_ncols, const unsigned int& i_nrows, const unsigned int& i_ndepth);
/**
* A constructor that creates an array of a given size
......@@ -122,19 +122,19 @@ template<class T> class Array3D {
/**
* A method that can be used to create an Array3D object that is contained in the
* one passed as _array3D argument. The resulting Array3D object is a by value copy of
* a subvolume of the volume spanned by the _array3D
* @param _array3D array containing to extract the values from
* @param _nx lower left corner cell X index
* @param _ny lower left corner cell Y index
* @param _nz lower left corner cell Z index
* @param _ncols number of columns of the new array
* @param _nrows number of rows of the new array
* @param _ndepth number of depths of the new array
* one passed as i_array3D argument. The resulting Array3D object is a by value copy of
* a subvolume of the volume spanned by the i_array3D
* @param i_array3D array containing to extract the values from
* @param i_nx lower left corner cell X index
* @param i_ny lower left corner cell Y index
* @param i_nz lower left corner cell Z index
* @param i_ncols number of columns of the new array
* @param i_nrows number of rows of the new array
* @param i_ndepth number of depths of the new array
*/
void subset(const Array3D<T>& _array3D,
const unsigned int& _nx, const unsigned int& _ny, const unsigned int& _nz,
const unsigned int& _ncols, const unsigned int& _nrows, const unsigned int& _ndepth);
void subset(const Array3D<T>& i_array3D,
const unsigned int& i_nx, const unsigned int& i_ny, const unsigned int& i_nz,
const unsigned int& i_ncols, const unsigned int& i_nrows, const unsigned int& i_ndepth);
void resize(const unsigned int& anx, const unsigned int& any, const unsigned int& anz);
void resize(const unsigned int& anx, const unsigned int& any, const unsigned int& anz, const T& init);
......@@ -239,32 +239,32 @@ template<class T> Array3D<T>::Array3D() {
nx = ny = nz = nxny = 0;
}
template<class T> Array3D<T>::Array3D(const Array3D<T>& _array3D,
const unsigned int& _nx, const unsigned int& _ny, const unsigned int& _nz,
const unsigned int& _ncols, const unsigned int& _nrows, const unsigned int& _ndepth)
template<class T> Array3D<T>::Array3D(const Array3D<T>& i_array3D,
const unsigned int& i_nx, const unsigned int& i_ny, const unsigned int& i_nz,
const unsigned int& i_ncols, const unsigned int& i_nrows, const unsigned int& i_ndepth)
{
subset(_array3D, _nx, _ny, _nz, _ncols, _nrows, _ndepth);
subset(i_array3D, i_nx, i_ny, i_nz, i_ncols, i_nrows, i_ndepth);
}
template<class T> void Array3D<T>::subset(const Array3D<T>& _array3D,
const unsigned int& _nx, const unsigned int& _ny, const unsigned int& _nz,
const unsigned int& _ncols, const unsigned int& _nrows, const unsigned int& _ndepth)
template<class T> void Array3D<T>::subset(const Array3D<T>& i_array3D,
const unsigned int& i_nx, const unsigned int& i_ny, const unsigned int& i_nz,
const unsigned int& i_ncols, const unsigned int& i_nrows, const unsigned int& i_ndepth)
{
if (((_nx+_ncols) > _array3D.nx) || ((_ny+_nrows) > _array3D.ny) || ((_nz+_ndepth) > _array3D.nz))
if (((i_nx+i_ncols) > i_array3D.nx) || ((i_ny+i_nrows) > i_array3D.ny) || ((i_nz+i_ndepth) > i_array3D.nz))
throw IndexOutOfBoundsException("", AT);
if ((_ncols == 0) || (_nrows == 0) || (_ndepth == 0)) //the space has to make sense
if ((i_ncols == 0) || (i_nrows == 0) || (i_ndepth == 0)) //the space has to make sense
throw IndexOutOfBoundsException("", AT);
resize(_ncols, _nrows, _ndepth); //create new Array3D object
resize(i_ncols, i_nrows, i_ndepth); //create new Array3D object
//Copy by value subspace
for (unsigned int ii=0; ii<nz; ii++) {
for (unsigned int jj=0; jj<ny; jj++) {
for (unsigned int kk=0; kk<nx; kk++) {
//Running through the vector in order of memory alignment
operator()(kk,jj,ii) = _array3D(_nx+kk, _ny+jj, _nz+ii);
operator()(kk,jj,ii) = i_array3D(i_nx+kk, i_ny+jj, i_nz+ii);
}
}
}
......
......@@ -177,15 +177,15 @@ unsigned int Config::findKeys(std::vector<std::string>& vecResult, std::string k
IOUtils::toUpper(section);
IOUtils::toUpper(keystart);
string _keystart = section + "::" + keystart;
string tmp_keystart = section + "::" + keystart;
//Loop through keys, look for substring match - push it into vecResult
map<string,string>::const_iterator it;
for (it=properties.begin(); it != properties.end(); it++){
string tmp = (*it).first;
tmp = tmp.substr(0, _keystart.length());
tmp = tmp.substr(0, tmp_keystart.length());
int matchcount = _keystart.compare(tmp);
int matchcount = tmp_keystart.compare(tmp);
if (matchcount == 0){ //perfect match
string tmp2 = it->first;
......
......@@ -232,11 +232,11 @@ class Config {
const Options& opt=Config::dothrow) const
{
try {
std::string _key(key);
std::string _section(section);
IOUtils::toUpper(_key);
IOUtils::toUpper(_section);
IOUtils::getValueForKey<T>(properties, _section + "::" + _key, t);
std::string tmp_key(key);
std::string tmp_section(section);
IOUtils::toUpper(tmp_key);
IOUtils::toUpper(tmp_section);
IOUtils::getValueForKey<T>(properties, tmp_section + "::" + tmp_key, t);
} catch(std::exception& e){
if (opt != Config::nothrow) {
std::stringstream ss;
......
......@@ -585,9 +585,9 @@ bool Coords::isSameProj(const Coords& target) const {
/**
* @brief Copy the projection parameters of another Coords object
* @param source source object to copy the projection from
* @param _update should the necessary coordinates be updated? (default=true)
* @param i_update should the necessary coordinates be updated? (default=true)
*/
void Coords::copyProj(const Coords& source, const bool _update) {
void Coords::copyProj(const Coords& source, const bool i_update) {
if(!isSameProj(source)) {
//we only do a copy if we are not already using the same projection
if(source.coordsystem=="LOCAL") {
......@@ -601,7 +601,7 @@ void Coords::copyProj(const Coords& source, const bool _update) {
}
setFunctionPointers();
if(_update==true) {
if(i_update==true) {
if((latitude!=IOUtils::nodata) && (longitude!=IOUtils::nodata)) {
convert_from_WGS84(latitude, longitude, easting, northing);
} else {
......@@ -880,50 +880,50 @@ void Coords::CH1903_to_WGS84(double east_in, double north_in, double& lat_out, d
*/
}
int Coords::getUTMZone(const double _latitude, const double _longitude, std::string& zone_out) const
int Coords::getUTMZone(const double i_latitude, const double i_longitude, std::string& zone_out) const
{//This routine determines the correct UTM letter designator for the given latitude
//UTM limits its coverage to [80S , 84N], outside of this, returns Y/Z/A/B for the zone
//computing zone number, assuming longitude in [-180. ; 180[
int ZoneNumber = int((_longitude + 180.)/6.) + 1;
int ZoneNumber = int((i_longitude + 180.)/6.) + 1;
// Special zones for Scandinavia
if( _latitude >= 72.0 && _latitude < 84.0 ) {
if( _longitude >= 0.0 && _longitude < 9.0 ) ZoneNumber = 31;
else if( _longitude >= 9.0 && _longitude < 21.0 ) ZoneNumber = 33;
else if( _longitude >= 21.0 && _longitude < 33.0 ) ZoneNumber = 35;
else if( _longitude >= 33.0 && _longitude < 42.0 ) ZoneNumber = 37;
if( i_latitude >= 72.0 && i_latitude < 84.0 ) {
if( i_longitude >= 0.0 && i_longitude < 9.0 ) ZoneNumber = 31;
else if( i_longitude >= 9.0 && i_longitude < 21.0 ) ZoneNumber = 33;
else if( i_longitude >= 21.0 && i_longitude < 33.0 ) ZoneNumber = 35;
else if( i_longitude >= 33.0 && i_longitude < 42.0 ) ZoneNumber = 37;
}
if( latitude >= 56.0 && _latitude < 64.0 && _longitude >= 3.0 && _longitude < 12.0 ) {
if( latitude >= 56.0 && i_latitude < 64.0 && i_longitude >= 3.0 && i_longitude < 12.0 ) {
ZoneNumber = 32;
}
//getting zone letter
char zoneLetter='Z';
if ((0 >= _longitude) && (_latitude > 84)) zoneLetter = 'Y';
else if((0 < _longitude) && (_latitude > 84)) zoneLetter = 'Z';
else if((84 >= _latitude) && (_latitude >= 72)) zoneLetter = 'X';
else if((72 > _latitude) && (_latitude >= 64)) zoneLetter = 'W';
else if((64 > _latitude) && (_latitude >= 56)) zoneLetter = 'V';
else if((56 > _latitude) && (_latitude >= 48)) zoneLetter = 'U';
else if((48 > _latitude) && (_latitude >= 40)) zoneLetter = 'T';
else if((40 > _latitude) && (_latitude >= 32)) zoneLetter = 'S';
else if((32 > _latitude) && (_latitude >= 24)) zoneLetter = 'R';
else if((24 > _latitude) && (_latitude >= 16)) zoneLetter = 'Q';
else if((16 > _latitude) && (_latitude >= 8)) zoneLetter = 'P';
else if(( 8 > _latitude) && (_latitude >= 0)) zoneLetter = 'N';
else if(( 0 > _latitude) && (_latitude >= -8)) zoneLetter = 'M';
else if((-8 > _latitude) && (_latitude >= -16)) zoneLetter = 'L';
else if((-16 > _latitude) && (_latitude >= -24)) zoneLetter = 'K';
else if((-24 > _latitude) && (_latitude >= -32)) zoneLetter = 'J';
else if((-32 > _latitude) && (_latitude >= -40)) zoneLetter = 'H';
else if((-40 > _latitude) && (_latitude >= -48)) zoneLetter = 'G';
else if((-48 > _latitude) && (_latitude >= -56)) zoneLetter = 'F';
else if((-56 > _latitude) && (_latitude >= -64)) zoneLetter = 'E';
else if((-64 > _latitude) && (_latitude >= -72)) zoneLetter = 'D';
else if((-72 > _latitude) && (_latitude >= -80)) zoneLetter = 'C';
else if((0 >= _longitude) && (latitude <= -80)) zoneLetter = 'A';
else if((0 < _longitude) && (latitude <= -80)) zoneLetter = 'B';
if ((0 >= i_longitude) && (i_latitude > 84)) zoneLetter = 'Y';
else if((0 < i_longitude) && (i_latitude > 84)) zoneLetter = 'Z';
else if((84 >= i_latitude) && (i_latitude >= 72)) zoneLetter = 'X';
else if((72 > i_latitude) && (i_latitude >= 64)) zoneLetter = 'W';
else if((64 > i_latitude) && (i_latitude >= 56)) zoneLetter = 'V';
else if((56 > i_latitude) && (i_latitude >= 48)) zoneLetter = 'U';
else if((48 > i_latitude) && (i_latitude >= 40)) zoneLetter = 'T';
else if((40 > i_latitude) && (i_latitude >= 32)) zoneLetter = 'S';
else if((32 > i_latitude) && (i_latitude >= 24)) zoneLetter = 'R';
else if((24 > i_latitude) && (i_latitude >= 16)) zoneLetter = 'Q';
else if((16 > i_latitude) && (i_latitude >= 8)) zoneLetter = 'P';
else if(( 8 > i_latitude) && (i_latitude >= 0)) zoneLetter = 'N';
else if(( 0 > i_latitude) && (i_latitude >= -8)) zoneLetter = 'M';
else if((-8 > i_latitude) && (i_latitude >= -16)) zoneLetter = 'L';
else if((-16 > i_latitude) && (i_latitude >= -24)) zoneLetter = 'K';
else if((-24 > i_latitude) && (i_latitude >= -32)) zoneLetter = 'J';
else if((-32 > i_latitude) && (i_latitude >= -40)) zoneLetter = 'H';
else if((-40 > i_latitude) && (i_latitude >= -48)) zoneLetter = 'G';
else if((-48 > i_latitude) && (i_latitude >= -56)) zoneLetter = 'F';
else if((-56 > i_latitude) && (i_latitude >= -64)) zoneLetter = 'E';
else if((-64 > i_latitude) && (i_latitude >= -72)) zoneLetter = 'D';
else if((-72 > i_latitude) && (i_latitude >= -80)) zoneLetter = 'C';
else if((0 >= i_longitude) && (i_latitude <= -80)) zoneLetter = 'A';
else if((0 < i_longitude) && (i_latitude <= -80)) zoneLetter = 'B';
std::stringstream zone;
zone << ZoneNumber << zoneLetter;
......
......@@ -100,7 +100,7 @@ class Coords {
void check();
double distance(const Coords& destination) const;
bool isSameProj(const Coords& target) const;
void copyProj(const Coords& source, const bool _update=true);
void copyProj(const Coords& source, const bool i_update=true);
//Static helper methods
static double dms_to_decimal(const std::string& dms);
......
......@@ -32,140 +32,140 @@ namespace mio {
/**
* @brief Default constructor.
* Initializes all variables to 0, except lat/long which are initialized to IOUtils::nodata
* @param _algorithm specify the default algorithm to use for slope computation (default=DFLT)
* @param i_algorithm specify the default algorithm to use for slope computation (default=DFLT)
*/
DEMObject::DEMObject(const slope_type& _algorithm) : Grid2DObject(), slope(), azi(), curvature(), Nx(), Ny(), Nz()
DEMObject::DEMObject(const slope_type& i_algorithm) : Grid2DObject(), slope(), azi(), curvature(), Nx(), Ny(), Nz()
{
min_altitude = min_slope = min_curvature = std::numeric_limits<double>::max();
max_altitude = max_slope = max_curvature = -std::numeric_limits<double>::max();
slope_failures = curvature_failures = 0;
update_flag = INT_MAX;
setDefaultAlgorithm(_algorithm);
setDefaultAlgorithm(i_algorithm);
}
/**
* @brief Constructor that sets variables.
* @param _ncols (unsigned int) number of colums in the grid2D
* @param _nrows (unsigned int) number of rows in the grid2D
* @param _cellsize (double) value for cellsize in grid2D
* @param _llcorner lower lower corner point
* @param _algorithm specify the default algorithm to use for slope computation (default=DFLT)
* @param i_ncols (unsigned int) number of colums in the grid2D
* @param i_nrows (unsigned int) number of rows in the grid2D
* @param i_cellsize (double) value for cellsize in grid2D
* @param i_llcorner lower lower corner point
* @param i_algorithm specify the default algorithm to use for slope computation (default=DFLT)
*/
DEMObject::DEMObject(const unsigned int& _ncols, const unsigned int& _nrows,
const double& _cellsize, const Coords& _llcorner, const slope_type& _algorithm)
: Grid2DObject(_ncols, _nrows, _cellsize, _llcorner),
DEMObject::DEMObject(const unsigned int& i_ncols, const unsigned int& i_nrows,
const double& i_cellsize, const Coords& i_llcorner, const slope_type& i_algorithm)
: Grid2DObject(i_ncols, i_nrows, i_cellsize, i_llcorner),
slope(), azi(), curvature(), Nx(), Ny(), Nz()
{
min_altitude = min_slope = min_curvature = std::numeric_limits<double>::max();
max_altitude = max_slope = max_curvature = -std::numeric_limits<double>::max();
slope_failures = curvature_failures = 0;
update_flag = INT_MAX;
setDefaultAlgorithm(_algorithm);
setDefaultAlgorithm(i_algorithm);
}
/**
* @brief Constructor that sets variables.
* @param _ncols (unsigned int) number of colums in the grid2D
* @param _nrows (unsigned int) number of rows in the grid2D
* @param _cellsize (double) value for cellsize in grid2D
* @param _llcorner lower lower corner point
* @param _altitude (Array2D\<double\>&) grid2D of elevations
* @param _update (bool) also update slope/normals/curvatures and their min/max? (default=true)
* @param _algorithm specify the default algorithm to use for slope computation (default=DFLT)
* @param i_ncols (unsigned int) number of colums in the grid2D
* @param i_nrows (unsigned int) number of rows in the grid2D
* @param i_cellsize (double) value for cellsize in grid2D
* @param i_llcorner lower lower corner point
* @param i_altitude (Array2D\<double\>&) grid2D of elevations
* @param i_update (bool) also update slope/normals/curvatures and their min/max? (default=true)
* @param i_algorithm specify the default algorithm to use for slope computation (default=DFLT)
*/
DEMObject::DEMObject(const unsigned int& _ncols, const unsigned int& _nrows,
const double& _cellsize, const Coords& _llcorner, const Array2D<double>& _altitude,
const bool& _update, const slope_type& _algorithm)
: Grid2DObject(_ncols, _nrows, _cellsize, _llcorner, _altitude),
DEMObject::DEMObject(const unsigned int& i_ncols, const unsigned int& i_nrows,
const double& i_cellsize, const Coords& i_llcorner, const Array2D<double>& i_altitude,
const bool& i_update, const slope_type& i_algorithm)
: Grid2DObject(i_ncols, i_nrows, i_cellsize, i_llcorner, i_altitude),
slope(), azi(), curvature(), Nx(), Ny(), Nz()
{
slope_failures = curvature_failures = 0;
update_flag = INT_MAX;
setDefaultAlgorithm(_algorithm);
if(_update==false) {
setDefaultAlgorithm(i_algorithm);
if(i_update==false) {
updateAllMinMax();
} else {
update(_algorithm);
update(i_algorithm);
}
}
/**
* @brief Constructor that sets variables from a Grid2DObject
* @param _dem (Grid2DObject&) grid contained in a Grid2DObject
* @param _update (bool) also update slope/normals/curvatures and their min/max? (default=true)
* @param _algorithm specify the default algorithm to use for slope computation (default=DFLT)
* @param i_dem (Grid2DObject&) grid contained in a Grid2DObject
* @param i_update (bool) also update slope/normals/curvatures and their min/max? (default=true)
* @param i_algorithm specify the default algorithm to use for slope computation (default=DFLT)
*/
DEMObject::DEMObject(const Grid2DObject& _dem, const bool& _update, const slope_type& _algorithm)
: Grid2DObject(_dem.ncols, _dem.nrows, _dem.cellsize, _dem.llcorner, _dem.grid2D),
DEMObject::DEMObject(const Grid2DObject& i_dem, const bool& i_update, const slope_type& i_algorithm)
: Grid2DObject(i_dem.ncols, i_dem.nrows, i_dem.cellsize, i_dem.llcorner, i_dem.grid2D),
slope(), azi(), curvature(), Nx(), Ny(), Nz()
{
slope_failures = curvature_failures = 0;
update_flag = INT_MAX;
setDefaultAlgorithm(_algorithm);
if(_update==false) {
setDefaultAlgorithm(i_algorithm);
if(i_update==false) {
updateAllMinMax();
} else {
update(_algorithm);
update(i_algorithm);
}
}
/**
* @brief Constructor that sets variables from a subset of another DEMObject,
* given an origin (X,Y) (first index being 0) and a number of columns and rows
* @param _dem (DEMObject&) dem contained in a DEMDObject
* @param _nx (unsigned int&) X coordinate of the new origin
* @param _ny (unsigned int&) Y coordinate of the new origin
* @param _ncols (unsigned int&) number of columns for the subset dem
* @param _nrows (unsigned int&) number of rows for the subset dem
* @param _update (bool) also update slope/normals/curvatures and their min/max? (default=true)
* @param _algorithm specify the default algorithm to use for slope computation (default=DFLT)
* @param i_dem (DEMObject&) dem contained in a DEMDObject
* @param i_nx (unsigned int&) X coordinate of the new origin
* @param i_ny (unsigned int&) Y coordinate of the new origin
* @param i_ncols (unsigned int&) number of columns for the subset dem
* @param i_nrows (unsigned int&) number of rows for the subset dem
* @param i_update (bool) also update slope/normals/curvatures and their min/max? (default=true)
* @param i_algorithm specify the default algorithm to use for slope computation (default=DFLT)
*/
DEMObject::DEMObject(const DEMObject& _dem, const unsigned int& _nx, const unsigned int& _ny,
const unsigned int& _ncols, const unsigned int& _nrows,
const bool& _update, const slope_type& _algorithm)
: Grid2DObject(_dem, _nx,_ny, _ncols,_nrows),
DEMObject::DEMObject(const DEMObject& i_dem, const unsigned int& i_nx, const unsigned int& i_ny,
const unsigned int& i_ncols, const unsigned int& i_nrows,
const bool& i_update, const slope_type& i_algorithm)
: Grid2DObject(i_dem, i_nx,i_ny, i_ncols,i_nrows),
slope(), azi(), curvature(), Nx(), Ny(), Nz()
{
if ((_ncols==0) || (_nrows==0)) {
if ((i_ncols==0) || (i_nrows==0)) {
throw InvalidArgumentException("requesting a subset of 0 columns or rows for DEMObject", AT);
}
//handling of the update properties
slope_failures = curvature_failures = 0;
update_flag = _dem.getUpdatePpt();
setDefaultAlgorithm(_algorithm);
if(_update==true) {
update_flag = i_dem.getUpdatePpt();
setDefaultAlgorithm(i_algorithm);
if(i_update==true) {
//if the object is in automatic update, then we only process the arrays according to
//the update_flag
update(_algorithm);
update(i_algorithm);
} else {
//if the object is NOT in automatic update, we manually copy all non-empty arrays
//from the original set
unsigned int nx, ny;
_dem.slope.size(nx, ny);
i_dem.slope.size(nx, ny);
if(nx>0 && ny>0) {
slope.subset(_dem.slope,_nx,_ny, _ncols,_nrows);
slope.subset(i_dem.slope,i_nx,i_ny, i_ncols,i_nrows);
}
_dem.azi.size(nx, ny);
i_dem.azi.size(nx, ny);
if(nx>0 && ny>0) {
azi.subset(_dem.azi,_nx,_ny, _ncols,_nrows);
azi.subset(i_dem.azi,i_nx,i_ny, i_ncols,i_nrows);
}
_dem.curvature.size(nx, ny);
i_dem.curvature.size(nx, ny);
if(nx>0 && ny>0) {
curvature.subset(_dem.curvature,_nx,_ny, _ncols,_nrows);
curvature.subset(i_dem.curvature,