Package org.locationtech.udig.catalog.jgrass.core

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


                        final Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();

                        Object firstElement = selection.getFirstElement();
                        if (firstElement instanceof JGrassMapsetGeoResource) {
                            try {
                                JGrassMapsetGeoResource mapsetResource = (JGrassMapsetGeoResource) firstElement;

                                File mapsetFile = mapsetResource.getFile();
                                // create a thread and inside do a syncExec
                                FileDialog fileDialog = new FileDialog(Display.getDefault().getActiveShell(), SWT.OPEN
                                        | SWT.MULTI);
                                fileDialog.setFilterExtensions(new String[]{"*.asc", "*.ASC", "*.tif", "*.TIF", "*.tiff",
                                        "*.TIFF", "*.*"});
                                String selpath = fileDialog.open();
                                if (selpath == null) {
                                    return;
                                }
                                File mapFile = new File(selpath);
                                if (!mapFile.exists()) {
                                    return;
                                }
                                File folder = mapFile.getParentFile();

                                String[] fileNames = fileDialog.getFileNames();
                                pm.beginTask("Importing maps...", fileNames.length);
                                for( int i = 0; i < fileNames.length; i++ ) {
                                    mapFile = new File(folder, fileNames[i]);
                                    /*
                                     * import the file
                                     */
                                    CoordinateReferenceSystem jGrassCrs = mapsetResource.getLocationCrs();
                                    GridCoverage2D geodata = null;
                                    CoordinateReferenceSystem fileCrs = null;
                                    if (mapFile.getName().toLowerCase().endsWith(".asc")) {
                                        ArcGridReader arcGridReader = new ArcGridReader(mapFile);
                                        geodata = arcGridReader.read(null);
View Full Code Here


                    mapsetDialog.open(shell);
                    List<JGrassMapsetGeoResource> selectedLayers = mapsetDialog.getSelectedLayers();
                    if (selectedLayers==null || selectedLayers.size() == 0) {
                        return;
                    }
                    JGrassMapsetGeoResource jGrassMapsetGeoResource = selectedLayers.get(0);
                    JGrassRegion activeRegionWindow = jGrassMapsetGeoResource.getActiveRegionWindow();
                    ActiveRegionStyle style = (ActiveRegionStyle) styleBlackboard.get(ActiveregionStyleContent.ID);
                    style.windPath = jGrassMapsetGeoResource.getActiveRegionWindowPath();
                    style.north = (float) activeRegionWindow.getNorth();
                    style.south = (float) activeRegionWindow.getSouth();
                    style.east = (float) activeRegionWindow.getEast();
                    style.west = (float) activeRegionWindow.getWest();
                    style.rows = activeRegionWindow.getRows();
                    style.cols = activeRegionWindow.getCols();

                    CoordinateReferenceSystem jGrassCrs = jGrassMapsetGeoResource.getLocationCrs();
                    String code = null;
                    try {
                        Integer epsg = CRS.lookupEpsgCode(jGrassCrs, true);
                        code = "EPSG:" + epsg;
                    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.locationtech.udig.catalog.jgrass.core.JGrassMapsetGeoResource

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.