Class MapBounds

java.lang.Object
org.mapfish.print.attribute.map.MapBounds
Direct Known Subclasses:
BBoxMapBounds, CenterScaleMapBounds

public abstract class MapBounds extends 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 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 a ReferencedEnvelope representing the bounds.
      Parameters:
      paintArea - the size of the map that will be drawn (at 72 DPI).
    • adjustedEnvelope

      public abstract MapBounds adjustedEnvelope(Rectangle paintArea)
      Create a ReferencedEnvelope 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 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.
    • 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

      public abstract Scale getScale(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(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object