Class SectorRangeFan

    • Field Detail

      • DEFAULT_NUM_INTERVALS

        public static final int DEFAULT_NUM_INTERVALS
        Default number of intervals used to draw each arcs.
        See Also:
        Constant Field Values
      • DEFAULT_CENTER_OF_SECTOR_LENGTH

        public static final double DEFAULT_CENTER_OF_SECTOR_LENGTH
        Default length of the Center Of Sector line, as a fraction of the final range fan radius.
        See Also:
        Constant Field Values
      • DEFAULT_ARROWHEAD_LENGTH

        public static final double DEFAULT_ARROWHEAD_LENGTH
        Default length of the arrowhead, as a fraction of the Center Of Sector line length.
        See Also:
        Constant Field Values
      • DEFAULT_ARROWHEAD_ANGLE

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

        protected static final double AZIMUTH_LABEL_OFFSET
        Azimuth labels are placed to the side of the line that they label. This value specifies a percentage that is multiplied by the maximum radius in the range fan to compute a distance for this offset.
        See Also:
        Constant Field Values
      • DEFAULT_NUMBER_FORMAT

        public static final java.text.NumberFormat DEFAULT_NUMBER_FORMAT
        Default number format used to create azimuth and radius labels.
      • arrowAngle

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

        protected double arrowLength
        Angle of the arrowhead.
      • centerOfSectorLength

        protected double centerOfSectorLength
        Length of the Center Of Sector line, as a fraction of the last range fan radius.
      • intervals

        protected int intervals
        Number of intervals used to draw each arcs.
      • azimuthFormat

        protected java.text.NumberFormat azimuthFormat
        Number format used to create azimuth labels.
      • radiusFormat

        protected java.text.NumberFormat radiusFormat
        Number format used to create radius labels.
      • position

        protected Position position
        Position of the center of the range fan.
      • paths

        protected java.util.List<Path> paths
        Rings that make up the range fan.
      • arrowHead

        protected SurfacePolygon arrowHead
        Polygon to draw a filled arrow head on the Center Of Sector line.
      • symbol

        protected TacticalSymbol symbol
        Symbol drawn at the center of the range fan.
      • radii

        protected java.lang.Iterable<java.lang.Double> radii
        Radii of the range fans, in meters.
      • azimuths

        protected java.lang.Iterable<? extends Angle> azimuths
        Azimuths of the range fans. The azimuths are specified in pairs, first the left azimuth, then the right azimuth.
      • altitudes

        protected java.lang.Iterable<java.lang.String> altitudes
        Altitudes of the range fans.
      • centerAzimuth

        protected Angle centerAzimuth
        Azimuth of the Center Of Sector arrow.
      • maxRadius

        protected double maxRadius
        Maximum radius in the range fan.
    • Constructor Detail

      • SectorRangeFan

        public SectorRangeFan​(java.lang.String sidc)
        Create the range fan.
        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.
      • 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.
      • getCenterOfSectorLength

        public double getCenterOfSectorLength()
        Indicates the length of the Center Of Sector line.
        Returns:
        The length of the Center Of Sector as a fraction of the final range fan radius.
      • setCenterOfSector

        public void setCenterOfSector​(double centerOfSectorLength)
        Specifies the length of the Center Of Sector line.
        Parameters:
        centerOfSectorLength - Length of the Center Of Sector arrow as a fraction of the final range fan radius.
      • 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.
      • getAzimuthFormat

        public java.text.NumberFormat getAzimuthFormat()
        Indicates the number format applied to azimuth values to create the azimuth labels.
        Returns:
        NumberFormat used to create azimuth labels.
      • setAzimuthFormat

        public void setAzimuthFormat​(java.text.NumberFormat azimuthFormat)
        Specifies the number format applied to azimuth values to create the azimuth labels.
        Parameters:
        azimuthFormat - NumberFormat to create azimuth labels.
      • getRadiusFormat

        public java.text.NumberFormat getRadiusFormat()
        Indicates the number format applied to radius values to create the radius labels.
        Returns:
        NumberFormat used to create radius labels.
      • setRadiusFormat

        public void setRadiusFormat​(java.text.NumberFormat radiusFormat)
        Specifies the number format applied to radius values to create the radius labels.
        Parameters:
        radiusFormat - NumberFormat to create radius labels.
      • getPosition

        public Position getPosition()
        Indicates the center position of the range ran.
        Returns:
        The range fan center position.
      • setPosition

        public void setPosition​(Position position)
        Specifies the center position of the range ran.
        Parameters:
        position - The new center position.
      • setPositions

        public void setPositions​(java.lang.Iterable<? extends Position> positions)
        Specifies the positions of the control points that place and orient the graphic.
        Specified by:
        setPositions in interface TacticalGraphic
        Parameters:
        positions - Control points. This graphic uses only one control point, which determines the center of the circle.
      • 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
        Overrides:
        setModifier in class AbstractMilStd2525TacticalGraphic
        Parameters:
        modifier - Key that identifies the modifier to set. The possible modifiers depends on the symbol set.
        value - New value for the modifier.
      • 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
        Overrides:
        getModifier in class AbstractMilStd2525TacticalGraphic
        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.
      • getRadii

        public java.lang.Iterable<java.lang.Double> getRadii()
        Indicates the radii of the rings that make up the range fan.
        Returns:
        List of radii, in meters. This method never returns null. If there are no rings this returns an empty list.
      • setRadii

        public void setRadii​(java.lang.Iterable<java.lang.Double> radii)
        Specifies the radii of the rings that make up the range fan.
        Parameters:
        radii - List of radii, in meters. A circle will be created for each radius.
      • getAzimuths

        public java.lang.Iterable<? extends Angle> getAzimuths()
        Indicates the left and right azimuths of the fans in this graphic. The list contains pairs of azimuths, first left and then right.
        Returns:
        Left and right azimuths, measured clockwise from North. This method never returns null. If there are no azimuths, returns an empty list.
      • setAzimuths

        public void setAzimuths​(java.lang.Iterable<? extends Angle> azimuths)
        Specifies the left and right azimuths of the range fans in this graphic. The provided iterable must specify pairs of azimuths: first left azimuth, first right azimuth, second left, second right, etc.
        Parameters:
        azimuths - Left and right azimuths, measured clockwise from North.
      • getAltitudes

        public java.lang.Iterable<java.lang.String> getAltitudes()
        Indicates the altitudes of the rings that make up the range fan. Note that the range fan is always drawn on the surface. The altitude strings are displayed as text.
        Returns:
        List of altitude strings. This method never returns null. If there are no altitudes, returns an empty list.
      • setAltitudes

        public void setAltitudes​(java.lang.Iterable<java.lang.String> altitudes)
        Specifies the altitudes of the rings that make up the range fan. Note that the range fan is always drawn on the surface. The altitude strings are displayed as text.
        Parameters:
        altitudes - List of altitude strings.
      • getSymbol

        public java.lang.String getSymbol()
        Indicates a symbol drawn at the center of the range fan.
        Returns:
        The identifier of a symbol drawn at the center of the range fan. May be null.
      • setSymbol

        public void setSymbol​(java.lang.String sidc)
        Specifies a symbol to draw at the center of the range fan. Equivalent to setting the SymbologyConstants.SYMBOL_INDICATOR modifier. The symbol's position will be changed to match the range fan center position.
        Parameters:
        sidc - The identifier of a MIL-STD-2525C tactical symbol to draw at the center of the range fan. May be null to indicate that no symbol is drawn.
      • getPositions

        public java.lang.Iterable<? extends Position> getPositions()
        Indicates the positions of the control points that place and orient the graphic.
        Specified by:
        getPositions in interface TacticalGraphic
        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.
        Specified by:
        getReferencePosition in interface Movable
        Returns:
        the object's reference position, or null if no reference position is available.
      • 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. Overridden to render symbol at the center of the range fan.
        Overrides:
        doRenderGraphicModifiers in class AbstractTacticalGraphic
        Parameters:
        dc - Current draw context.
      • 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.
      • reset

        protected void reset()
        Regenerate the graphics positions on the next frame.
      • createShapes

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

        protected void createCenterOfSectorArrow​(DrawContext dc,
                                                 Angle centerAzimuth,
                                                 double finalRadius)
        Create shapes to draw the Center Of Sector arrow. This arrow bisects the final range fan.
        Parameters:
        dc - Current draw context.
        centerAzimuth - Azimuth of the Center Of Sector arrow.
        finalRadius - Radius, in meters, of the final range fan.
      • computeCenterSectorAngle

        protected Angle computeCenterSectorAngle​(Angle finalLeftAzimuth,
                                                 Angle finalRightAzimuth)
        Compute the angle of the Center Of Sector line. The center sector angle is computed as the average of the left and right azimuths of the last range fan in the graphic. MIL-STD-2525C does not specify how this angle should be computed, but the graphic template (pg. 693) suggests that the Center Of Sector line should bisect the last range fan arc.
        Parameters:
        finalLeftAzimuth - Left azimuth of the last range fan in the graphic.
        finalRightAzimuth - Right azimuth of the last range fan in the graphic.
        Returns:
        Azimuth, from North, of the Center Of Sector line.
      • createArc

        protected void createArc​(DrawContext dc,
                                 double radius,
                                 Angle leftAzimuth,
                                 Angle rightAzimuth,
                                 java.util.List<Position> positions)
        Create positions to draw an arc around the graphic's center position. The arc is described by a radius, left azimuth, and right azimuth. The arc positions are added onto an existing list of positions, in left to right order (the arc draws from the left azimuth to the right azimuth).

        If the left and right azimuths are equal, then this methods adds a single position to the list at the desired azimuth and radius.

        Parameters:
        dc - Current draw context.
        radius - Radius of the circular segment, in meters.
        leftAzimuth - Azimuth (from North) of the left side of the arc.
        rightAzimuth - Azimuth (from North) of teh right side of the arc.
        positions - List to collect positions for the arc.
      • computeArrowheadPositions

        protected java.util.List<Position> computeArrowheadPositions​(DrawContext dc,
                                                                     Position base,
                                                                     Position tip,
                                                                     double arrowLength,
                                                                     Angle arrowAngle)
        Compute the positions of the arrow head for the sector center line.
        Parameters:
        dc - Current draw context
        base - Position of the arrow's starting point.
        tip - Position of the arrow head tip.
        arrowLength - Length of the arrowhead as a fraction of the total line length.
        arrowAngle - Angle of the arrow head.
        Returns:
        Positions required to draw the arrow head.
      • createAzimuthLabels

        protected void createAzimuthLabels()
        Create azimuth labels.
      • createRangeLabelString

        protected java.lang.String createRangeLabelString​(double radius,
                                                          java.lang.String altitude)
        Create text for a range label.
        Parameters:
        radius - Range of the ring, in meters.
        altitude - Altitude string.
        Returns:
        Range label text for this ring.
      • createAzimuthLabelString

        protected java.lang.String createAzimuthLabelString​(Angle azimuth)
        Create text for an azimuth label.
        Parameters:
        azimuth - Azimuth, measured clockwise from North.
        Returns:
        Azimuth label text.
      • computeAzimuthLabelOffset

        protected double computeAzimuthLabelOffset​(double radius,
                                                   double maxRadius)
        Compute an angular offset to apply to a azimuth label. This angle will be added to the azimuth of the label's azimuth in order to place the label a little bit to the side of the line that it applies to.
        Parameters:
        radius - Radius at which the label will be placed.
        maxRadius - Maximum radius in the range fan.
        Returns:
        Angle, in radians, to add to the range fan azimuth in order to determine the label position.
      • determineRangeLabelPosition

        protected Position determineRangeLabelPosition​(Position center,
                                                       Angle centerAzimuth,
                                                       Angle leftAzimuth,
                                                       Angle rightAzimuth,
                                                       double radiusRadians)
        Determine the position of a range label for a ring in the range fan. The method finds a point to either the left or right of the center line, depending on which has more space for the label.
        Parameters:
        center - Center of the range fan.
        centerAzimuth - Azimuth of the Center Of Sector arrow.
        leftAzimuth - Left azimuth of this ring.
        rightAzimuth - Right azimuth of this ring.
        radiusRadians - Radius, in radians, at which to place the label.
        Returns:
        Position for the range label on this ring.
      • normalizeAzimuth

        protected Angle normalizeAzimuth​(Angle azimuth)
        Normalize an azimuth angle to the range [-180:180] degrees.
        Parameters:
        azimuth - Azimuth to normalize.
        Returns:
        Normalized azimuth. Returns null if azimuth is null.
      • 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. Overridden to turn on shape interiors.
        Overrides:
        applyDefaultAttributes in class AbstractMilStd2525TacticalGraphic
        Parameters:
        attributes - Attributes bundle to receive defaults.
      • 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.
      • createPolygon

        protected SurfacePolygon createPolygon()
        Create and configure a SurfacePolygon to render the arrow head on the sector center line.
        Returns:
        New surface polygon.