uavsim.graphics.instruments.verticalspeedindicator
Class VerticalSpeedIndicator

java.lang.Object
  extended by uavsim.graphics.instruments.A_Instrument
      extended by uavsim.graphics.instruments.A_CircularInstrument<Altitude>
          extended by uavsim.graphics.instruments.verticalspeedindicator.VerticalSpeedIndicator
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener, javax.swing.event.MouseInputListener, I_AngleMapper<Altitude>

public class VerticalSpeedIndicator
extends A_CircularInstrument<Altitude>

Defines a vertical speed indicator.

Author:
Dan Tappan [21.06.11]

Field Summary
private  Altitude _altitudePrevious
          the altitude at the previous sample
private  Altitude _rateOfChangeAverage
          the average rate of change in altitude
private  Time _timePrevious
          the time at the previous sample
private static CircularFaceplateDescriptor<Altitude> FACEPLATE
          the faceplate descriptor
private static TickDescriptor<Altitude> MAJOR_TICKS
          the major-ticks descriptor
private static TickDescriptor<Altitude> MINOR_TICKS
          the minor-ticks descriptor
private static NeedleDescriptor NEEDLE
          the needle descriptor
private static NumberDescriptor<Altitude> NUMBERS
          the numbers descriptor
private static TextProperties NUMBERS_TEXT
          the text properties of the numbers
private static Altitude RATE_MAX
          the maximum climb rate
private static Altitude RATE_MIN
          the maximum descent rate
 
Fields inherited from class uavsim.graphics.instruments.A_CircularInstrument
_ringSize, DISK_COLOR, MOUNT_RING_COLOR, MOUNT_RING_INNER_SCALE
 
Fields inherited from class uavsim.graphics.instruments.A_Instrument
_canvasAnchor, _canvasSize, _graphics, _id
 
Constructor Summary
VerticalSpeedIndicator(java.lang.String id, int canvasSize, CoordinateCartesianAbsolute canvasAnchor)
          Creates a vertical speed indicator.
 
Method Summary
 Altitude getRateOfChange()
          Gets the average rate of altitude change.
 AngleMathematical mapAngle_(Altitude rateOfChange)
          Returns the angle corresponding to the value of a unit.
 void render(java.awt.Graphics graphics)
          Renders the current state of the instrument.
private  void renderNeedle()
          Renders the needle
private  void renderNumbers()
          Renders the numbers.
private  void renderTicks()
          Renders the major and minor ticks.
private  void sampleRateOfChange(Altitude altitude, Time time)
          Records an altitude entry to calculates the average rate of change per minute.
 java.lang.String toString()
          
 void update(Altitude altitude, Time time)
          Updates the state of the instrument without rendering it.
 
Methods inherited from class uavsim.graphics.instruments.A_CircularInstrument
mapAngle, renderDisk, renderMountRing
 
Methods inherited from class uavsim.graphics.instruments.A_Instrument
getAnchor, getCanvasSize, getGraphics, getID, getParentComponent, handleControlCallback, hasControls, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, refresh, registerControl, setCanvasAnchor, setCanvasSize, setParentComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_altitudePrevious

private Altitude _altitudePrevious
the altitude at the previous sample


_rateOfChangeAverage

private Altitude _rateOfChangeAverage
the average rate of change in altitude


_timePrevious

private Time _timePrevious
the time at the previous sample


FACEPLATE

private static final CircularFaceplateDescriptor<Altitude> FACEPLATE
the faceplate descriptor


MAJOR_TICKS

private static final TickDescriptor<Altitude> MAJOR_TICKS
the major-ticks descriptor


MINOR_TICKS

private static final TickDescriptor<Altitude> MINOR_TICKS
the minor-ticks descriptor


NEEDLE

private static final NeedleDescriptor NEEDLE
the needle descriptor


NUMBERS

private static final NumberDescriptor<Altitude> NUMBERS
the numbers descriptor


NUMBERS_TEXT

private static final TextProperties NUMBERS_TEXT
the text properties of the numbers


RATE_MAX

private static final Altitude RATE_MAX
the maximum climb rate


RATE_MIN

private static final Altitude RATE_MIN
the maximum descent rate

Constructor Detail

VerticalSpeedIndicator

public VerticalSpeedIndicator(java.lang.String id,
                              int canvasSize,
                              CoordinateCartesianAbsolute canvasAnchor)
Creates a vertical speed indicator.

Parameters:
id - - the unique instrument identifier
canvasSize - - the square size of the instrument footprint in pixels
canvasAnchor - - the anchor position for the center of the canvas in pixels
Method Detail

getRateOfChange

public Altitude getRateOfChange()
Gets the average rate of altitude change.

Returns:
the change

mapAngle_

public AngleMathematical mapAngle_(Altitude rateOfChange)
Returns the angle corresponding to the value of a unit.

Parameters:
rateOfChange - - the unit
Returns:
the angle

render

public void render(java.awt.Graphics graphics)
Renders the current state of the instrument.

Overrides:
render in class A_CircularInstrument<Altitude>
Parameters:
graphics - - the graphics context

renderNeedle

private void renderNeedle()
Renders the needle


renderNumbers

private void renderNumbers()
Renders the numbers.


renderTicks

private void renderTicks()
Renders the major and minor ticks.


sampleRateOfChange

private void sampleRateOfChange(Altitude altitude,
                                Time time)
Records an altitude entry to calculates the average rate of change per minute.

Parameters:
altitude - - the altitude
time - - the time

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

update

public void update(Altitude altitude,
                   Time time)
Updates the state of the instrument without rendering it.

Parameters:
altitude - - the altitude
time - - the time