Class AbstractTacticalSymbol

    • Field Detail

      • DEFAULT_UNITS_FORMAT

        public static final UnitsFormat DEFAULT_UNITS_FORMAT
        Default unit format.
      • LOADING_IMAGE_PATH

        public static final java.lang.String LOADING_IMAGE_PATH
        The image file displayed while the icon is loading.
      • LAYOUT_ABSOLUTE

        protected static final java.lang.String LAYOUT_ABSOLUTE
        See Also:
        Constant Field Values
      • LAYOUT_RELATIVE

        protected static final java.lang.String LAYOUT_RELATIVE
        See Also:
        Constant Field Values
      • DEFAULT_DEPTH_OFFSET

        protected static final double DEFAULT_DEPTH_OFFSET
        The default depth offset in device independent depth units: -8200. This value is configured to match the depth offset produced by existing screen elements such as PointPlacemark. This value was determined empirically.
        See Also:
        Constant Field Values
      • DEFAULT_MAX_TIME_SINCE_LAST_USED

        protected static final long DEFAULT_MAX_TIME_SINCE_LAST_USED
        See Also:
        Constant Field Values
      • DEFAULT_GLYPH_ATLAS

        protected static final TextureAtlas DEFAULT_GLYPH_ATLAS
        The default glyph texture atlas. This texture atlas holds all glyph images loaded by calls to layoutGlyphModifier. Initialized with initial dimensions of 1024x128 and maximum dimensions of 2048x2048. Configured to remove the least recently used texture elements when more space is needed.
      • MAX_SYMBOL_DIMENSION

        protected static final int MAX_SYMBOL_DIMENSION
        Maximum expected size of a symbol, used to estimate screen bounds for view frustum culling. This value is configured a bit higher than a symbol is likely to be drawn in practice to err on the side of not culling a symbol that is not visible, rather culling one that is visible.
        See Also:
        Constant Field Values
      • DEFAULT_LABEL_LINES

        protected static final int DEFAULT_LABEL_LINES
        The default number of label lines to expect when computing the minimum size of the text layout rectangle.
        See Also:
        Constant Field Values
      • defaultAttrs

        protected static TacticalSymbolAttributes defaultAttrs
        The attributes used if attributes are not specified.
      • visible

        protected boolean visible
        Indicates whether this symbol is drawn when in view. true if this symbol is drawn when in view, otherwise false. Initially true.
      • highlighted

        protected boolean highlighted
        Indicates whether this symbol is highlighted. true if this symbol is highlighted, otherwise false. Initially false.
      • altitudeMode

        protected int altitudeMode
        Indicates this symbol's altitude mode. See setAltitudeMode(int) for a description of the valid altitude modes. Initially Worldwind.ABSOLUTE.
      • showGraphicModifiers

        protected boolean showGraphicModifiers
        Indicates whether this symbol draws its supplemental graphic modifiers. true if this symbol draws its graphic modifiers, otherwise false. Initially true.
      • showTextModifiers

        protected boolean showTextModifiers
        Indicates whether this symbol draws its supplemental text modifiers. true if this symbol draws its text modifiers, otherwise false. Initially true.
      • delegateOwner

        protected java.lang.Object delegateOwner
        Indicates an object to attach to the picked object list instead of this symbol.
      • enableBatchRendering

        protected boolean enableBatchRendering
      • enableBatchPicking

        protected boolean enableBatchPicking
      • showLocation

        protected boolean showLocation
        Indicates whether or not to display the implicit location modifier.
      • showHostileIndicator

        protected boolean showHostileIndicator
        Indicates whether or not to display the implicit hostile indicator modifier.
      • modifiers

        protected AVList modifiers
        Indicates the current text and graphic modifiers assigned to this symbol. This list of key-value pairs contains both the modifiers specified by the string identifier during construction, and those specified by calling setModifier(String, Object). Initialized to a new AVListImpl, and populated during construction from values in the string identifier and the modifiers list.
      • normalAttrs

        protected TacticalSymbolAttributes normalAttrs
        Indicates this symbol's normal (as opposed to highlight) attributes. May be null, indicating that the default attributes are used. Initially null.
      • highlightAttrs

        protected TacticalSymbolAttributes highlightAttrs
        Indicates this symbol's highlight attributes. May be null, indicating that the default attributes are used. Initially null.
      • offset

        protected Offset offset
      • iconOffset

        protected Offset iconOffset
      • iconSize

        protected Size iconSize
      • depthOffset

        protected java.lang.Double depthOffset
      • frameNumber

        protected long frameNumber
        The frame used to calculate this symbol's per-frame values. Set to the draw context's frame number each frame. Initially -1.
      • iconRect

        protected java.awt.Rectangle iconRect
      • staticScreenRect

        protected java.awt.Rectangle staticScreenRect
        Screen rect computed from the icon and static modifiers. This rectangle is cached and only recomputed when the icon or modifiers change.
      • staticLayoutRect

        protected java.awt.Rectangle staticLayoutRect
        Layout rect computed from the icon and static modifiers. This rectangle is cached and only recomputed when the icon or modifiers change.
      • unresolvedGlyph

        protected boolean unresolvedGlyph
        Indicates that one or more glyphs have not been resolved.
      • iconTexture

        protected WWTexture iconTexture
      • activeIconTexture

        protected WWTexture activeIconTexture
      • maxTimeSinceLastUsed

        protected long maxTimeSinceLastUsed
      • unitsFormat

        protected UnitsFormat unitsFormat
        Unit format used to format location and altitude for text modifiers.
      • formattedPosition

        protected java.lang.String formattedPosition
        Current symbol position, formatted using the current unit format.
      • dragEnabled

        protected boolean dragEnabled
        Dragging support properties.
      • LODSelector

        protected TacticalSymbol.LODSelector LODSelector
        The LOD selector specified by the application, or null if none specified (the default).
    • Constructor Detail

      • AbstractTacticalSymbol

        protected AbstractTacticalSymbol()
        Constructs a new symbol with no position.
      • AbstractTacticalSymbol

        protected AbstractTacticalSymbol​(Position position)
        Constructs a new symbol with the specified position. The position specifies the latitude, longitude, and altitude where this symbol is drawn on the globe. The position's altitude component is interpreted according to the altitudeMode.
        Parameters:
        position - the latitude, longitude, and altitude where the symbol is drawn.
        Throws:
        java.lang.IllegalArgumentException - if the position is null.
    • Method Detail

      • isVisible

        public boolean isVisible()
        Indicates whether this symbol is drawn when in view.
        Specified by:
        isVisible in interface TacticalSymbol
        Returns:
        true if this symbol is drawn when in view, otherwise false.
      • setVisible

        public void setVisible​(boolean visible)
        Specifies whether this symbol is drawn when in view.
        Specified by:
        setVisible in interface TacticalSymbol
        Parameters:
        visible - true if this symbol should be drawn when in view, otherwise false.
      • isHighlighted

        public boolean isHighlighted()
        Indicates whether to highlight the shape.
        Specified by:
        isHighlighted in interface Highlightable
        Returns:
        true to highlight the shape, otherwise false.
      • setHighlighted

        public void setHighlighted​(boolean highlighted)
        Specifies whether to highlight the shape.
        Specified by:
        setHighlighted in interface Highlightable
        Parameters:
        highlighted - true to highlight the shape, otherwise false.
      • setPosition

        public void setPosition​(Position position)
        Specifies this symbol's geographic position. The specified position must be non-null, and defines where on the globe this symbol displays its graphic. The position's altitude component is interpreted according to the altitudeMode. The type of graphic this symbol displays at the position is implementation dependent.
        Specified by:
        setPosition in interface TacticalSymbol
        Parameters:
        position - this symbol's new position.
      • setAltitudeMode

        public void setAltitudeMode​(int altitudeMode)
        Specifies this symbol's altitude mode. Altitude mode defines how the altitude component of this symbol's position is interpreted. Recognized modes are:
        • WorldWind.CLAMP_TO_GROUND -- this symbol's graphic is placed on the terrain at the latitude and longitude of its position.
        • WorldWind.RELATIVE_TO_GROUND -- this symbol's graphic is placed above the terrain at the latitude and longitude of its position and the distance specified by its elevation.
        • WorldWind.ABSOLUTE -- this symbol's graphic is placed at its specified position.

        This symbol assumes the altitude mode WorldWind.ABSOLUTE if the specified mode is not recognized.

        Specified by:
        setAltitudeMode in interface TacticalSymbol
        Parameters:
        altitudeMode - this symbol's new altitude mode.
      • isShowGraphicModifiers

        public boolean isShowGraphicModifiers()
        Indicates whether this symbol draws its supplemental graphic modifiers.
        Specified by:
        isShowGraphicModifiers in interface TacticalSymbol
        Returns:
        true if this symbol draws its graphic modifiers, otherwise false.
      • setShowGraphicModifiers

        public void setShowGraphicModifiers​(boolean showGraphicModifiers)
        Specifies whether to draw this symbol's supplemental graphic modifiers.
        Specified by:
        setShowGraphicModifiers in interface TacticalSymbol
        Parameters:
        showGraphicModifiers - true if this symbol should draw its graphic modifiers, otherwise false.
      • isShowTextModifiers

        public boolean isShowTextModifiers()
        Indicates whether this symbol draws its supplemental text modifiers.
        Specified by:
        isShowTextModifiers in interface TacticalSymbol
        Returns:
        true if this symbol draws its text modifiers, otherwise false.
      • setShowTextModifiers

        public void setShowTextModifiers​(boolean showTextModifiers)
        Specifies whether to draw this symbol's supplemental text modifiers.
        Specified by:
        setShowTextModifiers in interface TacticalSymbol
        Parameters:
        showTextModifiers - true if this symbol should draw its text modifiers, otherwise false.
      • isShowLocation

        public boolean isShowLocation()
        Indicates whether or not to display this symbol's location as a text modifier. Not all symbols support the location modifier.
        Specified by:
        isShowLocation in interface TacticalSymbol
        Returns:
        true if the symbol will display the location modifier. Note that not some symbols may not support this modifier.
      • setShowLocation

        public void setShowLocation​(boolean show)
        Specifies whether or not to display this symbol's location as a text modifier. Not all symbols support the location modifier. Setting showLocation on a symbol that does not support the modifier will have no effect.
        Specified by:
        setShowLocation in interface TacticalSymbol
        Parameters:
        show - true if the symbol will display the location modifier. Note that not some symbols may not support this modifier.
      • isShowHostileIndicator

        public boolean isShowHostileIndicator()
        Indicates whether or not to display an indicator when the symbol represents a hostile entity. See comments on setShowHostileIndicator for more information.
        Specified by:
        isShowHostileIndicator in interface TacticalSymbol
        Returns:
        true if an indicator will be drawn when this symbol represents a hostile entity, if supported by the symbol specification.
      • setShowHostileIndicator

        public void setShowHostileIndicator​(boolean show)
        Specifies whether or not to display an indicator when the symbol represents a hostile entity. The indicator is determined by the symbology set, and may not apply to all symbols in the symbol set. In the case of MIL-STD-2525C, the indicator is the letters "ENY" displayed at the lower right corner of the symbol.
        Specified by:
        setShowHostileIndicator in interface TacticalSymbol
        Parameters:
        show - true if this symbol will display an indicator when this symbol represents a hostile entity and the symbol specification supports such an indicator.
      • isEnableBatchRendering

        public boolean isEnableBatchRendering()
      • setEnableBatchRendering

        public void setEnableBatchRendering​(boolean enableBatchRendering)
      • isEnableBatchPicking

        public boolean isEnableBatchPicking()
      • setEnableBatchPicking

        public void setEnableBatchPicking​(boolean enableBatchPicking)
      • getModifier

        public java.lang.Object getModifier​(java.lang.String modifier)
        Indicates the current value of a text or graphic modifier. See TacticalSymbol.setModifier(String, Object) for a description of how modifiers values are interpreted.
        Specified by:
        getModifier in interface TacticalSymbol
        Parameters:
        modifier - the modifier key.
        Returns:
        the modifier value. May be null, indicating that this symbol does not display the specified modifier.
      • setModifier

        public void setModifier​(java.lang.String modifier,
                                java.lang.Object value)
        Specifies the value of a text or graphic modifier. Which modifier keys are recognized how they affect the symbol's graphic is implementation dependent. If the modifier has an implicit value and only needs to be enabled (e.g. the MIL-STD-2525 location modifier), specify true as the modifier value. If the specified value is 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.

        Specified by:
        setModifier in interface TacticalSymbol
        Parameters:
        modifier - the modifier key.
        value - the modifier value. May be null, indicating that the modifier should be removed from this symbol.
      • getAttributes

        public TacticalSymbolAttributes getAttributes()
        Returns this symbol's normal (as opposed to highlight) attributes.
        Specified by:
        getAttributes in interface TacticalSymbol
        Returns:
        this symbol's normal attributes. May be null, indicating that the default highlight attributes are used.
      • setAttributes

        public void setAttributes​(TacticalSymbolAttributes normalAttrs)
        Specifies this symbol's normal (as opposed to highlight) attributes.
        Specified by:
        setAttributes in interface TacticalSymbol
        Parameters:
        normalAttrs - the normal attributes. May be null, in which case default attributes are used.
      • getHighlightAttributes

        public TacticalSymbolAttributes getHighlightAttributes()
        Returns this symbol's highlight attributes.
        Specified by:
        getHighlightAttributes in interface TacticalSymbol
        Returns:
        this symbol's highlight attributes. May be null, indicating that the default attributes are used.
      • setHighlightAttributes

        public void setHighlightAttributes​(TacticalSymbolAttributes highlightAttrs)
        Specifies this symbol's highlight attributes.
        Specified by:
        setHighlightAttributes in interface TacticalSymbol
        Parameters:
        highlightAttrs - the highlight attributes. May be null, in which case default highlight attributes are used.
      • getDelegateOwner

        public java.lang.Object getDelegateOwner()
        Indicates the delegate owner of this symbol. If non-null, the returned object replaces the symbol as the pickable object returned during picking. If null, the symbol itself is the pickable object returned during picking.
        Specified by:
        getDelegateOwner in interface TacticalSymbol
        Returns:
        the object used as the pickable object returned during picking, or null to indicate the the symbol is returned during picking.
      • setDelegateOwner

        public void setDelegateOwner​(java.lang.Object owner)
        Specifies the delegate owner of this symbol. If non-null, the delegate owner replaces the symbol as the pickable object returned during picking. If null, the symbol itself is the pickable object returned during picking.
        Specified by:
        setDelegateOwner in interface TacticalSymbol
        Parameters:
        owner - the object to use as the pickable object returned during picking, or null to return the symbol.
      • getUnitsFormat

        public UnitsFormat getUnitsFormat()
        Indicates the unit format used to format values in text modifiers.
        Specified by:
        getUnitsFormat in interface TacticalSymbol
        Returns:
        Units format used to format text modifiers.
      • setUnitsFormat

        public void setUnitsFormat​(UnitsFormat unitsFormat)
        Specifies the unit format used to format values in text modifiers.
        Specified by:
        setUnitsFormat in interface TacticalSymbol
        Parameters:
        unitsFormat - Format used to format text modifiers.
      • setLODSelector

        public void setLODSelector​(TacticalSymbol.LODSelector LODSelector)
        Description copied from interface: TacticalSymbol
        Specifies this symbols level of detail selector.
        Specified by:
        setLODSelector in interface TacticalSymbol
        Parameters:
        LODSelector - the level of detail selector. May be null, the default, to indicate no level of detail selector.
      • getReferencePosition

        public Position getReferencePosition()
        A position associated with the object that indicates its aggregate geographic position. The chosen position varies among implementers of this interface. For objects defined by a list of positions, the reference position is typically the first position in the list. For symmetric objects the reference position is often the center of the object. In many cases the object's reference position may be explicitly specified by the application.
        Specified by:
        getReferencePosition in interface Movable
        Returns:
        the object's reference position, or null if no reference position is available.
      • move

        public void move​(Position delta)
        Shift the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.
        Specified by:
        move in interface Movable
        Parameters:
        delta - the latitude and longitude to add to the shape's reference position.
      • moveTo

        public void moveTo​(Position position)
        Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.
        Specified by:
        moveTo in interface Movable
        Parameters:
        position - the new position of the shape's reference position.
      • isDragEnabled

        public boolean isDragEnabled()
        Description copied from interface: Draggable
        Indicates whether the object is enabled for dragging.
        Specified by:
        isDragEnabled in interface Draggable
        Returns:
        true if the object is enabled, else false.
      • setDragEnabled

        public void setDragEnabled​(boolean enabled)
        Description copied from interface: Draggable
        Controls whether the object is enabled for dragging.
        Specified by:
        setDragEnabled in interface Draggable
        Parameters:
        enabled - true if the object is enabled, else false.
      • doDrag

        protected void doDrag​(DragContext dragContext)
      • getOffset

        public Offset getOffset()
        Indicates a location within the symbol to align with the symbol point. See setOffset for more information.
        Returns:
        the hot spot controlling the symbol's placement relative to the symbol point. null indicates default alignment.
      • setOffset

        public void setOffset​(Offset offset)
        Specifies a location within the tactical symbol to align with the symbol point. By default, ground symbols are aligned at the bottom center of the symbol, and other symbols are aligned to the center of the symbol. setOffset(Offset.CENTER) aligns the center of the symbol with the symbol point, and setOffset(Offset.BOTTOM_CENTER) aligns the center of the bottom edge with the symbol point.
        Parameters:
        offset - the hot spot controlling the symbol's placement relative to the symbol point. May be null to indicate default alignment.
      • getFormattedPosition

        protected java.lang.String getFormattedPosition()
        Indicates the symbol's current position, formatted according to the current UnitsFormat.
        Returns:
        The current position formatted according to the current unit format. Returns null if the position is null.
      • getDepthOffset

        protected java.lang.Double getDepthOffset()
      • setDepthOffset

        protected void setDepthOffset​(java.lang.Double depthOffset)
      • setIconRetriever

        protected void setIconRetriever​(IconRetriever retriever)
      • getModifierRetriever

        protected IconRetriever getModifierRetriever()
      • setModifierRetriever

        protected void setModifierRetriever​(IconRetriever retriever)
      • setGlyphAtlas

        protected void setGlyphAtlas​(TextureAtlas atlas)
      • render

        public void render​(DrawContext dc)
        Causes this Renderable to render itself using the provided draw context.
        Specified by:
        render in interface Renderable
        Parameters:
        dc - the DrawContext to be used
        See Also:
        DrawContext
      • makeOrderedRenderable

        protected void makeOrderedRenderable​(DrawContext dc)
      • determineActiveAttributes

        protected void determineActiveAttributes()
      • reset

        protected void reset()
        Invalidate the symbol layout, causing it to be recomputed on the next frame.
      • mustLayout

        protected boolean mustLayout​(AbstractTacticalSymbol.IconSource iconSource,
                                     AVList modifiers)
        Determines if the icon layout or static modifier layout must be computed.
        Parameters:
        iconSource - Current icon source.
        modifiers - Current modifiers.
        Returns:
        true if the layout must be recomputed.
      • assembleIconRetrieverParameters

        protected AVList assembleIconRetrieverParameters​(AVList params)
      • applyImplicitModifiers

        protected void applyImplicitModifiers​(AVList modifiers)
        Add implicit modifiers to the modifier list. This method is called each frame to add modifiers that are determined implicitly by the symbol state, rather than set explicitly by the application. For example, the location modifier can be determined by the symbol position without the application needing to specify it.
        Parameters:
        modifiers - List of modifiers. This method may modify this list by adding implicit modifiers.
      • layoutRect

        protected java.awt.Rectangle layoutRect​(Offset offset,
                                                Offset hotspot,
                                                java.awt.Dimension size,
                                                java.lang.Object layoutMode,
                                                AbstractTacticalSymbol.OrderedSymbol osym)
        Layout a rectangle relative to the current layout.
        Parameters:
        offset - Offset into either the iconRect or layoutRect at which to align the hot spot.
        hotspot - Offset into the rectangle of the hot spot.
        size - Size of the rectangle.
        layoutMode - One of LAYOUT_ABSOLUTE, LAYOUT_RELATIVE, or LAYOUT_NONE.
        osym - The OrderedSymbol to hold the per-frame data.
        Returns:
        the laid out rectangle.
      • layoutLabelRect

        protected java.awt.Rectangle layoutLabelRect​(Offset offset,
                                                     Offset hotspot,
                                                     java.awt.Dimension size,
                                                     java.lang.Object layoutMode,
                                                     AbstractTacticalSymbol.OrderedSymbol osym)
        Layout a label rectangle relative to the current layout. This method lays out text around the icon and graphic modifiers after scaling has been applied (text is not scaled with the icon).
        Parameters:
        offset - Offset into either the iconRect or layoutRect at which to align the hot spot.
        hotspot - Offset into the rectangle of the hot spot.
        size - Size of the rectangle.
        layoutMode - One of LAYOUT_ABSOLUTE, LAYOUT_RELATIVE, or LAYOUT_NONE.
        osym - The OrderedSymbol to hold the per-frame data.
        Returns:
        the laid out rectangle.
      • layoutPoints

        protected java.util.List<? extends java.awt.geom.Point2D> layoutPoints​(Offset offset,
                                                                               java.util.List<? extends java.awt.geom.Point2D> points,
                                                                               java.lang.Object layoutMode,
                                                                               int numPointsInLayout,
                                                                               AbstractTacticalSymbol.OrderedSymbol osym)
      • removeDeadModifiers

        protected void removeDeadModifiers​(long now)
      • computeScaledBounds

        protected void computeScaledBounds​(DrawContext dc,
                                           AVList modifiers,
                                           AbstractTacticalSymbol.OrderedSymbol osym)
        Compute the bounds of symbol after the scale has been applied.
        Parameters:
        dc - Current draw context.
        modifiers - Current modifiers.
        osym - The OrderedSymbol to hold the per-frame data.
      • computeMinTextLayout

        protected java.awt.Dimension computeMinTextLayout​(DrawContext dc,
                                                          AVList modifiers)
        Compute the dimension of the minimum layout rectangle for the text modifiers.A minimum dimension is enforced to prevent the text from overlapping if the symbol is scaled to a very small size.
        Parameters:
        dc - Current draw context.
        modifiers - Modifiers to apply to the text.
        Returns:
        Minimum dimension for the label layout rectangle.
      • getMaxLabelLines

        protected int getMaxLabelLines​(AVList modifiers)
      • computeScaledRect

        protected java.awt.Rectangle computeScaledRect​(java.awt.Rectangle rect,
                                                       java.awt.Dimension maxDimension,
                                                       double scaleX,
                                                       double scaleY)
      • getMaxSymbolDimension

        protected int getMaxSymbolDimension()
        Indicates the maximum expected size of a rendered tactical symbol. This value is used to estimate the size of a symbol and perform culling. If the symbol would not be visible (assuming it is the max size), then the icon does not need to be retrieved.
        Returns:
        Maximum size of a symbol, in pixels.
      • beginDrawing

        protected void beginDrawing​(DrawContext dc,
                                    int attrMask)
      • endDrawing

        protected void endDrawing​(DrawContext dc)
      • mustDrawIcon

        protected boolean mustDrawIcon​(DrawContext dc)
      • mustDrawGraphicModifiers

        protected boolean mustDrawGraphicModifiers​(DrawContext dc)
      • mustDrawTextModifiers

        protected boolean mustDrawTextModifiers​(DrawContext dc)
      • drawIcon

        protected void drawIcon​(DrawContext dc)
      • drawTextModifiers

        protected void drawTextModifiers​(DrawContext dc)
      • drawGlyphs

        protected void drawGlyphs​(DrawContext dc)
      • drawLabels

        protected void drawLabels​(DrawContext dc)
      • createPickedObject

        protected PickedObject createPickedObject​(int colorCode)