Enum ZoomLevelSnapStrategy

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<ZoomLevelSnapStrategy>

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

      • 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 Detail

      • values

        public static ZoomLevelSnapStrategy[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (ZoomLevelSnapStrategy c : ZoomLevelSnapStrategy.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ZoomLevelSnapStrategy valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.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.