[geotk] GridCoverageBuilde using Graphics2D
jacob at beeusaert.com
Fri Aug 2 13:36:46 PDT 2013
Thanks for your quick response.
The reason why I am looking to use the Graphics2D API is because I need to fill multiple circles around a certain point with each circle having different grid values. This would be very easy with Graphics2D.
On 02 Aug 2013, at 19:00, Martin Desruisseaux <martin.desruisseaux at geomatys.fr> wrote:
> Hello Jacob
> Le 02/08/13 17:58, Jacob Beeusaert a écrit :
>> I am having some issues using Graphics2D to draw a GridCoverage using the GridCoverageBuilder. I've written a Test for the behaviour. Hopefully someone can help me understand what is going on.
> I had a look to the test. I didn't checked deeply, but I would suggest to follow different steps:
>> // Will use sample value in the range -10000 inclusive to 10000 exclusive.
>> builder.setSampleRange(-10000, 10000);
> I would suggest to avoid negative sample values, as they are not supported by IndexColorModel. While the library tries to workaround this limitation, there is more risk of unexpected results and it often consume more memory. I rather suggest:
> builder.setSampleRange(1, 20000);
> and replace:
>> elevation.setLinearTransform(0.01, 0);
>> elevation.addNodataValue("No data", 10000);
> elevation.setLinearTransform(0.01, -500);
> elevation.addNodataValue("No data", 0);
> While not essential, using "0" for "no-data" also reduce the risk of unexpected results and allows a few optimization in the library.
> On the following question:
>> //How to define the grid value of the stuff we will draw? setColor??
> I would not recommend to use ColorSpace or Graphics2D, since they are for drawing visual objects rather than computing geophysical values. Instead, I suggest:
> WritableRaster raster = image.getRaster();
> raster.setSample(x, y, 0, value);
> Geotoolkit mailing list
> Geotoolkit at lists.osgeo.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Geotoolkit