Package org.locationtech.udig.project.internal

Examples of org.locationtech.udig.project.internal.Layer


            notifications.add(newNotification);
            Collections.sort(notifications, new Comparator<Notification>() {

                public int compare(Notification o1, Notification o2) {
                    Layer layer1 = (Layer) o1.getNotifier();
                    Layer layer2 = (Layer) o2.getNotifier();
                    return layer1.compareTo(layer2);
                }

            });
            return true;
View Full Code Here


                        break;
                    }
                    case Notification.REMOVE: {
                        final Object eventOldObj = msg.getOldValue();
                        if (eventOldObj instanceof Layer) {
                            final Layer layer = (Layer) eventOldObj;
                            removeLayerLegendItem(layer);
                        }
                        break;
                    }
                    }
View Full Code Here

            if (result == null)
                result = defaultCase(theEObject);
            return result;
        }
        case ProjectPackage.LAYER: {
            Layer layer = (Layer) theEObject;
            T result = caseLayer(layer);
            if (result == null)
                result = caseILayer(layer);
            if (result == null)
                result = caseIAdaptable(layer);
View Full Code Here

    public void addDeepAdapter( Adapter adapter ) {
        deepAdapters.add(adapter);
        if (!owner.eAdapters().contains(adapter))
            owner.eAdapters().add(adapter);
        for( Object object : this ) {
            Layer layer = (Layer) object;
            if (!layer.eAdapters().contains(adapter))
                layer.eAdapters().add(adapter);
        }
    }
View Full Code Here

        if (ProjectPlugin.isDebugging(Trace.MODEL))
            ProjectPlugin
                    .trace(
                            getClass(),
                            "Adding " + ((Layer) object).getID() + " to map " + getMap().getName() + " at location: " + index, null); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
        Layer object2 = super.assign(index, object);
        if (ProjectPlugin.isDebugging(Trace.MODEL))
            ProjectPlugin.trace(getClass(), "Resulting list=" + this, null); //$NON-NLS-1$

        return object2;
    }
View Full Code Here

        super.doClear();
    }

    private void removeAllInterceptors( Collection<?> c ) {
        for( Iterator<?> iter = c.iterator(); iter.hasNext(); ) {
            Layer element = (Layer) iter.next();
            runLayerInterceptor(element, "layerRemoved"); //$NON-NLS-1$
            element.eAdapters().removeAll(deepAdapters);
        }
    }
View Full Code Here

            element.eAdapters().removeAll(deepAdapters);
        }
    }

    private void runAddInterceptors( Object element ) {
        Layer layer = (Layer) element;
        for( Adapter deepAdapter : deepAdapters ) {
            if (!layer.eAdapters().contains(deepAdapter))
                layer.eAdapters().add(deepAdapter);
        }
        runLayerInterceptor(layer, LayerInterceptor.ADDED_ID);
    }
View Full Code Here

    }

    private void runRemoveInterceptor( Object remove ) {
        if (remove == null || !contains(remove))
            return;
        Layer layer = (Layer) remove;
        runLayerInterceptor(layer, LayerInterceptor.REMOVED_ID);
        (layer).eAdapters().removeAll(deepAdapters);
    }
View Full Code Here

    /**
     * @param resource
     * @param map
     */
    static private void processFeatureType( Element resource, Map map ) {
        Layer layer;
        String hidden = resource.getAttributeValue("hidden"); //$NON-NLS-1$
        String name = resource.getChildTextTrim("Name", oc); //$NON-NLS-1$
        String title = resource.getChildTextTrim("Title", oc); //$NON-NLS-1$
        String min = resource.getChildTextTrim("MinScaleDenominator", sld); //$NON-NLS-1$
        String max = resource.getChildTextTrim("MaxScaleDenominator", sld); //$NON-NLS-1$
        String srs = resource.getChildTextTrim("SRS", oc); //$NON-NLS-1$

        Element server = resource.getChild("Server", oc); //$NON-NLS-1$
        String service = server.getAttributeValue("service"); // should be OGC:WMS //$NON-NLS-1$
        String servertitle = server.getAttributeValue("title"); //$NON-NLS-1$
        String serverversion = server.getAttributeValue("version"); // eg 1.1.1 //$NON-NLS-1$

        Element onlineResouce = server.getChild("OnlineResource", oc); //$NON-NLS-1$
        String method = onlineResouce.getAttributeValue("method"); // url //$NON-NLS-1$
        String href = onlineResouce.getAttributeValue("href", xlink); // url //$NON-NLS-1$
        try {
            href = URLDecoder.decode(href, "US-ASCII"); //$NON-NLS-1$
        } catch (UnsupportedEncodingException ex) {
            System.out.println(ex.toString());
            ex.printStackTrace();
        }
        String type = onlineResouce.getAttributeValue("type", xlink); // eg simple //$NON-NLS-1$
        try {
            URL url = new URL(href
                    + "?SERVICE=WFS&VERSION=" + serverversion + "&REQUEST=GetCapabilities"); //$NON-NLS-1$ //$NON-NLS-2$
            IGeoResource georesource = findResource(url, name);
            if (georesource == null) {
                layer = ProjectFactory.eINSTANCE.createLayer();
                layer.setID(new URL(url + "#" + name)); //$NON-NLS-1$
            } else
                layer = map.getLayerFactory().createLayer(georesource);
        } catch (IOException e) {
            System.out.println("Skip " + name + " due to " + e); //$NON-NLS-1$ //$NON-NLS-2$
            return;
        }

        if (hidden != null) {
            layer.setVisible(!"0".equals(hidden)); //$NON-NLS-1$
        }
        layer.setName(title != null ? title : name);
        if (min != null)
            layer.setMinScaleDenominator(Double.parseDouble(min));
        if (max != null)
            layer.setMaxScaleDenominator(Double.parseDouble(max));

        try {
            layer.setCRS(CRS.decode(srs));
        } catch (Throwable ignore) {
            System.out.println(name + " srs unavailable:" + srs); //$NON-NLS-1$
        }
        map.getLayersInternal().add(layer);
    }
