Package org.geotools.gce.grassraster

Examples of org.geotools.gce.grassraster.JGrassMapEnvironment


                                iDialog.open();
                                String newMapName = iDialog.getValue();
                                if (newMapName != null && newMapName.length() > 0) {
                                    newMapName = newMapName.replaceAll("\\s+", "_");

                                    JGrassMapEnvironment oldMapEnvironment = new JGrassMapEnvironment(oldMapFile);
                                    JGrassRegion jGrassRegion = oldMapEnvironment.getActiveRegion();
                                    GeneralParameterValue[] readParams = createGridGeometryGeneralParameter(
                                            jGrassRegion.getCols(), jGrassRegion.getRows(), jGrassRegion.getNorth(),
                                            jGrassRegion.getSouth(), jGrassRegion.getEast(), jGrassRegion.getWest(),
                                            oldMapEnvironment.getCoordinateReferenceSystem());
                                    AbstractGridFormat format = (AbstractGridFormat) new GrassCoverageFormatFactory()
                                            .createFormat();
                                    AbstractGridCoverage2DReader reader = format.getReader(oldMapEnvironment.getCELL());
                                    GridCoverage2D geodata = ((GridCoverage2D) reader.read(readParams));
                                    geodata = geodata.view(ViewType.GEOPHYSICS);

                                    File mapsetFile = oldMapEnvironment.getMAPSET();
                                    JGrassMapEnvironment newMapEnvironment = new JGrassMapEnvironment(mapsetFile, newMapName);
                                    format = new GrassCoverageFormatFactory().createFormat();
                                    GridCoverageWriter writer = format.getWriter(newMapEnvironment.getCELL(), null);
                                    writer.write(geodata, null);

                                    JGrassCatalogUtilities.addMapToCatalog(mapsetFile.getParent(), mapsetFile.getName(),
                                            newMapName, JGrassConstants.GRASSBINARYRASTERMAP);
View Full Code Here


            // is it a map resource
            if (file.exists() && file.isFile()) {
                File cellFolderFile = file.getParentFile();
                if (cellFolderFile.getName().equalsIgnoreCase(JGrassConstants.CELL)) {
                    // try to get its location
                    JGrassMapEnvironment env = new JGrassMapEnvironment(file);
                    file = env.getLOCATION();
                    url = file.toURI().toURL();
                }
            }

            /*
 
View Full Code Here

        type = typeAndPath[0].trim();

        // URL parentIdentifier = parent.getIdentifier();
        // ID parentID = new ID(parentIdentifier);

        jGrassMapEnvironment = new JGrassMapEnvironment(parentMapset.getFile(), name);
        locationCrs = parentMapset.getLocationCrs();
        // id = new ID(parentID, name);

        gridIconID = CatalogUIPlugin.getDefault().getImageDescriptor(ISharedImages.GRID_OBJ);
        gridMissingIconID = CatalogUIPlugin.getDefault().getImageDescriptor(ISharedImages.GRID_MISSING);
View Full Code Here

    public JGrassRegion getFileWindow() {
        return fileWindow;
    }

    public void resetBoundInfo() throws IOException {
        jGrassMapEnvironment = new JGrassMapEnvironment(jGrassMapEnvironment.getCELL());
        fileWindow = jGrassMapEnvironment.getFileRegion();
        ReferencedEnvelope newBounds = new ReferencedEnvelope(fileWindow.getEnvelope(), locationCrs);
        if (info != null) {
            ((JGrassMapGeoResourceInfo) info).setBounds(newBounds);
        }
View Full Code Here

                                        geodata = (GridCoverage2D) Operations.DEFAULT.resample(geodata, jGrassCrs);
                                    }

                                    String mapName = mapFile.getName();
                                    mapName = FilenameUtils.getBaseName(mapName);
                                    JGrassMapEnvironment mapEnvironment = new JGrassMapEnvironment(mapsetFile, mapName);
                                    GrassCoverageFormat format = new GrassCoverageFormatFactory().createFormat();
                                    GridCoverageWriter writer = format.getWriter(mapEnvironment.getCELL(), null);

                                    GeneralParameterValue[] readParams = null;
                                    writer.write(geodata, readParams);

                                    JGrassCatalogUtilities.addMapToCatalog(mapsetFile.getParent(), mapsetFile.getName(), mapName,
View Full Code Here

                            for( Object object : toList ) {
                                if (object instanceof JGrassMapGeoResource) {
                                    JGrassMapGeoResource mr = (JGrassMapGeoResource) object;
                                    File mapFile = mr.getMapFile();
                                    JGrassMapEnvironment mapEnvironment = new JGrassMapEnvironment(mapFile);
                                    JGrassRegion jGrassRegion = mapEnvironment.getActiveRegion();

                                    GeneralParameterValue[] readParams = createGridGeometryGeneralParameter(
                                            jGrassRegion.getCols(), jGrassRegion.getRows(), jGrassRegion.getNorth(),
                                            jGrassRegion.getSouth(), jGrassRegion.getEast(), jGrassRegion.getWest(),
                                            mapEnvironment.getCoordinateReferenceSystem());

                                    AbstractGridFormat format = (AbstractGridFormat) new GrassCoverageFormatFactory()
                                            .createFormat();
                                    GridCoverageReader reader = format.getReader(mapEnvironment.getCELL());
                                    GridCoverage2D geodata = ((GridCoverage2D) reader.read(readParams));
                                    geodata = geodata.view(ViewType.GEOPHYSICS);

                                    final ArcGridFormat format1 = new ArcGridFormat();
                                    final ArcGridWriteParams wp = new ArcGridWriteParams();
View Full Code Here

     *
     * @param cellFile
     *            the file of the raw raster data.
     */
    public GrassBinaryRasterReadHandler( File cellFile ) {
        readerGrassEnv = new JGrassMapEnvironment(cellFile);
        abortRequired = false;
    }
View Full Code Here

     */
    public GrassBinaryRasterWriteHandler( File destMapset, String newMapName,
            ProgressListener monitor ) {
        if (monitor != null)
            this.monitor = monitor;
        writerGrassEnv = new JGrassMapEnvironment(destMapset, newMapName);
        abortRequired = false;
    }
View Full Code Here

TOP

Related Classes of org.geotools.gce.grassraster.JGrassMapEnvironment

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.