public interface TacticalSymbol extends WWObject, Renderable, Highlightable
MilStd2525TacticalSymbol
provides support for
tactical symbols from the MIL-STD-2525 symbology specification.
To create a tactical symbol, instantiate a concrete implementation appropriate for the desired symbology set. Pass a string identifier, the desired geographic position, and (optionally) one or more symbol modifier key-value pairs to the symbol's constructor. The tactical symbol creates a graphic appropriate for the string identifier and optional symbol modifiers, and draws that graphic at the specified position when its render method is called. For example, a symbol implementation may display a 3D object at the position, or display a screen space icon who's screen location tracks the position. MIL-STD-2525 tactical symbols display a screen space icon with graphic and text modifiers surrounding the icon.
The format of the string identifier and the modifier key-value pairs are implementation dependent. For MIL-STD-2525, the string identifier must be a 15-character alphanumeric symbol identification code (SIDC), and the modifier keys must be one of the constants defined in MilStd2525TacticalSymbol's documentation.
Since TacticalSymbol extends the Renderable interface, a tactical symbol is displayed either by adding it to a layer,
or by calling its render method from within a custom layer or renderable object. The simplest way to display a
tactical symbol is to add it to a RenderableLayer
. Here's an example of creating
and displaying a tactical symbol for a MIL-STD-2525 friendly ground unit using a RenderableLayer:
// Create a tactical symbol for a MIL-STD-2525 friendly ground unit. Since the SIDC specifies a ground symbol, the // tactical symbol's altitude mode is automatically configured as WorldWind.CLAMP_TO_GROUND. TacticalSymbol symbol = new MilStd2525TacticalSymbol("SFGPU---------G", Position.fromDegrees(40, -120, 0)); // Create a renderable layer to display the tactical symbol. This example adds only a single symbol, but many // symbols can be added to a single layer. RenderableLayer symbolLayer = new RenderableLayer(); symbolLayer.addRenderable(symbol); // Add the layer to the WorldWindow's model and request that the window redraw itself. The WorldWindow draws the // symbol on the globe at the specified position. Interactions between the symbol and the cursor are returned in the // WorldWindow's picked object list, and reported to the WorldWindow's select listeners. WorldWindow wwd = ... // A reference to your application's WorldWindow instance. wwd.getModel().getLayers().add(symbolLayer); wwd.redraw();
A symbol's altitude mode defines how the altitude component if the position is interpreted. Altitude mode may be
specified by calling setAltitudeMode(int)
. Recognized modes are:
Tactical symbol implementations configure the altitude mode from the string identifier specified during construction. For example, specifying the MIL-STD-2525 SIDC "SFGPU---------G" specifies a friendly ground unit symbol, and causes a tactical symbol to configure the altitude mode as WorldWind.CLAMP_TO_GROUND. The automatically configured mode can be overridden by calling setAltitudeMode.
setModifier(String, Object)
with the modifier key and value. Which modifier keys are recognized by a tactical
symbol and how they affect the symbol's graphic is implementation dependent. Here's an example of setting the the
heading (direction of movement) modifier at construction for a MIL-STD-2525 friendly ground unit:
// Create a tactical symbol for a MIL-STD-2525 friendly ground unit, specifying the optional Direction of Movement // modifier by passing in a list of key-value pairs. AVList modifiers = new AVListImpl(); modifiers.setValue(SymbologyConstants.DIRECTION_OF_MOVEMENT, Angle.fromDegrees(45)); TacticalSymbol symbol = new MilStd2525TacticalSymbol("SFGPU---------G", Position.fromDegrees(40, -120, 0), modifiers);
Here's an example of setting the same modifier after construction:
// Create a tactical symbol for a MIL-STD-2525 friendly ground unit. TacticalSymbol symbol = new MilStd2525TacticalSymbol("SFGPU---------G", Position.fromDegrees(40, -120, 0)); // Set the heading (direction of movement) modifier. symbol.setModifier(SymbologyConstants.DIRECTION_OF_MOVEMENT, Angle.fromDegrees(45));
Tactical symbol implementations apply modifiers from the string identifier specified during construction. For example, given a MIL-STD-2525 symbol representing units, installation, or equipment, SIDC positions 11-12 specify the echelon and task force modifiers (See MIL-STD-2525C, Appendix A). Here's an example of setting the echelon and task force modifiers at construction for a MIL-STD-2525 friendly ground unit:
// Create a tactical symbol for a MIL-STD-2525 friendly ground unit. Specify the echelon modifier and task force // modifiers by setting the SIDC characters 11-12 to "EA". This indicates that the ground unit is a Task Force with // a Team/Crew Echelon (see MIL-STD-2525C, Appendix A, Table A-II). TacticalSymbol symbol = new MilStd2525TacticalSymbol("SFGPU-----EA--G", Position.fromDegrees(40, -120, 0));
Modifier and Type | Interface and Description |
---|---|
static interface |
TacticalSymbol.LODSelector
An interface to enable application selection of tactical symbol level of detail.
|
Modifier and Type | Method and Description |
---|---|
int |
getAltitudeMode()
Indicates this symbol's altitude mode.
|
TacticalSymbolAttributes |
getAttributes()
Returns this symbol's normal (as opposed to highlight) attributes.
|
java.lang.Object |
getDelegateOwner()
Indicates the delegate owner of this symbol.
|
TacticalSymbolAttributes |
getHighlightAttributes()
Returns this symbol's highlight attributes.
|
java.lang.String |
getIdentifier()
Indicates a string identifier for this symbol.
|
TacticalSymbol.LODSelector |
getLODSelector()
Indicates this symbol's level of detail selector.
|
java.lang.Object |
getModifier(java.lang.String modifier)
Indicates the current value of a text or graphic modifier.
|
Position |
getPosition()
Indicates this symbol's geographic position.
|
UnitsFormat |
getUnitsFormat()
Indicates the unit format used to format values in text modifiers.
|
boolean |
isShowGraphicModifiers()
Indicates whether this symbol draws its supplemental graphic modifiers.
|
boolean |
isShowHostileIndicator()
Indicates whether or not to display an indicator when the symbol represents a hostile entity.
|
boolean |
isShowLocation()
Indicates whether or not to display this symbol's location as a text modifier.
|
boolean |
isShowTextModifiers()
Indicates whether this symbol draws its supplemental text modifiers.
|
boolean |
isVisible()
Indicates whether this symbol is drawn when in view.
|
void |
setAltitudeMode(int altitudeMode)
Specifies this symbol's altitude mode.
|
void |
setAttributes(TacticalSymbolAttributes normalAttrs)
Specifies this symbol's normal (as opposed to highlight) attributes.
|
void |
setDelegateOwner(java.lang.Object owner)
Specifies the delegate owner of this symbol.
|
void |
setHighlightAttributes(TacticalSymbolAttributes highlightAttrs)
Specifies this symbol's highlight attributes.
|
void |
setLODSelector(TacticalSymbol.LODSelector LODSelector)
Specifies this symbols level of detail selector.
|
void |
setModifier(java.lang.String modifier,
java.lang.Object value)
Specifies the value of a text or graphic modifier.
|
void |
setPosition(Position position)
Specifies this symbol's geographic position.
|
void |
setShowGraphicModifiers(boolean showGraphicModifiers)
Specifies whether to draw this symbol's supplemental graphic modifiers.
|
void |
setShowHostileIndicator(boolean show)
Specifies whether or not to display an indicator when the symbol represents a hostile entity.
|
void |
setShowLocation(boolean show)
Specifies whether or not to display this symbol's location as a text modifier.
|
void |
setShowTextModifiers(boolean showTextModifiers)
Specifies whether to draw this symbol's supplemental text modifiers.
|
void |
setUnitsFormat(UnitsFormat unitsFormat)
Specifies the unit format used to format values in text modifiers.
|
void |
setVisible(boolean visible)
Specifies whether this symbol is drawn when in view.
|
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
onMessage
render
isHighlighted, setHighlighted
int getAltitudeMode()
setAltitudeMode(int)
for a description of the valid altitude
modes.TacticalSymbolAttributes getAttributes()
null
, indicating that the default highlight
attributes are used.java.lang.Object getDelegateOwner()
TacticalSymbolAttributes getHighlightAttributes()
null
, indicating that the default attributes are
used.java.lang.String getIdentifier()
TacticalSymbol.LODSelector getLODSelector()
java.lang.Object getModifier(java.lang.String modifier)
setModifier(String, Object)
for a
description of how modifiers values are interpreted.modifier
- the modifier key.null
, indicating that this symbol does not display the specified
modifier.java.lang.IllegalArgumentException
- if the modifier is null
.Position getPosition()
setPosition(gov.nasa.worldwind.geom.Position)
for a
description of how tactical symbols interpret their position.UnitsFormat getUnitsFormat()
boolean isShowGraphicModifiers()
boolean isShowHostileIndicator()
setShowHostileIndicator
for more information.boolean isShowLocation()
boolean isShowTextModifiers()
boolean isVisible()
void setAltitudeMode(int altitudeMode)
This symbol assumes the altitude mode WorldWind.ABSOLUTE if the specified mode is not recognized.
altitudeMode
- this symbol's new altitude mode.void setAttributes(TacticalSymbolAttributes normalAttrs)
normalAttrs
- the normal attributes. May be null
, in which case default attributes are used.void setDelegateOwner(java.lang.Object owner)
owner
- the object to use as the pickable object returned during picking, or null to return the symbol.void setHighlightAttributes(TacticalSymbolAttributes highlightAttrs)
highlightAttrs
- the highlight attributes. May be null
, in which case default highlight
attributes are used.void setLODSelector(TacticalSymbol.LODSelector LODSelector)
LODSelector
- the level of detail selector. May be null, the default, to indicate no level of detail
selector.void setModifier(java.lang.String modifier, java.lang.Object value)
null
, the modifier is removed from this symbol.
If the specified modifier represents a graphic or text modifier, its display is suppressed if isShowGraphicModifiers or isShowTextModifiers, respectively, returns false.
modifier
- the modifier key.value
- the modifier value. May be null
, indicating that the modifier should be removed from
this symbol.java.lang.IllegalArgumentException
- if the modifier is null
.void setPosition(Position position)
position
- this symbol's new position.java.lang.IllegalArgumentException
- if the position is null
.void setShowGraphicModifiers(boolean showGraphicModifiers)
showGraphicModifiers
- true if this symbol should draw its graphic modifiers, otherwise false.void setShowHostileIndicator(boolean show)
show
- true if this symbol will display an indicator when this symbol represents a hostile entity and the
symbol specification supports such an indicator.void setShowLocation(boolean show)
show
- true if the symbol will display the location modifier. Note that not some symbols may not support
this modifier.void setShowTextModifiers(boolean showTextModifiers)
showTextModifiers
- true if this symbol should draw its text modifiers, otherwise false.void setUnitsFormat(UnitsFormat unitsFormat)
unitsFormat
- Format used to format text modifiers.void setVisible(boolean visible)
visible
- true if this symbol should be drawn when in view, otherwise false.