NASA World Wind

gov.nasa.worldwind.symbology.milstd2525.graphics.lines
Class HoldingLine

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.symbology.AbstractTacticalGraphic
          extended by gov.nasa.worldwind.symbology.milstd2525.AbstractMilStd2525TacticalGraphic
              extended by gov.nasa.worldwind.symbology.milstd2525.graphics.lines.HoldingLine
All Implemented Interfaces:
AVList, Movable, Highlightable, Renderable, MilStd2525TacticalGraphic, TacticalGraphic

public class HoldingLine
extends AbstractMilStd2525TacticalGraphic

This class implements the following graphics:

Note: These graphics require three control points. The first two points define the end points of the graphic, and the third point defines the top of an arc that connects the endpoints. The specification for Holding Line and Bridgehead (MIL-STD-2525C pgs 538 and 540) states that "Additional points can be defined to extend the line". However, the specification is unclear as to how additional control points should be interpreted. This implementation ignores additional control points.


Field Summary
protected  double curvature
          Scale factor that determines the curvature of the corners of the arc.
static double DEFAULT_CURVATURE
          Scale factor that determines the curvature of the corners of the arc.
static int DEFAULT_NUM_INTERVALS
          Default number of intervals used to draw the arc.
protected  int intervals
          Number of intervals used to draw the arc.
protected  Path path
          Path used to render the line.
protected  Position position1
          First control point, defines the start of the line.
protected  Position position2
          Second control point, defines the end of the line.
protected  Position position3
          Third control point, defines the top of the arc.
 
Fields inherited from class gov.nasa.worldwind.symbology.milstd2525.AbstractMilStd2525TacticalGraphic
maskedSymbolCode, OUTLINE_STIPPLE_FACTOR_ANTICIPATED, OUTLINE_STIPPLE_FACTOR_PRESENT, OUTLINE_STIPPLE_PATTERN, symbolCode
 
Fields inherited from class gov.nasa.worldwind.symbology.AbstractTacticalGraphic
activeOverrides, activeShapeAttributes, DEFAULT_HIGHLIGHT_MATERIAL, DEFAULT_LABEL_INTERIOR_OPACITY, delegateOwner, frameTimestamp, highlightAttributes, highlighted, labelOffset, labels, modifiers, mustCreateLabels, normalAttributes, showGraphicModifiers, showHostileIndicator, showLocation, showTextModifiers, text, unitsFormat, visible
 
Constructor Summary
HoldingLine(String sidc)
          Create a new Holding Line graphic.
 
Method Summary
protected  void applyDelegateOwner(Object owner)
          Invoked each frame to apply to the current delegate owner to all renderable objects used to draw the graphic.
protected  void computeArc(Globe globe, List<Position> positions, Position center, Angle startAzimuth, Angle endAzimuth, double radius, int intervals)
          Compute the positions required to draw an arc.
protected  void computeRoundCorner(Globe globe, List<Position> positions, Vec4 ptLeg1, Vec4 ptVertex, Vec4 ptLeg2, double distance, int intervals)
          Compute positions to draw a rounded corner between three points.
protected  void createLabels()
          Create labels for the start and end of the path.
protected  Path createPath()
          Create and configure the Path used to render this graphic.
protected  void createShape(DrawContext dc)
          Create a Path to render the line.
protected  void determineLabelPositions(DrawContext dc)
          Determine positions for the start and end labels.
protected  void doRenderGraphic(DrawContext dc)
          Render this graphic, without modifiers.
 double getCurvature()
          Indicates a factor that controls the curvatures of the arcs in this graphic.
protected  String getGraphicLabel()
           
 int getIntervals()
          Indicates the number of intervals used to draw the arc in this graphic.
 Iterable<? extends Position> getPositions()
          Indicates the positions of the control points that place and orient the graphic.
 Position getReferencePosition()
          A position associated with the object that indicates its aggregate geographic position.
static List<String> getSupportedGraphics()
          Indicates the graphics supported by this class.
protected  void onShapeChanged()
           
 void setCurvature(double curvature)
          Specifies a factor that determines the curvature of the arcs in this graphic.
 void setIntervals(int intervals)
          Specifies the number of intervals used to draw the arc in this graphic.
 void setPositions(Iterable<? extends Position> positions)
          Specifies the positions of the control points that place and orient the graphic.
 
Methods inherited from class gov.nasa.worldwind.symbology.milstd2525.AbstractMilStd2525TacticalGraphic
applyDefaultAttributes, createSymbol, getDefaultMaterial, getIdentifier, getModifier, getOutlineStippleFactor, getOutlineStipplePattern, getStatus, getText, mustShowHostileIndicator, setModifier, setStatus
 
