/** * Creates a {@code WritableRectIter} for the specified source and destination rasters. * The given rectangle must be in the bounds of both rasters (this will not be verified). * * @param src The source raster. * @param dst The destination raster. * @param bounds The region of the rasters to iterate over. * @return An iterator that read sample from {@code src} and write sample to {@code dst}. * It will be an instance of {@code TransfertRectIter} if and only if the source * and destination rasters are not the same. * * @since 3.00 */ public static WritableRectIter create(Raster src, WritableRaster dst, Rectangle bounds) { WritableRectIter iter = RectIterFactory.createWritable(dst, bounds); if (src != dst) { iter = new TransfertRectIter(RectIterFactory.create(src, bounds), iter); } return iter; }
@SuppressWarnings("PMD.SystemPrintln") public static void printImage(RenderedImage renderedImage) { RectIter rectIter = RectIterFactory.create(renderedImage, null); do { do { double value = rectIter.getSampleDouble(); System.out.print(value + " "); } while (!rectIter.nextPixelDone()); rectIter.startPixels(); } while (!rectIter.nextLineDone()); } }
final double[] padNaNs = new double[numBands]; Arrays.fill(padNaNs, Double.NaN); final WritableRectIter iterator = RectIterFactory.createWritable(tiled, gridBounds); if (!iterator.finishedLines()) try {
create( name, (min == null || max == null) ? RectIterFactory.create(raster, null) : null, raster.getSampleModel(), min,
public RectIter create(RenderedImage image, Rectangle bounds) { if (image == null) { throw new IllegalArgumentException("image must not be null"); } if (!(image instanceof WritableRenderedImage)) { throw new IllegalArgumentException("image must be a WritableRenderedImage"); } if (bounds == null || bounds.isEmpty()) { return null; } return RectIterFactory.createWritable((WritableRenderedImage) image, bounds); }
/** * Creates a {@code WritableRectIter} for the specified source and destination images. * The given rectangle must be in the bounds of both images (this will not be verified). * * @param src The source image. * @param dst The destination image. * @param bounds The region of the images to iterate over. * @return An iterator that read samples from {@code src} and write samples to {@code dst}. * It will be an instance of {@code TransfertRectIter} if and only if the source * and destination images are not the same. * * @since 3.00 */ public static WritableRectIter create(RenderedImage src, WritableRenderedImage dst, Rectangle bounds) { if (dst instanceof BufferedImage) { /* * BufferedImage are always backed by a single raster. Consequently we are better to * delegate the work to create(RenderedImage, WritableRaster, Rectangle), which will * detects if the source uses the same raster than the destination. */ return create(src, ((BufferedImage) dst).getRaster(), bounds); } WritableRectIter iter = RectIterFactory.createWritable(dst, bounds); if (src != dst) { iter = new TransfertRectIter(RectIterFactory.create(src, bounds), iter); } return iter; }
create( name, RectIterFactory.create(image, null), image.getSampleModel(), null,
WritableRectIter iter = RectIterFactory.createWritable((TiledImage)lookupImg, null); do { do {
WritableRectIter iterator = RectIterFactory.createWritable(dest, destRect); if (true) { iterator = TransfertRectIter.create(RectIterFactory.create(source, destRect), iterator);
public RasterAsPointFeatureIterator(final RasterAsPointFeatureCollection fc) { // checks Utilities.ensureNonNull("fc", fc); // get elements this.fc = fc; this.fb = new SimpleFeatureBuilder(fc.getSchema()); this.size = fc.size; // create an iterator that only goes forward, it is the fastest one iterator = RectIterFactory.create(fc.gc2d.getRenderedImage(), null); // // start the iterator // iterator.startLines(); if (iterator.finishedLines()) { throw new NoSuchElementException("Index beyond size:" + index + ">" + size); } iterator.startPixels(); if (iterator.finishedPixels()) { throw new NoSuchElementException("Index beyond size:" + index + ">" + size); } // appo temp = new double[fc.numBands]; // grid convergence angle manager if (fc.gridConvergenceAngleCorrectionNeeded) { sourceCRSPosition = new DirectPosition2D(); targetCRSPosition = new DirectPosition2D(fc.targetCRS); } }
WritableRectIter iter = RectIterFactory.createWritable((TiledImage)lookupImg, null); do { do {
/** * Creates a {@code WritableRectIter} for the specified source image and destination raster. * The given rectangle must be in the bounds of both arguments (this will not be verified). * * @param src The source image. * @param dst The destination raster. * @param bounds The region of the image or raster to iterate over. * @return An iterator that read samples from {@code src} and write samples to {@code dst}. * It will be an instance of {@code TransfertRectIter} if and only if the source * and destination rasters are not the same. * * @since 3.00 */ public static WritableRectIter create(RenderedImage src, WritableRaster dst, Rectangle bounds) { final Raster tile = uniqueTile(src, bounds); if (tile == dst) { return create(tile, dst, bounds); } return new TransfertRectIter(RectIterFactory.create(src, bounds), RectIterFactory.createWritable(dst, bounds)); }
bounds.y = iy - top; final RectIter iter = RectIterFactory.create(image.getExtendedData(bounds, this.borderExtender), bounds); boolean[][] gaps = hasNoData ? new boolean[samples.length][samples[0].length] : null; for (; band < bandUp; band++) {
WritableRectIter iter = RectIterFactory.createWritable((TiledImage)lookupImg, null); do { do {
WritableRectIter iterator = RectIterFactory.createWritable(dest, destRect); if (true) { iterator = TransfertRectIter.create(RectIterFactory.create(source, destRect), iterator);
bounds.y = iy - top; final RectIter iter = RectIterFactory.create(image.getExtendedData(bounds, this.borderExtender), bounds); boolean[][] gaps = hasNoData ? new boolean[samples.length][samples[0].length] : null; for (; band < bandUp; band++) {
WritableRectIter iter = RectIterFactory.createWritable((TiledImage)lookupImg, null); do { do {
"Bounds mismatch: " + destRect + " and " + bounds); WritableRectIter iterator = RectIterFactory.createWritable(dest, bounds); if (true) { iterator = TransfertRectIter.create(RectIterFactory.create(source, bounds), iterator);
bounds.y = iy - top; final RectIter iter = RectIterFactory.create(image.getExtendedData(bounds, this.borderExtender), bounds); boolean[][] gaps = hasNoData ? new boolean[samples.length][samples[0].length] : null; for (; band < bandUp; band++) {
public void createRipplesImage(WritableRenderedImage destImg) { // image dimensions final int width = destImg.getWidth(); final int height = destImg.getHeight(); // first pixel coordinates int x = destImg.getMinX(); int y = destImg.getMinY(); // center pixel coordinates final int xc = x + destImg.getWidth() / 2; final int yc = y + destImg.getHeight() / 2; // constant term double C = Math.PI * 8; WritableRectIter iter = RectIterFactory.createWritable(destImg, null); do { double dy = ((double) (y - yc)) / yc; do { double dx = ((double) (x - xc)) / xc; double d = Math.sqrt(dx * dx + dy * dy); iter.setSample(Math.sin(d * C)); x++ ; } while (!iter.nextPixelDone()); x = destImg.getMinX(); y++; iter.startPixels(); } while (!iter.nextLineDone()); } // docs-end-method