Class MilitarySymbolStyle
- All Implemented Interfaces:
AutoCloseable
Use MilitarySymbolStyle#newBuilder
to create a new instance.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionCreates a new builder with the same properties as this symbol style.void
close()
protected void
finalize()
android.graphics.Color
getAffiliationColor
(MilitarySymbol.Affiliation affiliation) Returns the color that is configured for the given affiliation.android.graphics.Color
Returns the color used to fill the part of the frame that is not covered by thefill percentage
.android.graphics.Color
getColor()
Returns the color that is currently configured in the case that either affiliation colors are disabled.double
Returns the smoothness (or rounding) factor that is used to render corners of polygons.static MilitarySymbolStyle
Returns the default style for aMilitarySymbol
.static TextStyle
getDefaultTextStyle
(long iconSize) Returns the default text style.double
Returns the percentage ([0.0, 1.0]) of an icon symbol's frame that is painted with the regular fill color.long
Returns the size of icon symbols in pixels.android.graphics.Color
Returns the color that overrides the colors of icon or shape symbol.double
Returns the factor by which line widths should be scaled.android.graphics.Color
Returns the color of the rectangle that is painted around icon symbols.long
Returns the width in pixels of the rectangle that is painted around icon symbols.Returns the style parameters for texts part of the symbol.boolean
Returns whether the affiliation color mode is enabled.boolean
Returns whether an icon symbol should be painted filled.boolean
Returns whether the frame of an icon symbol should be painted.boolean
Returns whether the internal icon in the frame of an icon symbol should be painted.boolean
Returns whether modifiers are enabled.boolean
Returns whether icon symbols are painted with a surrounding rectangle.static MilitarySymbolStyle.Builder
Creates a new builder for creating aMilitarySymbolStyle
.
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
newBuilder
Creates a new builder for creating aMilitarySymbolStyle
.- Returns:
- a new builder for creating a
MilitarySymbolStyle
.
-
asBuilder
Creates a new builder with the same properties as this symbol style.- Returns:
- a new builder with the same properties as this symbol style.
-
getColor
@NotNull public android.graphics.Color getColor()Returns the color that is currently configured in the case that either affiliation colors are disabled.See
isAffiliationColorEnabled
or that the symbol has no affiliation by default.- Returns:
- the color to be used if affiliation colors are disabled or if the symbol has no affiliation by default.
-
getIconSize
public long getIconSize()Returns the size of icon symbols in pixels.- Returns:
- the size of icon symbols in pixels.
-
isAffiliationColorEnabled
public boolean isAffiliationColorEnabled()Returns whether the affiliation color mode is enabled.When this mode is enabled, the color for unframed icon symbols, line symbols and off-set lines of icon symbols will automatically be adapted to the affiliation of a symbol, as configured on this symbol style (see
getAffiliationColor
).- Returns:
- true if the affiliation color mode is enabled.
-
getAffiliationColor
@NotNull public android.graphics.Color getAffiliationColor(@NotNull MilitarySymbol.Affiliation affiliation) Returns the color that is configured for the given affiliation.This color is 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
isAffiliationColorEnabled
).- Parameters:
affiliation
- the affiliation.- Returns:
- the affiliation color.
-
getAlternateFillColor
@NotNull public android.graphics.Color getAlternateFillColor()Returns the color used to fill the part of the frame that is not covered by thefill percentage
.- Returns:
- the color used to fill the part of the frame that is not covered by the
fill percentage
.
-
getOverrideColor
@Nullable public android.graphics.Color getOverrideColor()Returns the color that overrides the colors of icon or shape symbol.The difference with the
getColor
method is that it replaces any affiliation and/or special pattern colors in icons and tactical shapes. If there is no color override, this method returnsnull
.- Returns:
- the color that overrides the normal colors of the icon symbol.
-
getFillPercentage
public double getFillPercentage()Returns the percentage ([0.0, 1.0]) of an icon symbol's frame that is painted with the regular fill color.The regular fill color is determined by its affiliation (see
getAffiliationColor
). The filled part begins at the bottom of the icon frame, up to the vertical position that corresponds with this 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 thealternate fill color
.This factor is a value in the interval
[0.0, 1.0]
.- Returns:
- the fill percentage to fill the frame of icon symbols.
-
isFrameEnabled
public boolean isFrameEnabled()Returns whether the frame of an icon symbol should be painted.- Returns:
- whether the frame of an icon symbol should be painted.
-
isFillEnabled
public boolean isFillEnabled()Returns whether an icon symbol should be painted filled.- Returns:
- whether an icon symbol should be painted filled.
-
isIconEnabled
public boolean isIconEnabled()Returns whether the internal icon in the frame of an icon symbol should be painted.- Returns:
- whether the internal icon in the frame of an icon symbol should be painted.
-
isModifiersEnabled
public boolean isModifiersEnabled()Returns whether modifiers are enabled.- Returns:
- whether modifiers are enabled.
-
getTextStyle
Returns the style parameters for texts part of the symbol.- Note
- If the text style has not been overridden in
MilitarySymbolStyle.Builder
, symbols are rendered with a text style that has a font size slightly smaller than 1/5th of the icon size.
- Returns:
- the style parameters for texts part of the symbol.
-
getStrokeScaleFactor
public double getStrokeScaleFactor()Returns 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
.- Returns:
- the factor by which line widths should be scaled.
-
isSurroundingRectangleEnabled
public boolean isSurroundingRectangleEnabled()Returns whether icon symbols are painted with a surrounding rectangle.- Returns:
- whether icon symbols are painted with a surrounding rectangle.
-
getSurroundingRectangleWidth
public long getSurroundingRectangleWidth()Returns the width in pixels of the rectangle that is painted around icon symbols.This property is only used if the surrounding rectangle
is enabled
.A pixel is defined as 1/96th of 1 inch (https://www.w3.org/TR/css-values-4/#absolute-lengths).
- Returns:
- the width in pixels of the rectangle that is painted around icon symbols.
-
getSurroundingRectangleColor
@NotNull public android.graphics.Color getSurroundingRectangleColor()Returns the color of the rectangle that is painted around icon symbols.This property is only used if the surrounding rectangle
is enabled
.- Returns:
- the color of the rectangle that is painted around icon symbols.
-
getCornerSmoothness
public double getCornerSmoothness()Returns the smoothness (or rounding) factor that is used to render corners of polygons.This factor is a value in the interval
[0.0, 1.0]
. The default value is0.5
.- Returns:
- the smoothness (or rounding) factor that is used to render corners of polygons.
-
getDefaultStyle
Returns the default style for aMilitarySymbol
.- Returns:
- the default style for a
MilitarySymbol
.
-
getDefaultTextStyle
Returns the default text style.The text style has a correctly scaled font size for a symbol with a specific icon size.
- Parameters:
iconSize
- length of width/height of symbol icon in pixel.- Returns:
- the default text style.
-