Methods inherited from class gov.nasa.worldwind.symbology.AbstractTacticalGraphic
addLabel, applyLabelAttributes, applyOverrideAttributes, computeGeometry, computeLabelInteriorOpacity, determineActiveAttributes, determineDelegateOwner, determinePerFrameAttributes, doRenderGraphicModifiers, doRenderTextModifiers, getActiveDelegateOwner, getActiveOverrideAttributes, getActiveShapeAttributes, getAttributes, getDefaultLabelOffset, getDelegateOwner, getHighlightAttributes, getLabelMaterial, getLabelOffset, getUnitsFormat, isHighlighted, isShowGraphicModifiers, isShowHostileIndicator, isShowLocation, isShowTextModifiers, isVisible, move, moveTo, onModifierChanged, render, setAttributes, setDelegateOwner, setHighlightAttributes, setHighlighted, setLabelOffset, setShowGraphicModifiers, setShowHostileIndicator, setShowLocation, setShowTextModifiers, setText, setUnitsFormat, setVisible
 
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.nasa.worldwind.symbology.TacticalGraphic
getAttributes, getDelegateOwner, getHighlightAttributes, getLabelOffset, getUnitsFormat, isShowGraphicModifiers, isShowHostileIndicator, isShowLocation, isShowTextModifiers, isVisible, setAttributes, setDelegateOwner, setHighlightAttributes, setLabelOffset, setShowGraphicModifiers, setShowHostileIndicator, setShowLocation, setShowTextModifiers, setText, setUnitsFormat, setVisible
 
Methods inherited from interface gov.nasa.worldwind.render.Renderable
render
 
Methods inherited from interface gov.nasa.worldwind.render.Highlightable
isHighlighted, setHighlighted
 
Methods inherited from interface gov.nasa.worldwind.Movable
move, moveTo
 
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 

Field Detail

curvature

protected double curvature
Scale factor that determines the curvature of the corners of the arc. Valid values are zero to one, where zero produced square corners.


DEFAULT_CURVATURE

public static final double DEFAULT_CURVATURE
Scale factor that determines the curvature of the corners of the arc.

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

intervals

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


path

protected Path path
Path used to render the line.


position1

protected Position position1
First control point, defines the start of the line.


position2

protected Position position2
Second control point, defines the end of the line.


position3

protected Position position3
Third control point, defines the top of the arc.

Constructor Detail

HoldingLine

public HoldingLine(String sidc)
Create a new Holding Line graphic.

Parameters:
sidc - Symbol code the identifies the graphic.
Method Detail

applyDelegateOwner

protected void applyDelegateOwner(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.

computeArc

protected void computeArc(Globe globe,
                          List<Position> positions,
                          Position center,
                          Angle startAzimuth,
                          Angle endAzimuth,
                          double radius,
                          int intervals)
Compute the positions required to draw an arc.

Parameters:
globe - Current globe.
positions - Add arc positions to this list.
center - Center point of the arc.
startAzimuth - Starting azimuth.
endAzimuth - Ending azimuth.
radius - Radius of the arc, in meters.
intervals - Number of intervals to generate.

computeRoundCorner

protected void computeRoundCorner(Globe globe,
                                  List<Position> positions,
                                  Vec4 ptLeg1,
                                  Vec4 ptVertex,
                                  Vec4 ptLeg2,
                                  double distance,
                                  int intervals)
Compute positions to draw a rounded corner between three points.

Parameters:
globe - Current globe.
positions - Positions will be added to this list.
ptLeg1 - Point at the end of the one leg.
ptVertex - Point at the vertex of the corner.
ptLeg2 - Point at the end of the other let.
distance - Distance from the vertex at which the arc should begin and end.
intervals - Number of intervals to use to generate the arc.

createLabels

protected void createLabels()
Create labels for the start and end of the path.

Overrides:
createLabels in class AbstractTacticalGraphic

createPath

protected Path createPath()
Create and configure the Path used to render this graphic.

Returns:
New path configured with defaults appropriate for this type of graphic.

createShape

protected void createShape(DrawContext dc)
Create a Path to render the line.

Parameters:
dc - Current draw context.

determineLabelPositions

protected void determineLabelPositions(DrawContext dc)
Determine positions for the start and end labels.

Overrides:
determineLabelPositions in class AbstractTacticalGraphic
Parameters:
dc - Current draw context.

doRenderGraphic

protected void doRenderGraphic(DrawContext dc)
Render this graphic, without modifiers.

Specified by:
doRenderGraphic in class AbstractTacticalGraphic
Parameters:
dc - Current draw context.
See Also:
AbstractTacticalGraphic.doRenderTextModifiers(gov.nasa.worldwind.render.DrawContext), AbstractTacticalGraphic.doRenderGraphicModifiers(gov.nasa.worldwind.render.DrawContext)

getCurvature

public double getCurvature()
Indicates a factor that controls the curvatures of the arcs in this graphic.

Returns:
Factor that determines arc curvature.
See Also:
setCurvature(double)

getGraphicLabel

protected String getGraphicLabel()

getIntervals

public int getIntervals()
Indicates the number of intervals used to draw the arc in this graphic.

Returns:
Intervals used to draw arc.

getPositions

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

getSupportedGraphics

public static List<String> getSupportedGraphics()
Indicates the graphics supported by this class.

Returns:
List of masked SIDC strings that identify graphics that this class supports.

onShapeChanged

protected void onShapeChanged()

setCurvature

public void setCurvature(double curvature)
Specifies a factor that determines the curvature of the arcs in this graphic. Valid values are zero to one, where zero creates square corners and one creates extremely rounded corners.

Parameters:
curvature - Factor that determines curvature of the 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.

setPositions

public void setPositions(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.

NASA World Wind