Hello Adrea
andrea antonello a écrit :
> I am tempted to use:
>
> GridCoverage2D coverage2D = factory.create(name, writableRaster,
> writeEnvelope, new GridSampleDimension[]{band});
A possible approach is to keep around the WritableRaster that you gave to this
constructor. Because GridCoverage2D will wrap it (not copy it), any changes you
make in this raster will be immediately visible to the GridCoverage2D.
If you want to get back the WritableRaster after the GridCoverage2D has been
created, then you approach is almost what you need:
> coverage2D.getRenderedImage().getData();
Lets just modify that a bit (because getData() copy the whole raster, which is
probably not what you want):
RenderedImage image = coverage2D.getRenderedImage();
// Following cast you work if the original image was writable.
WritableRenderedImage wri = (WritableRenderedImage) image;
// To be very strict, we should looks at how many tiles
// are in that image. In the case where we know that the
// original image was a BufferedImage and because I'm lazy,
// lets assume that is only one big tile:
WritableRaster raster = wri.getWritableTile(0,0);
// do you computation here, and when you are done:
wri.releaseWritableTile(0,0);
Martin
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users