use of com.revolsys.raster.BufferedGeoreferencedImage in project com.revolsys.open by revolsys.
the class LayerRendererOverlay method paintComponent.
@Override
public void paintComponent(final Graphics g) {
if (!(this.layer instanceof NullLayer)) {
GeoreferencedImage image;
synchronized (this.loadSync) {
image = this.image;
if ((image == null || this.loadImage) && this.imageWorker == null) {
final BoundingBox boundingBox = this.viewport.getBoundingBox();
final int viewWidthPixels = this.viewport.getViewWidthPixels();
final int viewHeightPixels = this.viewport.getViewHeightPixels();
final GeoreferencedImage loadImage = new BufferedGeoreferencedImage(boundingBox, viewWidthPixels, viewHeightPixels);
this.imageWorker = new LayerRendererOverlaySwingWorker(this, loadImage);
Invoke.worker(this.imageWorker);
}
}
if (image != null) {
render((Graphics2D) g);
}
}
}
use of com.revolsys.raster.BufferedGeoreferencedImage in project com.revolsys.open by revolsys.
the class EditGeoreferencedImageOverlay method getCachedImage.
private GeoreferencedImage getCachedImage(BoundingBox boundingBox) {
boundingBox = boundingBox.convert(getViewportGeometryFactory());
final Viewport2D viewport = getViewport();
final BoundingBox viewBoundingBox = viewport.getBoundingBox();
if (this.cachedImage == null || !this.cachedImage.getBoundingBox().equals(viewBoundingBox)) {
try (final ImageViewport imageViewport = new ImageViewport(viewport)) {
final BufferedImage image = imageViewport.getImage();
final Graphics2D graphics = (Graphics2D) image.getGraphics();
this.image.drawImage(graphics, viewBoundingBox, viewport.getViewWidthPixels(), viewport.getViewHeightPixels(), !this.layer.isShowOriginalImage(), RenderingHints.VALUE_INTERPOLATION_BILINEAR);
GeoreferencedImageLayerRenderer.render(imageViewport, graphics, this.image, !this.layer.isShowOriginalImage());
this.cachedImage = new BufferedGeoreferencedImage(imageViewport.getBoundingBox(), image);
}
}
return this.cachedImage;
}
Aggregations