uavsim.graphics.instruments.autopilot
Class Autopilot

java.lang.Object
  extended by uavsim.graphics.instruments.A_Instrument
      extended by uavsim.graphics.instruments.A_RectangularInstrument
          extended by uavsim.graphics.instruments.autopilot.Autopilot
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener, javax.swing.event.MouseInputListener

public class Autopilot
extends A_RectangularInstrument

Defines an autopilot selector with altitude and heading hold. Altitude is selected here; heading comes from a directional gyro.

Author:
Dan Tappan [06.08.11]

Field Summary
private  Altitude _altitude
          the desired altitude
private  PushButton _buttonEnable
          the enable pushbutton
private static ButtonProperties _buttonEnableProperties
          the enable-button properties
private  A_DirectionalGyro _directionalGyro
          the directional gyro providing the heading hold
private  boolean _isEngaged
          whether the autopilot is engaged
private  Knob _knobPrimary
          the primary knob for setting the altitude
private static KnobProperties _knobPrimaryProperties
          the primary-knob properties
private  Knob _knobSecondary
          the secondary knob for setting the altitude
private static KnobProperties _knobSecondaryProperties
          the secondary-knob properties
private static CoordinateCartesianRelative ALTITUDE_DISPLAY_ANCHOR_SCALE
          the anchor position of the altitude text relative to the center of the instrument
private static Altitude ALTITUDE_MAX
          the maximum altitude
private static TextProperties ALTITUDE_TEXT
          the text properties of the altitude
private static CoordinateCartesianRelative ALTITUDE_WINDOW_ANCHOR_SCALE
          the anchor position of the altitude window relative to the center of the instrument
private static java.awt.Color ALTITUDE_WINDOW_BODY_COLOR
          the color of the altitude window body
private static java.awt.Color ALTITUDE_WINDOW_OUTLINE_COLOR
          the color of the altitude window outline
private static Scaler ALTITUDE_WINDOW_OUTLINE_SCALE
          the size scale of the window outline relative to the instrument size
private static ScalerPair ALTITUDE_WINDOW_SIZE_SCALE
          the size scale of the window relative to the instrument size
private static TextProperties BUTTON_LABEL_PROPERTIES
          the text properties of the button label
private static java.awt.Color COLOR_DISENGAGED
          the color of the engage button indicating that the autpilot is disengaged
private static java.awt.Color COLOR_ENGAGED
          the color of the engage button indicating that the autpilot is engaged
private static RectangularFaceplaceDescriptor FACEPLATE
          the faceplace
private static TextProperties KNOB_LABEL_PROPERTIES
          the text properties of the knob label
private static Altitude KNOB_PRIMARY_STEP
          the major change in altitude caused by adjusting the primary knob
private static Altitude KNOB_SECONDARY_STEP
          the minor change in altitude caused by adjusting the primary knob
 
Fields inherited from class uavsim.graphics.instruments.A_RectangularInstrument
_faceplaceDescriptor, _faceSize
 
Fields inherited from class uavsim.graphics.instruments.A_Instrument
_canvasAnchor, _canvasSize, _graphics, _id
 
Constructor Summary
Autopilot(java.lang.String id, int canvasSize, CoordinateCartesianAbsolute canvasAnchor, A_DirectionalGyro directionalGyro)
          Creates an autopilot control.
 
Method Summary
private  void configureControls()
          Configures the controls.
 Altitude getAltitude()
          Gets the azimuth.
 void handleControlCallback(ControlCallbackEvent event)
          Handles an event from a registered control.
 boolean isEngaged()
          Returns whether the autopilot is engaged.
 void render(java.awt.Graphics graphics)
          Renders the current state of the instrument.
private  void renderAltitudeWindow()
          Renders the altitude window.
private  void renderControls()
          Renders the controls.
 java.lang.String toString()
          
 
Methods inherited from class uavsim.graphics.instruments.A_RectangularInstrument
getFaceSize, renderBox
 
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

