uavsim.graphics.instruments.airspeedindicator
Class AirspeedIndicator

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

public class AirspeedIndicator
extends A_CircularInstrument<Airspeed>

Defines a standard airspeed-indicator instrument.

Author:
Dan Tappan [21.06.11]

Field Summary
private  Airspeed _airspeed
          the airspeed
private static Airspeed AIRSPEED_MAX
          the maximum airspeed
private static Airspeed AIRSPEED_MIN
          the minimum airspeed
private static CircularFaceplateDescriptor<Airspeed> FACEPLATE
          the faceplate descriptor
private static ArcDescriptor<Airspeed> GREEN_ARC
          the arc descriptor for the green arc
private static TickDescriptor<Airspeed> MAJOR_TICKS
          the descriptor for the major ticks
private static TickDescriptor<Airspeed> MINOR_TICKS
          the descriptor for the minor ticks
private static NeedleDescriptor NEEDLE
          the needle descriptor
private static NumberDescriptor<Airspeed> NUMBERS
          the numbers descriptor
private static TextProperties NUMBERS_TEXT
          the text properties of the numbers
private static ArcDescriptor<Airspeed> RED_ARC
          the arc descriptor for the red arc
private static ArcDescriptor<Airspeed> WHITE_ARC
          the arc descriptor for the white arc
private static ArcDescriptor<Airspeed> YELLOW_ARC
          the arc descriptor for the yellow arc
 
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
AirspeedIndicator(java.lang.String id, int canvasSize, CoordinateCartesianAbsolute canvasAnchor)
          Creates an airspeed indicator.
 
Method Summary
 Airspeed getAirspeed()
          Gets the airspeed.
 AngleMathematical mapAngle_(Airspeed airspeed)
          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 renderArcs()
          Renders the arcs.
private  void renderNeedle()
          Renders the needle.
private  void renderNumbers()
          Renders the numbers.
private  void renderTicks()
          Renders the major and minor ticks.
 java.lang.String toString()
          
 void update(Airspeed airspeed)
          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

_airspeed

private Airspeed _airspeed
the airspeed


AIRSPEED_MAX

private static final Airspeed AIRSPEED_MAX
the maximum airspeed


AIRSPEED_MIN

private static final Airspeed AIRSPEED_MIN
the minimum airspeed


FACEPLATE

private static final CircularFaceplateDescriptor<Airspeed> FACEPLATE
the faceplate descriptor


GREEN_ARC

private static final ArcDescriptor<Airspeed> GREEN_ARC
the arc descriptor for the green arc


MAJOR_TICKS

private static final TickDescriptor<Airspeed> MAJOR_TICKS
the descriptor for the major ticks


MINOR_TICKS

private static final TickDescriptor<Airspeed> MINOR_TICKS
the descriptor for the minor ticks


NEEDLE

private static final NeedleDescriptor NEEDLE
the needle descriptor


NUMBERS

private static final NumberDescriptor<Airspeed> NUMBERS
the numbers descriptor


NUMBERS_TEXT

private static final TextProperties NUMBERS_TEXT
the text properties of the numbers


RED_ARC

private static final ArcDescriptor<Airspeed> RED_ARC
the arc descriptor for the red arc


WHITE_ARC

private static final ArcDescriptor<Airspeed> WHITE_ARC
the arc descriptor for the white arc


YELLOW_ARC

private static final ArcDescriptor<Airspeed> YELLOW_ARC
the arc descriptor for the yellow arc

Constructor Detail

AirspeedIndicator

public AirspeedIndicator(java.lang.String id,
                         int canvasSize,
                         CoordinateCartesianAbsolute canvasAnchor)
Creates an airspeed 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

getAirspeed

public Airspeed getAirspeed()
Gets the airspeed.

Returns:
the airspeed

mapAngle_

public AngleMathematical mapAngle_(Airspeed airspeed)
Returns the angle corresponding to the value of a unit.

Parameters:
airspeed - - 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<Airspeed>
Parameters:
graphics - - the graphics context

renderArcs

private void renderArcs()
Renders the arcs.


renderNeedle

private void renderNeedle()
Renders the needle.


renderNumbers

private void renderNumbers()
Renders the numbers.


renderTicks

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


toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

update

public void update(Airspeed airspeed)
Updates the state of the instrument without rendering it.

Parameters:
airspeed - - the airspeed