Interface TacticalGraphic

  • All Superinterfaces:
    AVList, Highlightable, Movable, Renderable
    All Known Subinterfaces:
    MilStd2525TacticalGraphic, TacticalCircle, TacticalPoint, TacticalQuad, TacticalRoute
    All Known Implementing Classes:
    AbstractAxisArrow, AbstractCircularGraphic, AbstractMilStd2525TacticalGraphic, AbstractRectangularGraphic, AbstractTacticalGraphic, AdvanceForFeint, Airborne, AirfieldZone, Airhead, Ambush, AttackByFirePosition, AttackRotaryWing, Aviation, AviationZone, BasicArea, BattlePosition, Boundary, CircularFireSupportArea, CircularPositionArea, CircularRangeFan, CombatSupportArea, DirectionOfAttack, DirectionOfAttackAviation, DirectionOfAttackForFeint, DoseRateContourLine, Dummy, Encirclement, FilledArea, FireSupportLine, FortifiedArea, ForwardEdgeOfBattleArea, ForwardLineOfOwnTroops, GroupOfTargets, HoldingLine, InfiltrationLane, IrregularFireSupportArea, LimitedAccessArea, LinearTarget, LineOfContact, MainAttack, MilStd2525PointGraphic, MinimumSafeDistanceZones, MunitionFlightPath, OffenseArea, PhaseLine, PrincipleDirectionOfFire, PullUpPoint, RectangularFireSupportArea, RectangularPositionArea, RectangularTarget, Route, RoutePoint, SearchArea, SectorRangeFan, Smoke, SpecialInterestArea, SupportByFirePosition, SupportingAttack, WeaponsFreeZone

    public interface TacticalGraphic
    extends Renderable, Highlightable, Movable, AVList
    TacticalGraphic provides a common interface for displaying a graphic from a symbology set. A graphic can be an icon that is drawn a geographic position, a vector graphic that is positioned using one or more control points, or a line or polygon that is styled according to the symbol set's specification. See the TacticalGraphic Tutorial for instructions on using TacticalGraphic in an application.

    See the Symbology and TacticalGraphics example applications for examples of how to use tactical graphics.

    Construction

    TacticalGraphics are typically created by an instance of TacticalGraphicFactory. Each graphic within a symbol set is identified by a string identifier. The format of this identifier depends on the symbol set. For example, a MIL-STD-2525 Symbol Identification Code (SIDC) is a string of 15 characters.

    You will need to instantiate the appropriate factory for the symbol set that you intend to use. For example, MilStd2525GraphicFactory creates graphics for the MIL-STD-2525 symbology set.

    The TacticalGraphic interface provides access to settings common to all tactical graphics. TacticalGraphic extends the Renderable interface, so you can add a TacticalGraphic directly to a RenderableLayer. Here's an example of creating a graphic from the MIL-STD-2525 symbol set:

     // Create a graphic factory for MIL-STD-2525
     TacticalGraphicFactory factory = new MilStd2525GraphicFactory();
    
     // Specify the control points for the line
     List<Position> positions = Arrays.asList(
         Position.fromDegrees(34.7327, -117.8347, 0),
         Position.fromDegrees(34.7328, -117.7305, 0));
    
     // Specify a text modifier
     AVList modifiers = new AVListImpl();
     modifiers.setValue(SymbologyConstants.UNIQUE_DESIGNATION, "Alpha");
    
     // Create a graphic for a MIL-STD-2525 hostile phase line. The first argument is the symbol identification code
     // (SIDC) that identifies the type of graphic to create.
     TacticalGraphic graphic = factory.createGraphic("GHGPGLP----AUSX", positions, modifiers);
    
     // Create a renderable layer to display the tactical graphic. This example adds only a single graphic, but many
     // graphics can be added to a single layer.
     RenderableLayer graphicLayer = new RenderableLayer();
     graphicLayer.addRenderable(graphic);
    
     // Add the layer to the WorldWindow's model and request that the layer redraw itself. The WorldWindow draws the
     // graphic on the globe at the specified position. Interactions between the graphic 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 WorldWind instance.
     wwd.getModel().getLayers().add(graphicLayer);
     wwd.redraw();
     

    The symbol identifier (GHGPGLP----AUSX) tells the factory what type of graphic to create, and how the graphic should be styled. In the example above we added a text modifier of "Alpha" to identify our shape. These parameters can be specified using a parameter list when the TacticalGraphic is created, as shown above. They can also be set after creation using setters in the TacticalGraphic interface.

    Modifiers

    Many graphics support text or graphic modifiers. Each modifier is identified by a String key. The set of possible modifiers is determined by the symbol set. Modifiers can be specified in the parameter list when a graphic is created, or using setModifier after the graphic has been created.

    For example, a MIL-STD-2525 General Area graphic can have a text modifier that identifies the area. Here's an example of how to specify the modifier when the graphic is created:

     AVList modifiers = new AVListImpl();
     modifiers.setValue(SymbologyConstants.UNIQUE_DESIGNATION, "Boston"); // Text that identifies the area enclosed by
                                                                          //  the  graphic.
    
     List<Position> positions = ...; // List of positions that define the boundary of the area.
     TacticalGraphic graphic = milstd2525Factory.createGraphic("GHGPGAG----AUSX", positions, modifiers);
     

    The modifier can also be set (or changed) after the graphic is created:

     // Create the graphic
     TacticalGraphic graphic = milstd2525Factory.createGraphic("GHGPGAG----AUSX", positions, null);
     graphic.setModifier(SymbologyConstants.UNIQUE_DESIGNATION, "Boston");
     

    Position

    Each tactical graphic is positioned by one or more control points. How many points are required depends on the type of graphic. A point graphic will only require one point. A more complex shape may require three or four, and a line or area may allow any number.

    Here is an example of how to create a point graphic in the MIL-STD-2525 symbol set:

     Position position = Position.fromDegrees(34.9362, -118.2559, 0);
     TacticalGraphic graphic = milstd2525Factory.createPoint("GFGPAPD----AUSX", position, null);
     

    More complicated graphics will require more control points. MIL-STD-2525 defines a template for each type of tactical graphic. Each template identifies how many control points are required for the graphic, and how the points are interpreted. The TacticalGraphic requires a list of Position objects, which identify the control points in the same order as in the specification. For example, in order to create a graphic that requires three control points we need to create a list of positions that specifies the three points in order:

     List<Position> positions = Arrays.asList(
         Position.fromDegrees(34.5073, -117.8380, 0), // PT. 1
         Position.fromDegrees(34.8686, -117.5088, 0), // PT. 2
         Position.fromDegrees(34.4845, -117.8495, 0)); // PT. 3
    
     TacticalGraphic graphic = milstd2525Factory.createGraphic("GFGPSLA----AUSX", positions, null);
     

    Sub-interfaces of TacticalGraphic

    TacticalGraphic describes any tactical graphic in the most general terms: a list of positions and modifiers. However, this general interface is not convenient for all graphics. For example, when creating a circle graphic it is more convenient to access the radius of the circle directly than to set a modifier that affects the radius. Sub-interfaces of tactical graphic provide more convenient methods for manipulating common types of graphics. Instances of these sub-interfaces can be created directly using a TacticalGraphicFactory. The sub-interfaces are:

    • TacticalPoint- Graphics positioned by a single point.
    • TacticalCircle - Graphics positioned by a center point and radius.
    • TacticalQuad - Rectangles with a length and width.
    • TacticalRoute - A series of point graphics connected by lines and treated as a single graphic.
    See Also:
    TacticalGraphicFactory
    • Method Detail

      • isVisible

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

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

        java.lang.Object getModifier​(java.lang.String modifier)
        Indicates the current value of a text or graphic modifier.
        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

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

        boolean isShowGraphicModifiers()
        Indicates whether this graphic draws its supplemental graphic modifiers.
        Returns:
        true if this graphic draws its graphic modifiers, otherwise false.
      • setShowGraphicModifiers

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

        boolean isShowTextModifiers()
        Indicates whether this graphic draws its supplemental text modifiers.
        Returns:
        true if this graphic draws its text modifiers, otherwise false.
      • setShowTextModifiers

        void setShowTextModifiers​(boolean showTextModifiers)
        Specifies whether to draw this graphic's supplemental text modifiers.
        Parameters:
        showTextModifiers - true if this graphic should draw its text modifiers, otherwise false.
      • isShowLocation

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

        void setShowLocation​(boolean show)
        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.
        Parameters:
        show - true if the graphic will display the location modifier. Note that not all graphics support this modifier.
      • isShowHostileIndicator

        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.
        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

        void setShowHostileIndicator​(boolean show)
        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.
        Parameters:
        show - 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.
      • getIdentifier

        java.lang.String getIdentifier()
        Indicates a string identifier for this graphic. The format of the identifier depends on the symbol set to which the graphic belongs.
        Returns:
        An identifier for this graphic.
      • setText

        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).
        Parameters:
        text - New text modifier. May be null.
        See Also:
        setModifier(String, Object)
      • getText

        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).
        Returns:
        Descriptive text for this graphic.
        See Also:
        getModifier(String)
      • getPositions

        java.lang.Iterable<? extends Position> getPositions()
        Indicates the positions of the control points that place and orient the graphic.
        Returns:
        positions that orient the graphic. How many positions are returned depends on the type of graphic. Some graphics require only a single position, others require many.
      • setPositions

        void setPositions​(java.lang.Iterable<? extends Position> positions)
        Specifies the positions of the control points that place and orient the graphic.
        Parameters:
        positions - Positions that orient the graphic. How many positions are returned depends on the type of graphic. Some graphics require only a single position, others require many. The positions must be specified in the same order as the control points defined by the symbology set's template for this type of graphic.
      • getAttributes

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

        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.
        Parameters:
        attributes - new attributes. May be null, in which case default attributes are used.
      • getHighlightAttributes

        TacticalGraphicAttributes getHighlightAttributes()
        Indicate this graphic's attributes when it is in the highlighted state.
        Returns:
        this graphic's highlight attributes. May be null.
      • setHighlightAttributes

        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.
        Parameters:
        attributes - Attributes to apply to the graphic when it is highlighted. May be null, in which default attributes are used.
      • getLabelOffset

        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.
        Returns:
        The offset that determines how the graphic's label is placed relative to the graphic.
      • setLabelOffset

        void setLabelOffset​(Offset offset)
        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.

        Parameters:
        offset - The offset that determines how the graphic's label is placed relative to the graphic.
      • getDelegateOwner

        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.
        Returns:
        the object used as the pickable object returned during picking, or null to indicate the the graphic is returned during picking.
      • setDelegateOwner

        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.
        Parameters:
        owner - the object to use as the pickable object returned during picking, or null to return the graphic.
      • getUnitsFormat

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

        void setUnitsFormat​(UnitsFormat unitsFormat)
        Specifies the unit format used to format values in text modifiers.
        Parameters:
        unitsFormat - Format used to format text modifiers.