Package org.mapfish.print.attribute.map
Class MapBounds
java.lang.Object
org.mapfish.print.attribute.map.MapBounds
- Direct Known Subclasses:
BBoxMapBounds
,CenterScaleMapBounds
Class Represents the bounds of the map in some way. The implementations will represent the as a
bbox or as a center and scale. Created by Jesse on 3/26/14.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
MapBounds
(org.geotools.api.referencing.crs.CoordinateReferenceSystem projection) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionabstract MapBounds
adjustBoundsToNearestScale
(ZoomLevels zoomLevels, double tolerance, ZoomLevelSnapStrategy zoomLevelSnapStrategy, boolean geodetic, Rectangle paintArea, double dpi) Adjust these bounds so that they are adjusted to the nearest scale in the provided set of scales.abstract MapBounds
adjustBoundsToRotation
(double rotation) In case a rotation is used for the map, the bounds have to be adjusted so that all visible parts are rendered.abstract MapBounds
adjustedEnvelope
(Rectangle paintArea) Create aReferencedEnvelope
representing the bounds.boolean
abstract org.locationtech.jts.geom.Coordinate
Get the center.getNearestScale
(ZoomLevels zoomLevels, double tolerance, ZoomLevelSnapStrategy zoomLevelSnapStrategy, boolean geodetic, Rectangle paintArea, double dpi) Get the nearest scale.final org.geotools.api.referencing.crs.CoordinateReferenceSystem
Get the projection these bounds are calculated in.abstract Scale
Calculate and return the scale of the map bounds.int
hashCode()
abstract org.geotools.geometry.jts.ReferencedEnvelope
toReferencedEnvelope
(Rectangle paintArea) Create aReferencedEnvelope
representing the bounds.abstract MapBounds
zoomOut
(double factor) Zooms-out the bounds by the given factor.abstract MapBounds
zoomToScale
(Scale scale) Zoom to the given scale.
-
Constructor Details
-
MapBounds
protected MapBounds(org.geotools.api.referencing.crs.CoordinateReferenceSystem projection) Constructor.- Parameters:
projection
- the projection these bounds are defined in.
-
-
Method Details
-
toReferencedEnvelope
public abstract org.geotools.geometry.jts.ReferencedEnvelope toReferencedEnvelope(Rectangle paintArea) Create aReferencedEnvelope
representing the bounds.- Parameters:
paintArea
- the size of the map that will be drawn (at 72 DPI).
-
adjustedEnvelope
Create aReferencedEnvelope
representing the bounds.- Parameters:
paintArea
- the size of the map that will be drawn.
-
getProjection
public final org.geotools.api.referencing.crs.CoordinateReferenceSystem getProjection()Get the projection these bounds are calculated in. -
adjustBoundsToNearestScale
public abstract MapBounds adjustBoundsToNearestScale(ZoomLevels zoomLevels, double tolerance, ZoomLevelSnapStrategy zoomLevelSnapStrategy, boolean geodetic, Rectangle paintArea, double dpi) Adjust these bounds so that they are adjusted to the nearest scale in the provided set of scales.The center should remain the same and the scale should be adjusted
- Parameters:
zoomLevels
- the list of Zoom Levelstolerance
- the tolerance to use when considering if two values are equal. For example if 12.0 == 12.001. The tolerance is a percentagezoomLevelSnapStrategy
- the strategy to use for snapping to the nearest zoom level.geodetic
- snap to geodetic scales.paintArea
- the paint area of the map.dpi
- the DPI.
-
getNearestScale
public Scale getNearestScale(ZoomLevels zoomLevels, double tolerance, ZoomLevelSnapStrategy zoomLevelSnapStrategy, boolean geodetic, Rectangle paintArea, double dpi) Get the nearest scale.- Parameters:
zoomLevels
- the list of Zoom Levels.tolerance
- the tolerance to use when considering if two values are equal. For example if 12.0 == 12.001. The tolerance is a percentage.zoomLevelSnapStrategy
- the strategy to use for snapping to the nearest zoom level.geodetic
- snap to geodetic scales.paintArea
- the paint area of the map.dpi
- the DPI.
-
getScale
Calculate and return the scale of the map bounds.- Parameters:
paintArea
- the paint area of the map.dpi
- the dpi of the map
-
adjustBoundsToRotation
In case a rotation is used for the map, the bounds have to be adjusted so that all visible parts are rendered.- Parameters:
rotation
- The rotation of the map in radians.- Returns:
- Bounds adjusted to the map rotation.
-
zoomOut
Zooms-out the bounds by the given factor.- Parameters:
factor
- The zoom factor.- Returns:
- Bounds adjusted to the zoom factor.
-
zoomToScale
Zoom to the given scale.- Parameters:
scale
- The new scale.- Returns:
- Bounds adjusted to the scale.
-
getCenter
public abstract org.locationtech.jts.geom.Coordinate getCenter()Get the center.- Returns:
- the center position
-
equals
-
hashCode
public int hashCode()
-