[pktools] 191/375: porting to windows, solving compilation issues with Visual Studio, added Optionpk.cc for template specialization
Bas Couwenberg
sebastic at xs4all.nl
Wed Dec 3 21:54:13 UTC 2014
This is an automated email from the git hooks/post-receive script.
sebastic-guest pushed a commit to branch upstream-master
in repository pktools.
commit 045da7b1853ea7232c4bf03546c7bf9bcf29fd56
Author: Default Seadas User <seadas-user at localhost>
Date: Fri Feb 28 12:37:05 2014 +0100
porting to windows, solving compilation issues with Visual Studio, added Optionpk.cc for template specialization
---
src/algorithms/Filter2d.cc | 2 +-
src/algorithms/Filter2d.h | 12 +++-
src/algorithms/StatFactory.h | 24 ++++++--
src/apps/pkstatascii.cc | 6 ++
src/base/Makefile.am | 2 +-
src/base/Optionpk.cc | 118 ++++++++++++++++++++++++++++++++++++++
src/base/Optionpk.h | 119 +++++----------------------------------
src/imageclasses/ImgReaderGdal.h | 6 +-
src/imageclasses/ImgWriterGdal.h | 2 +-
9 files changed, 173 insertions(+), 118 deletions(-)
diff --git a/src/algorithms/Filter2d.cc b/src/algorithms/Filter2d.cc
index 0ad0739..5fc341e 100644
--- a/src/algorithms/Filter2d.cc
+++ b/src/algorithms/Filter2d.cc
@@ -1148,7 +1148,7 @@ void filter2d::Filter2d::linearFeature(const ImgReaderGdal& input, ImgWriterGdal
std::vector< Vector2d<float> > outputBuffer;
input.readDataBlock(inputBuffer, GDT_Float32, 0, input.nrOfCol()-1, 0, input.nrOfRow()-1, band);
if(maxDistance<=0)
- maxDistance=sqrt(input.nrOfCol()*input.nrOfRow());
+ maxDistance=sqrt(static_cast<float>(input.nrOfCol()*input.nrOfRow()));
linearFeature(inputBuffer,outputBuffer,angle,angleStep,maxDistance,eps, l1, a1, l2, a2,verbose);
for(int iband=0;iband<outputBuffer.size();++iband)
output.writeDataBlock(outputBuffer[iband],GDT_Float32,0,output.nrOfCol()-1,0,output.nrOfRow()-1,iband);
diff --git a/src/algorithms/Filter2d.h b/src/algorithms/Filter2d.h
index de44136..bbb2af5 100644
--- a/src/algorithms/Filter2d.h
+++ b/src/algorithms/Filter2d.h
@@ -32,6 +32,10 @@ along with pktools. If not, see <http://www.gnu.org/licenses/>.
#define RAD2DEG(RAD) (RAD/PI*180)
#endif
+#ifdef WIN32
+#define getpid _getpid
+#endif
+
#include <assert.h>
#include <math.h>
#include <limits>
@@ -800,7 +804,9 @@ template<class T> void Filter2d::dwtForward(Vector2d<T>& theBuffer, const std::s
for(int irow=0;irow<theBuffer.size();++irow)
while(theBuffer[irow].size()&(theBuffer[irow].size()-1))
theBuffer[irow].push_back(theBuffer[irow].back());
- double data[theBuffer.size()*theBuffer[0].size()];
+ std::vector<double> vdata(theBuffer.size()*theBuffer[0].size());
+ double *data=&(vdata[0]);
+ //double data[theBuffer.size()*theBuffer[0].size()];
for(int irow=0;irow<theBuffer.size();++irow){
for(int icol=0;icol<theBuffer[0].size();++icol){
int index=irow*theBuffer[0].size()+icol;
@@ -846,7 +852,9 @@ template<class T> void Filter2d::dwtInverse(Vector2d<T>& theBuffer, const std::s
for(int irow=0;irow<theBuffer.size();++irow)
while(theBuffer[irow].size()&(theBuffer[irow].size()-1))
theBuffer[irow].push_back(theBuffer[irow].back());
- double data[theBuffer.size()*theBuffer[0].size()];
+ std::vector<double> vdata(theBuffer.size()*theBuffer[0].size());
+ double *data=&(vdata[0]);
+ //double data[theBuffer.size()*theBuffer[0].size()];
for(int irow=0;irow<theBuffer.size();++irow){
for(int icol=0;icol<theBuffer[0].size();++icol){
int index=irow*theBuffer[0].size()+icol;
diff --git a/src/algorithms/StatFactory.h b/src/algorithms/StatFactory.h
index b8e3e3d..d4b972c 100644
--- a/src/algorithms/StatFactory.h
+++ b/src/algorithms/StatFactory.h
@@ -153,7 +153,7 @@ public:
template<class T> void minmax(const std::vector<T>& v, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end, T& theMin, T& theMax) const;
template<class T> T sum(const std::vector<T>& v) const;
template<class T> double mean(const std::vector<T>& v) const;
- template<class T> T eraseNoData(std::vector<T>& v) const;
+ template<class T> void eraseNoData(std::vector<T>& v) const;
template<class T> T median(const std::vector<T>& v) const;
template<class T> double var(const std::vector<T>& v) const;
template<class T> double moment(const std::vector<T>& v, int n) const;
@@ -162,16 +162,17 @@ public:
template<class T> double kurtosis(const std::vector<T>& v) const;
template<class T> void meanVar(const std::vector<T>& v, double& m1, double& v1) const;
template<class T1, class T2> void scale2byte(const std::vector<T1>& input, std::vector<T2>& output, unsigned char lbound=0, unsigned char ubound=255) const;
- template<class T> void distribution(const std::vector<T>& input, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end, std::vector<double>& output, int nbin, T &minimum=0.0, T &maximum=0.0, double sigma=0, const std::string &filename="") const;
+ template<class T> void distribution(const std::vector<T>& input, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end, std::vector<double>& output, int nbin, T &minimum, T &maximum, double sigma=0, const std::string &filename="") const;
template<class T> void distribution(const std::vector<T>& input, std::vector<double>& output, int nbin, double sigma=0, const std::string &filename="") const{distribution(input,input.begin(),input.end(),output,nbin,0,0,sigma,filename);};
- template<class T> void distribution2d(const std::vector<T>& inputX, const std::vector<T>& inputY, std::vector< std::vector<double> >& output, int nbin, T& minX=0, T& maxX=0, T& minY=0, T& maxY=0, double sigma=0, const std::string& filename="") const;
+ template<class T> void distribution2d(const std::vector<T>& inputX, const std::vector<T>& inputY, std::vector< std::vector<double> >& output, int nbin, T& minX, T& maxX, T& minY, T& maxY, double sigma=0, const std::string& filename="") const;
template<class T> void cumulative (const std::vector<T>& input, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end, std::vector<int>& output, int nbin, T &minimum, T &maximum) const;
- template<class T> void percentiles (const std::vector<T>& input, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end, std::vector<T>& output, int nbin=10, T &minimum=0.0, T &maximum=0.0, const std::string &filename="") const;
+ template<class T> void percentiles (const std::vector<T>& input, typename std::vector<T>::const_iterator begin, typename std::vector<T>::const_iterator end, std::vector<T>& output, int nbin, T &minimum, T &maximum, const std::string &filename="") const;
template<class T> void signature(const std::vector<T>& input, double& k, double& alpha, double& beta, double e) const;
void signature(double m1, double m2, double& k, double& alpha, double& beta, double e) const;
template<class T> void normalize(const std::vector<T>& input, std::vector<double>& output) const;
template<class T> void normalize_pct(std::vector<T>& input) const;
template<class T> double rmse(const std::vector<T>& x, const std::vector<T>& y) const;
+ template<class T> double rrmse(const std::vector<T>& x, const std::vector<T>& y) const;
template<class T> double correlation(const std::vector<T>& x, const std::vector<T>& y, int delay=0) const;
template<class T> double cross_correlation(const std::vector<T>& x, const std::vector<T>& y, int maxdelay, std::vector<T>& z) const;
template<class T> double linear_regression(const std::vector<T>& x, const std::vector<T>& y, double &c0, double &c1) const;
@@ -425,7 +426,7 @@ template<class T> inline double StatFactory::mean(const std::vector<T>& v) const
return 0;
}
-template<class T> inline T StatFactory::eraseNoData(std::vector<T>& v) const
+template<class T> inline void StatFactory::eraseNoData(std::vector<T>& v) const
{
typename std::vector<T>::iterator it=v.begin();
while(it!=v.end()){
@@ -827,6 +828,19 @@ template<class T> double StatFactory::rmse(const std::vector<T>& x, const std::v
return sqrt(mse);
}
+template<class T> double StatFactory::rrmse(const std::vector<T>& x, const std::vector<T>& y) const{
+ assert(x.size()==y.size());
+ assert(x.size());
+ double mse=0;
+ for(int isample=0;isample<x.size();++isample){
+ if(x[isample]==0)
+ continue;
+ double e=(x[isample]-y[isample])/x[isample];
+ mse+=e*e/x.size();
+ }
+ return sqrt(mse);
+}
+
template<class T> double StatFactory::correlation(const std::vector<T>& x, const std::vector<T>& y, int delay) const{
double meanX=0;
double meanY=0;
diff --git a/src/apps/pkstatascii.cc b/src/apps/pkstatascii.cc
index fd9c832..a228158 100644
--- a/src/apps/pkstatascii.cc
+++ b/src/apps/pkstatascii.cc
@@ -59,6 +59,7 @@ int main(int argc, char *argv[])
Optionpk<double> kde_opt("kde","kde","bandwith of kernel density when producing histogram, use 0 for practical estimation based on Silverman's rule of thumb. Leave empty if no kernel density is required");
Optionpk<bool> correlation_opt("cor","correlation","calculate Pearson produc-moment correlation coefficient between two columns (defined by -c <col1> -c <col2>",false);
Optionpk<bool> rmse_opt("rmse","rmse","calculate root mean square error between two columns (defined by -c <col1> -c <col2>",false);
+ Optionpk<bool> rrmse_opt("rrmse","rrmse","calculate relative root mean square error between two columns (defined by -c <col1> -c <col2>",false);
Optionpk<bool> reg_opt("reg","regression","calculate linear regression error between two columns (defined by -c <col1> -c <col2>",false);
Optionpk<short> verbose_opt("v", "verbose", "verbose mode when > 0", 0);
@@ -95,6 +96,7 @@ int main(int argc, char *argv[])
kde_opt.retrieveOption(argc,argv);
correlation_opt.retrieveOption(argc,argv);
rmse_opt.retrieveOption(argc,argv);
+ rrmse_opt.retrieveOption(argc,argv);
reg_opt.retrieveOption(argc,argv);
verbose_opt.retrieveOption(argc,argv);
}
@@ -232,6 +234,10 @@ int main(int argc, char *argv[])
assert(dataVector.size()==2);
cout << "root mean square error between columns " << col_opt[0] << " and " << col_opt[1] << ": " << stat.rmse(dataVector[0],dataVector[1]) << endl;
}
+ if(rrmse_opt[0]){
+ assert(dataVector.size()==2);
+ cout << "relative root mean square error between columns " << col_opt[0] << " and " << col_opt[1] << ": " << stat.rrmse(dataVector[0],dataVector[1]) << endl;
+ }
if(reg_opt[0]){
assert(dataVector.size()==2);
double c0=0;
diff --git a/src/base/Makefile.am b/src/base/Makefile.am
index efde6a4..23345e2 100644
--- a/src/base/Makefile.am
+++ b/src/base/Makefile.am
@@ -26,7 +26,7 @@ libbase_la_HEADERS = $(top_srcdir)/config.h Vector2d.h IndexValue.h Optionpk.h P
# the sources to add to the library and to add to the source distribution
###############################################################################
-libbase_la_SOURCES = $(libbase_la_HEADERS)
+libbase_la_SOURCES = Optionpk.cc $(libbase_la_HEADERS)
# list of sources for the binaries
pktestOption_SOURCES = pktestOption.cc
diff --git a/src/base/Optionpk.cc b/src/base/Optionpk.cc
new file mode 100644
index 0000000..07a326f
--- /dev/null
+++ b/src/base/Optionpk.cc
@@ -0,0 +1,118 @@
+/**********************************************************************
+Optionpk.cc: source file used for specialization of template class
+Optionpk defined in Optionpk.h
+Copyright (C) 2008-2014 Pieter Kempeneers
+
+This file is part of pktools
+
+pktools is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+pktools is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with pktools. If not, see <http://www.gnu.org/licenses/>.
+***********************************************************************/
+
+#include "Optionpk.h"
+
+///specialization for string
+template<> inline std::string string2type(std::string const& s){
+ return s;
+}
+
+///specialization for OGRFieldType
+template<> inline OGRFieldType string2type(std::string const& s){
+ OGRFieldType ftype;
+ int ogr_typecount=11;//hard coded for now!
+ for(int iType = 0; iType < ogr_typecount; ++iType){
+ if( OGRFieldDefn::GetFieldTypeName((OGRFieldType)iType) != NULL
+ && EQUAL(OGRFieldDefn::GetFieldTypeName((OGRFieldType)iType),s.c_str()))
+ ftype=(OGRFieldType) iType;
+ }
+ return ftype;
+}
+
+///specialization for bool
+template<> inline std::string type2string(bool const& value){
+ if(value)
+ return("true");
+ else
+ return("false");
+}
+
+///specialization for string
+template<> inline std::string type2string(std::string const& value){
+ // if(value.empty())
+ // return("<empty string>");
+ // else
+ return(value);
+}
+
+///specialization for float
+template<> inline std::string type2string(float const& value){
+ std::ostringstream oss;
+ // oss.precision(1);
+ // oss.setf(ios::fixed);
+ oss << value;
+ return oss.str();
+}
+
+///specialization for double
+template<> inline std::string type2string(double const& value){
+ std::ostringstream oss;
+ // oss.precision(1);
+ // oss.setf(ios::fixed);
+ oss << value;
+ return oss.str();
+}
+
+///specialization for bool
+template<> inline void Optionpk<bool>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo);
+
+template<> inline void Optionpk<bool>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo)
+{
+ m_shortName=shortName;
+ m_longName=longName;
+ m_hasArgument=false;
+ m_help=helpInfo;
+ m_hide=0;
+}
+
+///specialization for bool
+template<> inline void Optionpk<bool>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo,const bool& defaultValue, short hide);
+
+///specialization for bool
+template<> inline void Optionpk<bool>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo,const bool& defaultValue, short hide)
+{
+ m_shortName=shortName;
+ m_longName=longName;
+ m_hasArgument=false;
+ m_help=helpInfo;
+ m_defaultValue=defaultValue;
+ m_hasDefault=true;
+ m_hide=hide;
+}
+
+///specialization for bool
+template<> inline Optionpk<bool>::Optionpk(const std::string& shortName, const std::string& longName, const std::string& helpInfo,const bool& defaultValue, short hide)
+{
+ setAll(shortName,longName,helpInfo,defaultValue, hide);
+}
+
+//specialization (only makes sense for T=std::string), generic function throws exception
+//find a substring in string option (e.g., option is of type -co INTERLEAVE=BAND)
+template<> inline std::vector<std::string>::const_iterator Optionpk<std::string>::findSubstring(const std::string& argument) const{
+ std::vector<std::string>::const_iterator opit=this->begin();
+ while(opit!=this->end()){
+ if(opit->find(argument)!=std::string::npos)
+ break;
+ ++opit;
+ }
+ return opit;
+}
diff --git a/src/base/Optionpk.h b/src/base/Optionpk.h
index b1fdbaf..38cda5f 100644
--- a/src/base/Optionpk.h
+++ b/src/base/Optionpk.h
@@ -63,23 +63,6 @@ template<typename T> inline T string2type(std::string const& s,bool failIfLeftov
return x;
}
-///specialization for string
-template<> inline std::string string2type(std::string const& s){
- return s;
-}
-
-///specialization for OGRFieldType
-template<> inline OGRFieldType string2type(std::string const& s){
- OGRFieldType ftype;
- int ogr_typecount=11;//hard coded for now!
- for(int iType = 0; iType < ogr_typecount; ++iType){
- if( OGRFieldDefn::GetFieldTypeName((OGRFieldType)iType) != NULL
- && EQUAL(OGRFieldDefn::GetFieldTypeName((OGRFieldType)iType),s.c_str()))
- ftype=(OGRFieldType) iType;
- }
- return ftype;
-}
-
///serialization for help or to dump option values to screen in verbose mode
template<typename T> inline std::string type2string(T const& value){
std::ostringstream oss;
@@ -87,40 +70,6 @@ template<typename T> inline std::string type2string(T const& value){
return oss.str();
}
-///specialization for bool
-template<> inline std::string type2string(bool const& value){
- if(value)
- return("true");
- else
- return("false");
-}
-
-///specialization for string
-template<> inline std::string type2string(std::string const& value){
- // if(value.empty())
- // return("<empty string>");
- // else
- return(value);
-}
-
-///specialization for float
-template<> inline std::string type2string(float const& value){
- std::ostringstream oss;
- // oss.precision(1);
- // oss.setf(ios::fixed);
- oss << value;
- return oss.str();
-}
-
-///specialization for double
-template<> inline std::string type2string(double const& value){
- std::ostringstream oss;
- // oss.precision(1);
- // oss.setf(ios::fixed);
- oss << value;
- return oss.str();
-}
-
/**
Class to implement command line options. With the constructor you can define an option, in both short `-` and long `--` format, of a specific type, help information and a default value.\n
This class inherits from std::vector, so the option variable is a vector, supporting multiple inputs for the same option (e.g., --input file1 [--input file2 ...].
@@ -188,8 +137,11 @@ public:
\n\
You should have received a copy of the GNU General Public License\n\
along with this program. If not, see <http://www.gnu.org/licenses/>.\n");};
- std::vector<std::string>::const_iterator findSubstring(const std::string& argument) const;
-private:
+
+ //this function only makes sense for T=std::string (will need a specialization)
+ typename std::vector<T>::const_iterator findSubstring(const T& argument) const {std::string errorString="Error: findSubstring only defined for options of type std::string"; throw(errorString);};
+
+ private:
bool hasArgument() const {return m_hasArgument;};//all options except bools should have arguments
bool hasShortOption() const {return m_shortName.compare("\0");};
bool hasLongOption() const {return m_longName.compare("\0");};
@@ -214,7 +166,7 @@ template<class T1> std::ostream& operator<<(std::ostream& os, const Optionpk<T1>
return os;
}
-template<class T> Optionpk<T>::Optionpk()
+template<class T> inline Optionpk<T>::Optionpk()
: m_hasDefault(false)
{
}
@@ -225,7 +177,7 @@ shortName is option invoked with `-`\n
longName is option invoked with `--`\n
helpInfo is the help message that is shown when option -h or --help is invoked\n
**/
-template<class T> Optionpk<T>::Optionpk(const std::string& shortName, const std::string& longName, const std::string& helpInfo)
+template<class T> inline Optionpk<T>::Optionpk(const std::string& shortName, const std::string& longName, const std::string& helpInfo)
: m_hasDefault(false)
{
setAll(shortName,longName,helpInfo);
@@ -241,12 +193,12 @@ hide=0 : option is visible for in both short (`-h`) and long (`--help`) help. Ty
hide=1 : option is only visible in long help (`--help`). Typical use: expert options\n
hide=2 : option is hidden for user. Typical use: Easter eggs or options only known to author
**/
-template<class T> Optionpk<T>::Optionpk(const std::string& shortName, const std::string& longName, const std::string& helpInfo,const T& defaultValue, short hide)
+template<class T> inline Optionpk<T>::Optionpk(const std::string& shortName, const std::string& longName, const std::string& helpInfo,const T& defaultValue, short hide)
{
setAll(shortName,longName,helpInfo,defaultValue, hide);
}
-template<class T> std::string Optionpk<T>::usage() const
+template<class T> inline std::string Optionpk<T>::usage() const
{
std::ostringstream helpss;
std::string shortOption=m_shortName;
@@ -267,7 +219,7 @@ template<class T> std::string Optionpk<T>::usage() const
return helpss.str();
}
-template<class T> std::string Optionpk<T>::usageDoxygen() const
+template<class T> inline std::string Optionpk<T>::usageDoxygen() const
{
std::ostringstream helpss;
std::string shortOption=m_shortName;
@@ -292,7 +244,7 @@ template<class T> std::string Optionpk<T>::usageDoxygen() const
return helpss.str();
}
-template<class T> void Optionpk<T>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo)
+template<class T> inline void Optionpk<T>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo)
{
m_shortName=shortName;
m_longName=longName;
@@ -301,7 +253,7 @@ template<class T> void Optionpk<T>::setAll(const std::string& shortName, const s
m_hide=0;
}
-template<class T> void Optionpk<T>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo,const T& defaultValue, short hide)
+template<class T> inline void Optionpk<T>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo,const T& defaultValue, short hide)
{
m_shortName=shortName;
m_longName=longName;
@@ -312,47 +264,15 @@ template<class T> void Optionpk<T>::setAll(const std::string& shortName, const s
m_hide=hide;
}
-///specialization for bool
-template<> void Optionpk<bool>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo);
-
-template<> void Optionpk<bool>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo)
-{
- m_shortName=shortName;
- m_longName=longName;
- m_hasArgument=false;
- m_help=helpInfo;
- m_hide=0;
-}
-
-///specialization for bool
-template<> void Optionpk<bool>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo,const bool& defaultValue, short hide);
-
-///specialization for bool
-template<> void Optionpk<bool>::setAll(const std::string& shortName, const std::string& longName, const std::string& helpInfo,const bool& defaultValue, short hide)
-{
- m_shortName=shortName;
- m_longName=longName;
- m_hasArgument=false;
- m_help=helpInfo;
- m_defaultValue=defaultValue;
- m_hasDefault=true;
- m_hide=hide;
-}
-
-///specialization for bool
-template<> Optionpk<bool>::Optionpk(const std::string& shortName, const std::string& longName, const std::string& helpInfo,const bool& defaultValue, short hide)
-{
- setAll(shortName,longName,helpInfo,defaultValue, hide);
-}
-template<class T> Optionpk<T>::~Optionpk()
+template<class T> inline Optionpk<T>::~Optionpk()
{
}
/**
make sure to call this function first before using the option in main program (or segmentation fault will occur...)
**/
-template<class T> bool Optionpk<T>::retrieveOption(int argc, char **argv){
+template<class T> inline bool Optionpk<T>::retrieveOption(int argc, char **argv){
bool noHelp=true;//return value, alert main program that hard coded option (help, version, license, doxygen) was invoked
std::string helpStringShort="-h";//short option for help (hard coded)
std::string helpStringLong="--help";//long option for help (hard coded)
@@ -420,15 +340,4 @@ template<class T> bool Optionpk<T>::retrieveOption(int argc, char **argv){
return(noHelp);
}
-//find a substring in string option (e.g., option is of type -co INTERLEAVE=BAND)
-template<> std::vector<std::string>::const_iterator Optionpk<std::string>::findSubstring(const std::string& argument) const{
- std::vector<std::string>::const_iterator opit=this->begin();
- while(opit!=this->end()){
- if(opit->find(argument)!=std::string::npos)
- break;
- ++opit;
- }
- return opit;
-}
-
#endif
diff --git a/src/imageclasses/ImgReaderGdal.h b/src/imageclasses/ImgReaderGdal.h
index adf903c..c3303c1 100644
--- a/src/imageclasses/ImgReaderGdal.h
+++ b/src/imageclasses/ImgReaderGdal.h
@@ -80,7 +80,7 @@ public:
int getNoDataValues(std::vector<double>& noDataValues) const;
bool isNoData(double value) const{if(m_noDataValues.empty()) return false;else return find(m_noDataValues.begin(),m_noDataValues.end(),value)!=m_noDataValues.end();};
int pushNoDataValue(double noDataValue);
- CPLErr GDALSetNoDataValue(double noDataValue, int band=0) {getRasterBand(band)->SetNoDataValue(noDataValue);};
+ CPLErr GDALSetNoDataValue(double noDataValue, int band=0) {return getRasterBand(band)->SetNoDataValue(noDataValue);};
bool covers(double x, double y) const;
bool covers(double ulx, double uly, double lrx, double lry) const;
bool geo2image(double x, double y, double& i, double& j) const;
@@ -89,11 +89,11 @@ public:
double getDeltaY(void) const {double gt[6];getGeoTransform(gt);return -gt[5];};
template<typename T> void readData(T& value, const GDALDataType& dataType, int col, int row, int band=0) const;
template<typename T> void readData(std::vector<T>& buffer, const GDALDataType& dataType , int minCol, int maxCol, int row, int band=0) const;
- template<typename T> void readData(std::vector<T>& buffer, const GDALDataType& dataType , int minCol, int maxCol, double row, int band=0, RESAMPLE resample=0) const;
+ template<typename T> void readData(std::vector<T>& buffer, const GDALDataType& dataType , int minCol, int maxCol, double row, int band=0, RESAMPLE resample=NEAR) const;
template<typename T> void readDataBlock(Vector2d<T>& buffer, const GDALDataType& dataType , int minCol, int maxCol, int minRow, int maxRow, int band=0) const;
template<typename T> void readDataBlock(std::vector<T>& buffer, const GDALDataType& dataType , int minCol, int maxCol, int minRow, int maxRow, int band=0) const;
template<typename T> void readData(std::vector<T>& buffer, const GDALDataType& dataType, int row, int band=0) const;
- template<typename T> void readData(std::vector<T>& buffer, const GDALDataType& dataType, double row, int band=0, RESAMPLE resample=0) const;
+ template<typename T> void readData(std::vector<T>& buffer, const GDALDataType& dataType, double row, int band=0, RESAMPLE resample=NEAR) const;
void getMinMax(int startCol, int endCol, int startRow, int endRow, int band, double& minValue, double& maxValue) const;
void getMinMax(double& minValue, double& maxValue, int band=0, bool exhaustiveSearch=false) const;
double getMin(int& col, int& row, int band=0) const;
diff --git a/src/imageclasses/ImgWriterGdal.h b/src/imageclasses/ImgWriterGdal.h
index 98da98b..a90f586 100644
--- a/src/imageclasses/ImgWriterGdal.h
+++ b/src/imageclasses/ImgWriterGdal.h
@@ -47,7 +47,7 @@ public:
void setProjection(const std::string& projection);
std::string setProjectionProj4(const std::string& projection);
void setImageDescription(const std::string& imageDescription){m_gds->SetMetadataItem( "TIFFTAG_IMAGEDESCRIPTION",imageDescription.c_str());};
- CPLErr GDALSetNoDataValue(double noDataValue, int band=0) {getRasterBand(band)->SetNoDataValue(noDataValue);};
+ CPLErr GDALSetNoDataValue(double noDataValue, int band=0) {return getRasterBand(band)->SetNoDataValue(noDataValue);};
std::string getProjection(void) const;
std::string getGeoTransform() const;
void getGeoTransform(double* gt) const;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pktools.git
More information about the Pkg-grass-devel
mailing list