private int getColumn( double x ) { int[] rasterCoordinate = this.geoRef.getRasterCoordinate( x, 0 ); if ( rasterCoordinate[0] < 0 ) { return -1; } return Math.min( columns, Math.max( -1, ( rasterCoordinate[0] / tileRasterWidth ) ) ); // double dx = x - envelope.getMin().get0(); // int column = (int) Math.floor( ( columns * dx ) / envelope.getSpan0() ); // if ( column < 0 ) { // // signal outside // return -1; // } // if ( column > columns - 1 ) { // // signal outside // return columns; // } // return column; }
int[] rrUpperLeft = getRasterCoordinate( ulX, ulY ); int[] rrLowerRight = getRasterCoordinate( lrX, lrY );
private int getRow( double y ) { int[] rasterCoordinate = this.geoRef.getRasterCoordinate( 0, y ); if ( rasterCoordinate[1] < 0 ) { return -1; } return Math.min( rows, Math.max( -1, ( rasterCoordinate[1] / tileRasterHeight ) ) ); // double dy = y - envelope.getMin().get1(); // int row = (int) Math.floor( ( ( rows * ( envelope.getSpan1() - dy ) ) / envelope.getSpan1() ) ); // if ( row < 0 ) { // // signal outside // return -1; // } // if ( row > rows - 1 ) { // // signal outside // return rows; // } // return row; }
int maxRow = getRowIdx( env.getMin().get1() ); int[] max = rasterReference.getRasterCoordinate( env.getMax().get0(), env.getMin().get1() ); double[] maxReal = rasterReference.getRasterCoordinateUnrounded( env.getMax().get0(), env.getMin().get1() ); if ( ( Math.abs( maxReal[0] - max[0] ) < 1E-6 ) && max[0] % tileSamplesX == 0 ) {
private int getColumnIdx( double x ) { int[] rasterCoordinate = rasterReference.getRasterCoordinate( x, 0 ); if ( rasterCoordinate[0] < 0 ) { return -1; } return Math.min( columns, Math.max( -1, ( rasterCoordinate[0] / tileSamplesX ) ) ); // if ( x < envelope.getMin().get0() || x > envelope.getMax().get0() ) { // String msg = "Specified x coordinate (=" + x + ") is out of range [" + envelope.getMin().get0() + ";" // + envelope.getMax().get0() + "]"; // LOG.debug( msg ); // throw new IllegalArgumentException( msg ); // } // double dx = x - envelope.getMin().get0(); // int columnIdx = (int) Math.floor( ( columns * dx ) / envelopeWidth ); // if ( columnIdx < 0 ) { // // signal outside // return -1; // } // if ( columnIdx > columns - 1 ) { // // signal outside // return columns; // } // return columnIdx; }
int maxRow = getRow( env.getMin().get1() ); int[] max = geoRef.getRasterCoordinate( env.getMax().get0(), env.getMin().get1() ); double[] maxReal = geoRef.getRasterCoordinateUnrounded( env.getMax().get0(), env.getMin().get1() ); if ( ( Math.abs( maxReal[0] - max[0] ) < 1E-6 ) && max[0] % tileRasterWidth == 0 ) {
private int getRowIdx( double y ) { int[] rasterCoordinate = rasterReference.getRasterCoordinate( 0, y ); if ( rasterCoordinate[1] < 0 ) { return -1; } return Math.min( rows, Math.max( -1, ( rasterCoordinate[1] / tileSamplesY ) ) ); // if ( y < envelope.getMin().get1() || y > envelope.getMax().get1() ) { // String msg = "Specified y coordinate (=" + y + ") is out of range [" + envelope.getMin().get1() + ";" // + envelope.getMax().get1() + "]"; // LOG.debug( msg ); // throw new IllegalArgumentException( msg ); // } // double dy = y - envelope.getMin().get1(); // int rowIdx = (int) Math.floor( ( ( rows * ( envelopeHeight - dy ) ) / envelopeHeight ) ); // if ( rowIdx < 0 ) { // // signal outside // return -1; // } // if ( rowIdx > rows - 1 ) { // // signal outside // return rows; // } // return rowIdx; }
float getHeight( float x, float y ) { int[] rasterCoordinate = this.geoReference.getRasterCoordinate( x, y ); float height = getAsFloatSample( rasterCoordinate[0], rasterCoordinate[1], 0 ); // float height = 0.0f; // if ( x > boxMinX && x < boxMaxX && y > boxMinY && y < boxMaxY ) { // // height = getAsFloatSample( rasterCoordinate[0], // rasterCoordinate[1], 0 ); // height = 100.0f + getAsFloatSample( rasterCoordinate[0], // rasterCoordinate[1], 0 ); // } // // float height = getAsFloatSample( rasterCoordinate[0], // rasterCoordinate[1], 0 ); if ( height > maxZ ) { height = maxZ; } return height; }
@Override public void setSubRaster( double x, double y, int dstBand, AbstractRaster source ) { // calculate position in RasterData int offset[] = getRasterReference().getRasterCoordinate( x, y ); getRasterData().setSubset( offset[0], offset[1], dstBand, 0, source.getAsSimpleRaster().getReadOnlyRasterData() ); }
int[] pos = geoReference.getRasterCoordinate( p.x, p.y ); data.setFloatSample( pos[0], pos[1], 0, p.value );
@Override public void setSubRaster( double x, double y, AbstractRaster source ) { // calculate position in RasterData int offset[] = getRasterReference().getRasterCoordinate( x, y ); RasterData sourceRD = source.getAsSimpleRaster().getReadOnlyRasterData(); getRasterData().setSubset( offset[0], offset[1], sourceRD.getColumns(), sourceRD.getRows(), sourceRD ); }
double[] max = transformedEnv.getMax().getAsArray(); int[] rasterCoordinate = getRasterCoordinate( min[0], max[1] );