com.supermap.mapping

Class MixedTextStyle

  • java.lang.Object
    • com.supermap.mapping.MixedTextStyle


  • public class MixedTextStyle
    extends java.lang.Object
    The text composite style class.

    This class is mainly used to set the text content of the label in the label map. Through this type of user can make the label text display different styles, such as the text "Himalayas", through this class can be the first three words in red, the latter two words in blue.

    Setting different styles for the same text is essentially segmenting the characters of the text, and the characters in the same segment have the same display style. There are two ways to segment characters, one is to use the delimiter to segment the text; the other is segmented according to the segmented index value.

    • Constructor Summary

      Constructors 
      Constructor and Description
      MixedTextStyle()
      The default constructor for constructing a new object.
      MixedTextStyle(TextStyle[] styles, int[] startIndexes)
      Initializes a new instance of the MixedTextStyle class according to the specified text styles and the split indexes.
      MixedTextStyle(TextStyle[] styles, java.lang.String separator)
      Initializes a new instance of the MixedTextStyle class according to the specified text styles and the separator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void dispose()
      Releases the resources that the object occupies.
      TextStyle getDefaultStyle()
      Returns the default style.
      java.lang.String getSeparator()
      Returns the text separator, the style of which employs the default style.
      int[] getSplitIndexes()
      Returns the split index values used to separate text.
      TextStyle[] getStyles()
      Returns the text style collection.
      boolean isSeparatorEnabled()
      Returns whether the text delimiter is valid or not.
      void setDefaultStyle(TextStyle style)
      Sets the default style.
      void setSeparator(java.lang.String value)
      Sets the text separator, the style of which employs the default style.
      void setSeparatorEnabled(boolean value)
      Sets whether the text delimiter is valid or not.
      void setSplitIndexes(int[] indexes)
      Sets the split index values used to separate text.
      void setStyles(TextStyle[] styles)
      Sets the text style collection.
      • Methods inherited from class java.lang.Object

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

      • MixedTextStyle

        public MixedTextStyle()
        The default constructor for constructing a new object.
      • MixedTextStyle

        public MixedTextStyle(TextStyle[] styles,
                              java.lang.String separator)
        Initializes a new instance of the MixedTextStyle class according to the specified text styles and the separator.
        Parameters:
        styles - specify the text style.
        separator - Specifies the delimiter.
      • MixedTextStyle

        public MixedTextStyle(TextStyle[] styles,
                              int[] startIndexes)
        Initializes a new instance of the MixedTextStyle class according to the specified text styles and the split indexes.
        Parameters:
        styles - specify the text style.
        startIndexes - Specifies the segmented index value.
    • Method Detail

      • getDefaultStyle

        public TextStyle getDefaultStyle()
        Returns the default style.
        Returns:
        default style.defaults to {Alignment=TopLeft,BackColor=Color [A=255, R=0, G=0, B=0],BackOpaque=False,Bold=False,FontHeight=6,FontWidth=0,ForeColor=Color [A=255, R=0, G=0, B=0],IsSizeFixed=True,Italic=False,Outline=False,Rotation=0,Shadow=False,Strikeout=False,Underline=False,Weight=400}.
      • setDefaultStyle

        public void setDefaultStyle(TextStyle style)
        Sets the default style.
        Parameters:
        style - Specifies the default style.
      • getSeparator

        public java.lang.String getSeparator()
        Returns the text separator, the style of which employs the default style. The separator can be only one character.

        The delimiter of text is a symbol that separates the text, such as "_" as a delimiter, which divides the text "5_109" into "5" and "109", assuming a style array: style1, style2 and default text style DefaultStyle. In the display, "5" using Style1 style display, the separator "_" using the default style (DefaultStyle), the characters "1", "0", "9" use Style2 style.

        Returns:
        text delimiter.defaults to an empty string.
      • setSeparator

        public void setSeparator(java.lang.String value)
        Sets the text separator, the style of which employs the default style. The separator can be only one character.

        The delimiter of text is a symbol that separates the text, such as "_" as a delimiter, which divides the text "5_109" into "5" and "109", assuming a style array: style1, style2 and default text style DefaultStyle. In the display, "5" using Style1 style display, the separator "_" using the default style (DefaultStyle), the characters "1", "0", "9" use Style2 style.

        Parameters:
        value - Specifies the delimiter of the text.
      • isSeparatorEnabled

        public boolean isSeparatorEnabled()
        Returns whether the text delimiter is valid or not.

        When the delimiter is valid, the text is segmented with a delimiter; it is segmented according to the position of the character in the text when it is invalid. After segmenting, the characters in the same segment have the same display style.

        Returns:
        The separator returns true if true; otherwise, it returns false.The default value is false.
      • setSeparatorEnabled

        public void setSeparatorEnabled(boolean value)
        Sets whether the text delimiter is valid or not.

        When the delimiter is valid, the text is segmented with a delimiter; it is segmented according to the position of the character in the text when it is invalid. After segmenting, the characters in the same segment have the same display style.

        Parameters:
        value - A Boolean value specifies whether the text's delimiter is valid.
      • getStyles

        public TextStyle[] getStyles()
        Returns the text style collection. Styles in the text style collection are used for characters in different segments.
        Returns:
        Text style collection.The default value is TextStyle [] object with length 0.
      • setStyles

        public void setStyles(TextStyle[] styles)
        Sets the text style collection. Styles in the text style set are used for characters in different segments.
        Parameters:
        styles - Text style collection.
      • getSplitIndexes

        public int[] getSplitIndexes()
        Returns the split index values used to separate text.
        Returns:
        Segmented index value.The default is an integer array object of length 0.
      • setSplitIndexes

        public void setSplitIndexes(int[] indexes)
        Sets the split index values used to separate text.
        Parameters:
        indexes - Specifies the segmentation index value.
      • dispose

        public void dispose()
        Releases the resources that the object occupies. This object is no longer available when the method is called.