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

📄 omgraphichandlerlayer.java

📁 openmap java写的开源数字地图程序. 用applet实现,可以像google map 那样放大缩小地图.
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
            }            return null;        }        /**         * Called on the event dispatching thread (not on the worker         * thread) after the <code>construct</code> method has         * returned.         */        public void finished() {            workerComplete(this);            fireStatusUpdate(LayerStatusEvent.FINISH_WORKING);        }    }    /**     * Overrides the Layer setProperties method. Also calls Layer's     * version. If the ProjectionChangePolicy and RenderPolicy objects     * are set programmatically and are PropertyConsumers, they will     * still have access to properties if this method is called. Their     * property prefix will be scoped as if the OMGraphicHandlerLayer     * had them created, with their prefix being prefix + . +     * PropertyChangePolicyProperty and prefix + . +     * RenderPolicyProperty.     *      * @param prefix the token to prefix the property names     * @param props the <code>Properties</code> object     */    public void setProperties(String prefix, Properties props) {        super.setProperties(prefix, props);        String realPrefix = PropUtils.getScopedPropertyPrefix(prefix);        // Check to see if the layer wants to set its own projection        // change policy.        String pcpString = props.getProperty(realPrefix                + ProjectionChangePolicyProperty);        String policyPrefix;        if (pcpString != null) {            policyPrefix = realPrefix + pcpString;            // If the projection change policy is null, try to create            // it.            if (projectionChangePolicy == null) {                String pcpClass = props.getProperty(policyPrefix + ".class");                if (pcpClass == null) {                    Debug.error("Layer "                            + getName()                            + " has "                            + policyPrefix                            + " property defined in properties for PropertyChangePolicy, but "                            + policyPrefix + ".class property is undefined.");                } else {                    Object obj = ComponentFactory.create(pcpClass,                            policyPrefix,                            props);                    if (obj != null) {                        if (Debug.debugging("layer")) {                            Debug.output("Layer " + getName()                                    + " setting ProjectionChangePolicy ["                                    + obj.getClass().getName() + "]");                        }                        try {                            setProjectionChangePolicy((ProjectionChangePolicy) obj);                        } catch (ClassCastException cce) {                            Debug.error("Layer "                                    + getName()                                    + " has "                                    + policyPrefix                                    + " property defined in properties for ProjectionChangePolicy, but "                                    + policyPrefix                                    + ".class property ("                                    + pcpClass                                    + ") does not define a valid ProjectionChangePolicy. A "                                    + obj.getClass().getName()                                    + " was created instead.");                        }                    } else {                        Debug.error("Layer "                                + getName()                                + " has "                                + policyPrefix                                + " property defined in properties for PropertyChangePolicy, but "                                + policyPrefix                                + ".class property does not define a valid PropertyChangePolicy.");                    }                }            } else { // ProjectionChangePolicy is not null...                // If the projection change policy is not null and the                // policy is a PropertyConsumer, pass the properties                // to the policy. Note that the property prefix for                // the policy is prefix +                // ProjectionChangePolicyProperty                if (projectionChangePolicy instanceof PropertyConsumer) {                    ((PropertyConsumer) projectionChangePolicy).setProperties(policyPrefix,                            props);                }            }        } else if (Debug.debugging("layer")) {            Debug.output("Layer " + getName()                    + " using default ProjectionChangePolicy ["                    + getProjectionChangePolicy().getClass().getName() + "]");        }        // Check to see if the layer want to set its own rendering        // policy.        String rpString = props.getProperty(realPrefix + RenderPolicyProperty);        if (rpString != null) {            policyPrefix = realPrefix + rpString;            if (renderPolicy == null) {                String rpClass = props.getProperty(policyPrefix + ".class");                if (rpClass == null) {                    Debug.error("Layer "                            + getName()                            + " has "                            + policyPrefix                            + " property defined in properties for RenderPolicy, but "                            + policyPrefix + ".class property is undefined.");                } else {                    Object rpObj = ComponentFactory.create(rpClass,                            policyPrefix,                            props);                    if (rpObj != null) {                        if (Debug.debugging("layer")) {                            Debug.output("Layer " + getName()                                    + " setting RenderPolicy ["                                    + rpObj.getClass().getName() + "]");                        }                        try {                            setRenderPolicy((RenderPolicy) rpObj);                        } catch (ClassCastException cce) {                            Debug.error("Layer "                                    + getName()                                    + " has "                                    + policyPrefix                                    + " property defined in properties for RenderPolicy, but "                                    + policyPrefix                                    + ".class property ("                                    + rpClass                                    + ") does not define a valid RenderPolicy. A "                                    + rpObj.getClass().getName()                                    + " was created instead.");                        }                    } else {                        Debug.error("Layer "                                + getName()                                + " has "                                + policyPrefix                                + " property defined in properties for RenderPolicy, but "                                + policyPrefix + ".class property (" + rpClass                                + ") isn't being created.");                    }                }            } else { // RenderPolicy is not null...                // Same thing with renderPolicy as with projection                // change policy.                if (renderPolicy instanceof PropertyConsumer) {                    ((PropertyConsumer) renderPolicy).setProperties(policyPrefix,                            props);                }            }        } else if (Debug.debugging("layer")) {            Debug.output("Layer " + getName() + " using default RenderPolicy ["                    + getRenderPolicy().getClass().getName() + "]");        }        String mmString = props.getProperty(realPrefix + MouseModesProperty);        if (mmString != null) {            Vector mmv = PropUtils.parseSpacedMarkers(mmString);            if (mmv.size() > 0) {                String[] mm = new String[mmv.size()];                Iterator it = mmv.iterator();                int i = 0;                while (it.hasNext()) {                    mm[i] = (String) it.next();                }                setMouseModeIDsForEvents(mm);            }        }        consumeEvents = PropUtils.booleanFromProperties(props, realPrefix                + ConsumeEventsProperty, consumeEvents);    }    /**     * Overrides Layer getProperties method., also calls that method     * on Layer. Sets the properties from the policy objects used by     * this OMGraphicHandler layer.     */    public Properties getProperties(Properties props) {        props = super.getProperties(props);        String prefix = PropUtils.getScopedPropertyPrefix(this);        String policyPrefix = null;        // //// ProjectionChangePolicy        ProjectionChangePolicy pcp = getProjectionChangePolicy();        if (pcp instanceof PropertyConsumer) {            policyPrefix = ((PropertyConsumer) pcp).getPropertyPrefix();            ((PropertyConsumer) pcp).getProperties(props);        }        if (policyPrefix == null) {            policyPrefix = prefix + "pcp";        }        // Whoops, need to make sure pcp is valid but removing the        // OMGHL prefix from the front of the policy prefix (if        // applicable). Same for RenderPolicy        props.put(prefix + ProjectionChangePolicyProperty,                policyPrefix.substring(prefix.length()));        // This has to come after the above line, or the above        // property will have a trailing period.        policyPrefix = PropUtils.getScopedPropertyPrefix(policyPrefix);        props.put(policyPrefix + "class", pcp.getClass().getName());        RenderPolicy rp = getRenderPolicy();        if (rp instanceof PropertyConsumer) {            policyPrefix = ((PropertyConsumer) rp).getPropertyPrefix();            ((PropertyConsumer) rp).getProperties(props);        }        // /// RenderPolicy        if (policyPrefix == null) {            policyPrefix = prefix + "rp";        }        props.put(prefix + RenderPolicyProperty,                policyPrefix.substring(prefix.length()));        // This has to come after the above line, or the above        // property will have a trailing period.        policyPrefix = PropUtils.getScopedPropertyPrefix(policyPrefix);        props.put(policyPrefix + "class", rp.getClass().getName());        props.put(prefix + ConsumeEventsProperty,                new Boolean(consumeEvents).toString());        String[] mm = getMouseModeIDsForEvents();        if (mm != null && mm.length > 0) {            StringBuffer sb = new StringBuffer();            for (int i = 0; i < mm.length; i++) {                // Don't need any MouseModes that have been scoped to                // the pretty name, those are automatically generated.                if (mm[i].equals(getName())) {                    continue;                }                sb.append(mm[i] + " ");            }            props.put(prefix + MouseModesProperty, sb.toString());        }        return props;    }    /**     * Overrides Layer getProperties method., also calls that method     * on Layer. Sets the properties from the policy objects used by     * this OMGraphicHandler layer.     */    public Properties getPropertyInfo(Properties list) {        list = super.getPropertyInfo(list);        String policyPrefix = null;        ProjectionChangePolicy pcp = getProjectionChangePolicy();        if (pcp instanceof PropertyConsumer) {            policyPrefix = ((PropertyConsumer) pcp).getPropertyPrefix();            if (policyPrefix != null) {                int index = policyPrefix.indexOf(".");                if (index != -1) {                    policyPrefix = policyPrefix.substring(index + 1);                }                ((PropertyConsumer) pcp).getPropertyInfo(list);            }        }        if (policyPrefix == null) {            policyPrefix = "pcp";        }        list.put(policyPrefix + ".class",                "Class name of ProjectionChangePolicy (optional)");        RenderPolicy rp = getRenderPolicy();        if (rp instanceof PropertyConsumer) {            policyPrefix = ((PropertyConsumer) rp).getPropertyPrefix();            if (policyPrefix != null) {                int index = policyPrefix.indexOf(".");                if (index != -1) {                    policyPrefix = policyPrefix.substring(index + 1);                }            }            ((PropertyConsumer) rp).getPropertyInfo(list);        } else {        }        if (policyPrefix == null) {            policyPrefix = "rp";        }        list.put(policyPrefix + ".class",                "Class name of RenderPolicy (optional)");        list.put(ConsumeEventsProperty,                "Flag that tells the layer to consume MouseEvents, or let others use them as well.");        list.put(ConsumeEventsProperty + ScopedEditorProperty,                "com.bbn.openmap.util.propertyEditor.OnOffPropertyEditor");        list.put(MouseModesProperty,                "Space-separated list of MouseMode IDs to receive events from.");        return list;    }    /**     * The MapMouseInterpreter used to catch the MapMouseEvents and     * direct them to layer as referencing certain OMGraphics.     * Mananges how the layer responds to mouse events.     */    protected MapMouseInterpreter mouseEventInterpreter = null;    /**     * Set the interpreter used to field and interpret MouseEvents,     * thereby calling GestureResponsePolicy methods on this layer.     */

⌨️ 快捷键说明

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