Class TriangleWavePositionIterator
- java.lang.Object
-
- gov.nasa.worldwind.symbology.milstd2525.graphics.TriangleWavePositionIterator
-
- All Implemented Interfaces:
java.util.Iterator
public class TriangleWavePositionIterator extends java.lang.Object implements java.util.IteratorIterator that computes the positions required to draw a triangle wave along a line specified by control positions. The generated wave looks like this:/\ /\ <--- Amplitude / \ / \ ________/ \_________/ \_____ ^ ^ | Wave length|
-
-
Field Summary
Fields Modifier and Type Field Description protected doubleamplitudeAmplitude of the wave, in meters.protected PositionfirstPositionFirst position along the line.protected GlobeglobeGlobe used to compute geographic positions.protected AnglehalfWaveLengthWavelength, as a geographic angle.protected PositionnextControlPositionPosition of the next control point.protected java.util.Iterator<? extends Position>positionsControl positions.protected intstateCurrent state of the state machine.protected static intSTATE_FIRSTInitial state.protected static intSTATE_LINEDrawing connecting line between waves.protected static intSTATE_TOOTH_PEAKAt peak of wave.protected static intSTATE_WAVE_STARTAbout to draw wave.protected PositionthisPositionCurrent position.protected doublethisStepDistance (in meters) to the next wave start or end.protected PositionwaveEndPositionEnd position for the current wave.
-
Constructor Summary
Constructors Constructor Description TriangleWavePositionIterator(java.lang.Iterable<? extends Position> positions, double waveLength, double amplitude, Globe globe)Create a new iterator to compute the positions of a triangle wave.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected PositioncomputeNext()Compute the next position along the line, and transition the state machine to the next state (if appropriate).booleanhasNext()Positionnext()voidremove()Not supported.
-
-
-
Field Detail
-
STATE_FIRST
protected static final int STATE_FIRST
Initial state.- See Also:
- Constant Field Values
-
STATE_LINE
protected static final int STATE_LINE
Drawing connecting line between waves.- See Also:
- Constant Field Values
-
STATE_WAVE_START
protected static final int STATE_WAVE_START
About to draw wave.- See Also:
- Constant Field Values
-
STATE_TOOTH_PEAK
protected static final int STATE_TOOTH_PEAK
At peak of wave.- See Also:
- Constant Field Values
-
state
protected int state
Current state of the state machine.
-
positions
protected java.util.Iterator<? extends Position> positions
Control positions.
-
globe
protected Globe globe
Globe used to compute geographic positions.
-
amplitude
protected double amplitude
Amplitude of the wave, in meters.
-
halfWaveLength
protected Angle halfWaveLength
Wavelength, as a geographic angle.
-
thisPosition
protected Position thisPosition
Current position.
-
nextControlPosition
protected Position nextControlPosition
Position of the next control point.
-
firstPosition
protected Position firstPosition
First position along the line.
-
waveEndPosition
protected Position waveEndPosition
End position for the current wave.
-
thisStep
protected double thisStep
Distance (in meters) to the next wave start or end.
-
-
Constructor Detail
-
TriangleWavePositionIterator
public TriangleWavePositionIterator(java.lang.Iterable<? extends Position> positions, double waveLength, double amplitude, Globe globe)
Create a new iterator to compute the positions of a triangle wave.- Parameters:
positions- Control positions for the triangle wave line.waveLength- Distance (in meters) between waves.amplitude- Amplitude (in meters) of the wave. This is the distance from the base line to the tip of each triangular wave.globe- Globe used to compute geographic positions.
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfacejava.util.Iterator
-
next
public Position next()
- Specified by:
nextin interfacejava.util.Iterator
-
computeNext
protected Position computeNext()
Compute the next position along the line, and transition the state machine to the next state (if appropriate).If the current state is STATE_LINE, this method returns either the next control point (if it is less than waveLength meters from the current position, or a position waveLength meters along the control line. The state machine will transition to STATE_WAVE_START only if the returned position is a full wavelength from the current position.
If the current state is STATE_WAVE_START, this method returns a position waveLength meters from the current position along the control line, and transitions to state STATE_WAVE_PEAK.
- Returns:
- next position along the line.
-
remove
public void remove()
Not supported.- Specified by:
removein interfacejava.util.Iterator
-
-