Package org.locationtech.udig.project.internal

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


        layer.setResourceID(resourceID);

        // process the style content extension point to initially populate
        // the style blackboard with style info
        // TODO: the style objects need access to preference system
        final Layer theLayer = layer;

        ICatalog localCatalog = local;
        ID layerResourceID = layer.getResourceID();
        IProgressMonitor monitor = ProgressManager.instance().get();
        List<IResolve> resolves = localCatalog.find(layerResourceID, monitor);
        if (resolves.isEmpty()) {
            // Identifier lookup is being inconsistent; this often happens when code trips up over
            // converting URLs to and from Files
            throw new IOException("Could not find " + layerResourceID + " in local catalog");
        }
        EList resources = new EDataTypeUniqueEList(IGeoResource.class, this,
                ProjectPackage.LAYER__GEO_RESOURCES);
        LayerResource preferredResource = null;
        for (IResolve resolve : resolves) {
            if (resolve instanceof IGeoResource) {
                LayerResource layerResource = new LayerResource((LayerImpl) layer,
                        (IGeoResource) resolve);
                if (resolve.getID().equals(layerResourceID)) {
                    resources.add(0, layerResource);
                } else {
                    resources.add(layerResource);
                }
                if (resolve == resource) {
                    preferredResource = layerResource;
                }
            }
        }
        // This is the total list of resources capable of providing information
        ((LayerImpl) layer).geoResources = resources;

        // This is the "best" match; usually the one the user supplied
        layer.setGeoResource(preferredResource);

        // determine the default colour
        ColourScheme colourScheme = getColorScheme();
        Color colour = colourScheme.addItem(theLayer.getID().toString());
        theLayer.setDefaultColor(colour);

        runLayerCreatedInterceptor(layer);

        return layer;
    }
