Examples of JGrassMapsetGeoResource


Examples of org.locationtech.udig.catalog.jgrass.core.JGrassMapsetGeoResource

                String value = labelProvider.getText(domain);
                itemNames.add(value);
            }
            itemLayers = new ArrayList<JGrassMapsetGeoResource>();
            for( String name : itemNames ) {
                JGrassMapsetGeoResource tmpLayer = itemsMap.get(name);
                if (tmpLayer != null) {
                    itemLayers.add(tmpLayer);
                }
            }
View Full Code Here

Examples of org.locationtech.udig.catalog.jgrass.core.JGrassMapsetGeoResource

                if (answer) {
                    List toList = selection.toList();
                    for( Object object : toList ) {
                        if (object instanceof JGrassMapsetGeoResource) {

                            JGrassMapsetGeoResource mapsetr = (JGrassMapsetGeoResource) object;
                            String mapsetPath = mapsetr.getFile().getAbsolutePath();

                            try {
                                FileUtils.deleteDirectory(new File(mapsetPath));
                                JGrassCatalogUtilities.removeMapsetFromCatalog(mapsetr.getFile().getParent(), mapsetr.getFile()
                                        .getName());
                            } catch (IOException e) {
                                e.printStackTrace();
                                String message = "An error occurred while removing the mapset.";
                                ExceptionDetailsDialog.openError("ERROR", message, IStatus.ERROR, JGrassPlugin.PLUGIN_ID, e);
View Full Code Here

Examples of org.locationtech.udig.catalog.jgrass.core.JGrassMapsetGeoResource

                return;
            }
            JGrassMapGeoResource grassMapGeoResource = resource.resolve(JGrassMapGeoResource.class, monitor);

            JGrassRegion fileWindow = new JGrassRegion(grassMapGeoResource.getFileWindow());
            JGrassMapsetGeoResource parent = (JGrassMapsetGeoResource) grassMapGeoResource.parent(new NullProgressMonitor());
            CoordinateReferenceSystem grassCrs = parent.getLocationCrs();
            JGrassRegion screenDrawWindow = new JGrassRegion(envelope.getMinX(), envelope.getMaxX(), envelope.getMinY(),
                    envelope.getMaxY(), fileWindow.getRows(), fileWindow.getCols());

            // to intersect with the data window, we transform the screen window
            JGrassRegion reprojectedScreenDrawWindow = screenDrawWindow;
View Full Code Here

Examples of org.locationtech.udig.catalog.jgrass.core.JGrassMapsetGeoResource

            e.printStackTrace();
            return null;
        }

        JGrassMapsetGeoResource mapsetResource = null;
        try {
            mapsetResource = (JGrassMapsetGeoResource) mapResource.parent(null);
            mapsetPathAndMapName[0] = mapsetResource.getFile().getAbsolutePath();
            mapsetPathAndMapName[1] = mapResource.getTitle();
        } catch (IOException e) {
            JGrassPlugin
                    .log("JGrassPlugin problem: eu.hydrologis.udig.catalog.utils#JGrassCatalogUtilities#getMapsetpathAndMapnameFromJGrassMapGeoResource", e); //$NON-NLS-1$
            e.printStackTrace();
View Full Code Here

Examples of org.locationtech.udig.catalog.jgrass.core.JGrassMapsetGeoResource

     */
    public synchronized static JGrassMapGeoResource addMapToCatalog( String locationPath, String mapsetName, String mapName,
            String mapType ) {
        // URL mapsetId = JGrassMapsetGeoResource.createId(locationPath, mapsetName);

        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);
                JGrassService locationService = localCatalog.getById(JGrassService.class, locationId, ProgressManager.instance()
                        .get());
                mapset = locationService.getMapsetGeoresourceByName(mapsetName);
            }
        } catch (MalformedURLException e) {
            e.printStackTrace();
            String message = "An error occurred while adding the map to the catalog";
            ExceptionDetailsDialog.openError(null, message, IStatus.ERROR, JGrassPlugin.PLUGIN_ID, e);
        }
        if (mapset == null)
            return null;
        return mapset.addMap(mapName, mapType);
    }
View Full Code Here

Examples of org.locationtech.udig.catalog.jgrass.core.JGrassMapsetGeoResource

        // 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

Examples of org.locationtech.udig.catalog.jgrass.core.JGrassMapsetGeoResource

            public void run() {
                List toList = selection.toList();
                List<String> paths = new ArrayList<String>();
                for( Object object : toList ) {
                    if (object instanceof JGrassMapsetGeoResource) {
                        JGrassMapsetGeoResource mapsetGeoresource = (JGrassMapsetGeoResource) object;
                        String mapsetPath = mapsetGeoresource.getFile().getAbsolutePath();
                        if (!Program.launch(mapsetPath)) {
                            paths.add(mapsetPath);
                        }
                        paths.add(mapsetPath);
                    } else if (object instanceof JGrassService) {
View Full Code Here

Examples of org.locationtech.udig.catalog.jgrass.core.JGrassMapsetGeoResource

         * @return Object[]
         */
        public Object[] getChildren( Object arg0 ) {

            if (arg0 instanceof JGrassMapsetGeoResource) {
                JGrassMapsetGeoResource map = (JGrassMapsetGeoResource) arg0;
                List<IResolve> layers = map.members(null);
                if (layers == null)
                    return null;
                return filteredLayers(layers);
            } else if (arg0 instanceof JGrassMapGeoResource) {
                return null;
View Full Code Here

Examples of org.locationtech.udig.catalog.jgrass.core.JGrassMapsetGeoResource

                for( IResolve catalogMember : allCatalogMembers ) {
                    if (catalogMember instanceof JGrassService) {
                        List<IResolve> layers = ((JGrassService) catalogMember).members(null);
                        for( IResolve resource : layers ) {
                            if (mapset != null && resource instanceof JGrassMapsetGeoResource) {
                                JGrassMapsetGeoResource map = (JGrassMapsetGeoResource) resource;
                                File refFile = map.getFile();
                                File mapsetFile = new File(mapset);

                                if (refFile.getAbsolutePath().equals(mapsetFile.getAbsolutePath())) {
                                    neededCatalogMembers.add(resource);
                                }
View Full Code Here

Examples of org.locationtech.udig.catalog.jgrass.core.JGrassMapsetGeoResource

                        JGrassMapGeoResource mapResolve = layer.getGeoResource().resolve(JGrassMapGeoResource.class,
                                new NullProgressMonitor());
                        IResolve mapsetResolve = mapResolve.parent(new NullProgressMonitor());
                        // check for the limiting mapset
                        if (mapsetPath != null && mapsetResolve instanceof JGrassMapsetGeoResource) {
                            JGrassMapsetGeoResource map = (JGrassMapsetGeoResource) mapsetResolve;
                            File refFile = map.getFile();
                            File mapsetFile = new File(mapsetPath);

                            if (refFile.getAbsolutePath().equals(mapsetFile.getAbsolutePath())) {
                                filteredLayers.add(layer);
                                itemsMap.put(layer.getName(), layer);
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.