Package com.massifmaps.styles
Class TextStyleBuilder
java.lang.Object
com.massifmaps.styles.StyleBuilder
com.massifmaps.styles.BillboardStyleBuilder
com.massifmaps.styles.LabelStyleBuilder
com.massifmaps.styles.TextStyleBuilder
A builder class for TextStyle.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a TextStyleBuilder object with all parameters set to defaults. -
Method Summary
Modifier and TypeMethodDescriptionBuilds a new instance of the TextStyle object using previously set parameters.Returns the background color for the text label.Returns the border color for the text label.floatReturns the border width for the text label.Returns the font name for the text label.floatReturns the font size for the text label.Returns the stroke color for the text label.floatReturns the stroke width for the text label.Returns the text field variable.Returns the margins for the text.booleanReturns the state of the 'break lines' flag.voidsetBackgroundColor(Color backgroundColor) Sets the background color for the text label.voidsetBorderColor(Color borderColor) Sets the border color for the text label.voidsetBorderWidth(float borderWidth) Sets the border width for the text label.voidsetBreakLines(boolean enable) Sets the state of the 'break lines' flag.
If enabled, texts containing CR or NL characters are split into multiple lines.
By default the flag is false, due to backward compatibility reasons.voidsetFontName(String fontName) Sets the font name for the text label.voidsetFontSize(float size) Sets the font size for the text label.voidsetStrokeColor(Color strokeColor) Sets the stroke color for the text label.voidsetStrokeWidth(float strokeWidth) Sets the stroke width for the text label.voidsetTextField(String field) Sets the text field variable.voidsetTextMargins(TextMargins textMargins) Sets the margins for the text.Methods inherited from class com.massifmaps.styles.LabelStyleBuilder
getAnchorPointX, getAnchorPointY, getOrientationMode, getRenderScale, getScalingMode, isFlippable, setAnchorPoint, setAnchorPointX, setAnchorPointY, setFlippable, setOrientationMode, setRenderScale, setScalingModeMethods inherited from class com.massifmaps.styles.BillboardStyleBuilder
getAnimationStyle, getAttachAnchorPointX, getAttachAnchorPointY, getHorizontalOffset, getPlacementPriority, getVerticalOffset, isCausesOverlap, isHideIfOverlapped, isScaleWithDPI, setAnimationStyle, setAttachAnchorPoint, setAttachAnchorPointX, setAttachAnchorPointY, setCausesOverlap, setHideIfOverlapped, setHorizontalOffset, setPlacementPriority, setScaleWithDPI, setVerticalOffsetMethods inherited from class com.massifmaps.styles.StyleBuilder
equals, getColor, hashCode, setColor
-
Constructor Details
-
TextStyleBuilder
public TextStyleBuilder()Constructs a TextStyleBuilder object with all parameters set to defaults.
-
-
Method Details
-
getFontName
Returns the font name for the text label.- Returns:
- The platform dependent font name for the text label.
-
setFontName
Sets the font name for the text label. Accepts a CSS-like list, the most preferred name first, entries
optionally tagged with the platform they are for ("android:Roboto, ios:Helvetica Neue,
sans-serif"). A name the device has no font for is skipped; generic names ("sans-serif",
"serif", "monospace", "Arial", ...) map to the platform font.- Parameters:
fontName- The new platform dependent font name for the text label.
-
getTextField
Returns the text field variable. If not empty, this variable is used to read actual text string from object meta info.- Returns:
- The current text variable.
-
setTextField
Sets the text field variable. If not empty, this variable is used to read actual text string from object meta info.- Parameters:
field- The text field to use for displaying text from metainfo.
-
getFontSize
public float getFontSize()Returns the font size for the text label.- Returns:
- The font size for the text label in points.
-
setFontSize
public void setFontSize(float size) Sets the font size for the text label.- Parameters:
size- The new font size for the text label in points.
-
isBreakLines
public boolean isBreakLines()Returns the state of the 'break lines' flag.- Returns:
- The state of the 'break lines' flag.
-
setBreakLines
public void setBreakLines(boolean enable) Sets the state of the 'break lines' flag.
If enabled, texts containing CR or NL characters are split into multiple lines.
By default the flag is false, due to backward compatibility reasons. -
getTextMargins
Returns the margins for the text.- Returns:
- The margins for the text.
-
setTextMargins
Sets the margins for the text. The margins will determine how much
empty space should surround the text. The default is TextMargins(0, 0, 0, 0).- Parameters:
textMargins- The new margins for the text in dp.
-
getStrokeColor
Returns the stroke color for the text label.- Returns:
- The stroke color for the text label.
-
setStrokeColor
Sets the stroke color for the text label.- Parameters:
strokeColor- The new stroke color for the text label.
-
getStrokeWidth
public float getStrokeWidth()Returns the stroke width for the text label.- Returns:
- The stroke width for the text label in screen density independent pixels.
-
setStrokeWidth
public void setStrokeWidth(float strokeWidth) Sets the stroke width for the text label.- Parameters:
strokeWidth- The new stroke width for the text label in screen density independent pixels.
-
getBorderColor
Returns the border color for the text label.- Returns:
- The border color for the text label.
-
setBorderColor
Sets the border color for the text label.- Parameters:
borderColor- The new border color for the text label. By default the border color is transparent.
-
getBorderWidth
public float getBorderWidth()Returns the border width for the text label.- Returns:
- The border width for the text label in screen density independent pixels.
-
setBorderWidth
public void setBorderWidth(float borderWidth) Sets the border width for the text label.- Parameters:
borderWidth- The new border width for the text label in screen density independent pixels. By default the border width is 0.
-
getBackgroundColor
Returns the background color for the text label.- Returns:
- The background color for the text label.
-
setBackgroundColor
Sets the background color for the text label.- Parameters:
backgroundColor- The new background color for the text label. By default the background color is transparent.
-
buildStyle
Builds a new instance of the TextStyle object using previously set parameters.- Overrides:
buildStylein classLabelStyleBuilder- Returns:
- A new TextStyle object.
-