Class: LabelMixedTextStyle

SuperMap.LabelMixedTextStyle

The LabelMixedTextStyle class.

new SuperMap.LabelMixedTextStyle(options)

LabelMixedTextStyle.js, line 5

This class is mainly used to set the styles for the text content of the label in the label map. The users can display the text label with different styles by this class, such as the text "xi ma la ya shan", the first three words can be shown in red, while the last two in blue. The same text with different styles is to segment the characters of the text essentially, the characters in the same range have the same display style. There are two ways to segment characters, one is the delimiter, and the other is the range index value.

  1. The delimiter: for example, the text "5&109" is splited into "5" and "109" two parts by the delimiter "&", when display, the "5" and the delimiter "& " have the same style, the string "109" uses a style.
  2. the range index value: the index values of the characters in the text are integers started from 0, such as the text "zhu mu lang ma feng", the index value of the first character ("zhu") is 0, the second ("mu") is 1, and so on; when the range indexes are set to be 1, 3, 4, 9, the corresponding ranges are (-∞, 1), [1 , 3), [3,4), [4,9), [9, +∞), you can see that characters with the index number 0 (the "zhu") in the first segment, the index number 1, 2 ("mu", "lang") in the second segment, the index number 3 ("ma") in the third section, the index 4 ("feng" ) in the fourth section, there are no characters in the remaining segments.
Name Type Description
options Object

The parameters.

Name Type Default Description
defaultStyle SuperMap.ServerTextStyle optional

The default text composite style.

separator string optional

The delimiter of the text.

separatorEnabled boolean false optional

Whether the text separator is enabled.

splitIndexes Array.<number> optional

The range index value. The range index value is used to segment the characters in the text.

styles Array.<SuperMap.ServerTextStyle> optional

The collection of the text style.

Members

The default composite text style, indicating the default value of each field in the ServerTextStyle.

separatorstring

The delimiter of the text, it’s style is the same as the previous character's. The delimiter of the text is a symbol used to split the text, such as the text "5_109" is splited into "5" and "109" by the "".Supposes there are style arrays: style1, style2, the "5" and the delimiter "" are rendered by the Style1 style, while the string "109" by the Style2 style.

separatorEnabledboolean

Whether the text separator is enabled. If valid, the delimiter is used to split the text; otherwise, the position of the character in the text is used. After segment, the characters in the same range have the same display style. The default is false.

splitIndexesArray.<number>

The range index value. The range index value is used to segment the characters in the text. The index values of the characters in the text are integers started from 0, such as the text "zhu mu lang ma feng", the index value of the first character ("zhu") is 0, the second ("mu") is 1, and so on; when the range indexes are set to be the array [1, 3, 4, 9], the corresponding ranges are (-∞, 1), [1 , 3), [3,4), [4,9), [9, +∞), you can see that characters with the index number 0 (the "zhu") in the first segment, the index number 1, 2 ("mu", "lang") in the second segment, the index number 3 ("ma") in the third section, the index 4 ("feng" ) in the fourth section, there are no characters in the remaining segments.

stylesArray.<SuperMap.ServerTextStyle>

The collection of the text style. The styles in the text style collection correspond to different segments according to the indexes, if the segment corresponds to no style, then the defaultStyle is used.

Methods

SuperMap.LabelMixedTextStyle.fromObj(obj){SuperMap.LabelMixedTextStyle}

LabelMixedTextStyle.js, line 95

Get the compound style of the label text from the incoming object

Name Type Description
obj Object

The object to be pass-in.

Returns:
Type Description
SuperMap.LabelMixedTextStyle Return the LabelMixedTextStyle object.

destroy()

LabelMixedTextStyle.js, line 72

Disposes the resource. The property that references resource is set to null.