/** * Returns a new MultiRangedRaster with selected indices. * * @param indices selected ranges * @return new MultiRangeRaster */ public MultiRangedRaster getRanges(int... indices) { MultiRangedRaster result = new MultiRangedRaster(); for (int index : indices) { result.addRaster(multiRange.get(index)); } return result; }
@Override public MultiRangedRaster copy() { MultiRangedRaster result = new MultiRangedRaster(); for (AbstractRaster r : multiRange) { result.addRaster(r.copy()); } return result; }
/** * Sets the MultiRangedRaster with data from source. * * <p>The number of ranges must be equal. * * @param x left boundary * @param y upper boundary * @param source data to copy */ public void setSubset(double x, double y, MultiRangedRaster source) { // checkBounds(x, y, source.getColumns(), source.getRows()); if (source.getNumberOfRanges() != getNumberOfRanges()) { throw new IndexOutOfBoundsException(); } for (int i = 0; i < getNumberOfRanges(); i++) { SimpleRaster raster = multiRange.get(i).getAsSimpleRaster(); raster.setSubRaster(x, y, source.getRange(i).getAsSimpleRaster()); multiRange.set(i, raster); } }
@Override public MultiRangedRaster getSubRaster( Envelope env, BandType[] bands, OriginLocation targetLocation) { if (getEnvelope().equals(env) && (bands == null || Arrays.equals(bands, getRasterDataInfo().bandInfo))) { return this; } checkBounds(env); MultiRangedRaster result = new MultiRangedRaster(); for (AbstractRaster raster : multiRange) { result.addRaster(raster.getSubRaster(env, bands, targetLocation)); } return result; }