Class 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)
    • Constructor Detail

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

      • 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)
      • getStop

        public double getStop​(MBLayer layer)