use of com.revolsys.swing.map.Viewport2D in project com.revolsys.open by revolsys.
the class AbstractOverlay method appendPoint.
protected void appendPoint(final StringBuilder text, final Point point) {
final Viewport2D viewport = getViewport();
final double unitsPerPixel = viewport.getMetresPerPixel();
final GeometryFactory geometryFactory = getGeometryFactory();
double scale = geometryFactory.getScaleXY();
if (geometryFactory.isProjected()) {
if (unitsPerPixel > 2) {
scale = 1.0;
}
}
final double x = point.getX();
text.append(Doubles.toString(Doubles.makePrecise(scale, x)));
text.append(",");
final double y = point.getY();
text.append(Doubles.toString(Doubles.makePrecise(scale, y)));
}
use of com.revolsys.swing.map.Viewport2D 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