Class ZoomLevels

java.lang.Object
org.mapfish.print.attribute.map.ZoomLevels
All Implemented Interfaces:
ConfigurationObject

public final class ZoomLevels extends 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 Details

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

    • 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 String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

      public void validate(List<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.