Class MBStyleTransformer

    • Field Detail

      • mapboxTokenPattern

        protected static final Pattern mapboxTokenPattern
    • Constructor Detail

      • MBStyleTransformer

        public MBStyleTransformer​(MBObjectParser parse)
    • Method Detail

      • createExternalGraphicForSprite

        public ExternalGraphic createExternalGraphicForSprite​(Expression iconName,
                                                              Expression iconSize,
                                                              MBStyle styleContext)
        Takes the name of an icon, and an MBStyle as a context, and returns an External Graphic referencing the full URL of the image for consumption by the SpriteGraphicFactory. (The format of the image will be SpriteGraphicFactory.FORMAT).
        Parameters:
        iconName - The name of the icon inside the spritesheet.
        iconSize - The size (scale multiplier) to apply to the icon. (Nullable).
        styleContext - The style context in which to resolve the icon name to the full sprite URL (for consumption by the SpriteGraphicFactory).
        Returns:
        An external graphic with the full URL of the mage for the SpriteGraphicFactory.
        See Also:
        SpriteGraphicFactory
      • requireLiteral

        public static <T> T requireLiteral​(Expression expression,
                                           Class<T> clazz,
                                           T fallback,
                                           String propertyName,
                                           String layerId)
        Utility method for getting a concrete value out of an expression, used by transformer methods when GeoTools is unable to accept an expression.
        • If the provided Expression is a Literal, evaluates it and returns the value.
        • Otherwise, returns the provided fallback value and logs a warning that dynamic styling is not yet supported for this property.
        Parameters:
        expression - The expression
        clazz - The type to provide as the context for the expression's evaluation.
        fallback - The value to return if the expression is not a literal
        propertyName - The name of the property that the expression corresponds to, for logging purposes.
        layerId - The ID of the layer that the expression corresponds to, for logging purposes.
        Returns:
        The evaluated value of the provided Expression, or the provided fallback value.
      • getDefaultFonts

        public List<String> getDefaultFonts()
        Returns:
        The list of default font names