final double currentScale = currentContext.getViewportModel().getScaleDenominator();
double minScale = rule.getMinScaleDenominator();
double maxScale = rule.getMaxScaleDenominator();
if (minScale <= currentScale && currentScale <= maxScale ) {
final GridCoverageRenderer paint = new GridCoverageRenderer( destinationCRS, envelope, screenSize,worldToScreen,hints );
final RasterSymbolizer rasterSymbolizer = SLD.rasterSymbolizer(style);
// check if there is a color to mask
Object maskColor = getContext().getLayer().getStyleBlackboard().getString("raster-color-mask"); //$NON-NLS-1$
if (maskColor instanceof String) {
// create a color mask
String[] colorSplit = ((String) maskColor).split(":"); //$NON-NLS-1$
Color color = new Color(Integer.parseInt(colorSplit[0]), Integer.parseInt(colorSplit[1]),
Integer.parseInt(colorSplit[2]));
RenderedImage image = coverage.getRenderedImage();
ImageWorker iw = new ImageWorker(image);
iw.makeColorTransparent(color);
image = iw.getRenderedImage();
GridCoverageFactory gcF = CoverageFactoryFinder.getGridCoverageFactory(null);
coverage = gcF.create(coverage.getName(), image, coverage.getCoordinateReferenceSystem(), coverage
.getGridGeometry().getGridToCRS(), coverage.getSampleDimensions(), null, null);
}
//setState( RENDERING );
paint.paint( graphics, coverage, rasterSymbolizer );
setState( DONE );
}
} catch(Exception e) {
final GridCoverageRenderer paint = new GridCoverageRenderer( destinationCRS, envelope, screenSize,worldToScreen,hints );
RasterSymbolizer rasterSymbolizer = CommonFactoryFinder.getStyleFactory(null).createRasterSymbolizer();
//setState( RENDERING );
paint.paint( graphics, coverage, rasterSymbolizer );
setState( DONE );
}
//tempCache.flush();
}
} catch (Exception e1) {