|
From: Richard G. <rg...@re...> - 2005-01-15 00:53:23
|
Greetings all.
The following code doesn't seem to work. I have been staring at it too
long to notice any issues. Anyone notice anything out of place?
Thanks,
Richard
--------------------------------------------------------------
protected void paintImage( BufferedImage image, Graphics2D
destination, int width, int height,
Envelope incomingBBox ) {
CRSService service = new CRSService();
org.geotools.cs.CoordinateSystem cs =
service.cs(getContext().getViewportModel()
.getCRS());
org.geotools.pt.Envelope gtBbox = new
org.geotools.pt.Envelope(new double[]{
incomingBBox.getMinX(), incomingBBox.getMinY()}, new
double[]{
incomingBBox.getMaxX(), incomingBBox.getMaxY()});
GridCoverage grid = new GridCoverage(
"BasicWMSRenderer temporary reprojecting
GridCoverage", image, cs, gtBbox);
StyleBuilder sb = new StyleBuilder();
ColorMap cm = sb.createColorMap(new double[]{1000, 1200,
1400, 1600, 2000},
new Color[]{new Color(0, 255, 0), new Color(255,
255, 0),
new Color(255, 127, 0), new Color(191, 127, 63),
new Color(255, 255, 255)}, ColorMap.TYPE_RAMP);
RasterSymbolizer rsDem = sb.createRasterSymbolizer(cm, 1);
Style style = sb.createStyle(rsDem);
MapContext mapContext = new DefaultMapContext();
mapContext.addLayer(grid, style);
LiteRenderer2 lite = new LiteRenderer2(mapContext);
Rectangle paintArea = new Rectangle(width, height);
AffineTransform transform =
lite.worldToScreenTransform(incomingBBox, paintArea);
transform.concatenate(this.affineTransform);
lite.paint(destination, paintArea, transform);
}
|