[pktools] 102/375: some small corrections in Makefiles and defined static member variable in PointData.cc
Bas Couwenberg
sebastic at xs4all.nl
Wed Dec 3 21:54:04 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 c43a0b43a4c4fb9b82620bcbc8263fc473391e6c
Author: Pieter Kempeneers <kempenep at gmail.com>
Date: Wed May 8 10:21:09 2013 +0200
some small corrections in Makefiles and defined static member variable in PointData.cc
---
src/algorithms/Makefile.am | 1 -
src/apps/Makefile.am | 9 +++++----
src/apps/pkeditogr.cc | 27 +++++++++++++++++++++------
src/apps/pkgetchandelier.cc | 6 ------
src/apps/pksetchandelier.cc | 5 -----
src/base/Makefile.am | 12 ++++++------
src/base/Optionpk.h | 9 +++++++++
src/base/PointData.cc | 6 ++++++
src/fileclasses/Makefile.am | 2 +-
src/models/libprospect.a | Bin 119824 -> 0 bytes
10 files changed, 48 insertions(+), 29 deletions(-)
diff --git a/src/algorithms/Makefile.am b/src/algorithms/Makefile.am
index b3f9028..1fb3917 100644
--- a/src/algorithms/Makefile.am
+++ b/src/algorithms/Makefile.am
@@ -13,7 +13,6 @@ AM_CXXFLAGS = -I$(top_srcdir)/src $(GDAL_CFLAGS) @AM_CXXFLAGS@
# THE LIBRARIES TO BUILD
###############################################################################
-# the library names to build (note we are building static libs only)
#noinst_LIBRARIES = libalgorithms.a
lib_LTLIBRARIES = libalgorithms.la
diff --git a/src/apps/Makefile.am b/src/apps/Makefile.am
index f80400e..f717c7e 100644
--- a/src/apps/Makefile.am
+++ b/src/apps/Makefile.am
@@ -1,7 +1,7 @@
AM_CXXFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/base $(GDAL_CFLAGS) @AM_CXXFLAGS@
-AM_LDFLAGS = $(GDAL_LDFLAGS) $(top_builddir)/src/algorithms/libalgorithms.la $(top_builddir)/src/imageclasses/libimageClasses.la $(top_builddir)/src/fileclasses/libfileClasses.la @AM_LDFLAGS@
+AM_LDFLAGS = $(GDAL_LDFLAGS) $(top_builddir)/src/algorithms/libalgorithms.la $(top_builddir)/src/imageclasses/libimageClasses.la $(top_builddir)/src/fileclasses/libfileClasses.la $(top_builddir)/src/base/libbase.la @AM_LDFLAGS@
#LDADD = $(GDAL_LDFLAGS) $(top_builddir)/src/algorithms/libalgorithms.la $(top_builddir)/src/models/libmodels.la $(top_builddir)/src/models/libprospect.la $(top_builddir)/src/imageclasses/libimageClasses.la
-LDADD = $(GDAL_LDFLAGS) $(top_builddir)/src/algorithms/libalgorithms.la $(top_builddir)/src/models/libmodels.la $(top_builddir)/src/imageclasses/libimageClasses.la $(top_builddir)/src/fileclasses/libfileClasses.la
+LDADD = $(GDAL_LDFLAGS) $(top_builddir)/src/algorithms/libalgorithms.la $(top_builddir)/src/models/libmodels.la $(top_builddir)/src/imageclasses/libimageClasses.la $(top_builddir)/src/fileclasses/libfileClasses.la $(top_builddir)/src/base/libbase.la
###############################################################################
# THE PROGRAMS TO BUILD
###############################################################################
@@ -29,9 +29,9 @@ pklas2img_LDADD = -llas $(AM_LDFLAGS)
endif
if USE_NLOPT
bin_PROGRAMS += pksensormodel pkopt_svm
-pksensormodel_LDFLAGS = -O1
+#pksensormodel_LDFLAGS = -O1
pksensormodel_SOURCES = $(top_srcdir)/src/models/SensorModel.h pksensormodel.h pksensormodel.cc
-pksensormodel_LDADD = $(GSL_LIBS) $(AM_LDFLAGS) -lnlopt -lm -larmadillo #-lgslwrap
+pksensormodel_LDADD = $(GSL_LIBS) $(AM_LDFLAGS) -lnlopt -lm -larmadillo
pkopt_svm_SOURCES = $(top_srcdir)/src/algorithms/OptFactory.h pkclassify_nn.h pkopt_svm.cc
pkopt_svm_LDADD = $(GSL_LIBS) $(AM_LDFLAGS) -lnlopt
endif
@@ -66,6 +66,7 @@ pkfs_svm_LDADD = $(GSL_LIBS) $(AM_LDFLAGS)
pkascii2img_SOURCES = pkascii2img.cc
pkascii2ogr_SOURCES = pkascii2ogr.cc
pkeditogr_SOURCES = pkeditogr.cc
+pkeditogr_LDADD = $(AM_LDFLAGS)
#pkxcorimg_SOURCES= pkxcorimg.cc
#pkgeom_SOURCES = pkgeom.cc
###############################################################################
diff --git a/src/apps/pkeditogr.cc b/src/apps/pkeditogr.cc
index f764d51..6e8f8a5 100644
--- a/src/apps/pkeditogr.cc
+++ b/src/apps/pkeditogr.cc
@@ -30,7 +30,8 @@ int main(int argc, char *argv[])
Optionpk<string> input_opt("i", "input", "Input image");
Optionpk<string> output_opt("o", "output", "Output mask file");
Optionpk<string> selectField_opt("select", "select", "select field (combined with like opt)");
- Optionpk<string> like_opt("like", "like", "substring(s) to be found in select field (if multiple substrings are provided, feature will be selected if one of them is found)");
+ Optionpk<string> like_opt("like", "like", "substring(s) to be found in select field. If multiple substrings are provided, feature will be selected if one of them is found (default) or all of them are found (stringent option is set)");
+ Optionpk<bool> stringent_opt("st", "stringent", "all substring(s) in like option must be found in order to select feature)",false);
Optionpk<string> field_opt("f", "field", "output field names (number must exactly match input fields)");
Optionpk<long int> setfeature_opt("sf", "sf", "id of feature(s) to set (start from 0)");
Optionpk<string> setname_opt("sn", "sn", "name(s) of field(s) to set");
@@ -46,6 +47,7 @@ int main(int argc, char *argv[])
output_opt.retrieveOption(argc,argv);
selectField_opt.retrieveOption(argc,argv);
like_opt.retrieveOption(argc,argv);
+ stringent_opt.retrieveOption(argc,argv);
field_opt.retrieveOption(argc,argv);
addname_opt.retrieveOption(argc,argv);
addtype_opt.retrieveOption(argc,argv);
@@ -137,25 +139,38 @@ int main(int argc, char *argv[])
}
OGRFeature *poFeature;
while((poFeature = ogrReader.getLayer()->GetNextFeature()) != NULL ){
+ if(verbose_opt[0])
+ std::cout << "feature " << ifeature << std::endl;
++ifeature;
bool doSelect;
if(like_opt.empty())
doSelect=true;
else{
- doSelect=false;
+ doSelect=stringent_opt[0];
int fieldIndex=poFeature->GetFieldIndex(selectField_opt[0].c_str());
string fieldValue=poFeature->GetFieldAsString(fieldIndex);
for(int ilike=0;ilike<like_opt.size();++ilike){
if(fieldValue.find(like_opt[ilike])!=std::string::npos){
if(verbose_opt[0])
std::cout << "found " << like_opt[ilike] << " in " << fieldValue << std::endl;
- doSelect=true;
- break;
- }
+ if(stringent_opt[0])
+ continue;
+ else{
+ doSelect=true;
+ break;
+ }
+ }
+ else if(stringent_opt[0]){
+ doSelect=false;
+ break;
+ }
}
}
- if(!doSelect)
+ if(!doSelect){
+ if(verbose_opt[0])
+ std::cout << "string not found in feature " << ifeature << std::endl;
continue;
+ }
OGRFeature *poDstFeature = NULL;
poDstFeature=ogrWriter.createFeature();
if( poDstFeature->SetFrom( poFeature, TRUE ) != OGRERR_NONE ){
diff --git a/src/apps/pkgetchandelier.cc b/src/apps/pkgetchandelier.cc
index 3590906..46b4a15 100644
--- a/src/apps/pkgetchandelier.cc
+++ b/src/apps/pkgetchandelier.cc
@@ -77,12 +77,6 @@ double objFunction(const std::vector<double> &x, std::vector<double> &grad, void
return rmse;
}
-double PointData::m_tau=0;
-double PointData::m_deltaT=0;
-double PointData::m_epsilon=0.00001;
-double PointData::m_flag=1000;
-double PointData::m_residual=0;
-
int main(int argc, char *argv[])
{
std::string versionString="version ";
diff --git a/src/apps/pksetchandelier.cc b/src/apps/pksetchandelier.cc
index 42ee765..95bca22 100644
--- a/src/apps/pksetchandelier.cc
+++ b/src/apps/pksetchandelier.cc
@@ -30,11 +30,6 @@ along with pktools. If not, see <http://www.gnu.org/licenses/>.
#include <config.h>
#endif
-double PointData::m_tau=0;
-double PointData::m_deltaT=0;
-double PointData::m_epsilon=0.00001;
-double PointData::m_flag=1000;
-
int main(int argc, char *argv[])
{
std::string versionString="version ";
diff --git a/src/base/Makefile.am b/src/base/Makefile.am
index 17d46b1..927e830 100644
--- a/src/base/Makefile.am
+++ b/src/base/Makefile.am
@@ -13,17 +13,17 @@ AM_CXXFLAGS = -I$(top_srcdir)/src @AM_CXXFLAGS@
# THE LIBRARIES TO BUILD
###############################################################################
-# the library names to build (note we are building static libs only)
-noinst_LIBRARIES = libbase.a
+#noinst_LIBRARIES = libbase.a
+lib_LTLIBRARIES = libbase.la
# where to install the headers on the system
-libbase_adir = $(includedir)/base
+libbase_ladir = $(includedir)/base
# the list of header files that belong to the library (to be installed later)
-libbase_a_HEADERS = $(top_srcdir)/config.h PointData.h Vector2d.h IndexValue.h Optionpk.h PosValue.h
+libbase_la_HEADERS = $(top_srcdir)/config.h PointData.h Vector2d.h IndexValue.h Optionpk.h PosValue.h
# the sources to add to the library and to add to the source distribution
-libbase_a_SOURCES = $(libbase_a_HEADERS) PointData.cc
+libbase_la_SOURCES = $(libbase_la_HEADERS) PointData.cc
###############################################################################
# list of sources for the binaries
@@ -33,5 +33,5 @@ pktestOption_SOURCES = pktestOption.cc
# HEADERS USED FOR BUILDING BUT NOT TO BE INSTALLED
###############################################################################
-noinst_HEADERS = Optionpk.h PosValue.h Vector2d.h PointData.h
+#noinst_HEADERS = Optionpk.h PosValue.h Vector2d.h PointData.h
###############################################################################
diff --git a/src/base/Optionpk.h b/src/base/Optionpk.h
index 3f074e6..fd0922f 100644
--- a/src/base/Optionpk.h
+++ b/src/base/Optionpk.h
@@ -315,6 +315,15 @@ template<class T> void Optionpk<T>::setAll(const std::string& shortName, const s
///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);
diff --git a/src/base/PointData.cc b/src/base/PointData.cc
index 79e2166..3d55767 100644
--- a/src/base/PointData.cc
+++ b/src/base/PointData.cc
@@ -1,5 +1,11 @@
#include "PointData.h"
+double PointData::m_tau=0;
+double PointData::m_deltaT=0;
+double PointData::m_epsilon=0.00001;
+double PointData::m_flag=1000;
+double PointData::m_residual=0;
+
PointData::PointData(){
}
diff --git a/src/fileclasses/Makefile.am b/src/fileclasses/Makefile.am
index 7d95c69..fb93397 100644
--- a/src/fileclasses/Makefile.am
+++ b/src/fileclasses/Makefile.am
@@ -16,7 +16,7 @@ libfileClasses_ladir = $(includedir)/fileclasses
libfileClasses_la_HEADERS = FileReaderAscii.h
# the sources to add to the library and to add to the source distribution
-libfileClasses_la_SOURCES = $(libfileClasses_a_HEADERS) FileReaderAscii.cc
+libfileClasses_la_SOURCES = $(libfileClasses_la_HEADERS) FileReaderAscii.cc
if USE_LAS
# the list of header files that belong to the library (to be installed later)
diff --git a/src/models/libprospect.a b/src/models/libprospect.a
deleted file mode 100644
index d2e475f..0000000
Binary files a/src/models/libprospect.a and /dev/null differ
--
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