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

📄 layer.java

📁 openmap java写的开源数字地图程序. 用applet实现,可以像google map 那样放大缩小地图.
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
        setRemovable(PropUtils.booleanFromProperties(props, realPrefix                + RemoveableProperty, isRemovable()));        autoPalette = PropUtils.booleanFromProperties(props, realPrefix                + AutoPaletteProperty, autoPalette);        setMinScale(PropUtils.floatFromProperties(props, realPrefix                + MinScaleProperty, getMinScale()));        setMaxScale(PropUtils.floatFromProperties(props, realPrefix                + MaxScaleProperty, getMaxScale()));    }    public void setName(String name) {        super.setName(name);        BeanContext bc = getBeanContext();        if (bc != null && bc instanceof MapHandler) {            LayerHandler lh = (LayerHandler) ((MapHandler) bc).get("com.bbn.openmap.LayerHandler");            if (lh != null) {                lh.setLayers();            }        }    }    /**     * PropertyConsumer method, to fill in a Properties object,     * reflecting the current values of the layer. If the layer has a     * propertyPrefix set, the property keys should have that prefix     * plus a separating '.' prepended to each propery key it uses for     * configuration.     *      * @param props a Properties object to load the PropertyConsumer     *        properties into. If props 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 getProperties(Properties props) {        if (props == null) {            props = new Properties();        }        String prefix = PropUtils.getScopedPropertyPrefix(propertyPrefix);        props.put(prefix + "class", this.getClass().getName());        String prettyName = getName();        if (prettyName != null) {            props.put(prefix + PrettyNameProperty, prettyName);        }        props.put(prefix + AutoPaletteProperty,                new Boolean(autoPalette).toString());        props.put(prefix + AddAsBackgroundProperty,                new Boolean(addAsBackground).toString());        props.put(prefix + RemovableProperty, new Boolean(removable).toString());        props.put(prefix + AddToBeanContextProperty,                new Boolean(addToBeanContext).toString());        if (getMinScale() != Float.MIN_VALUE) {            props.put(prefix + MinScaleProperty, Float.toString(getMinScale()));        }        if (getMaxScale() != Float.MAX_VALUE) {            props.put(prefix + MaxScaleProperty, Float.toString(getMaxScale()));        }        return props;    }    /**     * Method to fill in a Properties object with values reflecting     * the 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.). For Layer, this method should at least return the     * 'prettyName' property.     *      * @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) {        if (list == null) {            list = new Properties();        }        list.put("class", "Class Name used for Layer.");        list.put("class.editor",                "com.bbn.openmap.util.propertyEditor.NonEditablePropertyEditor");        String internString = i18n.get(Layer.class,                PrettyNameProperty,                I18n.TOOLTIP,                "Presentable name for Layer");        list.put(PrettyNameProperty, internString);        internString = i18n.get(Layer.class, PrettyNameProperty, "Layer Name");        list.put(PrettyNameProperty + LabelEditorProperty, internString);        list.put(PrettyNameProperty + ScopedEditorProperty,                "com.bbn.openmap.util.propertyEditor.NonEditablePropertyEditor");        internString = i18n.get(Layer.class,                AutoPaletteProperty,                I18n.TOOLTIP,                "Flag to automatically display palette when properties are set");        list.put(AutoPaletteProperty, internString);        internString = i18n.get(Layer.class,                AutoPaletteProperty,                "Open Palette At Start");        list.put(AutoPaletteProperty + LabelEditorProperty, internString);        list.put(AutoPaletteProperty + ScopedEditorProperty,                "com.bbn.openmap.util.propertyEditor.YesNoPropertyEditor");        internString = i18n.get(Layer.class,                AddAsBackgroundProperty,                I18n.TOOLTIP,                "Flag to use the layer as a background layer");        list.put(AddAsBackgroundProperty, internString);        internString = i18n.get(Layer.class,                AddAsBackgroundProperty,                "Background");        list.put(AddAsBackgroundProperty + LabelEditorProperty, internString);        list.put(AddAsBackgroundProperty + ScopedEditorProperty,                "com.bbn.openmap.util.propertyEditor.YesNoPropertyEditor");        internString = i18n.get(Layer.class,                RemovableProperty,                I18n.TOOLTIP,                "Flag to allow layer to be deleted.");        list.put(RemovableProperty, internString);        internString = i18n.get(Layer.class, RemovableProperty, "Removable");        list.put(RemovableProperty + LabelEditorProperty, internString);        list.put(RemovableProperty + ScopedEditorProperty,                "com.bbn.openmap.util.propertyEditor.YesNoPropertyEditor");        internString = i18n.get(Layer.class,                AddToBeanContextProperty,                I18n.TOOLTIP,                "Flag to give the layer access to all of the other application components.");        list.put(AddToBeanContextProperty, internString);        internString = i18n.get(Layer.class,                AddToBeanContextProperty,                "Add to MapHandler");        list.put(AddToBeanContextProperty + LabelEditorProperty, internString);        list.put(AddToBeanContextProperty + ScopedEditorProperty,                "com.bbn.openmap.util.propertyEditor.YesNoPropertyEditor");        internString = i18n.get(Layer.class,                MinScaleProperty,                I18n.TOOLTIP,                "Minimum projection scale value that the layer will respond to.");        list.put(MinScaleProperty, internString);        internString = i18n.get(Layer.class,                MinScaleProperty,                "Minimum Scale Value");        list.put(MinScaleProperty + LabelEditorProperty, internString);        internString = i18n.get(Layer.class,                MaxScaleProperty,                I18n.TOOLTIP,                "Maximum projection scale value that the layer will respond to.");        list.put(MaxScaleProperty, internString);        internString = i18n.get(Layer.class,                MaxScaleProperty,                "Maximum Scale Value");        list.put(MaxScaleProperty + LabelEditorProperty, internString);        return list;    }    /**     * Set the property key prefix that should be used by the     * PropertyConsumer. The prefix, along with a '.', should be     * prepended to the property keys known by the PropertyConsumer.     *      * @param prefix the prefix String.     */    public void setPropertyPrefix(String prefix) {        propertyPrefix = prefix;    }    /**     * Get the property key prefix that is being used to prepend to     * the property keys for Properties lookups.     *      * @return the property prefix for the layer     */    public String getPropertyPrefix() {        return propertyPrefix;    }    /**     * Set the projection the layer should use for calculations. You     * probably don't need this if you are wondering if you do. Call     * setProjection(projEvent) instead.     */    public void setProjection(Projection proj) {        projection = proj;    }    /**     * This method lets you take the ProjectionEvent received from the     * MapBean, and lets you know if you should do something with it.     * MUST to be called in the projectionChanged() method of your     * layer, if you want to refer to the projection later. If this     * methods returns null, you probably just want to call repaint()     * if your layer.paint() method is ready to paint what it should.     *      * @param projEvent the ProjectionEvent from the     *        ProjectionListener method.     * @return The new Projection if it is different from the one we     *         already have, null if is the same as the current one.     */    public Projection setProjection(ProjectionEvent projEvent) {        Projection newProjection = projEvent.getProjection();        if (!newProjection.equals(getProjection())) {            Projection clone = newProjection.makeClone();            setProjection(clone);            return clone;        } else {            return null;        }    }    /**     * Get the latest projection.     */    public Projection getProjection() {        return projection;    }    /**     * Returns the MapMouseListener object that handles the mouse     * events. This method is IGNORED in this class: it returns null.     * Derived Layers should return the appropriate object if they     * desire to receive MouseEvents. The easiest thing for a Layer to     * do in order to receive MouseEvents is to implement the     * MapMouseListener interface and return itself. A code snippet:     * <code><pre>     * public MapMouseListener getMapMouseListener() {     *     return this;     * }     *      * public String[] getMouseModeServiceList() {     *     return new String[] { SelectMouseMode.modeID };     * }     * </pre></code>     *      * @return null     */    public MapMouseListener getMapMouseListener() {        return null;    }    /**     * Gets the gui controls associated with the layer. This default     * implementation returns null indicating that the layer has no     * gui controls.     *      * @return java.awt.Component or null     */    public Component getGUI() {        return null;    }    // /////////////////////////////////////////////////    // InfoDisplay Handling Setup and Firing    /**     * Adds a listener for <code>InfoDisplayEvent</code>s.     *      * @param aInfoDisplayListener the listener to add     */    public synchronized void addInfoDisplayListener(                                                    InfoDisplayListener aInfoDisplayListener) {        if (IDListeners == null) {            IDListeners = new ListenerSupport(this);        }        IDListeners.addListener(aInfoDisplayListener);    }    /**     * Removes an InfoDisplayListener from this Layer.     *      * @param aInfoDisplayListener the listener to remove     */    public synchronized void removeInfoDisplayListener(                                                       InfoDisplayListener aInfoDisplayListener) {        if (IDListeners != null) {            IDListeners.removeListener(aInfoDisplayListener);        }    }    /**     * Sends a request to the InfoDisplayListener to show the     * information in the InfoDisplay event on an single line display     * facility.     *      * @param evt the InfoDisplay event carrying the string.     */    public void fireRequestInfoLine(InfoDisplayEvent evt) {        if (IDListeners != null) {            for (Iterator it = IDListeners.iterator(); it.hasNext();) {                ((InfoDisplayListener) it.next()).requestInfoLine(evt);            }        } else if (Debug.debugging("layer")) {            Debug.output(getName()                    + "|Layer.fireRequestInfoLine(): no info request listener!");        }    }    /**     * Sends a request to the InfoDisplay listener to display the     * information on an single line display facility. The     * InfoDisplayEvent is created inside this function.     *      * @param infoLine the string to put in the InfoDisplayEvent.     */    public void fireRequestInfoLine(String infoLine) {        fireRequestInfoLine(new InfoDisplayEvent(this, infoLine));    }    /**     * Sends a request to the InfoDisplay listener to display the     * information on an single line display facility at preferred     * location. The InfoDisplayEvent is created inside this function.     *      * @param infoLine the string to put in the InfoDisplayEvent.     * @param loc the index of a preferred location, starting at 0.     */    public void fireRequestInfoLine(String infoLine, int loc) {        fireRequestInfoLine(new InfoDisplayEvent(this, infoLine, loc));    }    /**     * Sends a request to the InfoDisplay listener to display the     * information in the InfoDisplay event in a Browser.     *      * @param evt the InfoDisplayEvent holding the contents to put in     *        the Browser.     */    public void fireRequestBrowserContent(InfoDisplayEvent evt) {        if (IDListeners != null) {            for (Iterator it = IDListeners.iterator(); it.hasNext();) {                ((InfoDisplayListener) it.next()).requestBrowserContent(evt);            }        } else if (Debug.debugging("layer")) {            Debug.output(getName()                    + "|Layer.fireRequestBrowserContent(): no info request listener!");        }    }    /**     * Sends a request to the InfoDisplayListener to display the     * information in a Browser. The InfoDisplayEvent is created here     * holding the browserContent     *      * @param browserContent the contents to put in the Browser.     */    public void fireRequestBrowserContent(String browserContent) {        fireRequestBrowserContent(new InfoDisplayEvent(this, browserContent));    }    /**     * Sends a request to the InfoDisplayListener to display a URL     * given in the InfoDisplay event in a Browser.     *      * @param evt the InfoDisplayEvent holding the url location to     *        give to the Browser.     */    public void fireRequestURL(InfoDisplayEvent evt) {        if (IDListeners != null) {            for (Iterator it = IDListeners.iterator(); it.hasNext();) {                ((InfoDisplayListener) it.next()).requestURL(evt);            }        } else if (Debug.debugging("layer")) {            Debug.output(getName()                    + "|Layer.fireRequestURL(): no info request listener!");        }    }    /**     * Sends a request to the InfoDisplayListener to display a URL in     * a browser. The InfoDisplayEvent is created here, and the URL     * location is put inside it.     *      * @param url the url location to give to the Browser.     */    public void fireRequestURL(String url) {        fireRequestURL(new InfoDisplayEvent(this, url));    }    /**     * Sends a request to the InfoDisplayListener to show a specific     * cursor over its component area.

⌨️ 快捷键说明

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