⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shapespecialist.java

📁 openmap java写的开源数字地图程序. 用applet实现,可以像google map 那样放大缩小地图.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
            }        }        return list;    }    /**     * The CSpecialist function.     */    public UGraphic[] fillRectangle(                                    com.bbn.openmap.CSpecialist.CProjection p,                                    com.bbn.openmap.CSpecialist.LLPoint ll1,                                    com.bbn.openmap.CSpecialist.LLPoint ll2,                                    java.lang.String staticArgs,                                    org.omg.CORBA.StringHolder dynamicArgs,                                    com.bbn.openmap.CSpecialist.GraphicChange notifyOnChange,                                    String uniqueID) {        //      System.out.println("ShapeSpecialist.fillRectangle()");        try {            Vector list = computeGraphics(ll1, ll2);            int len = list.size();            UGraphic[] ugraphics = new UGraphic[len];            for (int i = 0; i < len; i++) {                SGraphic sg = (SGraphic) list.elementAt(i);                ugraphics[i] = sg.ufill();            }            //          System.out.println("ShapeSpecialist.fillRectangle():            // got "+ugraphics.length+" graphics");            return ugraphics;        } catch (Throwable t) {            System.err.println("ShapeSpecialist.fillRectangle(): " + t);            t.printStackTrace();            // Don't throw another one! Try to recover!            //          throw new RuntimeException();            return new UGraphic[0];        }    }    protected SpecialistSpatialIndex locateAndSetShapeData(                                                           String shapeFileName,                                                           String spatialIndexFileName) {        File spatialIndexFile = new File(spatialIndexFileName);        SpatialIndex si = null;        if (spatialIndexFile.isAbsolute()) {            //          System.out.println("Absolute!");            try {                si = new SpecialistSpatialIndex(spatialIndexFileName, shapeFileName);            } catch (java.io.IOException e) {                e.printStackTrace();            }        } else {            //          System.out.println("Relative!");            Vector dirs = Environment.getClasspathDirs();            int nDirs = dirs.size();            if (nDirs > 0) {                for (int i = 0; i < nDirs; i++) {                    String dir = (String) dirs.elementAt(i);                    File sif = new File(dir, spatialIndexFileName);                    if (sif.isFile()) {                        File sf = new File(dir, shapeFileName);                        try {                            //                          System.out.println(sif.toString());                            //                          System.out.println(sf.toString());                            si = new SpecialistSpatialIndex(sif.toString(), sf.toString());                            break;                        } catch (java.io.IOException e) {                            e.printStackTrace();                        }                    }                }                if (si == null) {                    System.err.println("Unable to find file: " + shapeFileName);                    System.err.println("Unable to find file: "                            + spatialIndexFileName);                }            } else {                System.err.println("No directories in CLASSPATH!");                System.err.println("Unable to locate file: " + shapeFileName);                System.err.println("Unable to locate file: "                        + spatialIndexFileName);            }        }        return (SpecialistSpatialIndex) si;    }    public void signOff(String uniqueID) {        System.out.println("ShapeSpecialist.signOff()");    }    public void receiveGesture(MouseEvent gesture, String uniqueID) {}    public void makePalette(WidgetChange notifyOnChange, String staticArgs,                            org.omg.CORBA.StringHolder dynamicArgs,                            String uniqueID) {}    public void printHelp() {        System.err.println("usage: java [java/vbj args] <specialist class> [specialist args]");        System.err.println("");        System.err.println("       Java Args:");        System.err.println("       -mx<NUM>m               Set max Java heap in Megs");        System.err.println("");        System.err.println("       VBJ Args:");        System.err.println("       -DORBmbufSize=8388608   Define the VBJ buffer size");        System.err.println("       -DORBdebug              Enable VBJ debugging");        System.err.println("");        System.err.println("       Specialist Args:");        System.err.println("       -ior <iorfile>                  IOR file");        System.err.println("       -properties \"<file> ...\"      Path to properties file");    }    public void parseArgs(String[] args) {        Color lcolor = null;        Color fcolor = null;        for (int i = 0; i < args.length; i++) {            if (args[i].equalsIgnoreCase("-properties")                    && (args.length > (i + 1))) {                properties = loadProps(args[i + 1]);                lcolor = PropUtils.parseColorFromProperties(properties,                        lineColorProperty,                        "FF000000");                lineColor = new SColor((short) ((lcolor.getRed()) * 65535 / 255), (short) ((lcolor.getGreen()) * 65535 / 255), (short) ((lcolor.getBlue()) * 65535 / 255));                if (properties.getProperty(fillColorProperty) != null) {                    fcolor = PropUtils.parseColorFromProperties(properties,                            fillColorProperty,                            "FF000000");                    fillColor = new SColor((short) ((fcolor.getRed()) * 65535 / 255), (short) ((fcolor.getGreen()) * 65535 / 255), (short) ((fcolor.getBlue()) * 65535 / 255));                }                String ssx = properties.getProperty(spatialIndexProperty);                String shp = properties.getProperty(shapeFileProperty);                //              System.out.println("Getting " + shp + " and " +                // ssx);                init(shp, ssx);            }        }        if (properties == null) {            System.out.println("Need properties file!");            System.out.println("");            System.out.println("#######################################");            System.out.println("shapeFile=<path to shape file (.shp)>");            System.out.println("spatialIndex=<path to spatial index file (.ssx)>");            System.out.println("lineColor=<hex ARGB color> i.e. FF000000 for black");            System.out.println("fillColor=<hex ARGB color> i.e. FF000000 for black>");            System.out.println("#######################################");            System.out.println("");            printHelp();            System.exit(0);        }        super.parseArgs(args);        System.out.println("Using colors -> lcolor = " + lcolor + ", fcolor = "                + fcolor);    }    /**     * Load the named file from the named directory into the given     * <code>Properties</code> instance. If the file is not found a     * warning is issued. If an IOExceptio occurs, a fatal error is     * printed and the application will exit.     *      * @param file the name of the file     * @return the loaded properties     */    public Properties loadProps(String file) {        java.io.File propsFile = new java.io.File(file);        Properties props = new Properties();        try {            java.io.InputStream propsStream = new java.io.FileInputStream(propsFile);            props.load(propsStream);        } catch (java.io.FileNotFoundException e) {            System.err.println("ShapeSpecialist did not find properties file: \""                    + file + "\"");            System.exit(1);        } catch (java.io.IOException e) {            System.err.println("Caught IO Exception reading configuration file \""                    + propsFile + "\"");            e.printStackTrace();            System.exit(1);        }        return props;    }    public static void main(String[] args) {        Debug.init(System.getProperties());        // Create the specialist server        ShapeSpecialist srv = new ShapeSpecialist();        srv.parseArgs(args);        srv.start(args);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -