Examples of ILayer


Examples of org.locationtech.udig.project.ILayer

        return canImport(data2);
    }

    private boolean destinationLayerMapContainsLayer( ILayer layer ) {
        if( getDestination() instanceof ILayer ){
            ILayer dest=(ILayer) getDestination();
            if( dest.getMap().getMapLayers().contains(layer) )
                return true;
        }
        return false;
    }
View Full Code Here

Examples of org.locationtech.udig.project.ILayer

    }

    private int calculateDropPosition( ) {
        int layerpos=-1;
        if( getDestination() instanceof ILayer ){
            ILayer target=(ILayer) getDestination();
            ViewerDropLocation location = getViewerLocation();
            layerpos = target.getZorder();
           
            if (location == ViewerDropLocation.NONE) {
                layerpos=0;
            }
View Full Code Here

Examples of org.locationtech.udig.project.ILayer

        this.snapBehaviour=PreferenceUtil.instance().getSnapBehaviour();
    }

    public void run( IProgressMonitor monitor ) throws Exception {
        if (command == null) {
            ILayer selectedLayer = handler.getEditLayer();
            EditBlackboard editBlackboard = handler.getEditBlackboard(selectedLayer);
           
            Coordinate destinationCoord=null;
            Point dest;
            destinationCoord = calculateDestinationPoint(editBlackboard, destinationCoord);
View Full Code Here

Examples of org.locationtech.udig.project.ILayer

     */
    public Coordinate snapToGrid( Point centerPoint, IMap map )  {
        List<ILayer> layers = map.getMapLayers();
       
        // by default choose something that will work
        ILayer found=layers.get(0);
        GridMapGraphic graphic=new GridMapGraphic();
        for( ILayer layer : layers ) {
            if( layer.hasResource(GridMapGraphic.class) ){
                found = layer;
                try {
View Full Code Here

Examples of org.locationtech.udig.project.ILayer

        if (!layer.hasResource(FeatureSource.class) ||
                !layer.getInteraction(Interaction.EDIT)
                || !layer.isVisible() )
            return null;
       
        ILayer editLayer = context.getEditManager().getEditLayer();
        SimpleFeature editFeature=context.getEditManager().getEditFeature();
        String editFeatureID=null;
        if( editFeature!=null )
            editFeatureID=editFeature.getID();
       
View Full Code Here

Examples of org.locationtech.udig.project.ILayer

        catch (IOException notAvailable){           
        }       
    }

    private void makeGraphVisible( IMap map ) throws IOException {
        ILayer graphLayer = null;
        ILayer pathLayer = null;
       
        ID GRAPH_ID = new ID(new URL( null, GraphMapGraphic.ID, CorePlugin.RELAXED_HANDLER ));           
        ID PATH_ID =  new ID(new URL( null, PathMapGraphic.ID, CorePlugin.RELAXED_HANDLER ));           
        
        for( ILayer look : map.getMapLayers() ){
            URL id = look.getGeoResource().getIdentifier();
            if(GRAPH_ID.equals(id) ){
                graphLayer = look;
                break;
            }
        }
        if( graphLayer == null ){           
            ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
            IGeoResource resource = catalog.getById(IGeoResource.class, GRAPH_ID, new NullProgressMonitor() );
            if( resource == null ){
                return; // not available?
            }
            List<IGeoResource> resourceList = Collections.singletonList( resource );           
            List< ? extends ILayer> added = ApplicationGIS.addLayersToMap(map, resourceList, 0 );
            if( added.isEmpty() ){
                return; // not available?
            }
            graphLayer = (ILayer) added.get(0);           
        }
        if( !graphLayer.isVisible() ){
            map.sendCommandASync( new SetLayerVisibilityCommand(graphLayer, true) );
        }
       
        for( ILayer look : map.getMapLayers() ){
            URL id = look.getGeoResource().getIdentifier();
            if(PATH_ID.equals(id) ){
                pathLayer = look;
                break;
            }
        }
        if( pathLayer == null ){           
            ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
            IGeoResource resource = catalog.getById(IGeoResource.class, PATH_ID, new NullProgressMonitor() );
            if( resource == null ){
                return; // not available?
            }
            List<IGeoResource> resourceList = Collections.singletonList( resource );           
            List< ? extends ILayer> added = ApplicationGIS.addLayersToMap(map, resourceList, 0 );
            if( added.isEmpty() ){
                return; // not available?
            }
            pathLayer = (ILayer) added.get(0);           
        }
        if( !pathLayer.isVisible() ){
            map.sendCommandASync( new SetLayerVisibilityCommand(pathLayer, true) );
        }
        pathLayer.refresh(null);
    }
View Full Code Here

Examples of org.locationtech.udig.project.ILayer

     *
     * @param metrics
     * @return A rating for a given metric.  The lower the rating the better fit the metric is.
     */
    private double rate( InternalRenderMetrics metrics ) {
        ILayer layer = metrics.getRenderContext().getLayer();
        final IStyleBlackboard style = layer.getStyleBlackboard();
       
        //render metrics -
        //guarenteed to be between 0 & 1 - higher better so we subtract one to get make lower better
        double renderAppearanceMetric = 1 - metrics.getUserAppearanceMetric(style);
        double userAppearanceMetric = 1 - metrics.getRenderAppearanceMetric(style);
View Full Code Here

Examples of org.locationtech.udig.project.ILayer

                diff[0]=selection.diffLayer;
            }
        });
        if( value[0]==Window.CANCEL )
            return;
        ILayer fromLayer=from[0];
        ILayer diffLayer=diff[0];
       
        if( !fromLayer.hasResource(FeatureSource.class) ){
            MessageDialog.openError(display.getActiveShell(), Messages.differenceOp_inputError1, fromLayer.getName()+Messages.differenceOp_inputError2);
            return;
        }
        if( !diffLayer.hasResource(FeatureSource.class) ){
            MessageDialog.openError(display.getActiveShell(), Messages.differenceOp_inputError1, diffLayer.getName()+Messages.differenceOp_inputError2);
            return;
        }
       
        ShapefileDataStoreFactory dsfac = new ShapefileDataStoreFactory();
        File tmp = File.createTempFile(layers[0].getName() + "_" + layers[1].getName() + "_diff", ".shp"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        DataStore ds = dsfac.createDataStore(tmp.toURL());
        final SimpleFeatureType newSchema = FeatureTypes.newFeatureType(
                fromLayer.getSchema().getAttributeDescriptors().toArray(
                        new AttributeDescriptor[0]), "diff"); //$NON-NLS-1$
        ds.createSchema(newSchema);
       
        final FeatureSource<SimpleFeatureType, SimpleFeature> fromSource = fromLayer.getResource(FeatureSource.class, monitor);
        final FeatureSource<SimpleFeatureType, SimpleFeature> diffSource = diffLayer.getResource(FeatureSource.class, monitor);
        if (isGeometryCollection(fromSource.getSchema().getGeometryDescriptor())) {
            MessageDialog.openError(display.getActiveShell(), Messages.differenceOp_inputError, fromLayer.getName() + Messages.differenceOp_multiGeoms);
            return;
        }
        if (isGeometryCollection(diffSource.getSchema().getGeometryDescriptor())) {
View Full Code Here

Examples of org.locationtech.udig.project.ILayer

                }

                if (viewer != null) {
                    // viewer.refresh(false);
                    viewer.setCheckedElements(checkedLayers.toArray());
                    ILayer selectedLayer = currentMap.getEditManager().getSelectedLayer();
                    if (selectedLayer != null)
                        viewer.setSelection(new StructuredSelection(selectedLayer), true);
                }
            }
View Full Code Here

Examples of org.locationtech.udig.project.ILayer

        if (!(event.getSelection() instanceof IStructuredSelection))
            return;
        IStructuredSelection structured = (IStructuredSelection) event.getSelection();
        Object firstElement = structured.getFirstElement();
        if (firstElement instanceof ILayer) {
            ILayer layer = ((ILayer) firstElement);
            if (layer.getStatus() == ILayer.ERROR) {
                getViewSite().getActionBars().getStatusLineManager().setErrorMessage(
                        layer.getStatusMessage());
            } else {
                getViewSite().getActionBars().getStatusLineManager().setErrorMessage(null);
                getViewSite().getActionBars().getStatusLineManager().setMessage(
                        layer.getStatusMessage());

            }
        } else {
            getViewSite().getActionBars().getStatusLineManager().setMessage(null);
            getViewSite().getActionBars().getStatusLineManager().setErrorMessage(null);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.