[pktools] 49/375: doxygen adapted, todo: remove doubles in related pages
Bas Couwenberg
sebastic at xs4all.nl
Wed Dec 3 21:53:57 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 47a770e2d9ee93176168174390eed96179b6b859
Author: user <user at osgeolive.(none)>
Date: Thu Jan 31 13:55:57 2013 +0100
doxygen adapted, todo: remove doubles in related pages
---
Doxyfile | 4 +--
mainpage.md | 31 --------------------
src/apps/apps.md | 40 -------------------------
src/apps/pkfs_nn.cc | 76 ++++++++++++++++++------------------------------
src/apps/pkinfo.cc | 56 -----------------------------------
src/apps/pkpolygonize.cc | 43 +++++++++------------------
src/base/Optionpk.h | 46 +++--------------------------
src/base/pktestOption.cc | 19 ++++++++++++
8 files changed, 67 insertions(+), 248 deletions(-)
diff --git a/Doxyfile b/Doxyfile
index 0d95bdc..568d39f 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -241,7 +241,7 @@ OPTIMIZE_OUTPUT_VHDL = NO
# that for custom extensions you also need to set FILE_PATTERNS otherwise the
# files are not read by doxygen.
-EXTENSION_MAPPING = dox=md
+EXTENSION_MAPPING += dox=md
# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all
# comments according to the Markdown format, which allows for more readable
@@ -1234,7 +1234,7 @@ MATHJAX_EXTENSIONS =
# typically be disabled. For large projects the javascript based search engine
# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
-SEARCHENGINE = YES
+SEARCHENGINE = NO
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a web server instead of a web client using Javascript.
diff --git a/mainpage.md b/mainpage.md
deleted file mode 100644
index 77862e3..0000000
--- a/mainpage.md
+++ /dev/null
@@ -1,31 +0,0 @@
-\mainpage
-Introduction
-============
-pktools is a collection of programs written by Pieter Kempeneers in C++ to perform operations on raster images.
-It heavily relies on the Geospatial Data Abstraction Library (GDAL, http://www.gdal.org) and OGR. Some of the programs are similar to the gdal tools (gdalinfo, gdal_translate, gdal_merge,...) and many of the functionalities provided in pktools already exist. The reason for implementing pktools is a combination of personal preference and additional functionality.
-
-All utilities in pktools use command line options and have a built in help
-
-- use the `-h` option to get help
-- pktools ALWAYS use -i for input and -o for output (unlike GDAL utilities that commonly use last argument as output and second but last argument as input)
-
-License
-=======
-pktools is released under the GNU General Public License version3
-
-See http://www.gnu.org/licenses for more details
-
-Download
-========
-You can download the latest release
-- from http://download.savannah.gnu.org/releases/pktools/ (tar ball)
-- or by getting a copy of the Git repository
-
-~~~
-git clone git://git.savannah.nongnu.org/pktools.git
-~~~
-
-How to refer
-============
-You are welcome to refer to pktools as: https://savannah.nongnu.org/projects/pktools (Pieter Kempeneers)
-
diff --git a/src/apps/apps.md b/src/apps/apps.md
deleted file mode 100644
index 2f9e926..0000000
--- a/src/apps/apps.md
+++ /dev/null
@@ -1,40 +0,0 @@
-
-# List of pktool applications (command line utilities)
-
-<!-- To create the current list of pktool apps, you can use:
-find src/apps/ -name 'pk*.cc'|sed -e 's/.*\//- /' -e 's/\.cc//'|sort
--->
-
-- pkascii2img
-- pkascii2ogr
-- pkclassify_nn
-- pkclassify_svm
-- pkcreatect
-- pkcrop
-- pkdiff
-- pkdsm2shadow
-- pkdumpimg
-- pkdumpogr
-- pkegcs
-- pkextract
-- pkfillnodata
-- pkfilter
-- pkfs_nn
-- pkfs_svm
-- pkgeom
-- pkgetchandelier
-- pkgetmask
-- \ref pkinfo
-- pklas2img
-- pkmosaic
-- pkndvi
-- pkopt_svm
-- pkpolygonize
-- pkreclass
-- pksensormodel
-- pksetchandelier
-- pksetmask
-- pksieve
-- pkstat
-- pkstatogr
-- pkxcorimg
\ No newline at end of file
diff --git a/src/apps/pkfs_nn.cc b/src/apps/pkfs_nn.cc
index f5e99f7..c97f41e 100644
--- a/src/apps/pkfs_nn.cc
+++ b/src/apps/pkfs_nn.cc
@@ -126,16 +126,6 @@ int main(int argc, char *argv[])
// vector<double> priors;
//--------------------------- command line options ------------------------------------
- std::string versionString="version ";
- versionString+=static_cast<string>(VERSION);
- versionString+=", Copyright (C) 2008-2012 Pieter Kempeneers.\n\
- This program comes with ABSOLUTELY NO WARRANTY; for details type use option -h.\n\
- This is free software, and you are welcome to redistribute it\n\
- under certain conditions; use option --license for details.";
- Optionpk<bool> version_opt("\0","version",versionString,false);
- Optionpk<bool> license_opt("lic","license","show license information",false);
- Optionpk<bool> help_opt("h","help","shows this help info",false);
- Optionpk<bool> todo_opt("\0","todo","",false);
Optionpk<string> training_opt("t", "training", "training shape file. A single shape file contains all training features (must be set as: B0, B1, B2,...) for all classes (class numbers identified by label option). Use multiple training files for bootstrap aggregation (alternative to the bag and bsize options, where a random subset is taken from a single training file)");
Optionpk<string> label_opt("\0", "label", "identifier for class label in training shape file.","label");
Optionpk<unsigned short> maxFeatures_opt("n", "nf", "number of features to select (0 to select optimal number, see also ecost option)", 0);
@@ -152,46 +142,38 @@ int main(int argc, char *argv[])
Optionpk<string> selector_opt("sm", "sm", "feature selection method (sffs=sequential floating forward search,sfs=sequential forward search, sbs, sequential backward search ,bfs=brute force search)","sffs");
Optionpk<float> epsilon_cost_opt("ecost", "ecost", "epsilon for stopping criterion in cost function to determine optimal number of features",0.001);
- version_opt.retrieveOption(argc,argv);
- license_opt.retrieveOption(argc,argv);
- help_opt.retrieveOption(argc,argv);
- todo_opt.retrieveOption(argc,argv);
-
- training_opt.retrieveOption(argc,argv);
- maxFeatures_opt.retrieveOption(argc,argv);
- label_opt.retrieveOption(argc,argv);
- reclass_opt.retrieveOption(argc,argv);
- balance_opt.retrieveOption(argc,argv);
- minSize_opt.retrieveOption(argc,argv);
- start_opt.retrieveOption(argc,argv);
- end_opt.retrieveOption(argc,argv);
- band_opt.retrieveOption(argc,argv);
- offset_opt.retrieveOption(argc,argv);
- scale_opt.retrieveOption(argc,argv);
- aggreg_opt.retrieveOption(argc,argv);
- // priors_opt.retrieveOption(argc,argv);
- nneuron_opt.retrieveOption(argc,argv);
- connection_opt.retrieveOption(argc,argv);
- weights_opt.retrieveOption(argc,argv);
- learning_opt.retrieveOption(argc,argv);
- maxit_opt.retrieveOption(argc,argv);
- cv_opt.retrieveOption(argc,argv);
- selector_opt.retrieveOption(argc,argv);
- epsilon_cost_opt.retrieveOption(argc,argv);
- verbose_opt.retrieveOption(argc,argv);
-
- if(version_opt[0]||todo_opt[0]){
- std::cout << version_opt.getHelp() << std::endl;
- std::cout << "todo: " << todo_opt.getHelp() << std::endl;
- exit(0);
+ bool doProcess;//stop process when program was invoked with help option (-h --help)
+ try{
+ doProcess=training_opt.retrieveOption(argc,argv);
+ maxFeatures_opt.retrieveOption(argc,argv);
+ label_opt.retrieveOption(argc,argv);
+ reclass_opt.retrieveOption(argc,argv);
+ balance_opt.retrieveOption(argc,argv);
+ minSize_opt.retrieveOption(argc,argv);
+ start_opt.retrieveOption(argc,argv);
+ end_opt.retrieveOption(argc,argv);
+ band_opt.retrieveOption(argc,argv);
+ offset_opt.retrieveOption(argc,argv);
+ scale_opt.retrieveOption(argc,argv);
+ aggreg_opt.retrieveOption(argc,argv);
+ // priors_opt.retrieveOption(argc,argv);
+ nneuron_opt.retrieveOption(argc,argv);
+ connection_opt.retrieveOption(argc,argv);
+ weights_opt.retrieveOption(argc,argv);
+ learning_opt.retrieveOption(argc,argv);
+ maxit_opt.retrieveOption(argc,argv);
+ cv_opt.retrieveOption(argc,argv);
+ selector_opt.retrieveOption(argc,argv);
+ epsilon_cost_opt.retrieveOption(argc,argv);
+ verbose_opt.retrieveOption(argc,argv);
}
- if(license_opt[0]){
- std::cout << Optionpk<bool>::getGPLv3License() << std::endl;
+ catch(string predefinedString){
+ std::cout << predefinedString << std::endl;
exit(0);
}
- if(help_opt[0]){
- std::cout << "usage: pkfs_svm -t training [OPTIONS]" << std::endl;
- exit(0);
+ if(!doProcess){
+ std::cout << "short option -h shows basic options only, use long option --help to show all options" << std::endl;
+ exit(0);//help was invoked, stop processing
}
static std::map<std::string, SelectorValue> selMap;
diff --git a/src/apps/pkinfo.cc b/src/apps/pkinfo.cc
index 9acaed4..a8d6c4f 100644
--- a/src/apps/pkinfo.cc
+++ b/src/apps/pkinfo.cc
@@ -17,62 +17,6 @@ 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/>.
***********************************************************************/
-/*! \page pkinfo pkinfo
- \tableofcontents
- program to retrieve information from raster images
-
- ## SYNOPSIS
- <code>
- pkinfo -i imagefile [\ref OPTIONS]
- </code>
- ## DESCRIPTION
- This tool is similar to gdalinfo but output is driven by input options. Output format can be used as pipe for other commands (see \ref pkinfo_examples)
-
- ## OPTIONS ##
- - use either `-short` or `--long` options (both `--long=value` as `--long value` are supported)
- - boolean (bool) options do not expect a value (e.g., `pkinfo --version`)
- - multiple inputs require duplicate options (e.g., `pkinfo -i input1.tif -i input2.tif -f`)
-
- |short|long|type|default|description|
- |-----|----|----|-------|-----------|
-| i | input | Ss | |Input image file |
- | bb | bbox | b | false |Shows bounding box |
- | te | te | b | false |Shows bounding box in GDAL format: xmin ymin xmax ymax |
- | c | centre | b | false |Image centre in projected X,Y coordinates |
- | ct | colourtable | b | false |Shows colour table |
- | s | samples | b | false |Number of samples in image |
- | l | lines | b | false |Number of lines in image |
- | nb | nband | b | false |Show number of bands in image |
- | b | band | s | 0 |Band specific information |
- | dx | dx | b | false |Gets resolution in x (in m) |
- | dy | dy | b | false |Gets resolution in y (in m) |
- | mm | minmax | b | false |Shows min and max value of the image |
- | stat | stat | b | false |Shows statistics (min,max, mean and stdDev of the image) |
- | min | min | d | |Sets minimum for histogram |
- | max | max | d | |Sets maximum for histogram |
- | rel | rel | b | false |Calculates relative histogram in percentage |
- | p | projection | b | false |Shows projection of the image |
- | geo | geo | b | false |Gets geotransform |
- | il | interleave | b | false |Shows interleave |
- | f | filename | b | false |Shows image filename |
- | cov | cover | b | false |Image covers bounding box (or x and y pos) if printed to std out |
- | x | xpos | d | |x pos |
- | y | ypos | d | |y pos |
- | r | read | b | false |Reads row y (in projected coordinates if geo option is set, otherwise in image coordinates, 0 based) |
- | ref | ref | b | false |Gets reference pixel (lower left corner of centre of gravity pixel) |
- | of | oformat | b | false |Gets driver description |
- | e | extent | Ss | |Gets boundary from extent from polygons in vector file |
- | ulx | ulx | d | |Upper left x value bounding box |
- | uly | uly | d | |Upper left y value bounding box |
- | lrx | lrx | d | |Lower right x value bounding box |
- | lry | lry | d | |Lower right y value bounding box |
- | hist | hist | b | false |Calculates histogram. Use --rel for a relative histogram output. |
- | nbin | nbin | s | 0 |Number of bins used in histogram. Use 0 for all input values as integers |
- | ot | otype | b | false |Returns data type |
- | d | description | b | false |Returns image description |
- | meta | meta | b | false |Shows meta data |
- | nodata | nodata | d | |Sets no data value(s) for calculations (flags in input image) |
-*/
#include <sstream>
#include <list>
#include "base/Optionpk.h"
diff --git a/src/apps/pkpolygonize.cc b/src/apps/pkpolygonize.cc
index 0581431..04160a5 100644
--- a/src/apps/pkpolygonize.cc
+++ b/src/apps/pkpolygonize.cc
@@ -37,16 +37,6 @@ extern "C" {
using namespace std;
int main(int argc,char **argv) {
- std::string versionString="version ";
- versionString+=VERSION;
- versionString+=", Copyright (C) 2008-2012 Pieter Kempeneers.\n\
- This program comes with ABSOLUTELY NO WARRANTY; for details type use option -h.\n\
- This is free software, and you are welcome to redistribute it\n\
- under certain conditions; use option --license for details.";
- Optionpk<bool> version_opt("\0","version",versionString,false);
- Optionpk<bool> license_opt("lic","license","show license information",false);
- Optionpk<bool> help_opt("h","help","shows this help info",false);
- Optionpk<bool> todo_opt("\0","todo","",false);
Optionpk<string> input_opt("i", "input", "Input image file (WARNING: will be overwritten with output!", "");
Optionpk<string> mask_opt("m", "mask", "All pixels in the mask band with a value other than zero will be considered suitable for collection as polygons. Use input file as mask to remove background polygon! ", "");
Optionpk<string> output_opt("o", "output", "Output vector file", "");
@@ -54,29 +44,22 @@ int main(int argc,char **argv) {
Optionpk<string> fname_opt("n", "name", "the field name of the output layer", "DN");
Optionpk<short> verbose_opt("v", "verbose", "verbose mode if > 0", 0);
- version_opt.retrieveOption(argc,argv);
- license_opt.retrieveOption(argc,argv);
- help_opt.retrieveOption(argc,argv);
- todo_opt.retrieveOption(argc,argv);
-
- input_opt.retrieveOption(argc,argv);
- mask_opt.retrieveOption(argc,argv);
- output_opt.retrieveOption(argc,argv);
- band_opt.retrieveOption(argc,argv);
- fname_opt.retrieveOption(argc,argv);
- verbose_opt.retrieveOption(argc,argv);
-
- if(version_opt[0]){
- cout << version_opt.getHelp() << endl;
- exit(0);
+ bool doProcess;//stop process when program was invoked with help option (-h --help)
+ try{
+ doProcess=input_opt.retrieveOption(argc,argv);
+ mask_opt.retrieveOption(argc,argv);
+ output_opt.retrieveOption(argc,argv);
+ band_opt.retrieveOption(argc,argv);
+ fname_opt.retrieveOption(argc,argv);
+ verbose_opt.retrieveOption(argc,argv);
}
- if(license_opt[0]){
- cout << Optionpk<bool>::getGPLv3License() << endl;
+ catch(string predefinedString){
+ std::cout << predefinedString << std::endl;
exit(0);
}
- if(help_opt[0]){
- cout << "usage: pkpolygonize -i inputimage -o outputimage [OPTIONS]" << endl;
- exit(0);
+ if(!doProcess){
+ std::cout << "short option -h shows basic options only, use long option --help to show all options" << std::endl;
+ exit(0);//help was invoked, stop processing
}
GDALAllRegister();
diff --git a/src/base/Optionpk.h b/src/base/Optionpk.h
index 8f3df87..3f074e6 100644
--- a/src/base/Optionpk.h
+++ b/src/base/Optionpk.h
@@ -146,47 +146,7 @@ All calls to retrieveOption should reside in a try{} block. If one of the reserv
- `version`
is used, an exception of type std::string is thrown. This can be caught with a catch(string predefinedString) right after the try block, where the message can be sent to stdout and the program can be ended.
-Similarly, if help is invoked with the short option `-h` or long option `--help`, the main program is informed by the return value `false` of \ref retrieveOption (for any option). Thus, a typical use of \ref Optionpk would look like:
-
-~~~
-#include <iostream>
-#include <string>
-#include "base/Optionpk.h"
-
-int main(int argc, char *argv[])
-{
- Optionpk<std::string> foo_opt("f","foo","command line option **foo** of type string can be invoked with either short (f) or long (foo) option","defaultString");
- Optionpk<int> bar_opt("\0","bar","command line option **bar** of type int has no short option",false,1);//bar will only be visible in long help (hide=1)
- Optionpk<bool> easterEgg_opt("egg","egg","this help information is useless",false,2);//this option will not be shown in help (hide=2)
-
- bool doProcess;//stop process when program was invoked with help option (-h --help)
- try{
- doProcess=foo_opt.retrieveOption(argc,argv);
- bar_opt.retrieveOption(argc,argv);
- easterEgg_opt.retrieveOption(argc,argv);
- }
- catch(std::string predefinedString){//command line option contained license or version
- std::cout << predefinedString << std::endl;//report the predefined string to stdout
- exit(0);//stop processing
- }
- if(!doProcess){//command line option contained help option
- std::cout << "short option -h shows basic options only, use long option --help to show all options" << std::endl;//provide extra details for help to the user
- exit(0);//stop processing
- }
- std::cout << "foo: ";
- for(int ifoo=0;ifoo<foo_opt.size();++ifoo){
- std::cout << foo_opt[ifoo] << " ";
- }
- std::cout << std::endl;
- std::cout << foo_opt << std::endl;//short cut for code above
-
- if(bar_opt[0]>0)
- std::cout << "long option for bar was used with a positive value" << std::endl;
-
- if(easterEgg_opt[0])
- std::cout << "How did you find this option -egg or --egg? Not through the help info!" << std::endl;
-}
-~~~
+Similarly, if help is invoked with the short option `-h` or long option `--help`, the main program is informed by the return value `false` of \ref retrieveOption (for any option). An example how to use Optionpk is shown in \ref pktestOption.cc
**/
template<class T> class Optionpk : public std::vector <T>
@@ -380,7 +340,9 @@ template<class T> Optionpk<T>::~Optionpk()
{
}
-///make sure to call this function first before using the option in main program (or segmentation fault will occur...)
+/**
+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){
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)
diff --git a/src/base/pktestOption.cc b/src/base/pktestOption.cc
index 1b3dd37..dfe49cc 100644
--- a/src/base/pktestOption.cc
+++ b/src/base/pktestOption.cc
@@ -1,3 +1,22 @@
+/**********************************************************************
+pktestOption: example program how to use class Optionpk pktestOption.cc
+Copyright (C) 2008-2013 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 <iostream>
#include <string>
#include "base/Optionpk.h"
--
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