uavsim.graphics.instruments.directionalgyro
Class DirectionalGyro

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

public class DirectionalGyro
extends A_DirectionalGyro

Defines a standard directional-gyro instrument.

Author:
Dan Tappan [22.06.11]

Field Summary
private  AngleNavigational _headingActual
          the actual heading
private  AngleNavigational _headingDesired
          the desired heading for the autopilot
private  Knob _knob
          the heading knob
private static KnobProperties _knobProperties
          the knob properties
private static double[][] AIRPLANE
          the polygon description of the airplane
private static java.awt.Color AIRPLANE_COLOR
          the color of the airplane glyph
private static double AIRPLANE_SCALE
          the size scale of the airplane relative to the instrument
private static AngleNavigational AZIMUTH_END
          the end angle of the azimuth numbers
private static AngleNavigational AZIMUTH_START
          the start angle of the azimuth numbers
private static NeedleDescriptor FIXED_BUG
          the fixed-bug descriptor
private static double[] FIXED_BUG_ANGLES
          the angles of the fixed bugs
private static TextProperties KNOB_LABEL_PROPERTIES
          the text properties of the knob label
private static AngleNavigational KNOB_STEP
          the step value for changing the heading
private static TickDescriptor<AngleNavigational> MAJOR_TICKS
          the major-ticks descriptor
private static TickDescriptor<AngleNavigational> MINOR_TICKS
          the minor-ticks descriptor
private static NeedleDescriptor MOVEABLE_BUG
          the moveable-bug descriptor
private static NeedleDescriptor NEEDLE
          the needle descriptor
private static NumberDescriptor<AngleNavigational> 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
DirectionalGyro(java.lang.String id, int canvasSize, CoordinateCartesianAbsolute canvasAnchor)
          Creates a directional gyro.
 
Method Summary
private  void configureKnob()
          Configures the knob.
private  void configureNumbers()
          Configures the numbers.
 AngleNavigational getHeadingActual()
          Gets the actual heading.
 AngleNavigational getHeadingDesired()
          Gets the desired heading for the autopilot.
 Knob getKnob()
          Gets the knob.
 void handleControlCallback(ControlCallbackEvent event)
          Handles an event from a registered control.
 AngleMathematical mapAngle_(AngleNavigational azimuth)
          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 renderAirplane()
          Renders the needle.
private  void renderBugs()
          Renders the bugs.
private  void renderKnob()
          Renders the knob.
private  void renderNeedle()
          Renders the needle.
private  void renderNumbers()
          Renders the numbers.
private  void renderTicks()
          Renders the minor, medium, and major ticks.
 java.lang.String toString()
          
 void update(AngleNavigational azimuthActual)
          Updates the state of the instrument without rendering it.
 void update(AngleNavigational azimuthActual, AngleNavigational azimuthDesired)
          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, 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

_headingActual

private AngleNavigational _headingActual
the actual heading


_headingDesired

private AngleNavigational _headingDesired
the desired heading for the autopilot


_knob

private final Knob _knob
the heading knob


_knobProperties

private static final KnobProperties _knobProperties
the knob properties


AIRPLANE

private static final double[][] AIRPLANE
the polygon description of the airplane


AIRPLANE_COLOR

private static final java.awt.Color AIRPLANE_COLOR
the color of the airplane glyph


AIRPLANE_SCALE

private static final double AIRPLANE_SCALE
the size scale of the airplane relative to the instrument

See Also:
Constant Field Values

AZIMUTH_END

private static final AngleNavigational AZIMUTH_END
the end angle of the azimuth numbers


AZIMUTH_START

private static final AngleNavigational AZIMUTH_START
the start angle of the azimuth numbers


FIXED_BUG

private static final NeedleDescriptor FIXED_BUG
the fixed-bug descriptor


FIXED_BUG_ANGLES

private static final double[] FIXED_BUG_ANGLES
the angles of the fixed bugs


KNOB_LABEL_PROPERTIES

private static final TextProperties KNOB_LABEL_PROPERTIES
the text properties of the knob label


KNOB_STEP

private static final AngleNavigational KNOB_STEP
the step value for changing the heading


MAJOR_TICKS

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


MINOR_TICKS

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


MOVEABLE_BUG

private static final NeedleDescriptor MOVEABLE_BUG
the moveable-bug descriptor


NEEDLE

private static final NeedleDescriptor NEEDLE
the needle descriptor


NUMBERS

private static final NumberDescriptor<AngleNavigational> NUMBERS
the numbers descriptor


NUMBERS_TEXT

private static final TextProperties NUMBERS_TEXT
the text properties of the numbers

Constructor Detail

DirectionalGyro

public DirectionalGyro(java.lang.String id,
                       int canvasSize,
                       CoordinateCartesianAbsolute canvasAnchor)
Creates a directional gyro.

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

configureKnob

private void configureKnob()
Configures the knob.


configureNumbers

private void configureNumbers()
Configures the numbers.


getHeadingActual

public AngleNavigational getHeadingActual()
Gets the actual heading.

Specified by:
getHeadingActual in class A_DirectionalGyro
Returns:
the heading

getHeadingDesired

public AngleNavigational getHeadingDesired()
Gets the desired heading for the autopilot.

Specified by:
getHeadingDesired in class A_DirectionalGyro
Returns:
the heading

getKnob

public Knob getKnob()
Gets the knob.

Returns:
the azimuth

handleControlCallback

public void handleControlCallback(ControlCallbackEvent event)
Handles an event from a registered control. This performs validation only. Its actions must be defined in overridden methods.

Overrides:
handleControlCallback in class A_Instrument
Parameters:
event - - the callback event

mapAngle_

public AngleMathematical mapAngle_(AngleNavigational azimuth)
Returns the angle corresponding to the value of a unit.

Parameters:
azimuth - - 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<AngleNavigational>
Parameters:
graphics - - the graphics context

renderAirplane

private void renderAirplane()
Renders the needle.


renderBugs

private void renderBugs()
Renders the bugs.


renderKnob

private void renderKnob()
Renders the knob.


renderNeedle

private void renderNeedle()
Renders the needle.


renderNumbers

private void renderNumbers()
Renders the numbers.


renderTicks

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


toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

update

public void update(AngleNavigational azimuthActual)
Updates the state of the instrument without rendering it.

Parameters:
azimuthActual - - the actual azimuth for heading

update

public void update(AngleNavigational azimuthActual,
                   AngleNavigational azimuthDesired)
Updates the state of the instrument without rendering it.

Parameters:
azimuthActual - - the actual azimuth for heading
azimuthDesired - - the desired azimuth for autopilot course