Class BackgroundMBLayer


  • public class BackgroundMBLayer
    extends MBLayer
    The background color or pattern of the map.

    MBLayer wrapper around a JSONObject representation of a "background" type latyer. All methods act as accessors on provided JSON layer, no other state is maintained. This allows modifications to be made cleanly with out chance of side-effect.

    • get methods: access the json directly
    • query methods: provide logic / transforms to GeoTools classes as required.
    • Constructor Detail

      • BackgroundMBLayer

        public BackgroundMBLayer​(JSONObject json)
    • Method Detail

      • defaultSemanticType

        protected SemanticType defaultSemanticType()
      • getBackgroundColor

        public Color getBackgroundColor()
        Optional color. Defaults to #000000. Disabled by background-pattern.
        Returns:
        The color with which the background will be drawn.
      • backgroundColor

        public Expression backgroundColor()
        Maps getBackgroundColor() to an Expression.

        Optional color. Defaults to #000000. Disabled by background-pattern.

        Returns:
        The color with which the background will be drawn.
      • getBackgroundPattern

        public String getBackgroundPattern()
        Optional string. Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512).
        Returns:
        Name of image in sprite to use for drawing an image background, or null if not defined.
      • hasBackgroundPattern

        public boolean hasBackgroundPattern()
        Returns:
        True if the layer has a background-pattern explicitly provided.
      • backgroundPattern

        public Expression backgroundPattern()
        Maps getBackgroundPattern() to an Expression.

        Optional string. Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512).

        Returns:
        Name of image in sprite to use for drawing an image background, or null if not defined.
      • getBackgroundOpacity

        public Number getBackgroundOpacity()
        Optional number. Defaults to 1.
        Returns:
        The opacity at which the background will be drawn.
      • transformInternal

        public List<FeatureTypeStyle> transformInternal​(MBStyle styleContext)
        Transform BackgroundMBLayer to GeoTools FeatureTypeStyle.
        Specified by:
        transformInternal in class MBLayer
        Parameters:
        styleContext - The MBStyle to which this layer belongs, used as a context for things like resolving sprite and glyph names to full urls.
        Returns:
        FeatureTypeStyle
      • getFill

        public Fill getFill​(MBStyle styleContext)
      • getType

        public String getType()
        Rendering type of this layer.
        Specified by:
        getType in class MBLayer
        Returns:
        TYPE