View Full Code Here

    /**
     * @param resource
     * @param map
     */
    static private void processLayer( Element resource, Map map ) {
        Layer layer = ProjectFactory.eINSTANCE.createLayer();
        String hidden = resource.getAttributeValue("hidden"); //$NON-NLS-1$
        if (hidden != null) {
            layer.setVisible(!"0".equals(hidden)); //$NON-NLS-1$
        }
        String queryable = resource.getAttributeValue("queryable"); //$NON-NLS-1$
        if (queryable != null) {
            layer.setInteraction(Interaction.SELECT, !"0".equals(queryable)); //$NON-NLS-1$ //$NON-NLS-2$
        }

        Namespace oc = Namespace.getNamespace("http://www.opengis.net/oc"); //$NON-NLS-1$
        Namespace sld = Namespace.getNamespace("http://www.opengis.net/sld"); //$NON-NLS-1$
        Namespace xlink = Namespace.getNamespace("http://www.w3.org/1999/xlink"); //$NON-NLS-1$

        String name = resource.getChildTextTrim("Name", oc); //$NON-NLS-1$
        {
            String title = resource.getChildTextTrim("Title", oc); //$NON-NLS-1$

            layer.setName(title != null ? title : name);
        }
        {
            Element server = resource.getChild("Server", oc); //$NON-NLS-1$

            String service = server.getAttributeValue("service"); // should be OGC:WMS //$NON-NLS-1$
                                                                    // //$NON-NLS-1$
            String title = server.getAttributeValue("title"); //$NON-NLS-1$
            String version = server.getAttributeValue("version"); // eg 1.1.1 //$NON-NLS-1$

            Element onlineResouce = server.getChild("OnlineResource", oc); //$NON-NLS-1$
            String type = onlineResouce.getAttributeValue("type", xlink); // eg simple //$NON-NLS-1$
                                                                            // //$NON-NLS-1$
            String href = onlineResouce.getAttributeValue("href", xlink); // url //$NON-NLS-1$
            try {
                href = URLDecoder.decode(href, "US-ASCII"); //$NON-NLS-1$
            } catch (UnsupportedEncodingException ex) {
                System.out.println(ex.toString());
                ex.printStackTrace();
            }

            try {
                URL url = new URL(href
                        + "?SERVICE=WMS&VERSION=" + version + "&REQUEST=GetCapabilities"); //$NON-NLS-1$ //$NON-NLS-2$
                url = service(url, WebMapServer.class);

                layer.setID(new URL(url + "#" + name)); //$NON-NLS-1$
            } catch (MalformedURLException e) {
                System.out.println("Skip " + name + " due to " + e); //$NON-NLS-1$ //$NON-NLS-2$
                return;
            }
        }
        String min = resource.getChildTextTrim("MinScaleDenominator", sld); //$NON-NLS-1$
        String max = resource.getChildTextTrim("MaxScaleDenominator", sld); //$NON-NLS-1$

        if (min != null)
            layer.setMinScaleDenominator(Double.parseDouble(min));
        if (max != null)
            layer.setMaxScaleDenominator(Double.parseDouble(max));

        String srs = resource.getChildTextTrim("SRS", oc); //$NON-NLS-1$
        try {
            layer.setCRS(CRS.decode(srs));
        } catch (Throwable ignore) {
            System.out.println(name + " srs unavailable:" + srs); //$NON-NLS-1$
        }

        map.getLayersInternal().add(layer);
View Full Code Here

TOP

Related Classes of org.locationtech.udig.project.internal.Layer

Copyright © 2018 www.massapicom. 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.