public abstract class AbstractTacticalGraphic extends AVListImpl implements TacticalGraphic, Renderable, Draggable
doRenderGraphic
and applyDelegateOwner(Object)
.Modifier and Type | Field and Description |
---|---|
protected TacticalGraphicAttributes |
activeOverrides
Override attributes for the current frame.
|
protected ShapeAttributes |
activeShapeAttributes
Shape attributes shared by all shapes that make up this graphic.
|
protected static Material |
DEFAULT_HIGHLIGHT_MATERIAL
The default highlight color.
|
protected static double |
DEFAULT_LABEL_INTERIOR_OPACITY
Opacity of label interiors.
|
protected Object |
delegateOwner
Object returned during picking to represent this graphic.
|
protected boolean |
dragEnabled
Indicates whether this object can be dragged.
|
protected DraggableSupport |
draggableSupport
Provides additional information for dragging regarding this particular object.
|
protected long |
frameTimestamp
Current frame timestamp.
|
protected TacticalGraphicAttributes |
highlightAttributes
Attributes to apply when the graphic is highlighted.
|
protected boolean |
highlighted
Indicates whether or not the graphic is highlighted.
|
protected Offset |
labelOffset
Offset applied to the graphic's main label.
|
protected List<TacticalGraphicLabel> |
labels
Labels to render with the graphic.
|
protected AVList |
modifiers
Map of modifiers applied to this graphic.
|
protected boolean |
mustCreateLabels
Flag to indicate that labels must be recreated before the graphic is rendered.
|
protected TacticalGraphicAttributes |
normalAttributes
Attributes to apply when the graphic is not highlighted.
|
protected boolean |
showGraphicModifiers
Indicates whether or not to render graphic modifiers.
|
protected boolean |
showHostileIndicator
Indicates whether or not to render the hostile/enemy modifier.
|
protected boolean |
showLocation
Indicates whether or not to render the location modifier.
|
protected boolean |
showTextModifiers
Indicates whether or not to render text modifiers.
|
protected String |
text
The graphic's text string.
|
protected UnitsFormat |
unitsFormat
Unit format used to format location and altitude for text modifiers.
|
protected boolean |
visible
Indicates whether or not to render the graphic.
|
Constructor and Description |
---|
AbstractTacticalGraphic() |
Modifier and Type | Method and Description |
---|---|
protected TacticalGraphicLabel |
addLabel(String text) |
protected void |
applyDefaultAttributes(ShapeAttributes attributes)
Apply defaults to the active attributes bundle.
|
protected abstract void |
applyDelegateOwner(Object owner)
Invoked each frame to apply to the current delegate owner to all renderable objects used to draw the graphic.
|
protected void |
applyLabelAttributes()
Apply the active attributes to the graphic's labels.
|
protected void |
applyOverrideAttributes(TacticalGraphicAttributes graphicAttributes,
ShapeAttributes shapeAttributes)
Apply override attributes specified in a TacticalGraphicAttributes bundle to the active ShapeAttributes.
|
protected void |
computeGeometry(DrawContext dc) |
protected double |
computeLabelInteriorOpacity(double textOpacity)
Compute the opacity for the label interior.
|
protected void |
createLabels() |
protected void |
determineActiveAttributes()
Determine active attributes for this frame.
|
protected void |
determineDelegateOwner()
Determine the delegate owner for the current frame, and apply the owner to all renderable objects used to draw
the graphic.
|
protected void |
determineLabelPositions(DrawContext dc)
Determine positions for the start and end labels.
|
protected void |
determinePerFrameAttributes(DrawContext dc)
Determine geometry and attributes for this frame.
|
protected void |
doDrag(DragContext dragContext) |
protected abstract void |
doRenderGraphic(DrawContext dc)
Render this graphic, without modifiers.
|
protected void |
doRenderGraphicModifiers(DrawContext dc)
Render the graphic modifiers.
|
protected void |
doRenderTextModifiers(DrawContext dc)
Render the text modifiers.
|
void |
drag(DragContext dragContext)
Drag the object given the provided
DragContext . |
protected Object |
getActiveDelegateOwner()
Indicates the object attached to the pick list to represent this graphic.
|
protected TacticalGraphicAttributes |
getActiveOverrideAttributes()
Get the override attributes that are active for this frame.
|
protected ShapeAttributes |
getActiveShapeAttributes()
Get the active shape attributes for this frame.
|
TacticalGraphicAttributes |
getAttributes()
Indicates this graphic's attributes when it is in the normal (as opposed to highlighted) state.
|
protected Offset |
getDefaultLabelOffset()
Indicates the default offset applied to the graphic's main label.
|
Object |
getDelegateOwner()
Returns the delegate owner of the graphic.
|
TacticalGraphicAttributes |
getHighlightAttributes()
Indicate this graphic's attributes when it is in the highlighted state.
|
protected Material |
getLabelMaterial()
Get the Material that should be used to draw labels.
|
Offset |
getLabelOffset()
Indicates an offset used to position the graphic's main label relative to the label's geographic position.
|
Object |
getModifier(String modifier)
Indicates the current value of a text or graphic modifier.
|
String |
getText()
Convenience method to access the text modifier of the graphic.
|
UnitsFormat |
getUnitsFormat()
Indicates the unit format used to format values in text modifiers.
|
boolean |
isDragEnabled()
Indicates whether the object is enabled for dragging.
|
boolean |
isHighlighted()
Indicates whether to highlight the shape.
|
boolean |
isShowGraphicModifiers()
Indicates whether this graphic draws its supplemental graphic modifiers.
|
boolean |
isShowHostileIndicator()
Indicates whether or not this graphic will display a text indicator when the graphic represents a hostile entity.
|
boolean |
isShowLocation()
Indicates whether or not the graphic should display its location as a text modifier.
|
boolean |
isShowTextModifiers()
Indicates whether this graphic draws its supplemental text modifiers.
|
boolean |
isVisible()
Indicates whether this graphic is drawn when in view.
|
void |
move(Position delta)
Shift the shape over the globe's surface while maintaining its original azimuth, its orientation relative to
North.
|
void |
moveTo(Position position)
Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to
North.
|
protected void |
onModifierChanged()
Invoked when a modifier is changed.
|
void |
render(DrawContext dc)
Causes this
Renderable to render itself using the provided draw context. |
void |
setAttributes(TacticalGraphicAttributes attributes)
Specifies attributes for this graphic in the normal (as opposed to highlighted) state.
|
void |
setDelegateOwner(Object owner)
Specifies the delegate owner of the graphic.
|
void |
setDragEnabled(boolean enabled)
Controls whether the object is enabled for dragging.
|
void |
setHighlightAttributes(TacticalGraphicAttributes attributes)
Specifies attributes for this graphic in the highlighted state.
|
void |
setHighlighted(boolean highlighted)
Specifies whether to highlight the shape.
|
void |
setLabelOffset(Offset labelOffset)
Specifies an offset used to position this graphic's main label relative to the label's geographic position.
|
void |
setModifier(String modifier,
Object value)
Specifies the value of a text or graphic modifier.
|
void |
setShowGraphicModifiers(boolean showModifiers)
Specifies whether to draw this graphic's supplemental graphic modifiers.
|
void |
setShowHostileIndicator(boolean showHostileIndicator)
Specifies whether or not to display a text indicator when the symbol or graphic represents a hostile entity.
|
void |
setShowLocation(boolean showLocation)
Specifies whether or not the graphic should display its location as a text modifier.
|
void |
setShowTextModifiers(boolean showModifiers)
Specifies whether to draw this graphic's supplemental text modifiers.
|
void |
setText(String text)
Convenience method to specify a text modifier for the graphic.
|
void |
setUnitsFormat(UnitsFormat unitsFormat)
Specifies the unit format used to format values in text modifiers.
|
void |
setVisible(boolean visible)
Specifies whether this graphic is drawn when in view.
|
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getIdentifier, getPositions, setPositions
getReferencePosition
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
protected TacticalGraphicAttributes activeOverrides
protected ShapeAttributes activeShapeAttributes
protected static final Material DEFAULT_HIGHLIGHT_MATERIAL
protected static final double DEFAULT_LABEL_INTERIOR_OPACITY
protected Object delegateOwner
protected boolean dragEnabled
protected DraggableSupport draggableSupport
protected long frameTimestamp
protected TacticalGraphicAttributes highlightAttributes
protected boolean highlighted
protected Offset labelOffset
protected List<TacticalGraphicLabel> labels
protected AVList modifiers
protected boolean mustCreateLabels
protected TacticalGraphicAttributes normalAttributes
protected boolean showGraphicModifiers
protected boolean showHostileIndicator
protected boolean showLocation
protected boolean showTextModifiers
protected String text
SymbologyConstants.UNIQUE_DESIGNATION
modifier.
Note that this field is not used if an Iterable is specified as the unique designation.protected UnitsFormat unitsFormat
protected boolean visible
protected TacticalGraphicLabel addLabel(String text)
protected void applyDefaultAttributes(ShapeAttributes attributes)
attributes
- Attributes bundle to receive defaults.protected abstract void applyDelegateOwner(Object owner)
owner
- Current delegate owner.protected void applyLabelAttributes()
protected void applyOverrideAttributes(TacticalGraphicAttributes graphicAttributes, ShapeAttributes shapeAttributes)
graphicAttributes
will be applied to shapeAttributes
.graphicAttributes
- Override attributes.shapeAttributes
- Shape attributes to receive overrides.protected void computeGeometry(DrawContext dc)
protected double computeLabelInteriorOpacity(double textOpacity)
textOpacity
- Opacity of the label text.protected void createLabels()
protected void determineActiveAttributes()
protected void determineDelegateOwner()
protected void determineLabelPositions(DrawContext dc)
dc
- Current draw context.protected void determinePerFrameAttributes(DrawContext dc)
dc
- Current draw context.protected void doDrag(DragContext dragContext)
protected abstract void doRenderGraphic(DrawContext dc)
dc
- Current draw context.doRenderTextModifiers(gov.nasa.worldwind.render.DrawContext)
,
doRenderGraphicModifiers(gov.nasa.worldwind.render.DrawContext)
protected void doRenderGraphicModifiers(DrawContext dc)
dc
- Current draw context.protected void doRenderTextModifiers(DrawContext dc)
dc
- Current draw context.public void drag(DragContext dragContext)
Draggable
DragContext
.drag
in interface Draggable
dragContext
- the DragContext
of this dragging event.protected Object getActiveDelegateOwner()
this
if an owner is not specified.protected TacticalGraphicAttributes getActiveOverrideAttributes()
protected ShapeAttributes getActiveShapeAttributes()
public TacticalGraphicAttributes getAttributes()
getAttributes
in interface TacticalGraphic
protected Offset getDefaultLabelOffset()
public Object getDelegateOwner()
getDelegateOwner
in interface TacticalGraphic
public TacticalGraphicAttributes getHighlightAttributes()
getHighlightAttributes
in interface TacticalGraphic
protected Material getLabelMaterial()
public Offset getLabelOffset()
setLabelOffset
for more information.getLabelOffset
in interface TacticalGraphic
public Object getModifier(String modifier)
getModifier
in interface TacticalGraphic
modifier
- Key that identifies the modifier to retrieve. The possible modifiers depends on the symbol set.null
if the modifier is not set.public String getText()
getModifier(SymbologyConstants.UNIQUE_DESIGNATION)
.getText
in interface TacticalGraphic
TacticalGraphic.getModifier(String)
public UnitsFormat getUnitsFormat()
getUnitsFormat
in interface TacticalGraphic
public boolean isDragEnabled()
Draggable
isDragEnabled
in interface Draggable
public boolean isHighlighted()
isHighlighted
in interface Highlightable
public boolean isShowGraphicModifiers()
isShowGraphicModifiers
in interface TacticalGraphic
public boolean isShowHostileIndicator()
setShowHostileIndicator
for more information.isShowHostileIndicator
in interface TacticalGraphic
public boolean isShowLocation()
isShowLocation
in interface TacticalGraphic
public boolean isShowTextModifiers()
isShowTextModifiers
in interface TacticalGraphic
public boolean isVisible()
isVisible
in interface TacticalGraphic
public void move(Position delta)
public void moveTo(Position position)
protected void onModifierChanged()
public void render(DrawContext dc)
Renderable
to render itself using the provided draw context.render
in interface Renderable
dc
- the DrawContext
to be usedDrawContext
public void setAttributes(TacticalGraphicAttributes attributes)
setAttributes
in interface TacticalGraphic
attributes
- new attributes. May be null, in which case default attributes are used.public void setDelegateOwner(Object owner)
setDelegateOwner
in interface TacticalGraphic
owner
- the object to use as the pickable object returned during picking, or null to return the graphic.public void setDragEnabled(boolean enabled)
Draggable
setDragEnabled
in interface Draggable
enabled
- true
if the object is enabled, else false
.public void setHighlightAttributes(TacticalGraphicAttributes attributes)
setAttributes
for more information on how the attributes are
interpreted.setHighlightAttributes
in interface TacticalGraphic
attributes
- Attributes to apply to the graphic when it is highlighted. May be null, in which default
attributes are used.public void setHighlighted(boolean highlighted)
setHighlighted
in interface Highlightable
highlighted
- true to highlight the shape, otherwise false.public void setLabelOffset(Offset labelOffset)
setLabelOffset
in interface TacticalGraphic
labelOffset
- The offset that determines how the graphic's label is placed relative to the graphic.public void setModifier(String modifier, Object value)
setModifier
in interface TacticalGraphic
modifier
- Key that identifies the modifier to set. The possible modifiers depends on the symbol set.value
- New value for the modifier.public void setShowGraphicModifiers(boolean showModifiers)
setShowGraphicModifiers
in interface TacticalGraphic
showModifiers
- true if this graphic should draw its graphic modifiers, otherwise false.public void setShowHostileIndicator(boolean showHostileIndicator)
setShowHostileIndicator
in interface TacticalGraphic
showHostileIndicator
- true if this graphic should display an indicator when this graphic represents a hostile entity and
the graphic implementation supports such an indicator. Note that some graphics may not display an
indicator, even when representing a hostile entity.public void setShowLocation(boolean showLocation)
setShowLocation
in interface TacticalGraphic
showLocation
- true if the graphic will display the location modifier. Note that not all graphics support this
modifier.public void setShowTextModifiers(boolean showModifiers)
setShowTextModifiers
in interface TacticalGraphic
showModifiers
- true if this graphic should draw its text modifiers, otherwise false.public void setText(String text)
setModifier(SymbologyConstants.UNIQUE_DESIGNATION, text)
.setText
in interface TacticalGraphic
text
- New text modifier. May be null.TacticalGraphic.setModifier(String, Object)
public void setUnitsFormat(UnitsFormat unitsFormat)
setUnitsFormat
in interface TacticalGraphic
unitsFormat
- Format used to format text modifiers.public void setVisible(boolean visible)
setVisible
in interface TacticalGraphic
visible
- true if this graphic should be drawn when in view, otherwise false.