uavsim.graphics.instruments.altimeter
Class Altimeter

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

public class Altimeter
extends A_CircularInstrument<Altitude>

Defines an altimeter.

Author:
Dan Tappan [21.06.11]

Field Summary
private  Altitude _altitude
          the altitude
private static Altitude ALTITUDE_MAX
          the maximum altitude
private static Altitude ALTITUDE_MIN
          the minimum altitude
private static CircularFaceplateDescriptor<Altitude> FACEPLATE
          the faceplate descriptor
private static TickDescriptor<Altitude> MAJOR_TICKS
          the descriptor for the major ticks
private static TickDescriptor<Altitude> MINOR_TICKS
          the descriptor for the minor ticks
private static NeedleDescriptor NEEDLE_100
          the hundreds-needle descriptor
private static NeedleDescriptor NEEDLE_1000
          the thousands-needle descriptor
private static NeedleDescriptor NEEDLE_10000
          the ten-thousands-needle descriptor
private static java.awt.Color NEEDLE_PIVOT_COLOR
          the color of the center pivot circle overlaying the needles
private static Scaler NEEDLE_PIVOT_SCALE
          the size scale of the needle pivot relative to the instrument size
private static NumberDescriptor<Altitude> NUMBERS
          the numbers descriptor
private static TextProperties NUMBERS_TEXT
          the text properties of the numbers
 
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
Altimeter(java.lang.String id, int canvasSize, CoordinateCartesianAbsolute canvasAnchor)
          Creates an altimeter.
 
Method Summary
 Altitude getAltitude()
          Gets the altitude.
 AngleMathematical mapAngle_(Altitude altitude)
          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 renderNeedles()
          Renders the needles.
private  void renderNumbers()
          Renders the numbers.
private  void renderTicks()
          Renders the major and minor ticks.
 java.lang.String toString()
          
 void update(Altitude altitude)
          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

_altitude

private Altitude _altitude
the altitude


ALTITUDE_MAX

private static final Altitude ALTITUDE_MAX
the maximum altitude


ALTITUDE_MIN

private static final Altitude ALTITUDE_MIN
the minimum altitude


FACEPLATE

private static final CircularFaceplateDescriptor<Altitude> FACEPLATE
the faceplate descriptor


MAJOR_TICKS

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


MINOR_TICKS

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


NEEDLE_100

private static final NeedleDescriptor NEEDLE_100
the hundreds-needle descriptor


NEEDLE_1000

private static final NeedleDescriptor NEEDLE_1000
the thousands-needle descriptor


NEEDLE_10000

private static final NeedleDescriptor NEEDLE_10000
the ten-thousands-needle descriptor


NEEDLE_PIVOT_COLOR

private static final java.awt.Color NEEDLE_PIVOT_COLOR
the color of the center pivot circle overlaying the needles


NEEDLE_PIVOT_SCALE

private static final Scaler NEEDLE_PIVOT_SCALE
the size scale of the needle pivot relative to the instrument size


NUMBERS

private static final NumberDescriptor<Altitude> NUMBERS
the numbers descriptor


NUMBERS_TEXT

private static final TextProperties NUMBERS_TEXT
the text properties of the numbers

Constructor Detail

Altimeter

public Altimeter(java.lang.String id,
                 int canvasSize,
                 CoordinateCartesianAbsolute canvasAnchor)
Creates an altimeter.

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

getAltitude

public Altitude getAltitude()
Gets the altitude.

Returns:
the altitude

mapAngle_

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

Parameters:
altitude - - 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

renderNeedles

private void renderNeedles()
Renders the needles.


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(Altitude altitude)
Updates the state of the instrument without rendering it.

Parameters:
altitude - - the altitude