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 7bb1b497b29c746af79fa3640186a00d7231495d Author: Pieter Kempeneers <kempe...@gmail.com> Date: Sun May 4 23:14:33 2014 +0200 long options pkinfo and worked on dsm2dtm vito --- ChangeLog | 2 ++ src/apps/pkinfo.cc | 48 +++++++++++++++++++-------------------- src/imageclasses/ImgReaderGdal.cc | 10 ++++---- src/imageclasses/ImgReaderGdal.h | 2 +- 4 files changed, 32 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a690e2..16d6767 100755 --- a/ChangeLog +++ b/ChangeLog @@ -267,6 +267,8 @@ version 2.5.2 - configure script: GDAL>=1.10.0 is required for pkdiff - programs ported to windows and GUI with Qt removed underscore for QProcess in Windows + - pkinfo + distinct long options - pkclassify_svm -> pksvm removed underscore for QProcess in Windows - pkclassify_nn -> pkann diff --git a/src/apps/pkinfo.cc b/src/apps/pkinfo.cc index 907cbf7..75f1fb1 100644 --- a/src/apps/pkinfo.cc +++ b/src/apps/pkinfo.cc @@ -31,21 +31,21 @@ int main(int argc, char *argv[]) Optionpk<std::string> input_opt("i","input","Input image file"); Optionpk<bool> bbox_opt("bb", "bbox", "Shows bounding box ", false,0); Optionpk<bool> bbox_te_opt("te", "te", "Shows bounding box in GDAL format: xmin ymin xmax ymax ", false,0); - Optionpk<bool> centre_opt("c", "centre", "Image centre in projected X,Y coordinates ", false,0); - Optionpk<bool> colorTable_opt("ct", "colourtable", "Shows colour table ", false,0); - Optionpk<bool> samples_opt("ns", "ns", "Number of samples in image ", false,0); - Optionpk<bool> lines_opt("nl", "nl", "Number of lines in image ", false,0); + Optionpk<bool> center_opt("c", "center", "Image center in projected X,Y coordinates ", false,0); + Optionpk<bool> colorTable_opt("ct", "colortable", "Shows colour table ", false,0); + Optionpk<bool> samples_opt("ns", "nsample", "Number of samples in image ", false,0); + Optionpk<bool> lines_opt("nl", "nline", "Number of lines in image ", false,0); Optionpk<bool> nband_opt("nb", "nband", "Show number of bands in image", false,0); Optionpk<short> band_opt("b", "band", "Band specific information", 0,0); Optionpk<bool> dx_opt("dx", "dx", "Gets resolution in x (in m)", false,0); Optionpk<bool> dy_opt("dy", "dy", "Gets resolution in y (in m)", false,0); Optionpk<bool> minmax_opt("mm", "minmax", "Shows min and max value of the image ", false,0); - Optionpk<bool> min_opt("min", "min", "Shows min value of the image ", false,0); - Optionpk<bool> max_opt("max", "max", "Shows max value of the image ", false,0); - Optionpk<bool> stat_opt("stats", "stats", "Shows statistics (min,max, mean and stdDev of the image)", false,0); + Optionpk<bool> min_opt("min", "minimum", "Shows min value of the image ", false,0); + Optionpk<bool> max_opt("max", "maximum", "Shows max value of the image ", false,0); + Optionpk<bool> stat_opt("stats", "statistics", "Shows statistics (min,max, mean and stdDev of the image)", false,0); Optionpk<double> src_min_opt("src_min", "src_min", "Sets minimum for histogram (does not calculate min value: use -mm instead)"); Optionpk<double> src_max_opt("src_max", "src_max", "Sets maximum for histogram (does not calculate min value: use -mm instead)"); - Optionpk<bool> relative_opt("rel", "rel", "Calculates relative histogram in percentage", false,0); + Optionpk<bool> relative_opt("rel", "relative", "Calculates relative histogram in percentage", false,0); Optionpk<bool> projection_opt("a_srs", "a_srs", "Shows projection of the image ", false,0); Optionpk<bool> geo_opt("geo", "geo", "Gets geotransform ", false,0); Optionpk<bool> interleave_opt("il", "interleave", "Shows interleave ", false,0); @@ -54,14 +54,14 @@ int main(int argc, char *argv[]) Optionpk<double> x_opt("x", "xpos", "x pos"); Optionpk<double> y_opt("y", "ypos", "y pos"); Optionpk<bool> read_opt("r", "read", "Reads row y (in projected coordinates if geo option is set, otherwise in image coordinates, 0 based)",false,0); - Optionpk<bool> refpixel_opt("ref", "ref", "Gets reference pixel (lower left corner of centre of gravity pixel)", false,0); + Optionpk<bool> refpixel_opt("ref", "reference", "Gets reference pixel (lower left corner of center of gravity pixel)", false,0); Optionpk<bool> driver_opt("of", "oformat", "Gets driver description ", false,0); Optionpk<std::string> extent_opt("e", "extent", "Gets boundary from vector file"); Optionpk<double> ulx_opt("ulx", "ulx", "Upper left x value bounding box"); Optionpk<double> uly_opt("uly", "uly", "Upper left y value bounding box"); Optionpk<double> lrx_opt("lrx", "lrx", "Lower right x value bounding box"); Optionpk<double> lry_opt("lry", "lry", "Lower right y value bounding box"); - Optionpk<bool> hist_opt("hist", "hist", "Calculates histogram. Use --rel for a relative histogram output. ", false,0); + Optionpk<bool> hist_opt("hist", "histogram", "Calculates histogram. Use --rel for a relative histogram output. ", false,0); Optionpk<unsigned int> nbin_opt("nbin", "nbin", "Number of bins used in histogram. Use 0 for all input values as integers"); Optionpk<bool> type_opt("ot", "otype", "Returns data type", false,0); Optionpk<bool> description_opt("d", "description", "Returns image description", false,0); @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) doProcess=input_opt.retrieveOption(argc,argv); bbox_opt.retrieveOption(argc,argv); bbox_te_opt.retrieveOption(argc,argv); - centre_opt.retrieveOption(argc,argv); + center_opt.retrieveOption(argc,argv); colorTable_opt.retrieveOption(argc,argv); samples_opt.retrieveOption(argc,argv); lines_opt.retrieveOption(argc,argv); @@ -161,16 +161,16 @@ int main(int argc, char *argv[]) } if(filename_opt[0]) std::cout << " --input " << input_opt[ifile] << " "; - if(centre_opt[0]){ + if(center_opt[0]){ double theX, theY; - imgReader.getCentrePos(theX,theY); + imgReader.getCenterPos(theX,theY); std::cout << std::setprecision(12) << " -x " << theX << " -y " << theY << " "; } if(refpixel_opt[0]){ assert(band_opt[0]<imgReader.nrOfBand()); Egcs egcs; double refX,refY; - //get centre of reference (centre of gravity) pixel in image + //get center of reference (center of gravity) pixel in image imgReader.getRefPix(refX,refY,band_opt[0]); std::cout << std::setprecision(12) << "-x " << refX << " -y " << refY << std::endl; egcs.setLevel(egcs.res2level(imgReader.getDeltaX())); @@ -246,12 +246,12 @@ int main(int argc, char *argv[]) } } else - std::cout << "--ct none "; + std::cout << "-ct none "; } if(samples_opt[0]) - std::cout << "--ns " << imgReader.nrOfCol() << " "; + std::cout << "--nsample " << imgReader.nrOfCol() << " "; if(lines_opt[0]) - std::cout << "--nl " << imgReader.nrOfRow() << " "; + std::cout << "--nline " << imgReader.nrOfRow() << " "; if(nband_opt[0]) std::cout << "--nband " << imgReader.nrOfBand() << " "; double minValue=0; @@ -265,7 +265,7 @@ int main(int argc, char *argv[]) GDALRasterBand* rasterBand; rasterBand=imgReader.getRasterBand(band_opt[0]); rasterBand->ComputeStatistics(0,&minValue,&maxValue,&meanValue,&stdDev,pfnProgress,pProgressData); - std::cout << "--min " << minValue << " --max " << maxValue << " --mean " << meanValue << " --stdDev " << stdDev << " "; + std::cout << "-min " << minValue << " -max " << maxValue << " --mean " << meanValue << " --stdDev " << stdDev << " "; } if(minmax_opt[0]||min_opt[0]||max_opt[0]){ @@ -279,12 +279,12 @@ int main(int argc, char *argv[]) else imgReader.getMinMax(minValue,maxValue,band_opt[0],true); if(minmax_opt[0]) - std::cout << "--min " << minValue << " --max " << maxValue << " "; + std::cout << "-min " << minValue << " -max " << maxValue << " "; else{ if(min_opt[0]) - std::cout << "--min " << minValue << " "; + std::cout << "-min " << minValue << " "; if(max_opt[0]) - std::cout << "--max " << maxValue << " "; + std::cout << "-max " << maxValue << " "; } } if(relative_opt[0]) @@ -321,11 +321,11 @@ int main(int argc, char *argv[]) // int minCol,minRow; // if(src_min_opt.size()){ // assert(band_opt[0]<imgReader.nrOfBand()); - // std::cout << "--min " << imgReader.getMin(minCol, minRow,band_opt[0]); + // std::cout << "-min " << imgReader.getMin(minCol, minRow,band_opt[0]); // } // if(src_max_opt.size()){ // assert(band_opt[0]<imgReader.nrOfBand()); - // std::cout << "--max " << imgReader.getMax(minCol, minRow,band_opt[0]); + // std::cout << "-max " << imgReader.getMax(minCol, minRow,band_opt[0]); // } // } if(projection_opt[0]){ @@ -335,7 +335,7 @@ int main(int argc, char *argv[]) std::cout << " -a_srs none" << " "; } if(geo_opt[0]&&!read_opt[0]){ - std::cout << " --geo " << std::setprecision(12) << imgReader.getGeoTransform(); + std::cout << " -geo " << std::setprecision(12) << imgReader.getGeoTransform(); } if(interleave_opt[0]){ std::cout << " --interleave " << imgReader.getInterleave() << " "; diff --git a/src/imageclasses/ImgReaderGdal.cc b/src/imageclasses/ImgReaderGdal.cc index 6bd8093..63d25bd 100644 --- a/src/imageclasses/ImgReaderGdal.cc +++ b/src/imageclasses/ImgReaderGdal.cc @@ -258,7 +258,7 @@ bool ImgReaderGdal::getBoundingBox(double& ulx, double& uly, double& lrx, double } } -bool ImgReaderGdal::getCentrePos(double& x, double& y) const +bool ImgReaderGdal::getCenterPos(double& x, double& y) const { double gt[6];// { 444720, 30, 0, 3751320, 0, -30 }; m_gds->GetGeoTransform(gt); @@ -318,7 +318,7 @@ bool ImgReaderGdal::geo2image(double x, double y, double& i, double& j) const } } -//x and y represent centre of pixel, return true if image is georeferenced +//x and y represent center of pixel, return true if image is georeferenced bool ImgReaderGdal::image2geo(double i, double j, double& x, double& y) const { double gt[6];// { 444720, 30, 0, 3751320, 0, -30 }; @@ -619,15 +619,15 @@ void ImgReaderGdal::getRefPix(double& refX, double &refY, int band) const } } if(isGeoRef()){ - //reference coordinate is lower left corner of pixel in centre of gravity + //reference coordinate is lower left corner of pixel in center of gravity //we need geo coordinates for exactly this location: validCol(Row)/nvalidCol(Row)-0.5 double cgravi=validCol/nvalidCol-0.5; double cgravj=validRow/nvalidRow-0.5; double refpixeli=floor(cgravi); double refpixelj=ceil(cgravj-1); - //but image2geo provides location at centre of pixel (shifted half pixel right down) + //but image2geo provides location at center of pixel (shifted half pixel right down) image2geo(refpixeli,refpixelj,refX,refY); - //refX and refY now refer to centre of gravity pixel + //refX and refY now refer to center of gravity pixel refX-=0.5*getDeltaX();//shift to left corner refY-=0.5*getDeltaY();//shift to lower left corner } diff --git a/src/imageclasses/ImgReaderGdal.h b/src/imageclasses/ImgReaderGdal.h index c3303c1..2d941a6 100644 --- a/src/imageclasses/ImgReaderGdal.h +++ b/src/imageclasses/ImgReaderGdal.h @@ -51,7 +51,7 @@ public: std::string getMetadataItem() const; std::string getImageDescription() const; bool getBoundingBox (double& ulx, double& uly, double& lrx, double& lry) const; - bool getCentrePos(double& x, double& y) const; + bool getCenterPos(double& x, double& y) const; double getUlx() const {double ulx, uly, lrx,lry;getBoundingBox(ulx,uly,lrx,lry);return(ulx);}; double getUly() const {double ulx, uly, lrx,lry;getBoundingBox(ulx,uly,lrx,lry);return(uly);}; double getLrx() const {double ulx, uly, lrx,lry;getBoundingBox(ulx,uly,lrx,lry);return(lrx);}; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pktools.git _______________________________________________ Pkg-grass-devel mailing list Pkg-grass-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel