Class ZoomLevels

  • All Implemented Interfaces:
    ConfigurationObject

    public final class ZoomLevels
    extends java.lang.Object
    implements ConfigurationObject
    Encapsulates a sorted set of scale denominators representing the allowed scales.

    The scales are sorted from largest to smallest and the index starts at 0, where 0 is the largest scale (most zoomed out).

    
       map: !map
         zoomLevels: !zoomLevels
            scales: [5000, 10000, 25000, 50000, 100000, 500000]
    [[examples=datasource_many_dynamictables_legend]]
    • Constructor Summary

      Constructors 
      Constructor Description
      ZoomLevels()
      default constructor for constructing by spring.
      ZoomLevels​(double... scaleDenominators)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      Scale get​(int index, DistanceUnit unit)
      Get the scale at the given index.
      double[] getScaleDenominators()
      Return a copy of the zoom level scale denominators.
      int hashCode()  
      void setScales​(double[] newScaleDenominators)
      Set the scales (sorts from largest to smallest).
      int size()
      The number of zoom levels.
      java.lang.String toString()  
      void validate​(java.util.List<java.lang.Throwable> validationErrors, Configuration configuration)
      validate that the configuration was correct.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ZoomLevels

        public ZoomLevels​(double... scaleDenominators)
        Constructor.
        Parameters:
        scaleDenominators - do not need to be sorted or unique.
      • ZoomLevels

        public ZoomLevels()
        default constructor for constructing by spring.
    • Method Detail

      • setScales

        public void setScales​(double[] newScaleDenominators)
        Set the scales (sorts from largest to smallest).
        Parameters:
        newScaleDenominators - The scales (may be unsorted).
      • size

        public int size()
        The number of zoom levels.
      • get

        public Scale get​(int index,
                         DistanceUnit unit)
        Get the scale at the given index.
        Parameters:
        index - the index of the zoom level to access.
        unit - the unit.
      • toString

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

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

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • validate

        public void validate​(java.util.List<java.lang.Throwable> validationErrors,
                             Configuration configuration)
        Description copied from interface: ConfigurationObject
        validate that the configuration was correct.
        Specified by:
        validate in interface ConfigurationObject
        Parameters:
        validationErrors - a list to add any detected errors to.
        configuration - the containing configuration
      • getScaleDenominators

        public double[] getScaleDenominators()
        Return a copy of the zoom level scale denominators. Scales are sorted greatest to least.