use of com.revolsys.elevation.gridded.rasterizer.GriddedElevationModelRasterizerDataBuffer in project com.revolsys.open by revolsys.
the class GriddedElevationModelImage method redraw.
public void redraw() {
synchronized (this) {
if (this.imageBuffer == null) {
final int width = this.elevationModel.getGridWidth();
final int height = this.elevationModel.getGridHeight();
final ColorModel colorModel = ColorModel.getRGBdefault();
final DataBuffer imageBuffer;
if (this.cached) {
imageBuffer = new TempFileMappedIntDataBuffer(width, height);
} else {
imageBuffer = new GriddedElevationModelRasterizerDataBuffer(this.rasterizer);
}
final SampleModel sampleModel = new SinglePixelPackedSampleModel(DataBuffer.TYPE_INT, width, height, new int[] { // Red
0x00ff0000, // Green
0x0000ff00, // Blue
0x000000ff, // Alpha
0xff000000 });
final WritableRaster raster = new IntegerRaster(sampleModel, imageBuffer);
final BufferedImage image = new BufferedImage(colorModel, raster, false, null);
if (this.cached) {
this.rasterizer.rasterize(imageBuffer);
}
setRenderedImage(image);
this.imageBuffer = imageBuffer;
} else {
if (this.cached) {
this.rasterizer.rasterize(this.imageBuffer);
}
}
}
}
Aggregations