View Full Code Here


            for( SimpleFeature feature : current ) {
                if (feature == null || feature.getFeatureType().getGeometryDescriptor() == null)
                    continue;
                DrawFeatureCommand command = null;
                if (feature instanceof IAdaptable) {
                    Layer layer = (Layer) ((IAdaptable) feature).getAdapter(Layer.class);
                    if (layer != null)
                        try {
                            command = new DrawFeatureCommand(feature, layer);
                        } catch (IOException e) {
                            // do nothing... thats life
View Full Code Here

        }
       
        if (obj != null && obj instanceof LayerLegendItem) {

            final LayerLegendItem layerItem = (LayerLegendItem) obj;
            final Layer layer = layerItem.getLayer();
            if (Notification.ADD == eventType) {
                if (LegendViewUtils.isGridLayer(layer)) {
                    if (this.isLegendViewAddingGrid) {
                        layer.setVisible(false);
                        this.isLegendViewAddingGrid = false;
                    }
                    addGridLayer(layer);
                }
            } else if (Notification.REMOVE == eventType) {
View Full Code Here

        super();
        setSize(new Point(500, 450));
    }

    public void createPageContent( Composite parent ) {
        Layer layer = getSelectedLayer();
        IGeoResource resource = layer.getGeoResource();

        if (resource.canResolve(GridCoverage.class)) {
            editorSupported = true;
        } else {
            editorSupported = false;
        }

        GridLayout gridLayout = new GridLayout(1, false);
        gridLayout.marginBottom = 0;
        gridLayout.marginHeight = 0;
        gridLayout.marginLeft = 0;
        gridLayout.marginRight = 0;
        gridLayout.marginTop = 0;
        gridLayout.marginWidth = 0;
        parent.setLayout(gridLayout);

        if (editorSupported) {
            colorRulesEditor = new CoverageColorEditor(parent, SWT.NONE);

            StyleBlackboard styleBlackboard = layer.getStyleBlackboard();

            Style style = (Style) styleBlackboard.get(SLDContent.ID);
            if (style == null) {
                style = createDefaultStyle();

                // put style back on blackboard
                styleBlackboard.put(SLDContent.ID, style);
                styleBlackboard.setSelected(new String[]{SLDContent.ID});
            }
            style.setName(layer.getName());
            ArrayList<CoverageRule> listOfRules = new ArrayList<CoverageRule>();
            // Rule ruleToUpdate = SLDs.getRasterSymbolizerRule(style);
            RasterSymbolizer rasterSymbolizer = SLDs.rasterSymbolizer(style);

            ColorMap colorMap = rasterSymbolizer.getColorMap();
View Full Code Here

                 * set global transparency for the map
                 */
                rasterSym.setOpacity(sB.literalExpression(colorRulesEditor.getAlphaVAlue() / 100.0));

                Style newStyle = SLD.wrapSymbolizers(rasterSym);
                Layer selLayer = getSelectedLayer();
                newStyle.setName(selLayer.getName());

                StyleBlackboard styleBlackboard = layer.getStyleBlackboard();

                // put style back on blackboard
                styleBlackboard.put(SLDContent.ID, newStyle);
View Full Code Here

    public boolean isValid() {
        return true;
    }

    public void refresh() {
        Layer layer = getSelectedLayer();
        IGeoResource resource = layer.getGeoResource();
        if (!resource.canResolve(FeatureSource.class)) {
            return;
        }

        StyleBlackboard styleBlackboard = layer.getStyleBlackboard();
        oldStyle = (Style) styleBlackboard.get(SLDContent.ID);
        if (oldStyle == null) {
            oldStyle = Utilities.createDefaultPointStyle();
        }
        DuplicatingStyleVisitor dsv = new DuplicatingStyleVisitor();
View Full Code Here

       
        IGeoResource resource = resources.get(0);
       
        Map map = ((Map)layers[0].getMap());
        LayerFactory factory = map.getLayerFactory();
        Layer outLayer = factory.createLayer(resource);
        map.getLayersInternal().add(outLayer);
    }
View Full Code Here

     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setLayer(Layer newLayer) {
        Layer oldLayer = layer;
        layer = newLayer;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET,
                    ProjectPackage.LAYER_LEGEND_ITEM__LAYER, oldLayer, layer));
    }
View Full Code Here

    public boolean isValid() {
        return true;
    }

    public void refresh() {
        Layer layer = getSelectedLayer();
        IGeoResource resource = layer.getGeoResource();
        if (!resource.canResolve(FeatureSource.class)) {
            return;
        }

        StyleBlackboard styleBlackboard = layer.getStyleBlackboard();
        style = (Style) styleBlackboard.get(SLDContent.ID);
        if (style == null) {
            style = Utilities.createDefaultPolygonStyle();
        }
        DuplicatingStyleVisitor dsv = new DuplicatingStyleVisitor();
View Full Code Here

        return;
      }else if (!(mg instanceof LegendGraphic)){
        return;
      }
     
      final Layer thislayer = layer;
     
      AdapterImpl thisAdapter = new AdapterImpl() {
        public void notifyChanged(Notification event) {
          if (event.getNotifier() instanceof Layer) {
            int eventid = event.getFeatureID(Layer.class);
            if (eventid == ProjectPackage.LAYER__STYLE_BLACKBOARD ||
                eventid == ProjectPackage.LAYER__NAME ||
                eventid == ProjectPackage.LAYER__VISIBLE ){
                updateLayer();
            }
       
          } else if (event.getNotifier() instanceof ContextModel) {
            if ( event.getFeatureID(ContextModel.class== ProjectPackage.CONTEXT_MODEL__LAYERS){
              updateLayer();
            }
          }
        }

        private void updateLayer() {
          thislayer.refresh(null);
        }
      };
      layer.getBlackboard().put(MAPGRAPHIC_ADAPTER_KEY, thisAdapter)//for removal later
      ((MapImpl)layer.getMap()).addDeepAdapter(thisAdapter);
     
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.