Class SymbolOptions


  • public class SymbolOptions
    extends Options<Symbol>
    Builder class from which a symbol is created.
    • Constructor Summary

      Constructors 
      Constructor Description
      SymbolOptions()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.google.gson.JsonElement getData()
      Get the arbitrary json data of the annotation.
      boolean getDraggable()
      Returns whether this symbol is draggable, meaning it can be dragged across the screen when touched and moved.
      com.mapbox.geojson.Point getGeometry()
      Get the geometry of the symbol, which represents the location of the symbol on the map
      java.lang.String getIconAnchor()
      Get the current configured icon-anchor for the symbol
      java.lang.String getIconColor()
      Get the current configured icon-color for the symbol
      java.lang.Float getIconHaloBlur()
      Get the current configured icon-halo-blur for the symbol
      java.lang.String getIconHaloColor()
      Get the current configured icon-halo-color for the symbol
      java.lang.Float getIconHaloWidth()
      Get the current configured icon-halo-width for the symbol
      java.lang.String getIconImage()
      Get the current configured icon-image for the symbol
      java.lang.Float[] getIconOffset()
      Get the current configured icon-offset for the symbol
      java.lang.Float getIconOpacity()
      Get the current configured icon-opacity for the symbol
      java.lang.Float getIconRotate()
      Get the current configured icon-rotate for the symbol
      java.lang.Float getIconSize()
      Get the current configured icon-size for the symbol
      com.mapbox.mapboxsdk.geometry.LatLng getLatLng()
      Get the LatLng of the symbol, which represents the location of the symbol on the map
      java.lang.Float getSymbolSortKey()
      Get the current configured symbol-sort-key for the symbol
      java.lang.String getTextAnchor()
      Get the current configured text-anchor for the symbol
      java.lang.String getTextColor()
      Get the current configured text-color for the symbol
      java.lang.String getTextField()
      Get the current configured text-field for the symbol
      java.lang.String[] getTextFont()
      Get the current configured text-font for the symbol
      java.lang.Float getTextHaloBlur()
      Get the current configured text-halo-blur for the symbol
      java.lang.String getTextHaloColor()
      Get the current configured text-halo-color for the symbol
      java.lang.Float getTextHaloWidth()
      Get the current configured text-halo-width for the symbol
      java.lang.String getTextJustify()
      Get the current configured text-justify for the symbol
      java.lang.Float getTextLetterSpacing()
      Get the current configured text-letter-spacing for the symbol
      java.lang.Float getTextMaxWidth()
      Get the current configured text-max-width for the symbol
      java.lang.Float[] getTextOffset()
      Get the current configured text-offset for the symbol
      java.lang.Float getTextOpacity()
      Get the current configured text-opacity for the symbol
      java.lang.Float getTextRadialOffset()
      Get the current configured text-radial-offset for the symbol
      java.lang.Float getTextRotate()
      Get the current configured text-rotate for the symbol
      java.lang.Float getTextSize()
      Get the current configured text-size for the symbol
      java.lang.String getTextTransform()
      Get the current configured text-transform for the symbol
      SymbolOptions withData​(com.google.gson.JsonElement jsonElement)
      Set the arbitrary json data of the annotation.
      SymbolOptions withDraggable​(boolean draggable)
      Set whether this symbol should be draggable, meaning it can be dragged across the screen when touched and moved.
      SymbolOptions withGeometry​(com.mapbox.geojson.Point geometry)
      Set the geometry of the symbol, which represents the location of the symbol on the map
      SymbolOptions withIconAnchor​(java.lang.String iconAnchor)
      Set icon-anchor to initialise the symbol with.
      SymbolOptions withIconColor​(java.lang.String iconColor)
      Set icon-color to initialise the symbol with.
      SymbolOptions withIconHaloBlur​(java.lang.Float iconHaloBlur)
      Set icon-halo-blur to initialise the symbol with.
      SymbolOptions withIconHaloColor​(java.lang.String iconHaloColor)
      Set icon-halo-color to initialise the symbol with.
      SymbolOptions withIconHaloWidth​(java.lang.Float iconHaloWidth)
      Set icon-halo-width to initialise the symbol with.
      SymbolOptions withIconImage​(java.lang.String iconImage)
      Set icon-image to initialise the symbol with.
      SymbolOptions withIconOffset​(java.lang.Float[] iconOffset)
      Set icon-offset to initialise the symbol with.
      SymbolOptions withIconOpacity​(java.lang.Float iconOpacity)
      Set icon-opacity to initialise the symbol with.
      SymbolOptions withIconRotate​(java.lang.Float iconRotate)
      Set icon-rotate to initialise the symbol with.
      SymbolOptions withIconSize​(java.lang.Float iconSize)
      Set icon-size to initialise the symbol with.
      SymbolOptions withLatLng​(com.mapbox.mapboxsdk.geometry.LatLng latLng)
      Set the LatLng of the symbol, which represents the location of the symbol on the map
      SymbolOptions withSymbolSortKey​(java.lang.Float symbolSortKey)
      Set symbol-sort-key to initialise the symbol with.
      SymbolOptions withTextAnchor​(java.lang.String textAnchor)
      Set text-anchor to initialise the symbol with.
      SymbolOptions withTextColor​(java.lang.String textColor)
      Set text-color to initialise the symbol with.
      SymbolOptions withTextField​(java.lang.String textField)
      Set text-field to initialise the symbol with.
      SymbolOptions withTextFont​(java.lang.String[] textFont)
      Set text-font to initialise the symbol with.
      SymbolOptions withTextHaloBlur​(java.lang.Float textHaloBlur)
      Set text-halo-blur to initialise the symbol with.
      SymbolOptions withTextHaloColor​(java.lang.String textHaloColor)
      Set text-halo-color to initialise the symbol with.
      SymbolOptions withTextHaloWidth​(java.lang.Float textHaloWidth)
      Set text-halo-width to initialise the symbol with.
      SymbolOptions withTextJustify​(java.lang.String textJustify)
      Set text-justify to initialise the symbol with.
      SymbolOptions withTextLetterSpacing​(java.lang.Float textLetterSpacing)
      Set text-letter-spacing to initialise the symbol with.
      SymbolOptions withTextMaxWidth​(java.lang.Float textMaxWidth)
      Set text-max-width to initialise the symbol with.
      SymbolOptions withTextOffset​(java.lang.Float[] textOffset)
      Set text-offset to initialise the symbol with.
      SymbolOptions withTextOpacity​(java.lang.Float textOpacity)
      Set text-opacity to initialise the symbol with.
      SymbolOptions withTextRadialOffset​(java.lang.Float textRadialOffset)
      Set text-radial-offset to initialise the symbol with.
      SymbolOptions withTextRotate​(java.lang.Float textRotate)
      Set text-rotate to initialise the symbol with.
      SymbolOptions withTextSize​(java.lang.Float textSize)
      Set text-size to initialise the symbol with.
      SymbolOptions withTextTransform​(java.lang.String textTransform)
      Set text-transform to initialise the symbol with.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SymbolOptions

        public SymbolOptions()
    • Method Detail

      • withSymbolSortKey

        public SymbolOptions withSymbolSortKey​(java.lang.Float symbolSortKey)
        Set symbol-sort-key to initialise the symbol with.

        Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key when they overlap. Features with a lower sort key will have priority over other features when doing placement.

        Parameters:
        symbolSortKey - the symbol-sort-key value
        Returns:
        this
      • getSymbolSortKey

        public java.lang.Float getSymbolSortKey()
        Get the current configured symbol-sort-key for the symbol

        Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key when they overlap. Features with a lower sort key will have priority over other features when doing placement.

        Returns:
        symbolSortKey value
      • withIconSize

        public SymbolOptions withIconSize​(java.lang.Float iconSize)
        Set icon-size to initialise the symbol with.

        Scales the original size of the icon by the provided factor. The new pixel size of the image will be the original pixel size multiplied by PropertyFactory.iconSize(java.lang.Float). 1 is the original size; 3 triples the size of the image.

        Parameters:
        iconSize - the icon-size value
        Returns:
        this
      • getIconSize

        public java.lang.Float getIconSize()
        Get the current configured icon-size for the symbol

        Scales the original size of the icon by the provided factor. The new pixel size of the image will be the original pixel size multiplied by PropertyFactory.iconSize(java.lang.Float). 1 is the original size; 3 triples the size of the image.

        Returns:
        iconSize value
      • withIconImage

        public SymbolOptions withIconImage​(java.lang.String iconImage)
        Set icon-image to initialise the symbol with.

        Name of image in sprite to use for drawing an image background.

        Parameters:
        iconImage - the icon-image value
        Returns:
        this
      • getIconImage

        public java.lang.String getIconImage()
        Get the current configured icon-image for the symbol

        Name of image in sprite to use for drawing an image background.

        Returns:
        iconImage value
      • withIconRotate

        public SymbolOptions withIconRotate​(java.lang.Float iconRotate)
        Set icon-rotate to initialise the symbol with.

        Rotates the icon clockwise.

        Parameters:
        iconRotate - the icon-rotate value
        Returns:
        this
      • getIconRotate

        public java.lang.Float getIconRotate()
        Get the current configured icon-rotate for the symbol

        Rotates the icon clockwise.

        Returns:
        iconRotate value
      • withIconOffset

        public SymbolOptions withIconOffset​(java.lang.Float[] iconOffset)
        Set icon-offset to initialise the symbol with.

        Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up. Each component is multiplied by the value of PropertyFactory.iconSize(java.lang.Float) to obtain the final offset in density-independent pixels. When combined with PropertyFactory.iconRotate(java.lang.Float) the offset will be as if the rotated direction was up.

        Parameters:
        iconOffset - the icon-offset value
        Returns:
        this
      • getIconOffset

        public java.lang.Float[] getIconOffset()
        Get the current configured icon-offset for the symbol

        Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up. Each component is multiplied by the value of PropertyFactory.iconSize(java.lang.Float) to obtain the final offset in density-independent pixels. When combined with PropertyFactory.iconRotate(java.lang.Float) the offset will be as if the rotated direction was up.

        Returns:
        iconOffset value
      • withIconAnchor

        public SymbolOptions withIconAnchor​(java.lang.String iconAnchor)
        Set icon-anchor to initialise the symbol with.

        Part of the icon placed closest to the anchor.

        Parameters:
        iconAnchor - the icon-anchor value
        Returns:
        this
      • getIconAnchor

        public java.lang.String getIconAnchor()
        Get the current configured icon-anchor for the symbol

        Part of the icon placed closest to the anchor.

        Returns:
        iconAnchor value
      • withTextField

        public SymbolOptions withTextField​(java.lang.String textField)
        Set text-field to initialise the symbol with.

        Value to use for a text label. If a plain `string` is provided, it will be treated as a `formatted` with default/inherited formatting options.

        Parameters:
        textField - the text-field value
        Returns:
        this
      • getTextField

        public java.lang.String getTextField()
        Get the current configured text-field for the symbol

        Value to use for a text label. If a plain `string` is provided, it will be treated as a `formatted` with default/inherited formatting options.

        Returns:
        textField value
      • withTextFont

        public SymbolOptions withTextFont​(java.lang.String[] textFont)
        Set text-font to initialise the symbol with.

        Font stack to use for displaying text.

        Parameters:
        textFont - the text-font value
        Returns:
        this
      • getTextFont

        public java.lang.String[] getTextFont()
        Get the current configured text-font for the symbol

        Font stack to use for displaying text.

        Returns:
        textFont value
      • withTextSize

        public SymbolOptions withTextSize​(java.lang.Float textSize)
        Set text-size to initialise the symbol with.

        Font size.

        Parameters:
        textSize - the text-size value
        Returns:
        this
      • getTextSize

        public java.lang.Float getTextSize()
        Get the current configured text-size for the symbol

        Font size.

        Returns:
        textSize value
      • withTextMaxWidth

        public SymbolOptions withTextMaxWidth​(java.lang.Float textMaxWidth)
        Set text-max-width to initialise the symbol with.

        The maximum line width for text wrapping.

        Parameters:
        textMaxWidth - the text-max-width value
        Returns:
        this
      • getTextMaxWidth

        public java.lang.Float getTextMaxWidth()
        Get the current configured text-max-width for the symbol

        The maximum line width for text wrapping.

        Returns:
        textMaxWidth value
      • withTextLetterSpacing

        public SymbolOptions withTextLetterSpacing​(java.lang.Float textLetterSpacing)
        Set text-letter-spacing to initialise the symbol with.

        Text tracking amount.

        Parameters:
        textLetterSpacing - the text-letter-spacing value
        Returns:
        this
      • getTextLetterSpacing

        public java.lang.Float getTextLetterSpacing()
        Get the current configured text-letter-spacing for the symbol

        Text tracking amount.

        Returns:
        textLetterSpacing value
      • withTextJustify

        public SymbolOptions withTextJustify​(java.lang.String textJustify)
        Set text-justify to initialise the symbol with.

        Text justification options.

        Parameters:
        textJustify - the text-justify value
        Returns:
        this
      • getTextJustify

        public java.lang.String getTextJustify()
        Get the current configured text-justify for the symbol

        Text justification options.

        Returns:
        textJustify value
      • withTextRadialOffset

        public SymbolOptions withTextRadialOffset​(java.lang.Float textRadialOffset)
        Set text-radial-offset to initialise the symbol with.

        Radial offset of text, in the direction of the symbol's anchor. Useful in combination with PropertyFactory.textVariableAnchor(java.lang.String[]), which doesn't support the two-dimensional PropertyFactory.textOffset(java.lang.Float[]).

        Parameters:
        textRadialOffset - the text-radial-offset value
        Returns:
        this
      • getTextRadialOffset

        public java.lang.Float getTextRadialOffset()
        Get the current configured text-radial-offset for the symbol

        Radial offset of text, in the direction of the symbol's anchor. Useful in combination with PropertyFactory.textVariableAnchor(java.lang.String[]), which doesn't support the two-dimensional PropertyFactory.textOffset(java.lang.Float[]).

        Returns:
        textRadialOffset value
      • withTextAnchor

        public SymbolOptions withTextAnchor​(java.lang.String textAnchor)
        Set text-anchor to initialise the symbol with.

        Part of the text placed closest to the anchor.

        Parameters:
        textAnchor - the text-anchor value
        Returns:
        this
      • getTextAnchor

        public java.lang.String getTextAnchor()
        Get the current configured text-anchor for the symbol

        Part of the text placed closest to the anchor.

        Returns:
        textAnchor value
      • withTextRotate

        public SymbolOptions withTextRotate​(java.lang.Float textRotate)
        Set text-rotate to initialise the symbol with.

        Rotates the text clockwise.

        Parameters:
        textRotate - the text-rotate value
        Returns:
        this
      • getTextRotate

        public java.lang.Float getTextRotate()
        Get the current configured text-rotate for the symbol

        Rotates the text clockwise.

        Returns:
        textRotate value
      • withTextTransform

        public SymbolOptions withTextTransform​(java.lang.String textTransform)
        Set text-transform to initialise the symbol with.

        Specifies how to capitalize text, similar to the CSS PropertyFactory.textTransform(java.lang.String) property.

        Parameters:
        textTransform - the text-transform value
        Returns:
        this
      • getTextTransform

        public java.lang.String getTextTransform()
        Get the current configured text-transform for the symbol

        Specifies how to capitalize text, similar to the CSS PropertyFactory.textTransform(java.lang.String) property.

        Returns:
        textTransform value
      • withTextOffset

        public SymbolOptions withTextOffset​(java.lang.Float[] textOffset)
        Set text-offset to initialise the symbol with.

        Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up.

        Parameters:
        textOffset - the text-offset value
        Returns:
        this
      • getTextOffset

        public java.lang.Float[] getTextOffset()
        Get the current configured text-offset for the symbol

        Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up.

        Returns:
        textOffset value
      • withIconOpacity

        public SymbolOptions withIconOpacity​(java.lang.Float iconOpacity)
        Set icon-opacity to initialise the symbol with.

        The opacity at which the icon will be drawn.

        Parameters:
        iconOpacity - the icon-opacity value
        Returns:
        this
      • getIconOpacity

        public java.lang.Float getIconOpacity()
        Get the current configured icon-opacity for the symbol

        The opacity at which the icon will be drawn.

        Returns:
        iconOpacity value
      • withIconColor

        public SymbolOptions withIconColor​(java.lang.String iconColor)
        Set icon-color to initialise the symbol with.

        The color of the icon. This can only be used with sdf icons.

        Parameters:
        iconColor - the icon-color value
        Returns:
        this
      • getIconColor

        public java.lang.String getIconColor()
        Get the current configured icon-color for the symbol

        The color of the icon. This can only be used with sdf icons.

        Returns:
        iconColor value
      • withIconHaloColor

        public SymbolOptions withIconHaloColor​(java.lang.String iconHaloColor)
        Set icon-halo-color to initialise the symbol with.

        The color of the icon's halo. Icon halos can only be used with SDF icons.

        Parameters:
        iconHaloColor - the icon-halo-color value
        Returns:
        this
      • getIconHaloColor

        public java.lang.String getIconHaloColor()
        Get the current configured icon-halo-color for the symbol

        The color of the icon's halo. Icon halos can only be used with SDF icons.

        Returns:
        iconHaloColor value
      • withIconHaloWidth

        public SymbolOptions withIconHaloWidth​(java.lang.Float iconHaloWidth)
        Set icon-halo-width to initialise the symbol with.

        Distance of halo to the icon outline.

        Parameters:
        iconHaloWidth - the icon-halo-width value
        Returns:
        this
      • getIconHaloWidth

        public java.lang.Float getIconHaloWidth()
        Get the current configured icon-halo-width for the symbol

        Distance of halo to the icon outline.

        Returns:
        iconHaloWidth value
      • withIconHaloBlur

        public SymbolOptions withIconHaloBlur​(java.lang.Float iconHaloBlur)
        Set icon-halo-blur to initialise the symbol with.

        Fade out the halo towards the outside.

        Parameters:
        iconHaloBlur - the icon-halo-blur value
        Returns:
        this
      • getIconHaloBlur

        public java.lang.Float getIconHaloBlur()
        Get the current configured icon-halo-blur for the symbol

        Fade out the halo towards the outside.

        Returns:
        iconHaloBlur value
      • withTextOpacity

        public SymbolOptions withTextOpacity​(java.lang.Float textOpacity)
        Set text-opacity to initialise the symbol with.

        The opacity at which the text will be drawn.

        Parameters:
        textOpacity - the text-opacity value
        Returns:
        this
      • getTextOpacity

        public java.lang.Float getTextOpacity()
        Get the current configured text-opacity for the symbol

        The opacity at which the text will be drawn.

        Returns:
        textOpacity value
      • withTextColor

        public SymbolOptions withTextColor​(java.lang.String textColor)
        Set text-color to initialise the symbol with.

        The color with which the text will be drawn.

        Parameters:
        textColor - the text-color value
        Returns:
        this
      • getTextColor

        public java.lang.String getTextColor()
        Get the current configured text-color for the symbol

        The color with which the text will be drawn.

        Returns:
        textColor value
      • withTextHaloColor

        public SymbolOptions withTextHaloColor​(java.lang.String textHaloColor)
        Set text-halo-color to initialise the symbol with.

        The color of the text's halo, which helps it stand out from backgrounds.

        Parameters:
        textHaloColor - the text-halo-color value
        Returns:
        this
      • getTextHaloColor

        public java.lang.String getTextHaloColor()
        Get the current configured text-halo-color for the symbol

        The color of the text's halo, which helps it stand out from backgrounds.

        Returns:
        textHaloColor value
      • withTextHaloWidth

        public SymbolOptions withTextHaloWidth​(java.lang.Float textHaloWidth)
        Set text-halo-width to initialise the symbol with.

        Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.

        Parameters:
        textHaloWidth - the text-halo-width value
        Returns:
        this
      • getTextHaloWidth

        public java.lang.Float getTextHaloWidth()
        Get the current configured text-halo-width for the symbol

        Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.

        Returns:
        textHaloWidth value
      • withTextHaloBlur

        public SymbolOptions withTextHaloBlur​(java.lang.Float textHaloBlur)
        Set text-halo-blur to initialise the symbol with.

        The halo's fadeout distance towards the outside.

        Parameters:
        textHaloBlur - the text-halo-blur value
        Returns:
        this
      • getTextHaloBlur

        public java.lang.Float getTextHaloBlur()
        Get the current configured text-halo-blur for the symbol

        The halo's fadeout distance towards the outside.

        Returns:
        textHaloBlur value
      • withLatLng

        public SymbolOptions withLatLng​(com.mapbox.mapboxsdk.geometry.LatLng latLng)
        Set the LatLng of the symbol, which represents the location of the symbol on the map
        Parameters:
        latLng - the location of the symbol in a longitude and latitude pair
        Returns:
        this
      • getLatLng

        public com.mapbox.mapboxsdk.geometry.LatLng getLatLng()
        Get the LatLng of the symbol, which represents the location of the symbol on the map
        Returns:
        the location of the symbol in a longitude and latitude pair
      • withGeometry

        public SymbolOptions withGeometry​(com.mapbox.geojson.Point geometry)
        Set the geometry of the symbol, which represents the location of the symbol on the map
        Parameters:
        geometry - the location of the symbol
        Returns:
        this
      • getGeometry

        public com.mapbox.geojson.Point getGeometry()
        Get the geometry of the symbol, which represents the location of the symbol on the map
        Returns:
        the location of the symbol
      • getDraggable

        public boolean getDraggable()
        Returns whether this symbol is draggable, meaning it can be dragged across the screen when touched and moved.
        Returns:
        draggable when touched
      • withDraggable

        public SymbolOptions withDraggable​(boolean draggable)
        Set whether this symbol should be draggable, meaning it can be dragged across the screen when touched and moved.
        Parameters:
        draggable - should be draggable
      • withData

        public SymbolOptions withData​(@Nullable
                                      com.google.gson.JsonElement jsonElement)
        Set the arbitrary json data of the annotation.
        Parameters:
        jsonElement - the arbitrary json element data
      • getData

        @Nullable
        public com.google.gson.JsonElement getData()
        Get the arbitrary json data of the annotation.
        Returns:
        the arbitrary json object data if set, else null