Package org.mapfish.print.attribute.map
Class MapBounds
- java.lang.Object
-
- org.mapfish.print.attribute.map.MapBounds
-
- Direct Known Subclasses:
BBoxMapBounds
,CenterScaleMapBounds
public abstract class MapBounds extends java.lang.Object
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
Constructors Modifier Constructor Description protected
MapBounds(org.geotools.api.referencing.crs.CoordinateReferenceSystem projection)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract MapBounds
adjustBoundsToNearestScale(ZoomLevels zoomLevels, double tolerance, ZoomLevelSnapStrategy zoomLevelSnapStrategy, boolean geodetic, java.awt.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(java.awt.Rectangle paintArea)
Create aReferencedEnvelope
representing the bounds.boolean
equals(java.lang.Object o)
abstract org.locationtech.jts.geom.Coordinate
getCenter()
Get the center.Scale
getNearestScale(ZoomLevels zoomLevels, double tolerance, ZoomLevelSnapStrategy zoomLevelSnapStrategy, boolean geodetic, java.awt.Rectangle paintArea, double dpi)
Get the nearest scale.org.geotools.api.referencing.crs.CoordinateReferenceSystem
getProjection()
Get the projection these bounds are calculated in.abstract Scale
getScale(java.awt.Rectangle paintArea, double dpi)
Calculate and return the scale of the map bounds.int
hashCode()
abstract org.geotools.geometry.jts.ReferencedEnvelope
toReferencedEnvelope(java.awt.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.
-
-
-
Method Detail
-
toReferencedEnvelope
public abstract org.geotools.geometry.jts.ReferencedEnvelope toReferencedEnvelope(java.awt.Rectangle paintArea)
Create aReferencedEnvelope
representing the bounds.- Parameters:
paintArea
- the size of the map that will be drawn (at 72 DPI).
-
adjustedEnvelope
public abstract MapBounds adjustedEnvelope(java.awt.Rectangle paintArea)
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, java.awt.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, java.awt.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
public abstract Scale getScale(java.awt.Rectangle paintArea, double dpi)
Calculate and return the scale of the map bounds.- Parameters:
paintArea
- the paint area of the map.dpi
- the dpi of the map
-
adjustBoundsToRotation
public 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.- Parameters:
rotation
- The rotation of the map in radians.- Returns:
- Bounds adjusted to the map rotation.
-
zoomOut
public abstract MapBounds zoomOut(double factor)
Zooms-out the bounds by the given factor.- Parameters:
factor
- The zoom factor.- Returns:
- Bounds adjusted to the zoom factor.
-
zoomToScale
public abstract MapBounds zoomToScale(Scale scale)
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
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-