Package org.locationtech.udig.catalog

Examples of org.locationtech.udig.catalog.ID


public class ShpPropertiesInterceptor implements ServiceInterceptor {

    public void run(IService service){
        if( service instanceof ShpServiceImpl){
            ID id = service.getID();
            File directory = id.toFile().getParentFile();
            File infoFile = new File( directory, id.toBaseFile()+".properties" );
            if( infoFile.exists() ){
               try {
                   FileReader infoReader = new FileReader( infoFile );
                 Properties info = new Properties();
                 info.load( infoReader );
View Full Code Here


  static URL toCapabilitiesURL( Object data ) {
       if( data instanceof IResolve ){
           return toCapabilitiesURL( (IResolve) data );
       }
       else if( ID.cast(data) != null ){
           ID id = ID.cast( data );
           if( id.toURL() != null ){
               return toCapabilitiesURL( id.toURL() );
           }
       }
       return null; // no idea what this should be      
   }
View Full Code Here

   
    public URL getIdentifier() {
        return identifier;
    }
    public ID getID() {
        return new ID(getIdentifier());       
    }
View Full Code Here

        if( !isSupportedExtension(url) )
            return Messages.GeoTiffServiceExtension_badExt;
       
        File file = null;
        try {
            ID id = new ID( url );
            file = id.toFile();
        } catch (IllegalArgumentException ex) {
            return url.toExternalForm()+Messages.GeoTiffServiceExtension_notFile;
        }
       
        if (!file.exists() )
View Full Code Here

          ICatalog localCatalog = CatalogPlugin.getDefault().getLocalCatalog();

            LayerFactory layerFactory = map.getLayerFactory();
            URL resourceID = new URL(null, "mapgraphic://localhost/mapgraphic#org.locationtech.udig.tutorial.mapgraphic.Whitebox", CorePlugin.RELAXED_HANDLER); //$NON-NLS-1$
            ID id = new ID(resourceID);
            IGeoResource resource = localCatalog.getById(IGeoResource.class, id, new NullProgressMonitor());
            Layer whiteboxLayer = layerFactory.createLayer(resource);
           
            whiteboxLayer.getStyleBlackboard().put(LocationStyleContent.ID, location);
            return whiteboxLayer;
View Full Code Here

            String prov = (String)selectedFarmFeature.getAttribute(0);
            String id = (String)selectedFarmFeature.getAttribute(1);
           
            //put layer info on the mapgraphic's style blackboard
            URL detailsResId = new URL(null, "mapgraphic://localhost/mapgraphic#org.locationtech.udig.tutorial.mapgraphic.TitleArea", CorePlugin.RELAXED_HANDLER);
            IGeoResource detailsRes = localCatalog.getById(IGeoResource.class, new ID(detailsResId), new NullProgressMonitor());
            
            Layer titleAreaLayer = layerFactory.createLayer(detailsRes);
            titleAreaLayer.getStyleBlackboard().put(LocationStyleContent.ID, location);
            XMLMemento selectedFeatureMemento = XMLMemento.createWriteRoot("style");
            selectedFeatureMemento.putString(FEATURE_ID_KEY, id);
View Full Code Here

    private ID id;

    public FeatureSourceGeoResource( DataStoreService service, Name name ) {
        this.service = service;
        this.name = name;
        this.id = new ID(service.getID(), name.getLocalPart());
    }
View Full Code Here

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

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

    public JGrassService( Map<String, Serializable> params ) {
        this.params = params;

        // get the file url from the connection parameters
        url = (URL) this.params.get(JGrassServiceExtension.KEY);
        id = new ID(url);

        locationFolderFile = URLUtils.urlToFile(url);
        if (!locationFolderFile.isDirectory()) {
            throw new IllegalArgumentException("The GRASS location has to be a folder: " + locationFolderFile.getAbsolutePath());
        }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.catalog.ID

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.