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

📄 shapelayer.java

📁 OpenMap是一个基于JavaBeansTM的开发工具包。利用OpenMap你就能够快速构建用于访问legacy数据库的应用程序与applets。OpenMap提供了允许用户查看和操作地理空间信息的
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     * properties able to be set on this PropertyConsumer. The key for each     * property should be the raw property name (without a prefix) with a value     * that is a String that describes what the property key represents, along     * with any other information about the property that would be helpful     * (range, default value, etc.).     *      * @param list a Properties object to load the PropertyConsumer properties     *        into. If getList equals null, then a new Properties object should     *        be created.     * @return Properties object containing PropertyConsumer property values. If     *         getList was not null, this should equal getList. Otherwise, it     *         should be the Properties object created by the PropertyConsumer.     */    public Properties getPropertyInfo(Properties list) {        list = super.getPropertyInfo(list);        String dummyMarker = PropUtils.getDummyMarkerForPropertyInfo(getPropertyPrefix(),                null);        PropUtils.setI18NPropertyInfo(i18n,                list,                ShapeLayer.class,                dummyMarker,                "Rendering Attributes",                "Attributes that determine how the shapes will be drawn.",                "com.bbn.openmap.omGraphics.DrawingAttributesPropertyEditor");        list.put(initPropertiesProperty, shapeFileProperty + " "                + spatialIndexProperty + " " + pointImageURLProperty + " "                + shadowXProperty + " " + shadowYProperty + " " + dummyMarker + " "                + AddToBeanContextProperty + " " + MinScaleProperty + " "                + MaxScaleProperty);        PropUtils.setI18NPropertyInfo(i18n,                list,                ShapeLayer.class,                shapeFileProperty,                shapeFileProperty,                "Location of Shape file - .shp (File, CURL or relative file path).",                "com.bbn.openmap.util.propertyEditor.FUPropertyEditor");        PropUtils.setI18NPropertyInfo(i18n,                list,                ShapeLayer.class,                spatialIndexProperty,                spatialIndexProperty,                "Location of Spatial Index file - .ssx (File, URL or relative file path).",                "com.bbn.openmap.util.propertyEditor.FUPropertyEditor");        PropUtils.setI18NPropertyInfo(i18n,                list,                ShapeLayer.class,                pointImageURLProperty,                pointImageURLProperty,                "Image file to use for map location of point data (optional).",                "com.bbn.openmap.util.propertyEditor.FUPropertyEditor");        PropUtils.setI18NPropertyInfo(i18n,                list,                ShapeLayer.class,                shadowXProperty,                shadowXProperty,                "Horizontal pixel offset for shadow image for shapes.",                null);        PropUtils.setI18NPropertyInfo(i18n,                list,                ShapeLayer.class,                shadowYProperty,                shadowYProperty,                "Vertical pixel offset for shadow image for shapes.",                null);        return list;    }    public void setDrawingAttributes(DrawingAttributes da) {        drawingAttributes = da;    }    public DrawingAttributes getDrawingAttributes() {        return drawingAttributes;    }    public String getInfoText(OMGraphic omg) {        return (String) omg.getAttribute(OMGraphic.INFOLINE);    }    /**     * If applicable, should return a tool tip for the OMGraphic. Return null if     * nothing should be shown.     */    public String getToolTipTextFor(OMGraphic omg) {        return (String) omg.getAttribute(OMGraphic.TOOLTIP);    }    /**     * Create the OMGraphics using the shape file and SpatialIndex.     *      * @return OMGraphicList     * @deprecated use prepare() instead.     */    protected OMGraphicList computeGraphics() {        return prepare();    }    /**     * Create the OMGraphics using the shape file and SpatialIndex.     *      * @return OMGraphicList     */    public synchronized OMGraphicList prepare() {        OMGraphicList list = getList();        Projection projection = getProjection();        if (projection == null) {            Debug.message("basic", "ShapeLayer|" + getName()                    + ": prepare called with null projection");            return new OMGraphicList();        }        if (spatialIndex == null) {            Debug.message("shape", "ShapeLayer: spatialIndex is null!");            if (list != null) {                list.generate(projection, true);// all new graphics                return list;            } else {                // What we'd really like to do is make this a buffered layer at                // this point, if we can't find an ssx file and can't create                // one.                return new OMGraphicList();            }        }        LatLonPoint ul = projection.getUpperLeft();        LatLonPoint lr = projection.getLowerRight();        float ulLat = ul.getLatitude();        float ulLon = ul.getLongitude();        float lrLat = lr.getLatitude();        float lrLon = lr.getLongitude();        if (list != null) {            list.clear();        }        // check for dateline anomaly on the screen. we check for        // ulLon >= lrLon, but we need to be careful of the check for        // equality because of floating point arguments...        if (ProjMath.isCrossingDateline(ulLon, lrLon, projection.getScale())) {            if (Debug.debugging("shape")) {                Debug.output("ShapeLayer.computeGraphics(): Dateline is on screen");            }            double ymin = (double) Math.min(ulLat, lrLat);            double ymax = (double) Math.max(ulLat, lrLat);            try {                list = spatialIndex.getOMGraphics(ulLon,                        ymin,                        180.0d,                        ymax,                        list,                        drawingAttributes,                        projection,                        coordTransform);                list = spatialIndex.getOMGraphics(-180.0d,                        ymin,                        lrLon,                        ymax,                        list,                        drawingAttributes,                        projection,                        coordTransform);            } catch (InterruptedIOException iioe) {                // This means that the thread has been interrupted,                // probably due to a projection change. Not a big                // deal, just return, don't do any more work, and let                // the next thread solve all problems.                list = null;            } catch (IOException ex) {                ex.printStackTrace();            } catch (FormatException fe) {                fe.printStackTrace();            }        } else {            double xmin = (double) Math.min(ulLon, lrLon);            double xmax = (double) Math.max(ulLon, lrLon);            double ymin = (double) Math.min(ulLat, lrLat);            double ymax = (double) Math.max(ulLat, lrLat);            try {                list = spatialIndex.getOMGraphics(xmin,                        ymin,                        xmax,                        ymax,                        list,                        drawingAttributes,                        projection,                        coordTransform);            } catch (InterruptedIOException iioe) {                // This means that the thread has been interrupted,                // probably due to a projection change. Not a big                // deal, just return, don't do any more work, and let                // the next thread solve all problems.                list = null;            } catch (java.io.IOException ex) {                ex.printStackTrace();            } catch (FormatException fe) {                fe.printStackTrace();            }        }        return list;    }    /**     * Renders the layer on the map.     *      * @param g a graphics context     */    public void paint(Graphics g) {        if (shadowX == 0 && shadowY == 0) {            // Enabling buffer...            super.paint(g);        } else {            // grab local for thread safety            OMGraphicList omg = getList();            if (omg != null) {                if (Debug.debugging("shape"))                    Debug.output("ShapeLayer.paint(): " + omg.size() + " omg"                            + " shadow=" + shadowX + "," + shadowY);                if (shadowX != 0 || shadowY != 0) {                    Graphics shadowG = g.create();                    shadowG.translate(shadowX, shadowY);                    omg.render(shadowG);                } else {                    omg.render(g);                }                if (Debug.debugging("shape")) {                    Debug.output("ShapeLayer.paint(): done");                }            }        }    }    protected transient JPanel box;    public Component getGUI() {        if (box == null) {            box = new JPanel();            box.setLayout(new BoxLayout(box, BoxLayout.Y_AXIS));            box.setAlignmentX(Component.LEFT_ALIGNMENT);            JPanel stuff = new JPanel();            // stuff.setLayout(new BoxLayout(stuff,            // BoxLayout.X_AXIS));            // stuff.setAlignmentX(Component.LEFT_ALIGNMENT);            DrawingAttributes da = getDrawingAttributes();            if (da != null) {                stuff.add(da.getGUI());            }            box.add(stuff);            JPanel pal2 = new JPanel();            JButton redraw = new JButton(i18n.get(ShapeLayer.class,                    "redrawLayerButton",                    "Redraw Layer"));            redraw.setActionCommand(RedrawCmd);            redraw.addActionListener(this);            pal2.add(redraw);            box.add(pal2);        }        return box;    }    public void actionPerformed(ActionEvent e) {        super.actionPerformed(e);        String cmd = e.getActionCommand();        if (cmd == RedrawCmd) {            if (isVisible()) {                doPrepare();            }        }    }    /**     * DataBoundsInformer interface.     */    public DataBounds getDataBounds() {        DataBounds box = null;        if (spatialIndex != null) {            ESRIBoundingBox bounds = spatialIndex.getBounds();            if (bounds != null) {                box = new DataBounds(bounds.min.x, bounds.min.y, bounds.max.x, bounds.max.y);            }        }        return box;    }    /**     * Called when the Layer is removed from the MapBean, giving an opportunity     * to clean up.     */    public void removed(Container cont) {        OMGraphicList list = getList();        if (list != null) {            list.clear();            list = null;        }    }}

⌨️ 快捷键说明

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