@Test public void testZoomOut() { BBoxMapBounds bboxMapBounds = new BBoxMapBounds(WGS84, -10, -10, 10, 10); MapBounds bounds = bboxMapBounds.zoomOut(1); assertEquals(bboxMapBounds, bounds); bounds = bboxMapBounds.zoomOut(2); ReferencedEnvelope envelope = bounds.toReferencedEnvelope(new Rectangle(5, 5)); assertEquals(-20, envelope.getMinX(), 0.001); assertEquals(20, envelope.getMaxX(), 0.001); assertEquals(-20, envelope.getMinY(), 0.001); assertEquals(20, envelope.getMaxY(), 0.001); assertEquals(WGS84, envelope.getCoordinateReferenceSystem()); bboxMapBounds = new BBoxMapBounds(WGS84, -10, -5, 10, 5); bounds = bboxMapBounds.zoomOut(1); assertEquals(bboxMapBounds, bounds); bounds = bboxMapBounds.zoomOut(4); envelope = bounds.toReferencedEnvelope(new Rectangle(40, 20)); assertEquals(-40, envelope.getMinX(), 0.001); assertEquals(40, envelope.getMaxX(), 0.001); assertEquals(-20, envelope.getMinY(), 0.001); assertEquals(20, envelope.getMaxY(), 0.001); assertEquals(WGS84, envelope.getCoordinateReferenceSystem()); }
@Override public MapBounds zoomOut(final double factor) { if (FloatingPointUtil.equals(factor, 1.0)) { return this; } double destWidth = this.bbox.getWidth() * factor; double destHeight = this.bbox.getHeight() * factor; double centerX = this.bbox.centre().x; double centerY = this.bbox.centre().y; double minGeoX = centerX - destWidth / 2.0f; double maxGeoX = centerX + destWidth / 2.0f; double minGeoY = centerY - destHeight / 2.0f; double maxGeoY = centerY + destHeight / 2.0f; return new BBoxMapBounds(getProjection(), minGeoX, minGeoY, maxGeoX, maxGeoY); }
BBoxMapBounds extends MapBounds { @Override public MapBounds zoomOut(final double factor) { if (FloatingPointUtil.equals(factor, 1.0)) { return this; } double destWidth = this.bbox.getWidth() * factor; double destHeight = this.bbox.getHeight() * factor; double centerX = this.bbox.centre().x; double centerY = this.bbox.centre().y; double minGeoX = centerX - destWidth / 2.0f; double maxGeoX = centerX + destWidth / 2.0f; double minGeoY = centerY - destHeight / 2.0f; double maxGeoY = centerY + destHeight / 2.0f; return new BBoxMapBounds(getProjection(), minGeoX, minGeoY, maxGeoX, maxGeoY); } }
BBoxMapBounds extends MapBounds { @Override public MapBounds zoomOut(final double factor) { if (FloatingPointUtil.equals(factor, 1.0)) { return this; } double destWidth = this.bbox.getWidth() * factor; double destHeight = this.bbox.getHeight() * factor; double centerX = this.bbox.centre().x; double centerY = this.bbox.centre().y; double minGeoX = centerX - destWidth / 2.0f; double maxGeoX = centerX + destWidth / 2.0f; double minGeoY = centerY - destHeight / 2.0f; double maxGeoY = centerY + destHeight / 2.0f; return new BBoxMapBounds(getProjection(), minGeoX, minGeoY, maxGeoX, maxGeoY); } BBoxMapBounds(final CoordinateReferenceSystem projection, final Envelope envelope);  BBoxMapBounds(
            final CoordinateReferenceSystem projection, final double minX, final double minY,
            final double maxX, final double maxY);  BBoxMapBounds(final ReferencedEnvelope bbox); }
BBoxMapBounds extends MapBounds { @Override public MapBounds zoomOut(final double factor) { if (FloatingPointUtil.equals(factor, 1.0)) { return this; } double destWidth = this.bbox.getWidth() * factor; double destHeight = this.bbox.getHeight() * factor; double centerX = this.bbox.centre().x; double centerY = this.bbox.centre().y; double minGeoX = centerX - destWidth / 2.0f; double maxGeoX = centerX + destWidth / 2.0f; double minGeoY = centerY - destHeight / 2.0f; double maxGeoY = centerY + destHeight / 2.0f; return new BBoxMapBounds(getProjection(), minGeoX, minGeoY, maxGeoX, maxGeoY); } BBoxMapBounds(final CoordinateReferenceSystem projection, final Envelope envelope);  BBoxMapBounds(
            final CoordinateReferenceSystem projection, final double minX, final double minY,
            final double maxX, final double maxY);  BBoxMapBounds(final ReferencedEnvelope bbox); @Override ReferencedEnvelope toReferencedEnvelope(final Rectangle paintArea); @Override MapBounds adjustedEnvelope(final Rectangle paintArea); @Override MapBounds adjustBoundsToNearestScale(
            final ZoomLevels zoomLevels, final double tolerance,
            final ZoomLevelSnapStrategy zoomLevelSnapStrategy,
            final boolean geodetic,
            final Rectangle paintArea,
            final double dpi); @Override Scale getScale(final Rectangle paintArea, final double dpi); @Override MapBounds adjustBoundsToRotation(final double rotation); @Override MapBounds zoomOut(final double factor); @Override MapBounds zoomToScale(final Scale scale); @Override Coordinate getCenter(); MapBounds expand(final int margin, final Rectangle paintArea); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
BBoxMapBounds extends MapBounds { @Override public MapBounds zoomOut(final double factor) { if (FloatingPointUtil.equals(factor, 1.0)) { return this; } double destWidth = this.bbox.getWidth() * factor; double destHeight = this.bbox.getHeight() * factor; double centerX = this.bbox.centre().x; double centerY = this.bbox.centre().y; double minGeoX = centerX - destWidth / 2.0f; double maxGeoX = centerX + destWidth / 2.0f; double minGeoY = centerY - destHeight / 2.0f; double maxGeoY = centerY + destHeight / 2.0f; return new BBoxMapBounds(getProjection(), minGeoX, minGeoY, maxGeoX, maxGeoY); } BBoxMapBounds(final CoordinateReferenceSystem projection, final Envelope envelope);  BBoxMapBounds(
            final CoordinateReferenceSystem projection, final double minX, final double minY,
            final double maxX, final double maxY);  BBoxMapBounds(final ReferencedEnvelope bbox); @Override ReferencedEnvelope toReferencedEnvelope(final Rectangle paintArea); @Override MapBounds adjustedEnvelope(final Rectangle paintArea); @Override MapBounds adjustBoundsToNearestScale(
            final ZoomLevels zoomLevels, final double tolerance,
            final ZoomLevelSnapStrategy zoomLevelSnapStrategy,
            final boolean geodetic,
            final Rectangle paintArea,
            final double dpi); @Override Scale getScale(final Rectangle paintArea, final double dpi); @Override MapBounds adjustBoundsToRotation(final double rotation); @Override MapBounds zoomOut(final double factor); @Override MapBounds zoomToScale(final Scale scale); @Override Coordinate getCenter(); MapBounds expand(final int margin, final Rectangle paintArea); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }