public void create( final String name, final String filename, final AnalysisExtent ae, int dataType, final int numBands, final GProjection projection) { if (projection == null) { _projection = ProjectionUtils.getDefaultProjection(); } else { _projection = projection; } if (dataType == DataBuffer.TYPE_DOUBLE) { dataType = DataBuffer.TYPE_FLOAT; } System.out.println(ae.getNX()); System.out.println(ae.getNY()); _raster = RasterFactory.createBandedRaster(dataType, ae.getNX(), ae.getNY(), numBands, null); _filename = filename; _name = name; _layerExtent = ae; _noDataValue = DEFAULT_NO_DATA_VALUE; }
@Override public double getLayerCellSize() { if (_layerExtent != null) { return _layerExtent.getCellSize(); } return 0; }
public void create(final IGlobeRasterLayer layer) { m_BaseDataObject = layer; _projection = layer.getRasterGeodata()._projection; _raster = layer.getRaster(); final GRasterGeodata extent = layer.getRasterGeodata(); _layerExtent = new AnalysisExtent(); _layerExtent.setCellSize(extent._cellsize); _layerExtent.setXRange( extent._xllcorner, extent._xllcorner + extent._cols * extent._cellsize, true); _layerExtent.setYRange( extent._yllcorner, extent._yllcorner + extent._rows * extent._cellsize, true); _name = layer.getName(); _noDataValue = layer.getNoDataValue(); }
@Override public void postProcess() { try { // BufferedImage bi = new // BufferedImage(RasterRenderer.getDefaultColorModel( // (WritableRaster)m_Raster), (WritableRaster)m_Raster, false, // null); // Sector sector = Sector.fromDegrees(m_LayerExtent.getYMin(), // m_LayerExtent.getYMax(), // m_LayerExtent.getXMin(), m_LayerExtent.getXMax()); // GeotiffWriter writer; // File file = new File(m_sFilename); // writer = new GeotiffWriter(file); // writer.write(bi); // TODO:Sector??????????? final File file = new File(_filename); final GRasterGeodata geodata = new GRasterGeodata( _layerExtent.getXMin(), _layerExtent.getYMin(), _layerExtent.getCellSize(), _layerExtent.getNY(), _layerExtent.getNX(), _projection); final GGlobeRasterLayer layer = new GGlobeRasterLayer(_raster, geodata); layer.setNoDataValue(_noDataValue); layer.setName(_name); ESRIAsciiFileTools.writeFile(layer, file); create(layer); } catch (final Exception e) { e.printStackTrace(); } }
@Override public Rectangle2D getFullExtent() { return _layerExtent.getAsRectangle2D(); }