uavsim.graphics.instruments
Class A_CircularInstrument<_UNIT_ extends I_Unitable<_UNIT_>>

java.lang.Object
  extended by uavsim.graphics.instruments.A_Instrument
      extended by uavsim.graphics.instruments.A_CircularInstrument<_UNIT_>
Type Parameters:
_UNIT_ - - the unit that the instrumentation is based on. Multi-needle instruments are possible with I_AngleMapper inner classes
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener, javax.swing.event.MouseInputListener, I_AngleMapper<_UNIT_>
Direct Known Subclasses:
A_DirectionalGyro, AirspeedIndicator, Altimeter, AttitudeIndicator, AutomaticDirectionFinder, ClockBasic, ClockEnhanced, HorizontalSituationIndicator, Tachometer, TurnCoordinator, VerticalSpeedIndicator, VORLocalizerGlideslope

public abstract class A_CircularInstrument<_UNIT_ extends I_Unitable<_UNIT_>>
extends A_Instrument
implements I_AngleMapper<_UNIT_>

Defines the shared elements of all resizeable circular instruments ("steam gauges").

Author:
Dan Tappan [11.06.11]

Field Summary
protected  Ring _ringSize
          the ring size in pixels
protected static java.awt.Color DISK_COLOR
          the disk color
protected static java.awt.Color MOUNT_RING_COLOR
          the mount-ring color
protected static Scaler MOUNT_RING_INNER_SCALE
          the scale of the mount ring relative to the instrument size
 
Fields inherited from class uavsim.graphics.instruments.A_Instrument
_canvasAnchor, _canvasSize, _graphics, _id
 
Constructor Summary
A_CircularInstrument(java.lang.String id, int canvasSize, CoordinateCartesianAbsolute canvasAnchor)
          Creates an abstract circular instrument.
 
Method Summary
protected  AngleMathematical mapAngle(CircularFaceplateDescriptor<_UNIT_> faceplate, _UNIT_ value)
          Maps a unit value to an angle on the faceplate arc.
 void render(java.awt.Graphics graphics)
          Renders the current state of the instrument.
protected  void renderDisk()
          Renders the mount ring.
protected  void renderMountRing()
          Renders the mount ring.
 
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, toString, wait, wait, wait
 
Methods inherited from interface uavsim.graphics.instruments.I_AngleMapper
mapAngle_
 

Field Detail

_ringSize

protected Ring _ringSize
the ring size in pixels


DISK_COLOR

protected static final java.awt.Color DISK_COLOR
the disk color


MOUNT_RING_COLOR

protected static final java.awt.Color MOUNT_RING_COLOR
the mount-ring color


MOUNT_RING_INNER_SCALE

protected static final Scaler MOUNT_RING_INNER_SCALE
the scale of the mount ring relative to the instrument size

Constructor Detail

A_CircularInstrument

public A_CircularInstrument(java.lang.String id,
                            int canvasSize,
                            CoordinateCartesianAbsolute canvasAnchor)
Creates an abstract circular instrument.

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

mapAngle

protected AngleMathematical mapAngle(CircularFaceplateDescriptor<_UNIT_> faceplate,
                                     _UNIT_ value)
Maps a unit value to an angle on the faceplate arc.

Parameters:
faceplate - - the faceplate that defines the unit that the instrumentation is based on
value - - the value to map to an angle
Returns:
the angle

render

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

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

renderDisk

protected void renderDisk()
Renders the mount ring.


renderMountRing

protected void renderMountRing()
Renders the mount ring.