Class Ambush

    • Field Detail

      • DEFAULT_ARROWHEAD_LENGTH

        public static final double DEFAULT_ARROWHEAD_LENGTH
        Default length of the arrowhead, as a fraction of the total line length.
        See Also:
        Constant Field Values
      • DEFAULT_ARC_ANGLE

        public static final Angle DEFAULT_ARC_ANGLE
        Default angle of the arc. Control points 2 and 3 define a chord of a circle. This chord and the arc angle fully define the circle, of which the arc is a segment.
      • DEFAULT_ARROWHEAD_ANGLE

        public static final Angle DEFAULT_ARROWHEAD_ANGLE
        Default angle of the arrowhead.
      • DEFAULT_LEG_LENGTH

        public static final double DEFAULT_LEG_LENGTH
        Default length of the legs of the graphic's base, as a fraction of the distance between the control points the define the base.
        See Also:
        Constant Field Values
      • DEFAULT_NUM_INTERVALS

        public static final int DEFAULT_NUM_INTERVALS
        Default number of intervals used to draw the arc.
        See Also:
        Constant Field Values
      • DEFAULT_NUM_LEGS

        public static final int DEFAULT_NUM_LEGS
        Default number of legs to draw on the graphic's arc.
        See Also:
        Constant Field Values
      • intervals

        protected int intervals
        Number of intervals used to draw the arc.
      • arcAngle

        protected Angle arcAngle
        The arc is drawn as a segment of a circle intersected by this angle.
      • arrowAngle

        protected Angle arrowAngle
        Length of the arrowhead from base to tip, as a fraction of the total line length.
      • arrowLength

        protected double arrowLength
        Angle of the arrowhead.
      • numLegs

        protected int numLegs
        Number of "legs" drawn on this graphic's arc.
      • legLength

        protected double legLength
        Length of the legs on the graphic's base, as a fraction of the distance between the control points that define the base.
      • position1

        protected Position position1
        First control point.
      • position2

        protected Position position2
        Second control point.
      • position3

        protected Position position3
        Third control point.
      • paths

        protected Path[] paths
        Path used to render the graphic.
    • Constructor Detail

      • Ambush

        public Ambush​(java.lang.String sidc)
        Create a new graphic.
        Parameters:
        sidc - Symbol code the identifies the graphic.
    • Method Detail

      • getSupportedGraphics

        public static java.util.List<java.lang.String> getSupportedGraphics()
        Indicates the graphics supported by this class.
        Returns:
        List of masked SIDC strings that identify graphics that this class supports.
      • getIntervals

        public int getIntervals()
        Indicates the number of intervals used to draw the arc in this graphic.
        Returns:
        Intervals used to draw arc.
      • setIntervals

        public void setIntervals​(int intervals)
        Specifies the number of intervals used to draw the arc in this graphic. More intervals will result in a smoother looking arc.
        Parameters:
        intervals - Number of intervals for drawing the arc.
      • getArcAngle

        public Angle getArcAngle()
        Indicates the angle of this graphic's arc. The arc is drawn as a segment of a circle defined by this angle and the chord formed by control points 2 and 3.
        Returns:
        Angle of the circular segment that forms this graphic's arc.
      • setArcAngle

        public void setArcAngle​(Angle arcAngle)
        Specifies the angle of this graphic's arc. The arc is drawn as a segment of a circle defined by this angle and the chord formed by control points 2 and 3. A greater angle makes the arc more curved and a smaller angle makes the arc less curved.
        Parameters:
        arcAngle - Angle of the circular segment that forms this graphic's arc.
      • getArrowAngle

        public Angle getArrowAngle()
        Indicates the angle of the arrowhead.
        Returns:
        Angle of the arrowhead in the graphic.
      • setArrowAngle

        public void setArrowAngle​(Angle arrowAngle)
        Specifies the angle of the arrowhead in the graphic.
        Parameters:
        arrowAngle - The angle of the arrowhead. Must be greater than zero degrees and less than 90 degrees.
      • getArrowLength

        public double getArrowLength()
        Indicates the length of the arrowhead.
        Returns:
        The length of the arrowhead as a fraction of the total line length.
      • setArrowLength

        public void setArrowLength​(double arrowLength)
        Specifies the length of the arrowhead.
        Parameters:
        arrowLength - Length of the arrowhead as a fraction of the total line length. If the arrowhead length is 0.25, then the arrowhead length will be one quarter of the total line length.
      • getLegs

        public int getLegs()
        Indicates how many "legs" stick out of the back side of this graphic's arc.
        Returns:
        Number of legs drawn on the arc of this graphic.
      • setLegs

        public void setLegs​(int numLegs)
        Specifies how many "legs" stick out of the back side of this graphic's arc.
        Parameters:
        numLegs - Number of legs to draw on the arc of this graphic.
      • getLegLength

        public double getLegLength()
        Indicates the length of legs on the graphic's base.
        Returns:
        The length of the legs on the base, as a fraction of the distance between the control points that define the base.
      • setLegLength

        public void setLegLength​(double legLength)
        Specifies the length of the legs on the graphic's base.
        Parameters:
        legLength - Length of the legs on the graphic's base, as a fraction of the distance between the control points that define the base.
      • setPositions

        public void setPositions​(java.lang.Iterable<? extends Position> positions)
        Specifies the positions of the control points that place and orient the graphic.
        Parameters:
        positions - Control points that orient the graphic. Must provide at least three points.
      • getPositions

        public 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.
      • 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.
        Returns:
        the object's reference position, or null if no reference position is available.
      • applyDelegateOwner

        protected 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.
        Specified by:
        applyDelegateOwner in class AbstractTacticalGraphic
        Parameters:
        owner - Current delegate owner.
      • onShapeChanged

        protected void onShapeChanged()
      • createShapes

        protected void createShapes​(DrawContext dc)
        Create the paths required to draw the graphic.
        Parameters:
        dc - Current draw context.
      • computeArc

        protected Ambush.ArcData computeArc​(DrawContext dc)
        Compute the arc. The arc is a segment of a circle defined by a chord and the arc angle. Control points 2 and 3 define the chord.
        Parameters:
        dc - Current draw context.
        Returns:
        Data that describes the arc.
      • computeArcPositions

        protected java.util.List<Position> computeArcPositions​(DrawContext dc,
                                                               Ambush.ArcData arcData)
        Compute positions required to draw the arc.
        Parameters:
        dc - Current draw context.
        arcData - Data that describes the arc.
        Returns:
        Positions along the arc.
      • createLegs

        protected void createLegs​(DrawContext dc,
                                  Ambush.ArcData arcData,
                                  Path[] paths,
                                  int startIndex,
                                  int pathCount)
        Create paths for the graphic's "legs". The legs stick out of the back side of the arc.
        Parameters:
        dc - Current draw context.
        arcData - Data that describes the graphic's arc.
        paths - Array to receive the new paths.
        startIndex - Index into paths at which to place the first leg path.
        pathCount - Number of leg paths to create. The paths array must have length of at least startIndex + pathCount.
      • computeArrowheadPositions

        protected java.util.List<Position> computeArrowheadPositions​(DrawContext dc,
                                                                     Position tip,
                                                                     Ambush.ArcData arcData)
        Determine the positions that make up the arrowhead.
        Parameters:
        dc - Current draw context.
        tip - Position of the arrow head tip.
        arcData - Data that describes the arc of this graphic.
        Returns:
        Positions that define the arrowhead.
      • createPath

        protected Path createPath​(java.util.List<Position> positions)
        Create and configure the Path used to render this graphic.
        Parameters:
        positions - Positions that define the path.
        Returns:
        New path configured with defaults appropriate for this type of graphic.