Class BBoxMapBounds


  • public final class BBoxMapBounds
    extends MapBounds
    Represent the map bounds with a bounding box.

    Created by Jesse on 3/26/14.

    • Constructor Summary

      Constructors 
      Constructor Description
      BBoxMapBounds​(org.geotools.api.referencing.crs.CoordinateReferenceSystem projection, double minX, double minY, double maxX, double maxY)
      Constructor.
      BBoxMapBounds​(org.geotools.api.referencing.crs.CoordinateReferenceSystem projection, org.locationtech.jts.geom.Envelope envelope)
      Constructor.
      BBoxMapBounds​(org.geotools.geometry.jts.ReferencedEnvelope bbox)
      Create from a bbox.
    • Constructor Detail

      • BBoxMapBounds

        public BBoxMapBounds​(org.geotools.api.referencing.crs.CoordinateReferenceSystem projection,
                             org.locationtech.jts.geom.Envelope envelope)
        Constructor.
        Parameters:
        projection - the projection these bounds are defined in.
        envelope - the bounds
      • BBoxMapBounds

        public BBoxMapBounds​(org.geotools.api.referencing.crs.CoordinateReferenceSystem projection,
                             double minX,
                             double minY,
                             double maxX,
                             double maxY)
        Constructor.
        Parameters:
        projection - the projection these bounds are defined in.
        minX - min X coordinate for the MapBounds
        minY - min Y coordinate for the MapBounds
        maxX - max X coordinate for the MapBounds
        maxY - max Y coordinate for the MapBounds
      • BBoxMapBounds

        public BBoxMapBounds​(org.geotools.geometry.jts.ReferencedEnvelope bbox)
        Create from a bbox.
        Parameters:
        bbox - the bounds.
    • Method Detail

      • toReferencedEnvelope

        public org.geotools.geometry.jts.ReferencedEnvelope toReferencedEnvelope​(java.awt.Rectangle paintArea)
        Description copied from class: MapBounds
        Create a ReferencedEnvelope representing the bounds.
        Specified by:
        toReferencedEnvelope in class MapBounds
        Parameters:
        paintArea - the size of the map that will be drawn (at 72 DPI).
      • adjustedEnvelope

        public MapBounds adjustedEnvelope​(java.awt.Rectangle paintArea)
        Description copied from class: MapBounds
        Create a ReferencedEnvelope representing the bounds.
        Specified by:
        adjustedEnvelope in class MapBounds
        Parameters:
        paintArea - the size of the map that will be drawn.
      • adjustBoundsToNearestScale

        public MapBounds adjustBoundsToNearestScale​(ZoomLevels zoomLevels,
                                                    double tolerance,
                                                    ZoomLevelSnapStrategy zoomLevelSnapStrategy,
                                                    boolean geodetic,
                                                    java.awt.Rectangle paintArea,
                                                    double dpi)
        Description copied from class: MapBounds
        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

        Specified by:
        adjustBoundsToNearestScale in class MapBounds
        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 Scale getScale​(java.awt.Rectangle paintArea,
                              double dpi)
        Description copied from class: MapBounds
        Calculate and return the scale of the map bounds.
        Specified by:
        getScale in class MapBounds
        Parameters:
        paintArea - the paint area of the map.
        dpi - the dpi of the map
      • adjustBoundsToRotation

        public MapBounds adjustBoundsToRotation​(double rotation)
        Description copied from class: MapBounds
        In case a rotation is used for the map, the bounds have to be adjusted so that all visible parts are rendered.
        Specified by:
        adjustBoundsToRotation in class MapBounds
        Parameters:
        rotation - The rotation of the map in radians.
        Returns:
        Bounds adjusted to the map rotation.
      • zoomOut

        public MapBounds zoomOut​(double factor)
        Description copied from class: MapBounds
        Zooms-out the bounds by the given factor.
        Specified by:
        zoomOut in class MapBounds
        Parameters:
        factor - The zoom factor.
        Returns:
        Bounds adjusted to the zoom factor.
      • zoomToScale

        public MapBounds zoomToScale​(Scale scale)
        Description copied from class: MapBounds
        Zoom to the given scale.
        Specified by:
        zoomToScale in class MapBounds
        Parameters:
        scale - The new scale.
        Returns:
        Bounds adjusted to the scale.
      • getCenter

        public org.locationtech.jts.geom.Coordinate getCenter()
        Description copied from class: MapBounds
        Get the center.
        Specified by:
        getCenter in class MapBounds
        Returns:
        the center position
      • expand

        public MapBounds expand​(int margin,
                                java.awt.Rectangle paintArea)
        Expand the bounds by the given margin (in pixel).
        Parameters:
        margin - Value in pixel.
        paintArea - the paint area of the map.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class MapBounds
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object