Class AbstractTacticalGraphic

    • Field Detail

      • DEFAULT_HIGHLIGHT_MATERIAL

        protected static final Material DEFAULT_HIGHLIGHT_MATERIAL
        The default highlight color.
      • DEFAULT_LABEL_INTERIOR_OPACITY

        protected static final double DEFAULT_LABEL_INTERIOR_OPACITY
        Opacity of label interiors. This value is multiplied by the label text opacity to determine the final interior opacity.
        See Also:
        Constant Field Values
      • text

        protected java.lang.String text
        The graphic's text string. This field corresponds to the SymbologyConstants.UNIQUE_DESIGNATION modifier. Note that this field is not used if an Iterable is specified as the unique designation.
      • highlighted

        protected boolean highlighted
        Indicates whether or not the graphic is highlighted.
      • visible

        protected boolean visible
        Indicates whether or not to render the graphic.
      • showTextModifiers

        protected boolean showTextModifiers
        Indicates whether or not to render text modifiers.
      • showGraphicModifiers

        protected boolean showGraphicModifiers
        Indicates whether or not to render graphic modifiers.
      • dragEnabled

        protected boolean dragEnabled
        Indicates whether this object can be dragged.
      • draggableSupport

        protected DraggableSupport draggableSupport
        Provides additional information for dragging regarding this particular object.
      • showHostileIndicator

        protected boolean showHostileIndicator
        Indicates whether or not to render the hostile/enemy modifier. This modifier is displayed by default.
      • showLocation

        protected boolean showLocation
        Indicates whether or not to render the location modifier.
      • delegateOwner

        protected java.lang.Object delegateOwner
        Object returned during picking to represent this graphic.
      • unitsFormat

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

        protected TacticalGraphicAttributes normalAttributes
        Attributes to apply when the graphic is not highlighted. These attributes override defaults determined by the graphic's symbol code.
      • highlightAttributes

        protected TacticalGraphicAttributes highlightAttributes
        Attributes to apply when the graphic is highlighted. These attributes override defaults determined by the graphic's symbol code.
      • labelOffset

        protected Offset labelOffset
        Offset applied to the graphic's main label.
      • modifiers

        protected AVList modifiers
        Map of modifiers applied to this graphic. Note that implementations may not store all modifiers in this map. Some modifiers may be handled specially.
      • frameTimestamp

        protected long frameTimestamp
        Current frame timestamp.
      • activeShapeAttributes

        protected ShapeAttributes activeShapeAttributes
        Shape attributes shared by all shapes that make up this graphic. The graphic's active attributes are copied into this attribute bundle on each frame.
      • mustCreateLabels

        protected boolean mustCreateLabels
        Flag to indicate that labels must be recreated before the graphic is rendered.
    • Constructor Detail

      • AbstractTacticalGraphic

        public AbstractTacticalGraphic()
    • Method Detail

      • applyDelegateOwner

        protected abstract void applyDelegateOwner​(java.lang.Object owner)
        Invoked each frame to apply to the current delegate owner to all renderable objects used to draw the graphic. This base class will apply the delegate owner to Label objects. Subclasses must implement this method to apply the delegate owner to any Renderables that they will draw in order to render the graphic.
        Parameters:
        owner - Current delegate owner.
      • getModifier

        public java.lang.Object getModifier​(java.lang.String modifier)
        Indicates the current value of a text or graphic modifier.
        Specified by:
        getModifier in interface TacticalGraphic
        Parameters:
        modifier - Key that identifies the modifier to retrieve. The possible modifiers depends on the symbol set.
        Returns:
        The value of the modifier, or null if the modifier is not set.
      • setModifier

        public void setModifier​(java.lang.String modifier,
                                java.lang.Object value)
        Specifies the value of a text or graphic modifier.
        Specified by:
        setModifier in interface TacticalGraphic
        Parameters:
        modifier - Key that identifies the modifier to set. The possible modifiers depends on the symbol set.
        value - New value for the modifier.
      • isShowTextModifiers

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

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

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

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

        public boolean isShowHostileIndicator()
        Indicates whether or not this graphic will display a text indicator when the graphic represents a hostile entity. See comments on setShowHostileIndicator for more information.
        Specified by:
        isShowHostileIndicator in interface TacticalGraphic
        Returns:
        true if an indicator may be drawn when this graphic represents a hostile entity, if supported by the graphic implementation. Note that some graphics may not display an indicator, even when representing a hostile entity.
      • setShowHostileIndicator

        public void setShowHostileIndicator​(boolean showHostileIndicator)
        Specifies whether or not to display a text indicator when the symbol or graphic represents a hostile entity. In the case of MIL-STD-2525C, the indicator is the letters "ENY". The indicator is determined by the symbology set, and may not apply to all graphics in the symbol set.
        Specified by:
        setShowHostileIndicator in interface TacticalGraphic
        Parameters:
        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.
      • isShowLocation

        public boolean isShowLocation()
        Indicates whether or not the graphic should display its location as a text modifier. Not all graphics support the location modifier.
        Specified by:
        isShowLocation in interface TacticalGraphic
        Returns:
        true if the graphic will display the location modifier. Note that not all graphics support this modifier.
      • setShowLocation

        public void setShowLocation​(boolean showLocation)
        Specifies whether or not the graphic should display its location as a text modifier. Not all graphics support the location modifier. Setting showLocation on a graphic that does not support the modifier will have no effect.
        Specified by:
        setShowLocation in interface TacticalGraphic
        Parameters:
        showLocation - true if the graphic will display the location modifier. Note that not all graphics support this modifier.
      • getText

        public java.lang.String getText()
        Convenience method to access the text modifier of the graphic. Calling this method is equivalent to calling getModifier(SymbologyConstants.UNIQUE_DESIGNATION).
        Specified by:
        getText in interface TacticalGraphic
        Returns:
        Descriptive text for this graphic.
        See Also:
        TacticalGraphic.getModifier(String)
      • setText

        public void setText​(java.lang.String text)
        Convenience method to specify a text modifier for the graphic. Calling this method is equivalent to calling setModifier(SymbologyConstants.UNIQUE_DESIGNATION, text).
        Specified by:
        setText in interface TacticalGraphic
        Parameters:
        text - New text modifier. May be null.
        See Also:
        TacticalGraphic.setModifier(String, Object)
      • isVisible

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

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

        public TacticalGraphicAttributes getAttributes()
        Indicates this graphic's attributes when it is in the normal (as opposed to highlighted) state.
        Specified by:
        getAttributes in interface TacticalGraphic
        Returns:
        this graphic's attributes. May be null.
      • setAttributes

        public void setAttributes​(TacticalGraphicAttributes attributes)
        Specifies attributes for this graphic in the normal (as opposed to highlighted) state. If any fields in the attribute bundle are null, the default attribute will be used instead. For example, if the attribute bundle includes a setting for outline material but not for interior material the new outline material will override the default outline material, but the interior material will remain the default. The default attributes are determined by the symbol set, and may differ depending on the type of graphic.
        Specified by:
        setAttributes in interface TacticalGraphic
        Parameters:
        attributes - new attributes. May be null, in which case default attributes are used.
      • setHighlightAttributes

        public void setHighlightAttributes​(TacticalGraphicAttributes attributes)
        Specifies attributes for this graphic in the highlighted state. See comments on setAttributes for more information on how the attributes are interpreted.
        Specified by:
        setHighlightAttributes in interface TacticalGraphic
        Parameters:
        attributes - Attributes to apply to the graphic when it is highlighted. May be null, in which default attributes are used.
      • getDelegateOwner

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

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

        public UnitsFormat getUnitsFormat()
        Indicates the unit format used to format values in text modifiers.
        Specified by:
        getUnitsFormat in interface TacticalGraphic
        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 TacticalGraphic
        Parameters:
        unitsFormat - Format used to format text modifiers.
      • getLabelOffset

        public Offset getLabelOffset()
        Indicates an offset used to position the graphic's main label relative to the label's geographic position. See comments on setLabelOffset for more information.
        Specified by:
        getLabelOffset in interface TacticalGraphic
        Returns:
        The offset that determines how the graphic's label is placed relative to the graphic.
      • setLabelOffset

        public void setLabelOffset​(Offset labelOffset)
        Specifies an offset used to position this graphic's main label relative to the label's geographic position. The geographic position is determined by the type of graphic. For example, the label for an area graphic is typically placed at the center of the area polygon. Note that not all graphics have labels.

        The offset can specify an absolute pixel value, or a an offset relative to the size of the label. For example, an offset of (-0.5, -0.5) in fraction units will center the label on its geographic position both horizontally and vertically.

        Specified by:
        setLabelOffset in interface TacticalGraphic
        Parameters:
        labelOffset - The offset that determines how the graphic's label is placed relative to the graphic.
      • 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.
      • 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)
      • 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
      • determinePerFrameAttributes

        protected void determinePerFrameAttributes​(DrawContext dc)
        Determine geometry and attributes for this frame. This method only determines attributes the first time that it is called for each frame. Multiple calls in the same frame will have no effect.
        Parameters:
        dc - Current draw context.
      • doRenderTextModifiers

        protected void doRenderTextModifiers​(DrawContext dc)
        Render the text modifiers.
        Parameters:
        dc - Current draw context.
      • doRenderGraphicModifiers

        protected void doRenderGraphicModifiers​(DrawContext dc)
        Render the graphic modifiers. This base class does not render anything, but subclasses may override this method to draw graphic modifiers.
        Parameters:
        dc - Current draw context.
      • onModifierChanged

        protected void onModifierChanged()
        Invoked when a modifier is changed. This implementation marks the label text as invalid causing it to be recreated based on the new modifiers.
      • determineLabelPositions

        protected void determineLabelPositions​(DrawContext dc)
        Determine positions for the start and end labels.
        Parameters:
        dc - Current draw context.
      • createLabels

        protected void createLabels()
      • computeGeometry

        protected void computeGeometry​(DrawContext dc)
      • determineDelegateOwner

        protected void determineDelegateOwner()
        Determine the delegate owner for the current frame, and apply the owner to all renderable objects used to draw the graphic.
      • getActiveDelegateOwner

        protected java.lang.Object getActiveDelegateOwner()
        Indicates the object attached to the pick list to represent this graphic.
        Returns:
        Delegate owner, if specified, or this if an owner is not specified.
      • determineActiveAttributes

        protected void determineActiveAttributes()
        Determine active attributes for this frame.
      • applyLabelAttributes

        protected void applyLabelAttributes()
        Apply the active attributes to the graphic's labels.
      • computeLabelInteriorOpacity

        protected double computeLabelInteriorOpacity​(double textOpacity)
        Compute the opacity for the label interior. By default, the label interior is opacity is computed as 70% of the text opacity.
        Parameters:
        textOpacity - Opacity of the label text.
        Returns:
        Opacity of the label interior as a floating point number between 0.0 and 1.0.
      • getDefaultLabelOffset

        protected Offset getDefaultLabelOffset()
        Indicates the default offset applied to the graphic's main label. This offset may be overridden by the graphic attributes.
        Returns:
        Offset to apply to the main label.
      • getActiveOverrideAttributes

        protected TacticalGraphicAttributes getActiveOverrideAttributes()
        Get the override attributes that are active for this frame.
        Returns:
        Override attributes. Values set in this bundle override defaults specified by the symbol set.
      • getActiveShapeAttributes

        protected ShapeAttributes getActiveShapeAttributes()
        Get the active shape attributes for this frame. The active attributes are created by applying application specified overrides to the default attributes specified by the symbol set.
        Returns:
        Active shape attributes.
      • getLabelMaterial

        protected Material getLabelMaterial()
        Get the Material that should be used to draw labels. If no override material has been specified, the graphic's outline Material is used for the labels.
        Returns:
        The Material that should be used when drawing labels. May change each frame.
      • applyDefaultAttributes

        protected void applyDefaultAttributes​(ShapeAttributes attributes)
        Apply defaults to the active attributes bundle. The default attributes are determined by the type of graphic. This method is called each frame to reset the active shape attributes to the appropriate default state. Override attributes specified by the application may be applied after the defaults have been set.
        Parameters:
        attributes - Attributes bundle to receive defaults.
      • applyOverrideAttributes

        protected void applyOverrideAttributes​(TacticalGraphicAttributes graphicAttributes,
                                               ShapeAttributes shapeAttributes)
        Apply override attributes specified in a TacticalGraphicAttributes bundle to the active ShapeAttributes. Any non-null properties of graphicAttributes will be applied to shapeAttributes.
        Parameters:
        graphicAttributes - Override attributes.
        shapeAttributes - Shape attributes to receive overrides.