Class TextSymbol

  • All Implemented Interfaces:
    JsonSerializable

    public final class TextSymbol
    extends MarkerSymbol
    Defines how text is displayed, describing the appearance and positioning of the text.

    Use TextSymbols to define the appearance of labels or to represent a Graphic or Feature as text. You can define different aspects of the symbol's appearance such as color, size and font.

    Setting the angle of a TextSymbol using MarkerSymbol.setAngle(float) only applies when working with 2D maps and will not work in 3D scenes.

    Since:
    100.0.0
    • Method Detail

      • getBackgroundColor

        public int getBackgroundColor()
        Gets the background color of this TextSymbol as an ARGB(alpha, red, green, blue) color value.

        Default value is 0x00000000.

        Returns:
        an integer representing the text background color as 0xAARRGGBB
        Since:
        100.4.0
        See Also:
        Color
      • setBackgroundColor

        public void setBackgroundColor​(int color)
        Sets the background color of this TextSymbol using an ARGB(alpha, red, green, blue) color value.

        ARGB integer color values range from 0x00000000 to 0xFFFFFFFF with each pair of hex values representing either the alpha, red, green, or blue channels. For the alpha channel, a value of 00 means fully transparent and a value of FF is opaque.

        Parameters:
        color - an integer representing the text background color using the form 0xAARRGGBB
        Since:
        100.4.0
      • getColor

        public int getColor()
        Gets the color of this TextSymbol as an ARGB(alpha, red, green, blue) color value.

        Default value is black, 0xFF000000.

        Returns:
        an integer representing the text color as 0xAARRGGBB
        Since:
        100.0.0
        See Also:
        setColor(int)
      • setColor

        public void setColor​(int color)
        Sets the color of this TextSymbol using an ARGB(alpha, red, green, blue) color value.

        ARGB integer color values range from 0x00000000 to 0xFFFFFFFF with each pair of hex values representing either the alpha, red, green, or blue channels. For the alpha channel, a value of 00 means fully transparent and a value of FF is opaque.

        Parameters:
        color - an integer representing the text color using the form 0xAARRGGBB
        Since:
        100.0.0
      • getFontFamily

        public String getFontFamily()
        Gets the FontFamily being used by this Symbol's text.

        Default value is an empty string.

        Returns:
        the font family the Symbol's text
        Since:
        100.0.0
        See Also:
        setFontFamily(java.lang.String)
      • setFontFamily

        public void setFontFamily​(String fontFamily)
        Sets the FontFamily for the text being used by this Symbol. This can be as specific as 'arial' or as generic as 'sans-serif'.
        Parameters:
        fontFamily - the new font family for this Symbol's text
        Since:
        100.0.0
      • setFontStyle

        public void setFontStyle​(TextSymbol.FontStyle fontStyle)
        Sets the FontStyle for the text that is being used by this Symbol.

        A FontStyle changes the appearance of text by leaning the text.

        Parameters:
        fontStyle - the new font style for this Symbol's text
        Throws:
        IllegalArgumentException - if input is null
        Since:
        100.0.0
      • setFontWeight

        public void setFontWeight​(TextSymbol.FontWeight fontWeight)
        Sets the FontWeight for the text that is being used by this Symbol.

        Font weight describes how thick or thin characters in text are displayed.

        Parameters:
        fontWeight - the new font weight for this Symbol's text
        Throws:
        IllegalArgumentException - if input is null @since 100.0.0
      • getSize

        public float getSize()
        Gets the Symbol's text size in density-independent pixels (dp).

        Default value is 8.0.

        Returns:
        the size of the Symbol's text in dp
        Since:
        100.0.0
      • setSize

        public void setSize​(float size)
        Sets the size of the text in density-independent pixels (dp).

        Setting the size of the text to 0.0 will cause the text not to be displayed.

        Parameters:
        size - the new size of this Symbol's text in dp, greater than 0.0 to be visible
        Throws:
        ArcGISRuntimeException - if size less than 0.0
        Since:
        100.0.0
      • getText

        public String getText()
        Gets the text displayed by this Symbol.

        Default value is an empty string.

        Returns:
        the text of this Symbol
        Since:
        100.0.0
        See Also:
        setText(java.lang.String)
      • getVerticalAlignment

        public TextSymbol.VerticalAlignment getVerticalAlignment()
        Gets the vertical alignment of the text relative to the Symbol's mid-point location.

        Default value is MIDDLE.

        Returns:
        the vertical alignment of the Symbol's text
        Since:
        100.0.0
        See Also:
        getVerticalAlignment()
      • getHorizontalAlignment

        public TextSymbol.HorizontalAlignment getHorizontalAlignment()
        Gets the horizontal alignment of the text relative to the Symbol's mid-point location.

        Default value is CENTER.

        Returns:
        the horizontal alignment of the Symbol's text
        Since:
        100.0.0
        See Also:
        getHorizontalAlignment()
      • getHaloColor

        public int getHaloColor()
        Gets the halo color as an ARGB(alpha, red, green, blue) color value.

        Default value is transparent.

        Returns:
        an integer representing the halo color as 0xAARRGGBB
        Since:
        100.0.0
        See Also:
        setHaloColor(int)
      • setHaloColor

        public void setHaloColor​(int haloColor)
        Sets the halo color using an ARGB(alpha, red, green, blue) color value.

        Halo displays a color along the outside border of a letter.

        ARGB integer color values range from 0x00000000 to 0xFFFFFFFF with each pair of hex values representing either the alpha, red, green, or blue channels. For the alpha channel, a value of 00 means fully transparent and a value of FF is opaque.

        Parameters:
        haloColor - an integer representing the halo color using the form 0xAARRGGBB
        Since:
        100.0.0
        See Also:
        getHaloColor()
      • getHaloWidth

        public float getHaloWidth()
        Gets the width of the halo in density-independent pixels (dp).

        Default value is 0.0.

        Returns:
        the width of the halo in density-independent pixels (dp)
        Since:
        100.0.0
        See Also:
        setHaloWidth(float)
      • setHaloWidth

        public void setHaloWidth​(float haloWidth)
        Sets the width of the halo in density-independent pixels (dp).

        Setting to 0.0 will cause the halo not to be displayed.

        Parameters:
        haloWidth - the new width of the halo in density-independent pixels (dp)
        Throws:
        ArcGISRuntimeException - if haloWidth less than 0.0
        Since:
        100.0.0
        See Also:
        getHaloWidth()
      • getOutlineColor

        public int getOutlineColor()
        Gets the outline color as an ARGB(alpha, red, green, blue) color value.

        Default value is transparent.

        Returns:
        an integer representing the halo color as 0xAARRGGBB
        Since:
        100.0.0
        See Also:
        setOutlineColor(int)
      • setOutlineColor

        public void setOutlineColor​(int outlineColor)
        Sets the outline color using an ARGB(alpha, red, green, blue) color value.

        Outline displays a color along the inside border of a letter.

        ARGB integer color values range from 0x00000000 to 0xFFFFFFFF with each pair of hex values representing either the alpha, red, green, or blue channels. For the alpha channel, a value of 00 means fully transparent and a value of FF is opaque.

        Parameters:
        outlineColor - an integer representing the outline color using the form 0xAARRGGBB
        Since:
        100.0.0
        See Also:
        getOutlineColor()
      • getOutlineWidth

        public float getOutlineWidth()
        Gets the width of the outline in density-independent pixels (dp).

        Default value is 0.0.

        Returns:
        the width of the outline in density-independent pixels (dp)
        Since:
        100.0.0
        See Also:
        setOutlineWidth(float)
      • setOutlineWidth

        public void setOutlineWidth​(float outlineWidth)
        Sets the width of the outline in density-independent pixels (dp).

        Setting to 0.0 will cause the outline not to be displayed.

        Parameters:
        outlineWidth - the new width of the outline in density-independent pixels (dp)
        Throws:
        ArcGISRuntimeException - if outlineWidth less than 0.0
        Since:
        100.0.0
        See Also:
        getOutlineWidth()