Class Ambush
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.symbology.AbstractTacticalGraphic
-
- gov.nasa.worldwind.symbology.milstd2525.AbstractMilStd2525TacticalGraphic
-
- gov.nasa.worldwind.symbology.milstd2525.graphics.areas.Ambush
-
- All Implemented Interfaces:
AVList
,Draggable
,Movable
,Highlightable
,Renderable
,MilStd2525TacticalGraphic
,TacticalGraphic
public class Ambush extends AbstractMilStd2525TacticalGraphic
Implementation of the Ambush graphic (2.X.2.6.1.1).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
Ambush.ArcData
Data required for intermediate calculations while generating the Ambush graphic.
-
Field Summary
Fields Modifier and Type Field Description protected Angle
arcAngle
The arc is drawn as a segment of a circle intersected by this angle.protected Angle
arrowAngle
Length of the arrowhead from base to tip, as a fraction of the total line length.protected double
arrowLength
Angle of the arrowhead.static Angle
DEFAULT_ARC_ANGLE
Default angle of the arc.static Angle
DEFAULT_ARROWHEAD_ANGLE
Default angle of the arrowhead.static double
DEFAULT_ARROWHEAD_LENGTH
Default length of the arrowhead, as a fraction of the total line length.static 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.static int
DEFAULT_NUM_INTERVALS
Default number of intervals used to draw the arc.static int
DEFAULT_NUM_LEGS
Default number of legs to draw on the graphic's arc.protected int
intervals
Number of intervals used to draw the arc.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.protected int
numLegs
Number of "legs" drawn on this graphic's arc.protected Path[]
paths
Path used to render the graphic.protected Position
position1
First control point.protected Position
position2
Second control point.protected Position
position3
Third control point.-
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, dragEnabled, draggableSupport, frameTimestamp, highlightAttributes, highlighted, labelOffset, labels, modifiers, mustCreateLabels, normalAttributes, showGraphicModifiers, showHostileIndicator, showLocation, showTextModifiers, text, unitsFormat, visible
-
-
Constructor Summary
Constructors Constructor Description Ambush(java.lang.String sidc)
Create a new graphic.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.protected Ambush.ArcData
computeArc(DrawContext dc)
Compute the arc.protected java.util.List<Position>
computeArcPositions(DrawContext dc, Ambush.ArcData arcData)
Compute positions required to draw the arc.protected java.util.List<Position>
computeArrowheadPositions(DrawContext dc, Position tip, Ambush.ArcData arcData)
Determine the positions that make up the arrowhead.protected void
createLegs(DrawContext dc, Ambush.ArcData arcData, Path[] paths, int startIndex, int pathCount)
Create paths for the graphic's "legs".protected Path
createPath(java.util.List<Position> positions)
Create and configure the Path used to render this graphic.protected void
createShapes(DrawContext dc)
Create the paths required to draw the graphic.protected void
doRenderGraphic(DrawContext dc)
Render this graphic, without modifiers.Angle
getArcAngle()
Indicates the angle of this graphic's arc.Angle
getArrowAngle()
Indicates the angle of the arrowhead.double
getArrowLength()
Indicates the length of the arrowhead.int
getIntervals()
Indicates the number of intervals used to draw the arc in this graphic.double
getLegLength()
Indicates the length of legs on the graphic's base.int
getLegs()
Indicates how many "legs" stick out of the back side of this graphic's arc.java.lang.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 java.util.List<java.lang.String>
getSupportedGraphics()
Indicates the graphics supported by this class.protected void
onShapeChanged()
void
setArcAngle(Angle arcAngle)
Specifies the angle of this graphic's arc.void
setArrowAngle(Angle arrowAngle)
Specifies the angle of the arrowhead in the graphic.void
setArrowLength(double arrowLength)
Specifies the length of the arrowhead.void
setIntervals(int intervals)
Specifies the number of intervals used to draw the arc in this graphic.void
setLegLength(double legLength)
Specifies the length of the legs on the graphic's base.void
setLegs(int numLegs)
Specifies how many "legs" stick out of the back side of this graphic's arc.void
setPositions(java.lang.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, createLabels, determineActiveAttributes, determineDelegateOwner, determineLabelPositions, determinePerFrameAttributes, doDrag, doRenderGraphicModifiers, doRenderTextModifiers, drag, getActiveDelegateOwner, getActiveOverrideAttributes, getActiveShapeAttributes, getAttributes, getDefaultLabelOffset, getDelegateOwner, getHighlightAttributes, getLabelMaterial, getLabelOffset, getUnitsFormat, isDragEnabled, isHighlighted, isShowGraphicModifiers, isShowHostileIndicator, isShowLocation, isShowTextModifiers, isVisible, move, moveTo, onModifierChanged, render, setAttributes, setDelegateOwner, setDragEnabled, 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, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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
-
Methods inherited from interface gov.nasa.worldwind.render.Highlightable
isHighlighted, setHighlighted
-
Methods inherited from interface gov.nasa.worldwind.render.Renderable
render
-
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
-
-
-
-
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.
-
-
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.
-
doRenderGraphic
protected void doRenderGraphic(DrawContext dc)
Render this graphic, without modifiers.- Specified by:
doRenderGraphic
in classAbstractTacticalGraphic
- Parameters:
dc
- Current draw context.- See Also:
AbstractTacticalGraphic.doRenderTextModifiers(gov.nasa.worldwind.render.DrawContext)
,AbstractTacticalGraphic.doRenderGraphicModifiers(gov.nasa.worldwind.render.DrawContext)
-
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 classAbstractTacticalGraphic
- 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 intopaths
at which to place the first leg path.pathCount
- Number of leg paths to create. Thepaths
array must have length of at leaststartIndex + 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.
-
-