Package org.locationtech.udig.catalog

Examples of org.locationtech.udig.catalog.ID


    public void load( IMemento memento ) {
        String url = memento.getTextData();

        try {
            IGeoResource resource = CatalogPlugin.getDefault().getLocalCatalog().getById(
                    IGeoResource.class, new ID(new URL(MapGraphicService.SERVICE_URL, url)),
                    new NullProgressMonitor());
            setMapGraphic((MapGraphicResource) resource);
        } catch (IOException e) {
            // uh oh must be missing a plugin
            setMissingResourceWarning();
View Full Code Here


                                if (resources.size() > 0) {
                                    geoResource = resources.get(0);
                                }
                            }
                            if (geoResource != null) {
                                ID id = geoResource.getID();
                                if (id != null)
                                    if (id.isFile()) {
                                        File file = id.toFile();
                                        if (file.exists()) {
                                            addFileToViewer(file);
                                            OmsBoxPlugin.getDefault().setLastFolderChosen(file.getParentFile().getAbsolutePath());
                                        }
                                    } else if (id.toString().contains("#") && id.toString().startsWith("file")) {
                                        // try to get the file
                                        String string = id.toString().replaceAll("#", "");
                                        URL url = new URL(string);
                                        File file = new File(url.toURI());
                                        if (file.exists()) {
                                            addFileToViewer(file);
                                            OmsBoxPlugin.getDefault().setLastFolderChosen(file.getParentFile().getAbsolutePath());
                                        }
                                    } else {
                                        System.out.println("Not a file: " + id.toString());
                                    }
                            }

                        }
                    } catch (Exception e) {
View Full Code Here

        synchronized (locationPath) {

            /*
             * if the catalog is active, refresh the location in the catalog window
             */
            ID id = null;
            if (JGrassPlugin.getDefault() != null) {
                File locationFile = new File(locationPath);
                try {
                    id = new ID(locationFile.toURI().toURL());
                } catch (MalformedURLException e) {
                    e.printStackTrace();
                    return;
                }
            } else {
View Full Code Here

        JGrassMapsetGeoResource mapset = null;
        try {
            File locationFile = new File(locationPath);

            ID locationId = new ID(locationFile.toURI().toURL());
            URL mapsetUrl = JGrassMapsetGeoResource.createId(locationFile.getAbsolutePath(), mapsetName);
            ID mapsetId = new ID(mapsetUrl);
            ICatalog localCatalog = CatalogPlugin.getDefault().getLocalCatalog();
            mapset = localCatalog.getById(JGrassMapsetGeoResource.class, mapsetId, ProgressManager.instance().get());
            if (mapset == null) {
                // try with the service
                // URL locationId = JGrassService.createId(locationPath);
View Full Code Here

     */
    public synchronized static void removeMapFromCatalog( String locationPath, String mapsetName, String mapName, String mapType ) {
        // URL mapsetId = JGrassMapsetGeoResource.createId(locationPath, mapsetName);
        File locationFile = new File(locationPath);
        URL mapsetUrl = JGrassMapsetGeoResource.createId(locationFile.getAbsolutePath(), mapsetName);
        ID mapsetId = new ID(mapsetUrl);

        JGrassMapsetGeoResource mapset = CatalogPlugin.getDefault().getLocalCatalog()
                .getById(JGrassMapsetGeoResource.class, mapsetId, ProgressManager.instance().get());
        mapset.removeMap(mapName, mapType);
    }
View Full Code Here

     */
    public synchronized static JGrassMapsetGeoResource addMapsetToCatalog( String locationPath, String mapsetName ) {
        // URL locationId = JGrassService.createId(locationPath);
        File locationFile = new File(locationPath);
        try {
            ID locationId = new ID(locationFile.toURI().toURL());
            JGrassService location = CatalogPlugin.getDefault().getLocalCatalog()
                    .getById(JGrassService.class, locationId, ProgressManager.instance().get());
            return location.addMapset(mapsetName);
        } catch (MalformedURLException e) {
            e.printStackTrace();
View Full Code Here

     */
    public synchronized static void removeMapsetFromCatalog( String locationPath, String mapsetName ) {
        // URL locationId = JGrassService.createId(locationPath);
        try {
            File locationFile = new File(locationPath);
            ID locationId = new ID(locationFile.toURI().toURL());
            JGrassService location = CatalogPlugin.getDefault().getLocalCatalog()
                    .getById(JGrassService.class, locationId, ProgressManager.instance().get());
            location.removeMapset(mapsetName);
        } catch (MalformedURLException e) {
            e.printStackTrace();
View Full Code Here

    public GridCoverageReaderMetrics( IRenderContext context2, GridCoverageReaderMetricsFactory factory) {
        super( context2, factory, listExpectedStyleIds());
        this.resolutionMetric = RES_PIXEL; // reads just what is needed for the screen
       
        // DATA SOURCE PERFORMANCE INDICATORS
        ID id = context.getGeoResource().getID();
        // Boolean memory = (Boolean) context.getLayer().getStyleBlackboard().get("org.locationtech.udig.style.cache");       
       
        if( id.isMemory() ){
            // in memory grid coverage (example a temporary image froma WPS)
            this.latencyMetric = LATENCY_MEMORY;
            this.timeToDrawMetric = DRAW_IMAGE_MEMORY;
        }
        else if (id.isFile() ){
            String filename = id.toBaseFile();
            if( filename.toLowerCase().endsWith("jpg") ||
                    filename.toLowerCase().endsWith("jpeg")){
                this.latencyMetric = LATENCY_LOCAL;
                this.timeToDrawMetric = DRAW_IMAGE_COMPRESSED;
            }
View Full Code Here

      return Collections.emptyList();     
    }   
    ICatalog local = CatalogPlugin.getDefault().getLocalCatalog();
   
    // look up frendly wfs entry from local catalog (if present)
    IGeoResource friend = local.getById( IGeoResource.class, new ID(target), monitor );
    if( friend == null ) {
      return Collections.emptyList();
    }
    else {
      return new ArrayList<IResolve>( Collections.singletonList( friend ) );
View Full Code Here

            return Collections.emptyList();        
        }      
        ICatalog local = CatalogPlugin.getDefault().getLocalCatalog();
       
        // look up frendly wfs entry from local catalog (if present)
        IGeoResource friend = local.getById( IGeoResource.class, new ID(target), monitor );
        if( friend == null ) {
            return Collections.emptyList();
        }
        else {
            return new ArrayList<IResolve>( Collections.singletonList( friend ) );
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.