Examples of ArgParser


Examples of com.bbn.openmap.util.ArgParser

    public static void main(String[] args) {
        Debug.init();

        try {

            ArgParser ap = new ArgParser("SimpleHttpImageServer");
            ap.add("properties",
                    "A URL to use to set the properties for the ImageServer.",
                    1);
            ap.add("port",
                    "The port to listen for new map image requests on. (Default 0)",
                    1);
            ap.add("verbose", "Print action messages.");
            ap.add("test", "Create a test default image.");

            if (!ap.parse(args)) {
                ap.printUsage();
                System.exit(0);
            }

            String proparg[];
            PropertyHandler propHandler;
            proparg = ap.getArgValues("properties");
            if (proparg != null) {
                propHandler = new PropertyHandler(proparg[0]);
            } else {
                propHandler = new PropertyHandler();
            }

            String[] varg = ap.getArgValues("verbose");
            if (varg != null) {
                Debug.put("shis");
                Debug.put("imageserver");
            }

            SimpleHttpImageServer shis;
            String[] portarg = ap.getArgValues("port");
            if (portarg != null) {
                int port = Integer.parseInt(portarg[0]);
                shis = new SimpleHttpImageServer(port, false, propHandler.getProperties());
            } else {
                shis = new SimpleHttpImageServer(propHandler.getProperties());
            }

            Debug.output("OpenMap SimpleHttpImageServer: listening on port: "
                    + shis.httpd.getPort()
                    + (proparg == null ? "" : " with properties in "
                            + proparg[0]));

            String[] testarg = ap.getArgValues("test");
            if (testarg != null) {
                OutputStream out = new FileOutputStream("test.jpg");
                shis.httpRequest(new HttpRequestEvent(shis, "/openmap?REQUEST=map", out));
            }
View Full Code Here

Examples of com.bbn.openmap.util.ArgParser

    }

    public static void main(String[] args) {
        Debug.init();

        ArgParser ap = new ArgParser("SymbolChooser");
        ap.add("type",
                "Type of symbol image set being used (PNG, GIF or SVG, PNG is default)",
                1);
        ap.add("path",
                "Path to root directory of symbol image set if not in classpath",
                1);
        ap.add("default", "15 character code for default icon", 1);
        ap.add("verbose", "Print messages");

        if (!ap.parse(args)) {
            ap.printUsage();
            System.exit(0);
        }

        String arg[];
        arg = ap.getArgValues("type");
        String symbolImageMakerClass = "com.bbn.openmap.tools.symbology.milStd2525.PNGSymbolImageMaker";
        if (arg != null) {
            if (arg[0].equalsIgnoreCase("SVG")) {
                symbolImageMakerClass = "com.bbn.openmap.tools.symbology.milStd2525.SVGSymbolImageMaker";
            } else if (arg[0].equalsIgnoreCase("GIF")) {
                symbolImageMakerClass = "com.bbn.openmap.tools.symbology.milStd2525.GIFSymbolImageMaker";
            }
        }

        String defaultSymbolCode = "SFPPV-----*****";
        arg = ap.getArgValues("default");
        if (arg != null) {
            defaultSymbolCode = arg[0];
        }

        arg = ap.getArgValues("verbose");
        if (arg != null) {
            Debug.put("symbology");
        }

        SymbolReferenceLibrary srl = new SymbolReferenceLibrary();
        if (srl.setSymbolImageMaker(symbolImageMakerClass) != null) {

            arg = ap.getArgValues("path");
            if (arg != null) {
                srl.getSymbolImageMaker().setDataPath(arg[0]);
            }

            SymbolChooser.showDialog(null,
View Full Code Here

Examples of com.bbn.openmap.util.ArgParser

     */
    public static void main(String[] argv) {
        Debug.init();
        boolean Dchum = false;

        ArgParser ap = new ArgParser("MakeToc");
        ap.add("absolute",
                "Use absolute paths in A.TOC - Use for multiple RPF Directories");
        ap.add("boundary", "Maximum frames on a boundary edge (Default 200)", 1);
        ap.add("dchum", "DCHUM files are included.");
        ap.add("log", "Pathname of log file to list A.TOC creation output.", 1);
        ap.add("output",
                "Path to directory to place A.TOC file. (Default is current directory)",
                1);
        ap.add("producer",
                "The producer of the frames (Default DMAAC).  Five letter code.",
                1);
        ap.add("verbose", "Print out progress");
        ap.add("extraverbose", "Print out ALL progress");
        ap.add("nw",
                "Don't put up swing progress window (Use this if you are getting weird exceptions)");
        ap.add("paths",
                "Space separated paths to RPF directory or directories.  Should be last.  If more than one directory is listed, then absolute paths are used in the A.TOC file.",
                ArgParser.TO_END);

        if (!ap.parse(argv)) {
            ap.printUsage();
            System.exit(0);
        }

        String outputFile = "." + File.separator
                + RpfTocHandler.RPF_TOC_FILE_NAME;

        String arg[];
        arg = ap.getArgValues("output");
        if (arg != null) {
            outputFile = arg[0] + File.separator
                    + RpfTocHandler.RPF_TOC_FILE_NAME;
        }

        arg = ap.getArgValues("log");
        if (arg != null) {
            String logfile = arg[0];
            Debug.directOutput(logfile, false, true);
            Debug.output("MakeToc: Creating log at " + logfile + " at "
                    + java.util.Calendar.getInstance().getTime());
        }

        arg = ap.getArgValues("dchum");
        if (arg != null) {
            Dchum = true;
        }

        arg = ap.getArgValues("verbose");
        if (arg != null) {
            Debug.put("maketoc");
        }

        arg = ap.getArgValues("extraverbose");
        if (arg != null) {
            Debug.put("maketoc");
            Debug.put("maketocdetail");
        }

        String[] paths = null;
        arg = ap.getArgValues("paths");
        if (arg != null) {
            paths = arg;
        } else {
            paths = ap.getRest();
        }

        if (paths == null || paths.length == 0) {
            Debug.output("MakeToc: need a path to start searching for RPF frames.");
            System.exit(0);
        }

        MakeToc mt = new MakeToc();

        // If the -nw argument was not used, add a progress gauge.
        arg = ap.getArgValues("nw");
        if (arg == null) {
            try {
                mt.addProgressListener(new com.bbn.openmap.gui.ProgressListenerGauge("RPF A.TOC File Creation"));
            } catch (RuntimeException re) {

            }
        }

        boolean argFlagged = false;
        arg = ap.getArgValues("absolute");
        if (arg != null) {
            argFlagged = true;
        }

        arg = ap.getArgValues("producer");
        if (arg != null) {
            mt.setProducer(arg[0]);
        }

        if (paths.length > 1 || argFlagged) {
            Debug.output("MakeToc:  creating A.TOC with absolute path names.");
            mt.setRelativeFramePaths(false);
        }

        arg = ap.getArgValues("boundary");
        int max_side = DEFAULT_MAX_SIDE;
        if (arg != null) {
            try {
                max_side = Integer.parseInt(arg[0]);
                if (max_side <= DEFAULT_MAX_SIDE) {
View Full Code Here

Examples of com.bbn.openmap.util.ArgParser

    }

    public static void main(String[] argv) {
        Debug.init();
        ArgParser argp = new ArgParser("GeoIntersectionLayer");

        argp.add("shape", "Shape file to use for GeoRegions in index.", 1);

        argp.parse(argv);
        String[] files = argp.getArgValues("shape");
        if (files != null && files.length > 0 && files[0].endsWith(".shp")) {
            File file = new File(files[0]);

            GeoIntersectionLayer gil = new GeoIntersectionLayer();
            Debug.output("Loading shape file: " + file.getName());
            long startTime = System.currentTimeMillis();
            gil.addShapeFile(file);
            long endTime = System.currentTimeMillis();

            Debug.output(" time to load file: " + (endTime - startTime) + " ms");

            gil.runGeoTests(25, 3);
           
        } else {
            argp.printUsage();
            System.exit(0);
        }
    }
View Full Code Here

Examples of com.bbn.openmap.util.ArgParser

        return model;
    }

    public static void main(String[] args) {
        Debug.init();
        ArgParser ap = new ArgParser("DbfFile");
        ap.add("columns", "Print field header information.");
        ap.add("mask", "Only show listed columns", -1);
        ap.add("source", "The dbf file to read.", 1);
        ap.add("target",
                "The dbf file to write, use with mask to remove columns into new dbf file.",
                1);
        ap.add("num",
                "Specify the number of records to read and display (handy for large dbf files)",
                1);

        if (!ap.parse(args)) {
            ap.printUsage();
            System.exit(0);
        }

        String source = null;
        String target = null;
        double num = Double.MAX_VALUE;

        String[] ags = ap.getArgValues("source");
        if (ags != null) {
            source = ags[0];
        } else {
            source = FileUtils.getFilePathToOpenFromUser("Choose DBF file");
            if (source == null) {
                System.exit(0);
            }
        }

        ags = ap.getArgValues("target");
        if (ags != null) {
            target = ags[0];
        }

        boolean readData = ap.getArgValues("columns") == null;

        if (!readData) {
            num = 0;
        } else {
            ags = ap.getArgValues("num");
            if (ags != null) {
                try {
                    num = Double.parseDouble(ags[0]);
                } catch (NumberFormatException nfe) {
                }
            }
        }

        String[] columnMask = ap.getArgValues("mask");
        String[] columns = ap.getArgValues("columns");

        try {

            DbfFile dtm = (DbfFile) DbfFile.getDbfTableModel(source);
View Full Code Here

Examples of com.bbn.openmap.util.ArgParser

     */
    public static void main(String[] argv) {
        Debug.init();
        boolean toUpper = true;

        ArgParser ap = new ArgParser("ChangeCase");
        ap.add("upper",
                "Change file and directory names to UPPER CASE (default). <path> <path> ...",
                ArgParser.TO_END);
        ap.add("lower",
                "Change file and directory names to lower case. <path> <path> ...",
                ArgParser.TO_END);

        if (argv.length == 0) {
            ap.bail("", true);
        }

        ap.parse(argv);

        String[] dirs;
        dirs = ap.getArgValues("lower");
        if (dirs != null) {
            Debug.output("Converting to lower case names...");
            toUpper = false;
        } else {
            dirs = ap.getArgValues("upper");
            // No arguments given, going to default.
            if (dirs == null) {
                dirs = argv;
            }
            Debug.output("Converting to UPPER CASE names...");
View Full Code Here

Examples of com.bbn.openmap.util.ArgParser

    /**
     * The main OpenMap application.
     */
    static public void main(String args[]) {

        ArgParser ap = new ArgParser("OpenMap");
        String propArgs = null;
        ap.add("properties",
                "A resource, file path or URL to properties file\n Ex: http://myhost.com/xyz.props or file:/myhome/abc.pro\n See Java Documentation for java.net.URL class for more details",
                1);

        ap.parse(args);

        String[] arg = ap.getArgValues("properties");
        if (arg != null) {
            propArgs = arg[0];
        }

        OpenMap.create(propArgs);
View Full Code Here

Examples of com.bbn.openmap.util.ArgParser

     * Run DTEDAdmin from the command line.
     */
    public static void main(String[] argv) {
        Debug.init();

        ArgParser ap = new ArgParser("DTEDAdmin");
        ap.add("boundary", "upper lat, left lon, lower lat, right lon", 4, true);
        ap.add("copy", "Copy files to DTED directory.", 1);
        ap.add("level",
                "DTED level to consider (0, 1, 2), 0 is default.  Needs to be set for other levels.",
                1);
        ap.add("outside", "Use files outside boundary.");
        ap.add("query", "Print out files that meet parameters.");
        ap.add("remove", "Delete DTED files.");
        ap.add("source", "The source DTED directory path.", 1);
        ap.add("verbose", "Print out progress.");

        if (!ap.parse(argv)) {
            ap.printUsage();
            System.exit(0);
        }

        String arg[];
        String sourceDir = null;

        arg = ap.getArgValues("source");
        if (arg != null) {
            sourceDir = arg[0];
        }

        boolean inside = true;
        arg = ap.getArgValues("outside");
        if (arg != null) {
            inside = false;
        }

        int level = 0;
        arg = ap.getArgValues("level");
        if (arg != null) {
            try {
                level = Integer.parseInt(arg[0]);
            } catch (NumberFormatException nfe) {
                level = 0;
            }
        }

        arg = ap.getArgValues("verbose");
        if (arg != null) {
            Debug.put("dted");
        }

        DTEDAdmin admin = null;
        double ullat = 89;
        double ullon = -180;
        double lrlat = -90;
        double lrlon = 179;

        arg = ap.getArgValues("boundary");
        if (arg != null) {
            try {
                ullat = Double.parseDouble(arg[0]);
                ullon = Double.parseDouble(arg[1]);
                lrlat = Double.parseDouble(arg[2]);
                lrlon = Double.parseDouble(arg[3]);
            } catch (NumberFormatException nfe1) {
                Debug.error("DTEDAdmin: boundary coordinates not valid:\n"
                        + "  " + arg[0] + "\n  " + arg[1] + "\n  " + arg[2]
                        + "\n  " + arg[3]);
                System.exit(0);
            }
        }

        if (sourceDir != null) {
            admin = new DTEDAdmin(sourceDir, ullat, ullon, lrlat, lrlon, level, inside, DTEDAdmin.DTED_EQUAL_LEVELS);
        }

        arg = ap.getArgValues("copy");
        if (arg != null) {
            if (admin != null) {
                admin.copyTo(arg[0]);
            } else {
                Debug.error("DTEDAdmin:  frame parameters not set for copy.  Need source directory");
                System.exit(0);
            }
        }

        arg = ap.getArgValues("query");
        if (arg != null) {
            if (admin != null) {
                Debug.output("DTED frame files found:");
                admin.query();
            } else {
                Debug.error("DTEDAdmin:  frame parameters not set for query.  Need source directory");
                System.exit(0);
            }
        }

        arg = ap.getArgValues("remove");
        if (arg != null) {
            if (admin != null) {
                Debug.output("These files will be deleted:");
                admin.query();
                Debug.output("Are you sure you want to delete them? [y/N]");
View Full Code Here

Examples of com.bbn.openmap.util.ArgParser

     *        usage statement.
     */
    public static void main(String[] argv) {
        Debug.init();

        ArgParser ap = new ArgParser("DTEDLocator");

        if (argv.length == 0) {
            ap.bail("", true);
        }

        DTEDLocator locator = new DTEDLocator();

        // Assume that the arguments are paths to directories or
View Full Code Here

Examples of com.bbn.openmap.util.ArgParser

     * .dbf files) and writes them back out.
     */
    public static void main(String[] argv) {
        Debug.init();

        ArgParser ap = new ArgParser("EsriShapeExport");
        ap.add("shp", "A URL to a shape file (.shp).", 1);

        if (argv.length < 1) {
            ap.bail("", true);
        }

        ap.parse(argv);

        String[] files = ap.getArgValues("shp");
        if (files != null && files[0] != null) {
            String shp = files[0];
            String dbf = null;

            try {
                dbf = shp.substring(0, shp.lastIndexOf('.') + 1) + PARAM_DBF;

                DbfTableModel model = DbfTableModel.getDbfTableModel(PropUtils.getResourceOrFileOrURL(dbf));
                EsriGraphicList list = EsriGraphicList.getEsriGraphicList(PropUtils.getResourceOrFileOrURL(shp),
                        null,
                        null);

                Debug.output(list.getDescription());

                EsriShapeExport ese = new EsriShapeExport(list, model, null);
                ese.export();

            } catch (MalformedURLException murle) {
                Debug.error("EsriShapeExport: Malformed URL Exception\n"
                        + murle.getMessage());
            } catch (NullPointerException npe) {
                Debug.error("EsriShapeExport: Path to shape file isn't good enough to find .dbf file and .shx file.");
            } catch (Exception exception) {
                Debug.error("EsriShapeExport: Exception\n"
                        + exception.getMessage());
                exception.printStackTrace();
            }

        } else {
            ap.bail("Need a path to a Shape file (.shp)", true);
        }
        System.exit(0);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.