Class TextSymbol
- java.lang.Object
-
- com.esri.arcgisruntime.symbology.Symbol
-
- com.esri.arcgisruntime.symbology.MarkerSymbol
-
- com.esri.arcgisruntime.symbology.TextSymbol
-
- All Implemented Interfaces:
JsonSerializable
public final class TextSymbol extends MarkerSymbol
Defines how text is displayed, describing the appearance and positioning of the text.Text symbols are used to display text for graphics. The graphics can be based on any type of geometry - point, multipoint, polyline, or polygon.
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TextSymbol.FontDecoration
Defines various decorations that can be applied to the text of this Symbol.static class
TextSymbol.FontStyle
Defines various styles that can be applied to the text of this Symbol.static class
TextSymbol.FontWeight
Defines how thick or thin the characters in text appear.static class
TextSymbol.HorizontalAlignment
Defines horizontal alignment of the text within the Symbol.static class
TextSymbol.VerticalAlignment
Defines vertical alignment of the text within the Symbol.-
Nested classes/interfaces inherited from class com.esri.arcgisruntime.symbology.MarkerSymbol
MarkerSymbol.AngleAlignment
-
-
Constructor Summary
Constructors Constructor Description TextSymbol()
Creates a new TextSymbol with default values.TextSymbol(float size, java.lang.String text, int color, TextSymbol.HorizontalAlignment hAlign, TextSymbol.VerticalAlignment vAlign)
Creates a new TextSymbol with the given size, text, and color along with the horizontal and vertical alignment relative to the mid-point of this Symbol.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getBackgroundColor()
Gets the background color of this TextSymbol as an ARGB(alpha, red, green, blue) color value.int
getColor()
Gets the color of this TextSymbol as an ARGB(alpha, red, green, blue) color value.TextSymbol.FontDecoration
getFontDecoration()
Gets the decoration being used by this Symbol's text.java.lang.String
getFontFamily()
Gets the FontFamily being used by this Symbol's text.TextSymbol.FontStyle
getFontStyle()
Gets the FontStyle of the text that is being used by this Symbol.TextSymbol.FontWeight
getFontWeight()
Gets the FontWeight of the text being displayed by this Symbol.int
getHaloColor()
Gets the halo color as an ARGB(alpha, red, green, blue) color value.float
getHaloWidth()
Gets the width of the halo in density-independent pixels (dp).TextSymbol.HorizontalAlignment
getHorizontalAlignment()
Gets the horizontal alignment of the text relative to the Symbol's mid-point location.int
getOutlineColor()
Gets the outline color as an ARGB(alpha, red, green, blue) color value.float
getOutlineWidth()
Gets the width of the outline in density-independent pixels (dp).float
getSize()
Gets the Symbol's text size in density-independent pixels (dp).java.lang.String
getText()
Gets the text displayed by this Symbol.TextSymbol.VerticalAlignment
getVerticalAlignment()
Gets the vertical alignment of the text relative to the Symbol's mid-point location.void
setBackgroundColor(int color)
Sets the background color of this TextSymbol using an ARGB(alpha, red, green, blue) color value.void
setColor(int color)
Sets the color of this TextSymbol using an ARGB(alpha, red, green, blue) color value.void
setFontDecoration(TextSymbol.FontDecoration fontDecoration)
Sets the decoration for the text being used by this Symbol.void
setFontFamily(java.lang.String fontFamily)
Sets the FontFamily for the text being used by this Symbol.void
setFontStyle(TextSymbol.FontStyle fontStyle)
Sets the FontStyle for the text that is being used by this Symbol.void
setFontWeight(TextSymbol.FontWeight fontWeight)
Sets the FontWeight for the text that is being used by this Symbol.void
setHaloColor(int haloColor)
Sets the halo color using an ARGB(alpha, red, green, blue) color value.void
setHaloWidth(float haloWidth)
Sets the width of the halo in density-independent pixels (dp).void
setHorizontalAlignment(TextSymbol.HorizontalAlignment horizontalAlignment)
Sets the horizontal alignment of the text relative to the Symbol's mid-point location.void
setOutlineColor(int outlineColor)
Sets the outline color using an ARGB(alpha, red, green, blue) color value.void
setOutlineWidth(float outlineWidth)
Sets the width of the outline in density-independent pixels (dp).void
setSize(float size)
Sets the size of the text in density-independent pixels (dp).void
setText(java.lang.String text)
Sets the text displayed by this Symbol.void
setVerticalAlignment(TextSymbol.VerticalAlignment verticalAlignment)
Sets the vertical alignment of the text relative to the Symbol's mid-point location.-
Methods inherited from class com.esri.arcgisruntime.symbology.MarkerSymbol
getAngle, getAngleAlignment, getLeaderOffsetX, getLeaderOffsetY, getOffsetX, getOffsetY, getRotationType, setAngle, setAngleAlignment, setLeaderOffsetX, setLeaderOffsetY, setOffsetX, setOffsetY, setRotationType
-
Methods inherited from class com.esri.arcgisruntime.symbology.Symbol
createSwatchAsync, createSwatchAsync, createSwatchAsync, createSwatchAsync, fromJson, getUnknownJson, getUnsupportedJson, toJson
-
-
-
-
Constructor Detail
-
TextSymbol
public TextSymbol()
Creates a new TextSymbol with default values.The default values are:
- Color, black
- Size, 8.0
- FontStyle,
TextSymbol.FontStyle.NORMAL
- FontWeight,
TextSymbol.FontWeight.NORMAL
- HorizontalAlignment,
TextSymbol.HorizontalAlignment.CENTER
- VerticalAlignment,
TextSymbol.VerticalAlignment.MIDDLE
- FontDecoration,
TextSymbol.FontDecoration.NONE
- Since:
- 100.0.0
-
TextSymbol
public TextSymbol(float size, java.lang.String text, int color, TextSymbol.HorizontalAlignment hAlign, TextSymbol.VerticalAlignment vAlign)
Creates a new TextSymbol with the given size, text, and color along with the horizontal and vertical alignment relative to the mid-point of this Symbol.- Parameters:
text
- the text to be displayed for the associated graphiccolor
- an integer representing the text color as 0xAARRGGBBsize
- the size of the Symbol's texthAlign
- the horizontal alignment of the Symbol's textvAlign
- the vertical alignment of the Symbol's text- Throws:
java.lang.IllegalArgumentException
- if text is nulljava.lang.IllegalArgumentException
- if hAlign is nulljava.lang.IllegalArgumentException
- if vAlign is null- 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
-
getFontDecoration
public TextSymbol.FontDecoration getFontDecoration()
Gets the decoration being used by this Symbol's text.Default value is NONE.
- Returns:
- the font decoration of this symbol's text
- Since:
- 100.0.0
- See Also:
setFontDecoration(com.esri.arcgisruntime.symbology.TextSymbol.FontDecoration)
-
setFontDecoration
public void setFontDecoration(TextSymbol.FontDecoration fontDecoration)
Sets the decoration for the text being used by this Symbol.FontDecoration adds effects on top of the text.
- Parameters:
fontDecoration
- the new font decoration for this Symbol's text- Throws:
java.lang.IllegalArgumentException
- if input is null- Since:
- 100.0.0
- See Also:
setFontDecoration(com.esri.arcgisruntime.symbology.TextSymbol.FontDecoration)
-
getFontFamily
public java.lang.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(java.lang.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
-
getFontStyle
public TextSymbol.FontStyle getFontStyle()
Gets the FontStyle of the text that is being used by this Symbol.Default value is NORMAL.
- Returns:
- the font style the Symbol's text
- Since:
- 100.0.0
- See Also:
setFontStyle(com.esri.arcgisruntime.symbology.TextSymbol.FontStyle)
-
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:
java.lang.IllegalArgumentException
- if input is null- Since:
- 100.0.0
-
getFontWeight
public TextSymbol.FontWeight getFontWeight()
Gets the FontWeight of the text being displayed by this Symbol.Default value is NORMAL.
- Returns:
- the font weight being used by this Symbol's text
- Since:
- 100.0.0
- See Also:
setFontWeight(com.esri.arcgisruntime.symbology.TextSymbol.FontWeight)
-
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:
java.lang.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 java.lang.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)
-
setText
public void setText(java.lang.String text)
Sets the text displayed by this Symbol.The alignment of the text has to do with the positioning of the text in relation to the mid-point of this Symbol.
- Parameters:
text
- the new text for this Symbol- Since:
- 100.0.0
- See Also:
setHorizontalAlignment(com.esri.arcgisruntime.symbology.TextSymbol.HorizontalAlignment)
,setVerticalAlignment(com.esri.arcgisruntime.symbology.TextSymbol.VerticalAlignment)
-
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()
-
setVerticalAlignment
public void setVerticalAlignment(TextSymbol.VerticalAlignment verticalAlignment)
Sets the vertical alignment of the text relative to the Symbol's mid-point location.- Parameters:
verticalAlignment
- the new vertical alignment for the Symbol's text- Throws:
java.lang.IllegalArgumentException
- if input is null- Since:
- 100.0.0
- See Also:
TextSymbol.VerticalAlignment
-
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()
-
setHorizontalAlignment
public void setHorizontalAlignment(TextSymbol.HorizontalAlignment horizontalAlignment)
Sets the horizontal alignment of the text relative to the Symbol's mid-point location.- Parameters:
horizontalAlignment
- the new horizontal alignment for the Symbol's text- Throws:
java.lang.IllegalArgumentException
- if input is null- Since:
- 100.0.0
- See Also:
TextSymbol.HorizontalAlignment
-
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()
-
-