Class MilitarySymbolStyle.Builder
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
MilitarySymbolStyle
Builder
for the MilitarySymbolStyle
class.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaffiliationColor
(MilitarySymbol.Affiliation affiliation, android.graphics.Color affiliationColor) Sets the color for the given affiliation.affiliationColorEnabled
(boolean affiliationColorEnabled) Sets the affiliation color mode.alternateFillColor
(android.graphics.Color alternateFillColor) Sets the alternate color to fill the part of the frame that is not covered by thefill percentage
.build()
Creates a newMilitarySymbolStyle
with the properties set on this builder.void
close()
color
(android.graphics.Color unaffiliatedColor) Sets the color to be used if affiliation colors have been disabled (seeaffiliationColorEnabled
) or if the symbol has no affiliation by default.cornerSmoothness
(double smoothness) Sets the smoothness (or rounding) factor for polygon corners.fillEnabled
(boolean fillEnabled) Sets whether an icon symbol should be painted filled.fillPercentage
(double fillPercentage) Sets the percentage ([0.0, 1.0]) of an icon symbol's frame that is painted with the regular fill color, as determined by its affiliation (seeaffiliationColor
).protected void
finalize()
frameEnabled
(boolean frameEnabled) Sets whether the frame of an icon symbol should be painted.iconEnabled
(boolean iconEnabled) Sets whether the internal icon in the frame of an icon symbol should be painted.iconSize
(long size) Sets the size of icon symbols in pixels.modifiersEnabled
(boolean modifiersEnabled) Sets whether modifiers should be enabled.overrideColor
(android.graphics.Color color) Sets the color to be used for the icon symbol.strokeScaleFactor
(double strokeScaleFactor) Sets the factor by which line widths should be scaled.surroundingRectangleColor
(android.graphics.Color color) Sets the color of the rectangle that is painted around icon symbols.surroundingRectangleEnabled
(boolean enabled) Sets whether icon symbols should be painted with a surrounding rectangle.surroundingRectangleWidth
(long width) Sets the line width in pixels of the rectangle that is painted around icon symbols.Sets the new text style to be used for all texts part of the symbol.
-
Constructor Details
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
build
Creates a newMilitarySymbolStyle
with the properties set on this builder.- Returns:
- a new
MilitarySymbolStyle
with the properties set on this builder.
-
color
@NotNull public MilitarySymbolStyle.Builder color(@NotNull android.graphics.Color unaffiliatedColor) Sets the color to be used if affiliation colors have been disabled (seeaffiliationColorEnabled
) or if the symbol has no affiliation by default.The default value is black.
- Parameters:
unaffiliatedColor
- The color.- Returns:
- this builder.
-
iconSize
Sets the size of icon symbols in pixels.This value must be > 0. The default value is
64
.- Parameters:
size
- the size of icon symbols in pixels.- Returns:
- this builder.
-
affiliationColorEnabled
@NotNull public MilitarySymbolStyle.Builder affiliationColorEnabled(boolean affiliationColorEnabled) Sets the affiliation color mode.When this mode is enabled, the color for unframed icon symbols, line symbols and off-set lines of icon symbols are automatically be adapted to the affiliation of a symbol.
The default value is
false
.- Parameters:
affiliationColorEnabled
- The affiliation color mode.- Returns:
- this builder.
-
affiliationColor
@NotNull public MilitarySymbolStyle.Builder affiliationColor(@NotNull MilitarySymbol.Affiliation affiliation, @NotNull android.graphics.Color affiliationColor) Sets the color for the given affiliation.These colors are used as fill color for framed icon symbols. For unframed icon symbols and line symbols, affiliation colors are only used when the affiliation color mode has been enabled (see
affiliationColorEnabled
).- Parameters:
affiliation
- The affiliation for which a color is set.affiliationColor
- The color to be used for the given affiliation.- Returns:
- this builder.
-
overrideColor
Sets the color to be used for the icon symbol.This overrides the affiliation and/or pattern colors in icons and tactical shapes. If this method is not invoked, there's no override color.
- Parameters:
color
- The color to be used for the icon symbol.- Returns:
- this builder.
-
fillPercentage
Sets the percentage ([0.0, 1.0]) of an icon symbol's frame that is painted with the regular fill color, as determined by its affiliation (seeaffiliationColor
).The filled part begins at the bottom of the icon frame, up to the vertical position that corresponds with the given fill percentage. In other words, a fill percentage of 0.5 results in an icon symbol of which only the bottom half is filled with the regular fill color. The remaining (top) part of the icon is filled with the
alternate fill color
.The default value is
1.0f
.- Parameters:
fillPercentage
- the fill percentage to fill the frame of icon symbols.- Returns:
- this builder.
-
alternateFillColor
@NotNull public MilitarySymbolStyle.Builder alternateFillColor(@NotNull android.graphics.Color alternateFillColor) Sets the alternate color to fill the part of the frame that is not covered by thefill percentage
.The default value is transparent (i.e. no fill).
- Parameters:
alternateFillColor
- the color to fill the part of the frame that is not covered by thefill percentage
.- Returns:
- this builder.
-
frameEnabled
Sets whether the frame of an icon symbol should be painted.The default value is
true
.- Parameters:
frameEnabled
- whether the frame of an icon symbol should be painted.- Returns:
- this builder.
-
fillEnabled
Sets whether an icon symbol should be painted filled.The default value is
true
.- Parameters:
fillEnabled
- whether an icon symbol should be painted filled.- Returns:
- this builder.
-
iconEnabled
Sets whether the internal icon in the frame of an icon symbol should be painted.The default value is
true
.- Parameters:
iconEnabled
- whether the internal icon in the frame of an icon symbol should be painted.- Returns:
- this builder.
-
modifiersEnabled
Sets whether modifiers should be enabled.The default value is
true
.- Parameters:
modifiersEnabled
- whether modifiers should be enabled.- Returns:
- this builder.
-
textStyle
Sets the new text style to be used for all texts part of the symbol.- Note
- Ideally, the font size for the text style should be less than 1/5th of the icon size. By default, the icon size is 64 and the font size is 12. You can use
MilitarySymbolStyle#getDefaultTextStyle
to get a correctly sizedTextStyle
.
- Parameters:
textStyle
- new text style to be used for all texts part of the symbol.- Returns:
- this builder.
-
strokeScaleFactor
Sets the factor by which line widths should be scaled.This setting can be used to increase or decrease the width of stroked lines in icons and tactical graphics. It also affects decoration sizes in tactical graphics.
The default value is
1
.- Parameters:
strokeScaleFactor
- the factor by which line widths should be scaled.- Returns:
- this builder.
-
surroundingRectangleEnabled
Sets whether icon symbols should be painted with a surrounding rectangle.The default value is
false
.- Parameters:
enabled
- whether icon symbols should be painted with a surrounding rectangle.- Returns:
- this builder.
-
surroundingRectangleWidth
Sets the line width in pixels of the rectangle that is painted around icon symbols.This value must be larger than
0
.The default value is
1
.A pixel is defined as 1/96th of 1 inch (https://www.w3.org/TR/css-values-4/#absolute-lengths).
- Parameters:
width
- the line width in pixels of the rectangle that is painted around icon symbols.- Returns:
- this builder.
- See Also:
-
surroundingRectangleColor
@NotNull public MilitarySymbolStyle.Builder surroundingRectangleColor(@NotNull android.graphics.Color color) Sets the color of the rectangle that is painted around icon symbols.- Parameters:
color
- the color of the rectangle that is painted around icon symbols.- Returns:
- this builder.
- See Also:
-
cornerSmoothness
Sets the smoothness (or rounding) factor for polygon corners.This factor must be a value inside the interval
[0.0, 1.0]
.By default, the smoothness is set to
0.5
.- Parameters:
smoothness
- the smoothness (or rounding) factor for polygon corners.- Returns:
- this builder.
-