/********************************************************************** pktestexternal: test program for Jim constructor with external data Author(s): Pieter.Kempeneers@ec.europa.eu Copyright (C) 2016-2020 European Union (Joint Research Centre) This file is part of jiplib. jiplib 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. jiplib 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 jiplib. If not, see . ***********************************************************************/ #include #include #include #include #include "base/Optionjl.h" #include "imageclasses/Jim.h" using namespace std; int main(int argc, char *argv[]) { Optionjl input_opt("i", "input", "Input shape file"); Optionjl output_opt("o", "output", "Output vector dataset"); Optionjl attribute_opt("af", "afilter", "attribute filter"); Optionjl verbose_opt("v", "verbose", "verbose (Default: 0)", 0,2); verbose_opt.setHide(2); bool doProcess;//stop process when program was invoked with help option (-h --help) try{ doProcess=input_opt.retrieveOption(argc,argv); output_opt.retrieveOption(argc,argv); verbose_opt.retrieveOption(argc,argv); } catch(string predefinedString){ std::cout << predefinedString << std::endl; exit(0); } if(!doProcess){ cout << endl; cout << "Usage: pktestogr -i input [-o output]" << endl; cout << endl; 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 } if(input_opt.empty()){ std::cerr << "No input file provided (use option -i). Use --help for help information" << std::endl; exit(0); } if(output_opt.empty()){ std::cerr << "No output file provided (use option -o). Use --help for help information" << std::endl; exit(0); } try{ Jim inputReader(input_opt[0]); std::vector vdata(inputReader.nrOfBand()); for(size_t iband=0;iband