Enum Class ZoomLevelSnapStrategy

java.lang.Object
java.lang.Enum<ZoomLevelSnapStrategy>
org.mapfish.print.attribute.map.ZoomLevelSnapStrategy
All Implemented Interfaces:
Serializable, Comparable<ZoomLevelSnapStrategy>, Constable

public enum ZoomLevelSnapStrategy extends Enum<ZoomLevelSnapStrategy>
Enumerates the different strategies for finding the closest zoom-level/scale.
  • Enum Constant Details

    • CLOSEST_LOWER_SCALE_ON_TIE

      public static final ZoomLevelSnapStrategy CLOSEST_LOWER_SCALE_ON_TIE
      Find the closest zoom level. If the targetScale is directly between two zoomLevels then the smaller/higher resolution scale will be chosen.
    • CLOSEST_HIGHER_SCALE_ON_TIE

      public static final ZoomLevelSnapStrategy CLOSEST_HIGHER_SCALE_ON_TIE
      Find the closest zoom level. If the targetScale is directly between two zoomLevels then the larger/lower resolution scale will be chosen.
    • HIGHER_SCALE

      public static final ZoomLevelSnapStrategy HIGHER_SCALE
      Always choose the zoom-level that is just higher than the target value.
    • LOWER_SCALE

      public static final ZoomLevelSnapStrategy LOWER_SCALE
      Always choose the zoom-level that is just lower than the target value.
  • Method Details

    • values

      public static ZoomLevelSnapStrategy[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ZoomLevelSnapStrategy valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • search

      protected abstract ZoomLevelSnapStrategy.SearchResult search(Scale scale, double tolerance, ZoomLevels zoomLevels)
      Search the provided zoomLevels for the scale that is the closest according to the current strategy.
      Parameters:
      scale - the reference scale
      tolerance - the amount from one of the zoomLevels to still be considered at the scale. This is important for all strategies other than CLOSEST in order to prevent the scale from jumping to a different version even when it is very close to one of the zoomLevels.
      zoomLevels - the allowed zoomLevels.