@Override public AbstractRaster getAsRaster( Envelope spatialExtent, SampleResolution resolution, InterpolationType interpolation ) { double res = resolution.getResolution( 0 ); AbstractRaster raster = getRaster( res ); if ( raster == null ) { return resolutions.get( resolutions.size() - 1 ); } return raster.getAsRaster( spatialExtent, resolution, interpolation ); }
@Override public boolean equals( Object other ) { if ( other != null && other instanceof SampleResolution ) { final SampleResolution that = (SampleResolution) other; return resMatch( that.resolutions ); } return false; }
if ( getResolutionInfo().getNativeResolutions().get( 0 ).equals( resolution ) ) { RasterGeoReference nGeoRef = resolution.createGeoReference( getRasterReference().getOriginLocation(), spatialExtent ); RasterRect rect = nGeoRef.convertEnvelopeToRasterCRS( spatialExtent ); GeometryTransformer gt = new GeometryTransformer( getCoordinateSystem() ); Envelope inLocalCRS = gt.transform( spatialExtent ).getEnvelope(); RasterGeoReference nGeoRef = resolution.createGeoReference( getRasterReference().getOriginLocation(), inLocalCRS ); rect = nGeoRef.convertEnvelopeToRasterCRS( inLocalCRS );
/** * Instantiate an AbstractRaster with given envelope and raster envelope. * * @param envelope * The envelope of the raster. * @param rasterReference * The raster reference of the underlying raster. */ protected AbstractRaster( Envelope envelope, RasterGeoReference rasterReference ) { super( envelope ); this.rasterReference = rasterReference; SampleResolution res = new SampleResolution( new double[] { rasterReference.getResolutionX(), rasterReference.getResolutionY() } ); this.resolutionInfo = new ResolutionInfo( res ); }
/** * Creates a new {@link GriddedTileContainer} instances. * * @param infoFile * containing the relevant information. * */ protected GriddedTileContainer( GridMetaInfoFile infoFile ) { this.rdi = infoFile.getDataInfo(); this.envelope = infoFile.getEnvelope( OriginLocation.OUTER ); this.envelopeWidth = envelope.getMax().get0() - envelope.getMin().get0(); this.envelopeHeight = envelope.getMax().get1() - envelope.getMin().get1(); // this.envelopeWidth = envelope.getSpan0(); // this.envelopeHeight = envelope.getSpan1(); this.rows = infoFile.rows(); this.columns = infoFile.columns(); this.tileSamplesX = infoFile.getTileRasterWidth(); this.tileSamplesY = infoFile.getTileRasterHeight(); this.tileWidth = envelopeWidth / columns; this.tileHeight = envelopeHeight / rows; this.rasterReference = infoFile.getGeoReference(); LOG.debug( "envelope: " + envelope ); LOG.debug( "raster reference: " + rasterReference ); SampleResolution sr = new SampleResolution( new double[] { rasterReference.getResolutionX(), rasterReference.getResolutionY() } ); this.resolutionInfo = new ResolutionInfo( sr ); }
public int compare( AbstractRaster a1, AbstractRaster a2 ) { double r1 = Math.abs( a1.getResolutionInfo().getNativeResolutions().get( 0 ).getResolution( 0 ) ); double r2 = Math.abs( a2.getResolutionInfo().getNativeResolutions().get( 0 ).getResolution( 0 ) ); return Double.valueOf( r1 ).compareTo( r2 ); } };