_altitude

private Altitude _altitude
the desired altitude


_buttonEnable

private final PushButton _buttonEnable
the enable pushbutton


_buttonEnableProperties

private static final ButtonProperties _buttonEnableProperties
the enable-button properties


_directionalGyro

private final A_DirectionalGyro _directionalGyro
the directional gyro providing the heading hold


_isEngaged

private boolean _isEngaged
whether the autopilot is engaged


_knobPrimary

private final Knob _knobPrimary
the primary knob for setting the altitude


_knobPrimaryProperties

private static final KnobProperties _knobPrimaryProperties
the primary-knob properties


_knobSecondary

private final Knob _knobSecondary
the secondary knob for setting the altitude


_knobSecondaryProperties

private static final KnobProperties _knobSecondaryProperties
the secondary-knob properties


ALTITUDE_DISPLAY_ANCHOR_SCALE

private static final CoordinateCartesianRelative ALTITUDE_DISPLAY_ANCHOR_SCALE
the anchor position of the altitude text relative to the center of the instrument


ALTITUDE_MAX

private static final Altitude ALTITUDE_MAX
the maximum altitude


ALTITUDE_TEXT

private static final TextProperties ALTITUDE_TEXT
the text properties of the altitude


ALTITUDE_WINDOW_ANCHOR_SCALE

private static final CoordinateCartesianRelative ALTITUDE_WINDOW_ANCHOR_SCALE
the anchor position of the altitude window relative to the center of the instrument


ALTITUDE_WINDOW_BODY_COLOR

private static final java.awt.Color ALTITUDE_WINDOW_BODY_COLOR
the color of the altitude window body


ALTITUDE_WINDOW_OUTLINE_COLOR

private static final java.awt.Color ALTITUDE_WINDOW_OUTLINE_COLOR
the color of the altitude window outline


ALTITUDE_WINDOW_OUTLINE_SCALE

private static final Scaler ALTITUDE_WINDOW_OUTLINE_SCALE
the size scale of the window outline relative to the instrument size


ALTITUDE_WINDOW_SIZE_SCALE

private static final ScalerPair ALTITUDE_WINDOW_SIZE_SCALE
the size scale of the window relative to the instrument size


BUTTON_LABEL_PROPERTIES

private static final TextProperties BUTTON_LABEL_PROPERTIES
the text properties of the button label


COLOR_DISENGAGED

private static final java.awt.Color COLOR_DISENGAGED
the color of the engage button indicating that the autpilot is disengaged


COLOR_ENGAGED

private static final java.awt.Color COLOR_ENGAGED
the color of the engage button indicating that the autpilot is engaged


FACEPLATE

private static final RectangularFaceplaceDescriptor FACEPLATE
the faceplace


KNOB_LABEL_PROPERTIES

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


KNOB_PRIMARY_STEP

private static final Altitude KNOB_PRIMARY_STEP
the major change in altitude caused by adjusting the primary knob


KNOB_SECONDARY_STEP

private static final Altitude KNOB_SECONDARY_STEP
the minor change in altitude caused by adjusting the primary knob

Constructor Detail

Autopilot

public Autopilot(java.lang.String id,
                 int canvasSize,
                 CoordinateCartesianAbsolute canvasAnchor,
                 A_DirectionalGyro directionalGyro)
Creates an autopilot control.

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
directionalGyro - - the directional gyro providing the desired course
Method Detail

configureControls

private void configureControls()
Configures the controls.


getAltitude

public Altitude getAltitude()
Gets the azimuth.

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

isEngaged

public boolean isEngaged()
Returns whether the autopilot is engaged.

Returns:
the state

render

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

Overrides:
render in class A_RectangularInstrument
Parameters:
graphics - - the graphics context

renderAltitudeWindow

private void renderAltitudeWindow()
Renders the altitude window.


renderControls

private void renderControls()
Renders the controls.


toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object