Examples of ICatalog


Examples of org.locationtech.udig.catalog.ICatalog

     */
  private void addToCatalog(File destination) throws MalformedURLException {
    IServiceFactory serviceFactory = CatalogPlugin.getDefault().getServiceFactory();
    URL url = DataUtilities.fileToURL( destination );
        List<IService> services = serviceFactory.createService(url);
    ICatalog localCatalog = CatalogPlugin.getDefault().getLocalCatalog();;
    for (IService service : services) {
      localCatalog.add(service);
    }
  }
View Full Code Here

Examples of org.locationtech.udig.catalog.ICatalog

                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 );
View Full Code Here

Examples of org.locationtech.udig.catalog.ICatalog

         * @param arg0 the input data
         * @return Object[]
         */
        public Object[] getElements( Object arg0 ) {
            // add the service to the catalog
            ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
            try {
                ArrayList<IResolve> finalCatalogMembers = new ArrayList<IResolve>();
                List< ? extends IResolve> allCatalogMembers = catalog.members(null);
                for( IResolve resolve : allCatalogMembers ) {
                    if (resolve instanceof JGrassService) {
                        finalCatalogMembers.add(resolve);
                    }
                }
View Full Code Here

Examples of org.locationtech.udig.catalog.ICatalog

        if (service == null) {
            return null;
        }
        // check that the service is part of catalog... If not add
        ICatalog local = CatalogPlugin.getDefault().getLocalCatalog();
        if (local.getById(IService.class, service.getID(), new NullProgressMonitor()) == null) {
            local.add(resource.service(null));
        }

        LayerImpl layer = (LayerImpl) ProjectFactory.eINSTANCE.createLayer();

        if (layer == null) {
            throw new IOException(
                    "Unable to create layer from resource '" + resource.getIdentifier() + "'"); //$NON-NLS-1$ //$NON-NLS-2$
        }

        ID resourceID = resource.getID();
        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");
        }
View Full Code Here

Examples of org.locationtech.udig.catalog.ICatalog

            IResolve resolve = mapsetMembers.get(i);
            URL identifier = resolve.getIdentifier();
            if (mapsetIdentifier.toExternalForm().equals(identifier.toExternalForm())) {
                mapsetMembers.remove(i);

                ICatalog catalog = parent(null);
                if (catalog instanceof CatalogImpl) {
                    IResolveDelta delta = new ResolveDelta(resource, Kind.REMOVED);
                    IResolveChangeEvent event = new ResolveChangeEvent(this, Type.POST_CHANGE, delta);
                    ((CatalogImpl) catalog).fire(event);
                }
View Full Code Here

Examples of org.locationtech.udig.catalog.ICatalog

        }

        if (!jgrassMapMembers.contains(resource)) {
            jgrassMapMembers.add(resource);

            ICatalog catalog = getService(null).parent(null);
            if (catalog instanceof CatalogImpl) {
                IResolveDelta delta = new ResolveDelta(resource, Kind.ADDED);
                IResolveChangeEvent event = new ResolveChangeEvent(this, Type.POST_CHANGE, delta);
                ((CatalogImpl) catalog).fire(event);
            }
View Full Code Here

Examples of org.locationtech.udig.catalog.ICatalog

            jgrassMapMembers = members(ProgressManager.instance().get(null));
        }
        if (jgrassMapMembers.contains(resource)) {
            jgrassMapMembers.remove(resource);

            ICatalog catalog = getService(null).parent(null);
            if (catalog instanceof CatalogImpl) {
                IResolveDelta delta = new ResolveDelta(resource, Kind.REMOVED);
                IResolveChangeEvent event = new ResolveChangeEvent(this, Type.POST_CHANGE, delta);
                ((CatalogImpl) catalog).fire(event);
            }
View Full Code Here

Examples of org.locationtech.udig.catalog.ICatalog

        // ensure the right type of service was created
        IService service = services.get(0);
        assertNotNull(service);

        ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
        catalog.add(service); // we can now find this service!

        ID id = new ID(new ID(url), "tasmania");

        IGeoResource resource = (IGeoResource) catalog.getById(IGeoResource.class, id, null);

        /*
         * setup the properties so this adapter is enabled
         */
        resource.getPersistentProperties().put(PreferenceConstants.P_TILESET_ON_OFF, true);
View Full Code Here

Examples of org.locationtech.udig.catalog.ICatalog

        }

        Job addToCatalog = new Job("Add "+file.getName() ){
            @Override
            protected IStatus run(IProgressMonitor monitor) {
                ICatalog localCatalog = CatalogPlugin.getDefault().getLocalCatalog();
                URL url = new ID( file, null ).toURL();
                IService service = null;
                try {
                    service = localCatalog.acquire( url, monitor );
                }
                catch( IOException unepected ){
                }
                return service != null ? Status.OK_STATUS : new Status( IStatus.ERROR, ProjectUIPlugin.ID, "Failed to add "+file );
            }
View Full Code Here

Examples of org.locationtech.udig.catalog.ICatalog

                }
            });
            if (files.isEmpty())
                return;
            List<IGeoResource> dataHandles = new ArrayList<IGeoResource>();
            ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
           
            for( File file : files ) {
                try {
                    URL url = file.toURI().toURL();
                    IService handle = catalog.acquire(url, null);
                    if (handle != null) {
                        // connected okay add all resources
                        List<IGeoResource> resources = (List<IGeoResource>) handle
                                .resources(new NullProgressMonitor());
                        dataHandles.addAll(resources);
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.