List of usage examples for org.apache.commons.cli Option setArgName
public void setArgName(String argName)
From source file:org.bootchart.Main.java
/** * Returns the command line options./*from w w w . ja v a2s.c om*/ * * @return CLI options */ private static Options getOptions() { Options options = new Options(); Option opt = null; options.addOption("h", "help", false, "print this message"); options.addOption("v", "version", false, "print version and exit"); opt = new Option("f", "format", true, "image format (png | eps | svg; default: " + DEFAULT_FORMAT + ")"); opt.setArgName("format"); options.addOption(opt); opt = new Option("o", "output-dir", true, "output directory where images are stored (default: .)"); opt.setArgName("dir"); options.addOption(opt); options.addOption("n", "no-prune", false, "do not prune the process tree"); return options; }
From source file:org.cleanlogic.sxf4j.utils.Sxf2Pgsql.java
public static void main(String... args) { Options options = new Options(); Option sridOption = new Option("s", true, "Set the SRID field. Defaults to detect from passport or 0. Optionally reprojects from given SRID"); sridOption.setArgName("[<from>:]<srid>"); options.addOption(sridOption);/* ww w.ja va2 s . c o m*/ Option stTransformOption = new Option("t", false, "Use only PostGIS coordinates transform (ST_Transform), Use with -s option. Not worked with -D. Default: client side convert."); options.addOption(stTransformOption); Option geometryColumnOption = new Option("g", true, "Specify the name of the geometry/geography column"); geometryColumnOption.setArgName("geocolumn"); options.addOption(geometryColumnOption); Option pgdumpFormatOption = new Option("D", false, "Use postgresql dump format (COPY from stdin) (defaults to SQL insert statements)."); options.addOption(pgdumpFormatOption); Option transactionOption = new Option("e", false, "Execute each statement individually, do not use a transaction. Not compatible with -D."); options.addOption(transactionOption); Option spatialIndexOption = new Option("I", false, "Create a spatial index on the geocolumn."); options.addOption(spatialIndexOption); Option geometryTypeOption = new Option("w", false, "Output WKT instead of WKB. Note that this can result in coordinate drift."); options.addOption(geometryTypeOption); Option encodingOption = new Option("W", true, "Specify the character encoding of SXF attribute column. (default: \"UTF-8\")"); encodingOption.setArgName("encoding"); options.addOption(encodingOption); Option tablespaceTableOption = new Option("T", true, "Specify the tablespace for the new table. Note that indexes will still use the default tablespace unless the -X flag is also used."); tablespaceTableOption.setArgName("tablespace"); options.addOption(tablespaceTableOption); Option tablespaceIndexOption = new Option("X", true, "Specify the tablespace for the table's indexes. This applies to the primary key, and the spatial index if the -I flag is used."); tablespaceIndexOption.setArgName("tablespace"); options.addOption(tablespaceIndexOption); Option helpOption = new Option("h", "help", false, "Display this help screen."); options.addOption(helpOption); OptionGroup optionGroup = new OptionGroup(); Option dropTableOption = new Option("d", false, "Drops the table, then recreates it and populates it with current shape file data."); optionGroup.addOption(dropTableOption); Option createTableOption = new Option("c", false, "Creates a new table and populates it, this is the default if you do not specify any options."); optionGroup.addOption(createTableOption); options.addOptionGroup(optionGroup); CommandLineParser commandLineParser = new DefaultParser(); HelpFormatter helpFormatter = new HelpFormatter(); CommandLine commandLine; try { commandLine = commandLineParser.parse(options, args); if (commandLine.hasOption("help") || commandLine.getArgList().size() == 0) { helpFormatter.printHelp("sxf2pgsql [<options>] <sxfile|dir> [[<schema>.]<table>]", options); return; } if (commandLine.hasOption('s')) { String srid = commandLine.getOptionValue('s'); String[] sridPair = srid.split(":"); if (sridPair.length == 2) { sxf2PgsqlOptions.srcSRID = Integer.parseInt(sridPair[0]); sxf2PgsqlOptions.dstSRID = Integer.parseInt(sridPair[1]); } else if (sridPair.length == 1) { sxf2PgsqlOptions.dstSRID = Integer.parseInt(srid); } } sxf2PgsqlOptions.stTransform = commandLine.hasOption('t'); sxf2PgsqlOptions.dropTable = commandLine.hasOption('d'); if (commandLine.hasOption('g')) { sxf2PgsqlOptions.geocolumnName = commandLine.getOptionValue('g'); } sxf2PgsqlOptions.pgdumpFormat = commandLine.hasOption('D'); sxf2PgsqlOptions.transaction = !commandLine.hasOption('e'); sxf2PgsqlOptions.spatialIndex = commandLine.hasOption('I'); if (commandLine.hasOption('w')) { sxf2PgsqlOptions.geometryFormat = "WKT"; } if (commandLine.hasOption('W')) { sxf2PgsqlOptions.encoding = commandLine.getOptionValue('W'); } List<File> files = new ArrayList<>(); if (commandLine.getArgList().size() > 0) { File file = new File(commandLine.getArgList().get(0)); if (file.isFile()) { files.add(file); } else if (file.isDirectory()) { Utils.search(file, files, ".sxf"); } } boolean useNomenclature = true; if (commandLine.getArgList().size() == 2) { String[] schemaTablePair = commandLine.getArgList().get(1).split("."); if (schemaTablePair.length == 2) { sxf2PgsqlOptions.schemaName = schemaTablePair[0]; sxf2PgsqlOptions.tableName = schemaTablePair[1]; } else if (schemaTablePair.length == 0) { sxf2PgsqlOptions.tableName = commandLine.getArgList().get(1); } useNomenclature = false; } // Begin document System.out.println("SET CLIENT_ENCODING TO UTF8;"); System.out.println("SET STANDARD_CONFORMING_STRINGS TO ON;"); System.out.println("SET STATEMENT_TIMEOUT TO 0;"); System.out.println("SET CLIENT_MIN_MESSAGES TO WARNING;"); System.out.println("CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;"); // Create schema.table at once (use from command line params) if (!useNomenclature && sxf2PgsqlOptions.dropTable) { System.out.print(dropTables()); } // Single table mode if (!useNomenclature) { // if (sxf2PgsqlOptions.transaction) { // System.out.println("BEGIN;"); // } System.out.print(createTables()); } for (File file : files) { try { SXFReader sxfReader = new SXFReader(file, true, true); SXFPassport sxfPassport = sxfReader.getPassport(); int srid = sxfPassport.srid(); // if (!Utils.SRID_EX.containsKey(srid)) { Proj4FileReader proj4FileReader = new Proj4FileReader(); String params[] = proj4FileReader.readParametersFromFile("EPSG", String.valueOf(srid)); if (params == null || params.length == 0) { // Wrong srid. Force from passport. srid = sxfPassport.srid(true); } } // if (srid != 0) { sxf2PgsqlOptions.srcSRID = srid; } if (!commandLine.hasOption("t")) { if (sxf2PgsqlOptions.srcSRID != sxf2PgsqlOptions.dstSRID && sxf2PgsqlOptions.dstSRID != 0) { coordinateTransform = createCoordinateTransform(); } } // Each file in separate transaction if (useNomenclature) { sxf2PgsqlOptions.tableName = sxfPassport.getNomenclature(); if (sxf2PgsqlOptions.dropTable) { System.out.print(dropTables()); } if (sxf2PgsqlOptions.transaction) { System.out.println("BEGIN;"); } System.out.print(createTables()); } if (!sxf2PgsqlOptions.pgdumpFormat) { for (int i = 0; i < sxfReader.getCount(); i++) { SXFRecord sxfRecord = sxfReader.getRecordByIncode(i); if (sxfRecord.getLocal() != null) { System.out.print(createInsert(sxfRecord)); } } } else { createCopy(sxfReader); } if (useNomenclature) { if (sxf2PgsqlOptions.spatialIndex) { for (Local local : Local.values()) { System.out.print(createIndex(local)); } } System.out.println("END;"); } coordinateTransform = null; } catch (IOException e) { e.printStackTrace(); } finally { coordinateTransform = null; } } if (!useNomenclature) { if (sxf2PgsqlOptions.spatialIndex) { for (Local local : Local.values()) { System.out.print(createIndex(local)); } } // if (sxf2PgsqlOptions.transaction) { // System.out.println("END;"); // } } } catch (ParseException e) { System.out.println(e.getMessage()); helpFormatter.printHelp("sxf2pgsql [<options>] <sxfile|dir> [[<schema>.]<table>]", options); System.exit(1); } }
From source file:org.cleanlogic.sxf4j.utils.SxfInfo.java
public static void main(String... args) throws IOException { Options options = new Options(); Option quietOption = new Option("q", "quiet", false, "Not print warning messages"); options.addOption(quietOption);//from w w w . ja v a 2 s . co m Option passportOption = new Option("p", "passport", false, "Print passport of SXF"); options.addOption(passportOption); Option descriptorOption = new Option("d", "descriptor", false, "Print descriptor of SXF"); options.addOption(descriptorOption); Option recordCountOption = new Option("c", "count", false, "Print record count"); options.addOption(recordCountOption); Option fileOption = new Option("f", "flipCoordinates", false, "Flip coordinates"); options.addOption(fileOption); Option sridOption = new Option("s", "srid", true, "Set the SRID field. Defaults to 0."); sridOption.setArgName("[<from>:]<srid>"); options.addOption(sridOption); Option recordOption = new Option("r", "record", true, "Print record header, text (if exists), semantics (if exists) without geometry (incode:<i> - by incode, excode:<i> - by excode, number:<i> - by number"); recordOption.setArgName("type:<i>"); options.addOption(recordOption); Option recordGeometryOption = new Option("rg", "recordGeometry", true, "Print record geometry only (incode:<i> - by incode, excode:<i> - by excode, number:<i> - by number"); recordGeometryOption.setArgName("type:<i>"); options.addOption(recordGeometryOption); Option recordGeomertyType = new Option("gt", "geometryType", true, "All geometry print type (WKT, EWKT, WKB). Default: WKT."); recordGeomertyType.setArgName("type"); options.addOption(recordGeomertyType); Option helpOption = new Option("h", "help", false, "Print usage"); options.addOption(helpOption); CommandLineParser commandLineParser = new DefaultParser(); HelpFormatter helpFormatter = new HelpFormatter(); CommandLine commandLine; try { commandLine = commandLineParser.parse(options, args); if (commandLine.hasOption("help") || commandLine.getArgList().size() != 1) { helpFormatter.printHelp("sxfinfo [<options>] <sxfile|dir>", options); return; } File file = new File(commandLine.getArgList().get(0)); List<File> files = new ArrayList<>(); if (file.isFile()) { files.add(file); } else if (file.isDirectory()) { if (commandLine.hasOption("record")) { System.out.println("Record info print not supported on directory mode"); return; } Utils.search(file, files, ".sxf"); } // SXFReaderOptions sxfReaderOptions = new SXFReaderOptions(); // sxfReaderOptions.quite = commandLine.hasOption("quiet"); // sxfReaderOptions.flipCoordinates = commandLine.hasOption('f'); if (commandLine.hasOption('s')) { String srid = commandLine.getOptionValue('s'); String[] sridPair = srid.split(":"); if (sridPair.length == 2) { srcSRID = Integer.parseInt(sridPair[0]); dstSRID = Integer.parseInt(sridPair[1]); } else if (sridPair.length == 1) { dstSRID = Integer.parseInt(srid); } } StringList geometryTypes = new StringList(); geometryTypes.add("WKT"); geometryTypes.add("WKB"); geometryTypes.add("EWKT"); String geometryType = "WKT"; if (commandLine.hasOption("geometryType")) { geometryType = commandLine.getOptionValue("geometryType"); if (!geometryTypes.contains(geometryType)) { System.err.printf("GeometryType - %s not supported.\n", geometryType); return; } } for (File _file : files) { // if (!sxfReaderOptions.quite) { // System.out.printf("Process file %s\n", _file.toString()); // } try { SXFReader sxfReader = new SXFReader(_file, true, true); SXFPassport sxfPassport = sxfReader.getPassport(); int srid = sxfPassport.srid(); // if (!Utils.SRID_EX.containsKey(srid)) { Proj4FileReader proj4FileReader = new Proj4FileReader(); String params[] = proj4FileReader.readParametersFromFile("EPSG", String.valueOf(srid)); if (params == null || params.length == 0) { // Wrong srid. Force from passport. srid = sxfPassport.srid(true); } } // if (srid != 0) { srcSRID = srid; } if (!commandLine.hasOption("t")) { if (srcSRID != dstSRID && dstSRID != 0) { coordinateTransform = createCoordinateTransform(); } } if (commandLine.hasOption("passport")) { System.out.printf("%s\n", sxfReader.getPassport().toString()); } if (commandLine.hasOption("descriptor")) { sxfReader.getDescriptor().print(); } if (commandLine.hasOption("count")) { System.out.printf("Total records: %d\n", sxfReader.getCount()); } String[] recordPair = null; if (commandLine.hasOption("record")) { recordPair = commandLine.getOptionValue("record").split(":"); } else if (commandLine.hasOption("recordGeometry")) { recordPair = commandLine.getOptionValue("recordGeometry").split(":"); } if (recordPair != null) { if (recordPair.length != 2) { System.err.println("Record search format must be - <type:i>"); return; } String type = recordPair[0]; int value = Integer.parseInt(recordPair[1]); if (type.equalsIgnoreCase("incode")) { SXFRecord sxfRecord = sxfReader.getRecordByIncode(value); if (sxfRecord == null) { return; } if (commandLine.hasOption("record")) { System.out.println(sxfRecord.toString()); if (sxfRecord.isTextExsits()) { printText(sxfRecord); } if (sxfRecord.isSemanticExists()) { printSemantics(sxfRecord); } } if (commandLine.hasOption("recordGeometry")) { printGeometry(sxfRecord, geometryType); } } else if (type.equalsIgnoreCase("excode")) { List<SXFRecord> sxfRecords = sxfReader.getRecordByExcode(value); for (SXFRecord sxfRecord : sxfRecords) { if (commandLine.hasOption("record")) { System.out.println(sxfRecord.toString()); if (sxfRecord.isTextExsits()) { printText(sxfRecord); } if (sxfRecord.isSemanticExists()) { printSemantics(sxfRecord); } } if (commandLine.hasOption("recordGeometry")) { if (commandLine.hasOption("recordGeometry")) { printGeometry(sxfRecord, geometryType); } } } } else if (type.equalsIgnoreCase("number")) { SXFRecord sxfRecord = sxfReader.getRecordByNumber(value); if (sxfRecord == null) { return; } if (commandLine.hasOption("record")) { System.out.println(sxfRecord.toString()); if (sxfRecord.isTextExsits()) { printText(sxfRecord); } if (sxfRecord.isSemanticExists()) { printSemantics(sxfRecord); } } if (commandLine.hasOption("recordGeometry")) { printGeometry(sxfRecord, geometryType); } } else { System.err.printf("Record search type - %s - not supported.\n", type); return; } } } catch (IOException ex) { ex.printStackTrace(); continue; } } } catch (ParseException e) { System.out.println(e.getMessage()); helpFormatter.printHelp("sxfinfo [<options>] <sxfile|dir>", options); System.exit(1); } }
From source file:org.codeseed.common.config.ext.CommandLineOptionsBuilder.java
/** * Potentially adds an option to the supplied collection. Used by the * {@link #build()} method to populate an options collection. * * @param options/*from w ww .j a va 2 s .co m*/ * the current collection of options * @param groups * mappings of argument group identifiers to groups * @param method * the configuration method to look up */ protected void addOption(Options options, Map<String, OptionGroup> groups, Method method) { final CommandLine commandLine = method.getAnnotation(CommandLine.class); // Iterate over the triggers; take the first values String opt = null; String longOpt = null; for (String trigger : commandLine.value()) { if (!options.hasOption(trigger)) { if (opt == null && trigger.length() == 1) { opt = trigger; } else if (longOpt == null) { longOpt = trigger; } } } // Either we can use the method name or there is no option being added if (opt == null && longOpt == null) { String methodOpt = LOWER_CAMEL.to(LOWER_HYPHEN, method.getName()); if (!options.hasOption(methodOpt)) { longOpt = methodOpt; } else { // TODO Warn? return; } } // Create a new option Option option = new Option(opt, null); option.setLongOpt(longOpt); // Set the number of arguments based on the return type final Class<?> returnType = Primitives.wrap(method.getReturnType()); if (returnType.equals(Boolean.class)) { option.setArgs(0); } else if (Iterable.class.isAssignableFrom(returnType)) { option.setArgs(commandLine.maximum()); } else if (Map.class.isAssignableFrom(returnType)) { option.setArgs(2); option.setValueSeparator('='); } else { option.setArgs(1); } // Add some descriptive text if (bundle != null) { try { // TODO Does this make sense? String key = option.hasLongOpt() ? option.getLongOpt() : method.getName(); option.setDescription(bundle.getString(key + ".description")); } catch (MissingResourceException e) { option.setDescription(null); } } // Set argument names if (bundle != null && option.getArgs() > 0) { try { option.setArgName(bundle.getString(method.getName() + ".argName")); } catch (MissingResourceException e) { option.setArgName(null); } } // Add to either the collection or to the option groups String groupKey = commandLine.groupId(); if (groupKey.isEmpty()) { options.addOption(option); } else { OptionGroup group = groups.get(groupKey); if (group == null) { group = new OptionGroup(); groups.put(groupKey, group); } group.addOption(option); } }
From source file:org.dacapo.harness.CommandLineArgs.java
private static Option makeOption(String shortName, String longName, String description, String argName) { assert longName != null; Option option = new Option(shortName, longName, argName != null, description); if (argName != null) { option.setValueSeparator('='); option.setArgName(argName); }//from w w w . j a v a2 s.c om return option; }
From source file:org.dcm4che2.tool.chess3d.Chess3D.java
private static CommandLine parse(String[] args) { Options opts = new Options(); Option oThickness = new Option("t", "thickness", true, "Slice Thickness, 1 by default"); oThickness.setArgName("thickness"); opts.addOption(oThickness);/* ww w .ja v a2 s .com*/ Option oLocation = new Option("l", "location", true, "Slice Location of first image, 0.0\\0.0\\0.0 by default"); oLocation.setArgName("location"); opts.addOption(oLocation); Option ox = new Option("x", "rectWidth", true, "Width of one chess rectangle (x-coord). 100 by default"); ox.setArgName("x"); opts.addOption(ox); Option oy = new Option("y", "rectDepth", true, "Heigth of one chess rectangle (y-coord). 100 by default"); oy.setArgName("y"); opts.addOption(oy); Option oX = new Option("X", "xRect", true, "Number of chess fields in x-coord, 10 by default"); oX.setArgName("X"); opts.addOption(oX); Option oY = new Option("Y", "yRect", true, "Number of chess fields in y-coord, 10 by default"); oY.setArgName("Y"); opts.addOption(oY); Option oZ = new Option("Z", "zRect", true, "Number of chess fields in z-coord, 5 by default"); oZ.setArgName("Z"); opts.addOption(oZ); Option oW = new Option("w", "white", true, "White field value (0-255), 225 by default"); oW.setArgName("w"); opts.addOption(oW); Option oB = new Option("b", "black", true, "Black field value (0-255), 0 by default"); oB.setArgName("b"); opts.addOption(oB); Option oWin = new Option("win", "window", true, "Window level. Format: <center>\\<width>. 128\\256 by default"); oWin.setArgName("win"); opts.addOption(oWin); OptionBuilder.withArgName("dir"); OptionBuilder.hasArg(); OptionBuilder.withDescription( "Destination directory, parent of xml file or current working directory by default"); opts.addOption(OptionBuilder.create("d")); opts.addOption("S", "studyUID", false, "Create new Study Instance UID. Only effective if xmlFile is specified and studyIUID is set"); opts.addOption("s", "seriesUID", false, "create new Series Instance UID. Only effective if xmlFile is specified and seriesIUID is set"); OptionBuilder.withArgName("prefix"); OptionBuilder.hasArg(); OptionBuilder.withDescription("Generate UIDs with given prefix, 1.2.40.0.13.1.<host-ip> by default."); opts.addOption(OptionBuilder.create("uid")); opts.addOption("h", "help", false, "print this message"); opts.addOption("V", "version", false, "print the version information and exit"); CommandLine cl = null; try { cl = new GnuParser().parse(opts, args); } catch (ParseException e) { exit("chess3d: " + e.getMessage()); throw new RuntimeException("unreachable"); } if (cl.hasOption('V')) { Package p = Chess3D.class.getPackage(); System.out.println("chess3d v" + p.getImplementationVersion()); System.exit(0); } if (cl.hasOption('h') || cl.getArgList().size() < 1) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE); System.exit(0); } return cl; }
From source file:org.dcm4che2.tool.xml2dcm.Xml2Dcm.java
private static CommandLine parse(String[] args) { Options opts = new Options(); Option ifile = new Option("i", true, "Update attributes in specified DICOM file instead " + "generating new one."); ifile.setArgName("dcmfile"); opts.addOption(ifile);//from w w w . j av a 2s .c o m Option xmlfile = new Option("x", true, "XML input, used to update or generate new DICOM file." + "Without <xmlfile>, read from standard input."); xmlfile.setOptionalArg(true); xmlfile.setArgName("xmlfile"); opts.addOption(xmlfile); Option basedir = new Option("d", true, "Directory to resolve external attribute values referenced by " + "XML read from standard input."); basedir.setArgName("basedir"); opts.addOption(basedir); Option ofile = new Option("o", true, "Generated DICOM file or ACR/NEMA-2 dump"); ofile.setArgName("dcmfile"); opts.addOption(ofile); Option tsuid = new Option("t", true, "Store result with specified Transfer Syntax."); tsuid.setArgName("tsuid"); opts.addOption(tsuid); opts.addOption("a", "acrnema2", false, "Store result as ACR/NEMA 2 dump. Mutual exclusive " + "with option -d"); opts.addOption("d", "dicom", false, "Store result as DICOM Part 10 File. Mutual exclusive " + "with option -a"); opts.addOption("g", "grlen", false, "Include (gggg,0000) Group Length attributes." + "By default, optional Group Length attributes are excluded."); opts.addOption("E", "explseqlen", false, "Encode sequences with explicit length. At default, non-empty " + "sequences are encoded with undefined length."); opts.addOption("e", "explitemlen", false, "Encode sequence items with explicit length. At default, " + "non-empty sequence items are encoded with undefined length."); opts.addOption("U", "undefseqlen", false, "Encode all sequences with undefined length. Mutual exclusive " + "with option -E."); opts.addOption("u", "undefitemlen", false, "Encode all sequence items with undefined length. Mutual " + "exclusive with option -e."); opts.addOption("h", "help", false, "print this message"); opts.addOption("V", "version", false, "print the version information and exit"); CommandLine cl = null; try { cl = new PosixParser().parse(opts, args); } catch (ParseException e) { exit("dcm2xml: " + e.getMessage()); throw new RuntimeException("unreachable"); } if (cl.hasOption('V')) { Package p = Xml2Dcm.class.getPackage(); System.out.println("dcm2xml v" + p.getImplementationVersion()); System.exit(0); } if (cl.hasOption('h') || !cl.hasOption("o") || (!cl.hasOption("x") && !cl.hasOption("i"))) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE); System.exit(0); } if (cl.hasOption("a") && cl.hasOption("d")) exit("xml2dcm: Option -a and -d are mutual exclusive"); if (cl.hasOption("e") && cl.hasOption("u")) exit("xml2dcm: Option -e and -u are mutual exclusive"); if (cl.hasOption("E") && cl.hasOption("U")) exit("xml2dcm: Option -E and -U are mutual exclusive"); return cl; }
From source file:org.deegree.coverage.tools.RasterOptionsParser.java
/** * Add the rasterio (loading) options to the given cli options. * //w w w. jav a 2 s . co m * @param options */ public static void addRasterIOLineOptions(Options options) { Option option = new Option("rl", OPT_RASTER_LOCATION, true, "The location of (a) raster data file(s)"); option.setArgs(1); option.setArgName("dir|file"); option.setRequired(true); options.addOption(option); option = new Option("it", OPT_INPUT_TYPE, true, "Type of the input raster files, only if the location is a directory"); option.setArgs(1); option.setArgName(OPT_TYPE_DESC); // option.setRequired( true ); options.addOption(option); option = new Option("s_srs", OPT_CRS, true, "The srs of the input files."); option.setArgs(1); option.setArgName("epsg:code"); options.addOption(option); option = new Option("nd", OPT_NO_DATA, true, "Value to be used as no (missing) data (default 0)."); option.setArgs(1); options.addOption(option); option = new Option("ndt", OPT_NO_DATA_TYPE, true, "Type of no data value (defaults to byte)."); option.setArgs(1); option.setArgName("byte|short|..."); options.addOption(option); option = new Option("ol", OPT_ORIGIN, true, "Origin location of the raster files, eg. center (default) or outer."); option.setArgs(1); option.setArgName("center|outer"); options.addOption(option); option = new Option("r", OPT_RECURSIVE, false, "Search for raster files recursively in the given directory (default true)."); options.addOption(option); option = new Option("rcd", OPT_RASTER_CACHE_DIR, true, "Directory to be used for caching, (default: " + RasterCache.DEFAULT_CACHE_DIR.getAbsolutePath() + ")."); option.setArgs(1); option.setArgName("dir"); options.addOption(option); CommandUtils.addDefaultOptions(options); }
From source file:org.deegree.tools.coverage.converter.RasterConverter.java
private static Options initOptions() { Options options = new Options(); Option option = new Option(RasterOptionsParser.OPT_RASTER_OUT_LOC_ABBREV, OPT_RASTER_OUT_LOC, true, "the output directory for the raster tree, defaults to input dir"); option.setArgs(1);/* w w w . java 2s . c o m*/ option.setArgName("dir|file"); options.addOption(option); option = new Option(OPT_OUTPUT_TYPE_ABBREV, OPT_OUTPUT_TYPE, true, "The output type of the rasters."); option.setArgs(1); option.setArgName(OPT_TYPE_DESC); option.setRequired(true); options.addOption(option); option = new Option(OPT_NUM_THREADS, "the number of threads used."); option.setArgs(1); option.setArgName("threads"); options.addOption(option); RasterOptionsParser.addRasterIOLineOptions(options); CommandUtils.addDefaultOptions(options); return options; }
From source file:org.deegree.tools.coverage.RTBClient.java
private static Options initOptions() { Options options = new Options(); Option option = new Option(OPT_T_SRS, "the srs of the target raster (defaults to the source srs)"); option.setArgs(1);//w w w. jav a 2 s.co m option.setArgName("epsg code"); options.addOption(option); option = new Option(OPT_RASTER_OUT_LOC_ABBREV, OPT_RASTER_OUT_LOC, true, "the output directory for the raster tree"); option.setRequired(true); option.setArgs(1); option.setArgName("dir"); options.addOption(option); option = new Option(OPT_TILE_SIZE, "the max tile size in pixel (defaults to " + DEFAULT_TILE_SIZE + "). the actual tile size is calculated to reduce 'black' borders" + " (see force_size)"); option.setArgs(1); option.setArgName("size"); options.addOption(option); option = new Option(OPT_FORCE_SIZE, "use the given tile_size as it is, do not calculate the optimal tile size"); options.addOption(option); option = new Option(OPT_BBOX, "the target bbox"); option.setArgs(1); option.setArgName("x0,y0,x1,y1"); options.addOption(option); option = new Option(OPT_NUM_LEVELS, "the number of raster levels. when omitted, generate levels until a level contains one tile."); option.setArgs(1); option.setArgName("levels"); options.addOption(option); option = new Option(OPT_RES, "the target resolution for the first level in units/px."); option.setArgs(1); option.setLongOpt("base_resolution"); option.setArgName("units/px"); options.addOption(option); option = new Option(OPT_INTERPOLATION, "the raster interpolation (nn: nearest neighbour, bl: bilinear"); option.setArgs(1); option.setArgName("nn|bl"); options.addOption(option); option = new Option(OPT_OUTPUT_TYPE_ABBREV, OPT_OUTPUT_TYPE, true, "the output format (defaults to " + DEFAULT_OUTPUT_FORMAT + ")"); option.setArgs(1); option.setArgName(OPT_TYPE_DESC); options.addOption(option); option = new Option(OPT_NUM_THREADS, "the number of threads used."); option.setArgs(1); option.setArgName("threads"); options.addOption(option); CommandUtils.addDefaultOptions(options); RasterOptionsParser.addRasterIOLineOptions(options); return options; }