Class MBObjectStops

Object
MBObjectStops

public class MBObjectStops extends Object
This class provides the ability to find all the zoom levels within a MapBox Style and returns a reduced list of only the layers and properties containing Base and Stops values. This class is only used with "zoom" and "zoom-and-property" and excludes the use of "property".
Author:
David Vick (Boundless)
  • Field Details

  • Constructor Details

    • MBObjectStops

      public MBObjectStops(MBLayer layer)
      Data structure for pre-processing a MBLayer determining whether the layer contains zoom and zoom-and-property functions and if so, getting the distinct stops for each, building a list of MBLayers (one for each stop) and setting ranges that are used to set min/max scale denominators for each MBLayer.
      Parameters:
      layer - Layer being processed for stops
  • Method Details

    • getCurrentStop

      public double getCurrentStop(MBLayer layer)
      Gets the current stop of the layer. This would be the bottom of the range i.e 0 for {0, 20}
      Parameters:
      layer - Layer being processed
      Returns:
      Current zoom-level stop
    • getRangeForStop

      public double[] getRangeForStop(Double stop, List<double[]> ranges)
      Finds the distinct range for the current stop.
      Parameters:
      stop - Current stop
      ranges - Available ranges
      Returns:
      distinct range for current stop
    • zoomLevelToScaleDenominator

      public static Double zoomLevelToScaleDenominator(double zoomLevel)
      Take a web mercator zoom level, and return the equivalent scale denominator (at the equator).

      Converting to a scale denominator at the equator is consistent with the conversion elsewhere in GeoTools, e.g., in the GeoTools YSLD ZoomContextFinder.

      Parameters:
      zoomLevel - The zoom level
      Returns:
      The equivalent scale denominator (at the equator)
    • zoomBoundaryScaleDenominator

      public static Double zoomBoundaryScaleDenominator(double zoomLevel)
      Returns the scale denominator to use as the boundary of a zoom range, such as a layer minzoom or maxzoom. The boundary sits one ZoomLevelFunction.ZOOM_STEP towards the lower zooms, so a request at that zoom level counts as being at or above it: a layer is drawn at its minzoom and hidden at its maxzoom. Without the step, small differences in how clients compute the scale put such requests on either side of the boundary.
    • getStop

      public double getStop(MBLayer layer)