@Test public void testToReferencedEnvelopeLatLong() { final double startScaleDenominator = 56304.83087498591; final CenterScaleMapBounds bounds = new CenterScaleMapBounds(DefaultGeographicCRS.WGS84, 8.2335427805083, 46.801424340241, startScaleDenominator); final Rectangle paintArea = new Rectangle(521, 330); final ReferencedEnvelope envelope = bounds.toReferencedEnvelope(paintArea); final double delta = 0.000001; assertEquals(8.1657602, envelope.getMinX(), delta); assertEquals(8.3013252, envelope.getMaxX(), delta); assertEquals(46.771942, envelope.getMinY(), delta); assertEquals(46.830906, envelope.getMaxY(), delta); assertEquals(DefaultGeographicCRS.WGS84, envelope.getCoordinateReferenceSystem()); }
@Override public ReferencedEnvelope toReferencedEnvelope(final Rectangle paintArea) { ReferencedEnvelope bbox; final DistanceUnit projectionUnit = DistanceUnit.fromProjection(getProjection()); if (projectionUnit == DistanceUnit.DEGREES) { double geoWidthInches = this.scale.getResolutionInInches() * paintArea.width; double geoHeightInches = this.scale.getResolutionInInches() * paintArea.height; bbox = computeGeodeticBBox(geoWidthInches, geoHeightInches); } else { final double centerX = this.center.getOrdinate(0); final double centerY = this.center.getOrdinate(1); double geoWidth = this.scale.getResolution() * paintArea.width; double geoHeight = this.scale.getResolution() * paintArea.height; double minGeoX = centerX - (geoWidth / 2.0); double minGeoY = centerY - (geoHeight / 2.0); double maxGeoX = minGeoX + geoWidth; double maxGeoY = minGeoY + geoHeight; bbox = new ReferencedEnvelope(minGeoX, maxGeoX, minGeoY, maxGeoY, getProjection()); } return bbox; }
CenterScaleMapBounds extends MapBounds { @Override public ReferencedEnvelope toReferencedEnvelope(final Rectangle paintArea) { ReferencedEnvelope bbox; final DistanceUnit projectionUnit = DistanceUnit.fromProjection(getProjection()); if (projectionUnit == DistanceUnit.DEGREES) { double geoWidthInches = this.scale.getResolutionInInches() * paintArea.width; double geoHeightInches = this.scale.getResolutionInInches() * paintArea.height; bbox = computeGeodeticBBox(geoWidthInches, geoHeightInches); } else { final double centerX = this.center.getOrdinate(0); final double centerY = this.center.getOrdinate(1); double geoWidth = this.scale.getResolution() * paintArea.width; double geoHeight = this.scale.getResolution() * paintArea.height; double minGeoX = centerX - (geoWidth / 2.0); double minGeoY = centerY - (geoHeight / 2.0); double maxGeoX = minGeoX + geoWidth; double maxGeoY = minGeoY + geoHeight; bbox = new ReferencedEnvelope(minGeoX, maxGeoX, minGeoY, maxGeoY, getProjection()); } return bbox; } }
CenterScaleMapBounds extends MapBounds { @Override public ReferencedEnvelope toReferencedEnvelope(final Rectangle paintArea) { ReferencedEnvelope bbox; final DistanceUnit projectionUnit = DistanceUnit.fromProjection(getProjection()); if (projectionUnit == DistanceUnit.DEGREES) { double geoWidthInches = this.scale.getResolutionInInches() * paintArea.width; double geoHeightInches = this.scale.getResolutionInInches() * paintArea.height; bbox = computeGeodeticBBox(geoWidthInches, geoHeightInches); } else { final double centerX = this.center.getOrdinate(0); final double centerY = this.center.getOrdinate(1); double geoWidth = this.scale.getResolution() * paintArea.width; double geoHeight = this.scale.getResolution() * paintArea.height; double minGeoX = centerX - (geoWidth / 2.0); double minGeoY = centerY - (geoHeight / 2.0); double maxGeoX = minGeoX + geoWidth; double maxGeoY = minGeoY + geoHeight; bbox = new ReferencedEnvelope(minGeoX, maxGeoX, minGeoY, maxGeoY, getProjection()); } return bbox; } CenterScaleMapBounds(
            final CoordinateReferenceSystem projection, final double centerX,
            final double centerY, final double scaleDenominator);  CenterScaleMapBounds(
            final CoordinateReferenceSystem projection, final double centerX,
            final double centerY, final Scale scale); }
CenterScaleMapBounds extends MapBounds { @Override public ReferencedEnvelope toReferencedEnvelope(final Rectangle paintArea) { ReferencedEnvelope bbox; final DistanceUnit projectionUnit = DistanceUnit.fromProjection(getProjection()); if (projectionUnit == DistanceUnit.DEGREES) { double geoWidthInches = this.scale.getResolutionInInches() * paintArea.width; double geoHeightInches = this.scale.getResolutionInInches() * paintArea.height; bbox = computeGeodeticBBox(geoWidthInches, geoHeightInches); } else { final double centerX = this.center.getOrdinate(0); final double centerY = this.center.getOrdinate(1); double geoWidth = this.scale.getResolution() * paintArea.width; double geoHeight = this.scale.getResolution() * paintArea.height; double minGeoX = centerX - (geoWidth / 2.0); double minGeoY = centerY - (geoHeight / 2.0); double maxGeoX = minGeoX + geoWidth; double maxGeoY = minGeoY + geoHeight; bbox = new ReferencedEnvelope(minGeoX, maxGeoX, minGeoY, maxGeoY, getProjection()); } return bbox; } CenterScaleMapBounds(
            final CoordinateReferenceSystem projection, final double centerX,
            final double centerY, final double scaleDenominator);  CenterScaleMapBounds(
            final CoordinateReferenceSystem projection, final double centerX,
            final double centerY, final Scale scale); @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 CenterScaleMapBounds zoomOut(final double factor); @Override MapBounds zoomToScale(final Scale newScale); @Override Coordinate getCenter(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); }
CenterScaleMapBounds extends MapBounds { @Override public ReferencedEnvelope toReferencedEnvelope(final Rectangle paintArea) { ReferencedEnvelope bbox; final DistanceUnit projectionUnit = DistanceUnit.fromProjection(getProjection()); if (projectionUnit == DistanceUnit.DEGREES) { double geoWidthInches = this.scale.getResolutionInInches() * paintArea.width; double geoHeightInches = this.scale.getResolutionInInches() * paintArea.height; bbox = computeGeodeticBBox(geoWidthInches, geoHeightInches); } else { final double centerX = this.center.getOrdinate(0); final double centerY = this.center.getOrdinate(1); double geoWidth = this.scale.getResolution() * paintArea.width; double geoHeight = this.scale.getResolution() * paintArea.height; double minGeoX = centerX - (geoWidth / 2.0); double minGeoY = centerY - (geoHeight / 2.0); double maxGeoX = minGeoX + geoWidth; double maxGeoY = minGeoY + geoHeight; bbox = new ReferencedEnvelope(minGeoX, maxGeoX, minGeoY, maxGeoY, getProjection()); } return bbox; } CenterScaleMapBounds(
            final CoordinateReferenceSystem projection, final double centerX,
            final double centerY, final double scaleDenominator);  CenterScaleMapBounds(
            final CoordinateReferenceSystem projection, final double centerX,
            final double centerY, final Scale scale); @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 CenterScaleMapBounds zoomOut(final double factor); @Override MapBounds zoomToScale(final Scale newScale); @Override Coordinate getCenter(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }