Package org.locationtech.udig.project.internal

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


        return true;
    }

    @Override
    public void perform( IProgressMonitor monitor ) {
        Layer destinationLayer;
        IMap destinationMap;
       
        if( getDestination() instanceof IMap ){
            destinationMap=(IMap) getDestination();
            destinationLayer=(Layer) destinationMap.getEditManager().getSelectedLayer();
        }else if( getDestination() instanceof Layer ){
            destinationLayer=(Layer)getDestination();
            destinationMap=destinationLayer.getMap();
        }else {
            return;
        }
       
        if( getData() instanceof IAdaptable ){
View Full Code Here


*/
public class MoveLayerDropAction extends IDropAction {

    @Override
    public boolean accept() {
        Layer layer = toLayer(this);
        if (layer==null ) return false;
        Object destination2 = getDestination();
        if (destination2 instanceof LayersView || destination2 instanceof MapEditorPart) {
            destination2=ApplicationGIS.getActiveMap();
        }
        return layer.getMap()!=destination2;
    }
View Full Code Here

        }
        return layer.getMap()!=destination2;
    }

     static Layer toLayer(IDropAction action) {
        Layer layer;
        if ( action.getData() instanceof Layer ){
            layer=(Layer) action.getData();
        }else {
           Object[] layers= (Object[])action.getData();
           layer=(Layer) layers[0];
           // check that all layers are from same map
           for( Object layer2 : layers ) {
               if (((ILayer) layer2).getMap()!=layer.getMap() )
                   return null;
           }
        }
        return layer;
    }
View Full Code Here

        @Override
        public boolean select( Viewer viewer, Object parentElement, Object element ) {
            if (element instanceof LayerLegendItem) {
                final LayerLegendItem layerItem = (LayerLegendItem) element;
                final Layer layer = layerItem.getLayer();
                if (!this.showLayer && isLayerType(layer)) {
                    return false;

                }
            }
View Full Code Here

        }
        return false;
    }

    protected boolean getStyle(){
        Layer layer = getLayer();
        assert( canStyle( layer ));
       
        Boolean isCached = (Boolean) getStyleBlackboard().get( CacheContent.ID );
       
        if( isCached == null ){
View Full Code Here

    /*
     * Called when new layer and blackbard values are available. <p> This provides update
     * information as a callback (rather than an event listener). </p>
     */
    protected void refresh() {
        Layer layer = getLayer();
        if (!canStyle(layer)) {
            throw new IllegalStateException("Hey I can't style " + layer); //$NON-NLS-1$
        }
        // pull the sld style off the blackboard, and initialize the cm
        Style style = (Style) getStyleBlackboard().get(SLDContent.ID);
       
        // if no style information, create default
        if (style == null) {
            style = SLDContent.createDefaultStyle();
            getStyleBlackboard().put(SLDContent.ID, style);
        }
        sldContentManager.init(SLDContent.getStyleBuilder(), style);
       
        // pull the feature type name out of the layer
        if (layer.getSchema() != null) {
            SimpleFeatureType featureType = layer.getSchema();
       
            //set the name of the feature type style for the feature renderer
            String name = featureType.getName().getLocalPart();
            sldContentManager.getDefaultFeatureTypeStyle().setFeatureTypeName(SLDs.GENERIC_FEATURE_TYPENAME);
        }
View Full Code Here

   
    // this is a workaround to provoke an event in the layer view that could be catch by the CoordToolPropertyValue 
    CoordToolPropertyValue.setVisible(false);

    EditManagerImpl editManager = (EditManagerImpl) ApplicationGIS.getActiveMap().getEditManager();
    Layer layer = editManager.getSelectedLayer();
    editManager.setSelectedLayerGen(layer);
  }
View Full Code Here

     * Grab the FilterStyle from the style blackboard (may be empty).
     *
     * @return FilterStyle from style blackboard (may be empty)
     */
    protected FilterStyle getFilterStyle() {
        Layer layer = getLayer();
        if( !canStyle(layer)){
            throw new IllegalStateException("Layer "+layer.getName()+" cannot be filtered" );
        }
       
        FilterStyle current = (FilterStyle) getStyleBlackboard().get(STYLE_ID);
        if (current == null) {
            return new FilterStyle(); // not available
View Full Code Here

      private void replaceLayer(IGeoResource resource,
          Collection<IGeoResource> exported) {
        List<Layer> layers = MapPaletteSaveStrategy.this.editor.getMap()
            .getLayersInternal();
        Layer found;
        do {
          found = null;
          for (Layer layer : layers) {
            if (URLUtils.urlEquals(layer.getID(), resource
                .getIdentifier(), false)) {
              found = layer;
              break;
            }
          }

          if (found != null) {
            layers.addAll(layers.indexOf(found), toLayers(found,
                exported));
            layers.remove(found);
          }
        } while (found != null);

      }

      private Collection<Layer> toLayers(Layer found,
          Collection<IGeoResource> exported) {
        LayerFactory layerFactory = MapPaletteSaveStrategy.this.editor
            .getMap().getLayerFactory();
        Collection<Layer> newLayers = new ArrayList<Layer>();

        for (IGeoResource exportedResource : exported) {
          try {
            Layer createLayer = layerFactory
                .createLayer(exportedResource);
            StyleBlackboard clone = (StyleBlackboard) found
                .getStyleBlackboard().clone();
            createLayer.setStyleBlackboard(clone);
            newLayers.add(createLayer);
          } catch (IOException e) {
            throw (RuntimeException) new RuntimeException()
                .initCause(e);
          }
View Full Code Here

        }
        /**
         * @see org.eclipse.jface.action.Action#isEnabled()
         */
        public boolean isEnabled() {
            Layer layer = getLayer();
            if (layer == null)
                return false;

            return SLD.getSupportedTypes(layer).contains(getContentType());
        }
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.