public static final class MilitarySymbolStyle.Builder extends Object implements AutoCloseable
Builder
for the MilitarySymbolStyle
class.Constructor and Description |
---|
Builder(MilitarySymbolStyle.Builder other) |
Modifier and Type | Method and Description |
---|---|
MilitarySymbolStyle.Builder |
affiliationColor(MilitarySymbol.Affiliation affiliation,
android.graphics.Color affiliationColor)
Sets the color for the given affiliation.
|
MilitarySymbolStyle.Builder |
affiliationColorEnabled(boolean affiliationColorEnabled)
Sets the affiliation color mode.
|
MilitarySymbolStyle.Builder |
alternateFillColor(android.graphics.Color alternateFillColor)
Sets the alternate color to fill the part of the frame that is not covered by the
fill percentage . |
MilitarySymbolStyle |
build()
Creates a new
MilitarySymbolStyle with the properties set on this builder. |
void |
close() |
MilitarySymbolStyle.Builder |
color(android.graphics.Color unaffiliatedColor)
Sets the color to be used if affiliation colors have been disabled (see
affiliationColorEnabled ) or if the symbol has no affiliation by default. |
MilitarySymbolStyle.Builder |
cornerSmoothness(double smoothness)
Sets the smoothness (or rounding) factor for polygon corners.
|
MilitarySymbolStyle.Builder |
fillEnabled(boolean fillEnabled)
Sets whether an icon symbol should be painted filled.
|
MilitarySymbolStyle.Builder |
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 (see
affiliationColor ). |
protected void |
finalize() |
MilitarySymbolStyle.Builder |
frameEnabled(boolean frameEnabled)
Sets whether the frame of an icon symbol should be painted.
|
MilitarySymbolStyle.Builder |
iconEnabled(boolean iconEnabled)
Sets whether the internal icon in the frame of an icon symbol should be painted.
|
MilitarySymbolStyle.Builder |
iconSize(long size)
Sets the size of icon symbols in pixels.
|
MilitarySymbolStyle.Builder |
modifiersEnabled(boolean modifiersEnabled)
Sets whether modifiers should be enabled.
|
MilitarySymbolStyle.Builder |
overrideColor(android.graphics.Color color)
Sets the color to be used for the icon symbol.
|
MilitarySymbolStyle.Builder |
strokeScaleFactor(double strokeScaleFactor)
Sets the factor by which line widths should be scaled.
|
MilitarySymbolStyle.Builder |
surroundingRectangleColor(android.graphics.Color color)
Sets the color of the rectangle that is painted around icon symbols.
|
MilitarySymbolStyle.Builder |
surroundingRectangleEnabled(boolean enabled)
Sets whether icon symbols should be painted with a surrounding rectangle.
|
MilitarySymbolStyle.Builder |
surroundingRectangleWidth(long width)
Sets the line width in pixels of the rectangle that is painted around icon symbols.
|
MilitarySymbolStyle.Builder |
textStyle(TextStyle textStyle)
Sets the new text style to be used for all texts part of the symbol.
|
public Builder(@NotNull MilitarySymbolStyle.Builder other)
public void close()
close
in interface AutoCloseable
@NotNull public MilitarySymbolStyle build()
MilitarySymbolStyle
with the properties set on this builder.MilitarySymbolStyle
with the properties set on this builder.@NotNull public MilitarySymbolStyle.Builder color(@NotNull android.graphics.Color unaffiliatedColor)
affiliationColorEnabled
) or if the symbol has no affiliation by default.
The default value is black.
unaffiliatedColor
- The color.@NotNull public MilitarySymbolStyle.Builder iconSize(long size)
This value must be > 0. The default value is 64
.
size
- the size of icon symbols in pixels.@NotNull public MilitarySymbolStyle.Builder affiliationColorEnabled(boolean affiliationColorEnabled)
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
.
affiliationColorEnabled
- The affiliation color mode.@NotNull public MilitarySymbolStyle.Builder affiliationColor(@NotNull MilitarySymbol.Affiliation affiliation, @NotNull android.graphics.Color affiliationColor)
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
).
affiliation
- The affiliation for which a color is set.affiliationColor
- The color to be used for the given affiliation.@NotNull public MilitarySymbolStyle.Builder overrideColor(@NotNull android.graphics.Color color)
This overrides the affiliation and/or pattern colors in icons and tactical shapes. If this method is not invoked, there's no override color.
color
- The color to be used for the icon symbol.@NotNull public MilitarySymbolStyle.Builder fillPercentage(double fillPercentage)
affiliationColor
).
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
.
fillPercentage
- the fill percentage to fill the frame of icon symbols.@NotNull public MilitarySymbolStyle.Builder alternateFillColor(@NotNull android.graphics.Color alternateFillColor)
fill percentage
.
The default value is transparent (i.e. no fill).
alternateFillColor
- the color to fill the part of the frame that is not covered by the fill percentage
.@NotNull public MilitarySymbolStyle.Builder frameEnabled(boolean frameEnabled)
The default value is true
.
frameEnabled
- whether the frame of an icon symbol should be painted.@NotNull public MilitarySymbolStyle.Builder fillEnabled(boolean fillEnabled)
The default value is true
.
fillEnabled
- whether an icon symbol should be painted filled.@NotNull public MilitarySymbolStyle.Builder iconEnabled(boolean iconEnabled)
The default value is true
.
iconEnabled
- whether the internal icon in the frame of an icon symbol should be painted.@NotNull public MilitarySymbolStyle.Builder modifiersEnabled(boolean modifiersEnabled)
The default value is true
.
modifiersEnabled
- whether modifiers should be enabled.@NotNull public MilitarySymbolStyle.Builder textStyle(@NotNull TextStyle textStyle)
MilitarySymbolStyle#getDefaultTextStyle
to get a correctly sized TextStyle
.textStyle
- new text style to be used for all texts part of the symbol.@NotNull public MilitarySymbolStyle.Builder strokeScaleFactor(double strokeScaleFactor)
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
.
strokeScaleFactor
- the factor by which line widths should be scaled.@NotNull public MilitarySymbolStyle.Builder surroundingRectangleEnabled(boolean enabled)
The default value is false
.
enabled
- whether icon symbols should be painted with a surrounding rectangle.@NotNull public MilitarySymbolStyle.Builder surroundingRectangleWidth(long width)
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).
width
- the line width in pixels of the rectangle that is painted around icon symbols.surroundingRectangleEnabled
@NotNull public MilitarySymbolStyle.Builder surroundingRectangleColor(@NotNull android.graphics.Color color)
color
- the color of the rectangle that is painted around icon symbols.surroundingRectangleEnabled
@NotNull public MilitarySymbolStyle.Builder cornerSmoothness(double smoothness)
This factor must be a value inside the interval [0.0, 1.0]
.
By default, the smoothness is set to 0.5
.
smoothness
- the smoothness (or rounding) factor for polygon corners.