|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectuavsim.graphics.instruments.A_Instrument
uavsim.graphics.instruments.A_CircularInstrument<AttitudeRoll>
uavsim.graphics.instruments.attitudeindicator.AttitudeIndicator
public class AttitudeIndicator
Defines a standard attitude-indicator or artificial-horizon instrument to depict pitch and roll. The operable range is [-55,+55] degrees for pitch and [-180,+180] for roll. Pitch outside this range causes the instrument to show a tumble indicator as red crossbars. This limitation is consistent with the real-world instrument.
| Nested Class Summary | |
|---|---|
private static class |
AttitudeIndicator.AttitudeMapper
Defines the mapper that converts a unit value (pitch or roll) into a corresponding angle on the display. |
| Field Summary | |
|---|---|
private Attitude |
_attitude
the attitude |
private static AttitudeIndicator.AttitudeMapper |
_attitudeMapper
the attitude mapper |
private static NeedleDescriptor |
BEZEL_BUG
the level-flight bug |
private static java.awt.Color |
BEZEL_GROUND_COLOR
the color of the ground element of the bezel |
private static ScalerPair |
BEZEL_SCALER
the size scale of the bezel inner and outer radii relative to the instrument size |
private static java.awt.Color |
BEZEL_SKY_COLOR
the color of the sky element of the bezel |
private static java.awt.Color |
GROUND_COLOR
the color of the ground |
private static java.awt.Color |
GROUND_LINE_COLOR
the color of the perspective lines overlain on the gorund |
private static Scaler |
GROUND_LINE_SCALE
the size scale of the ground lines relative to the instrument size |
private static ScalerPair |
HORIZON_SCALER
the size scale of the horizon inner and outer radii relative to the instrument size |
private static java.awt.Color |
MINIATURE_AIRPLANE_COLOR
the color of the miniature airplane |
private static Scaler |
MINIATURE_AIRPLANE_DOT_SCALE
the size scale of the airplane dot relative to the instrument size |
private static Scaler |
MINIATURE_AIRPLANE_LINE_END_SCALE
the position scale of the airplane wing line end relative to the instrument center |
private static Scaler |
MINIATURE_AIRPLANE_LINE_SCALE
the size scale of the airplane wing lines relative to the instrument size |
private static Scaler |
MINIATURE_AIRPLANE_LINE_START_SCALE
the position scale of the airplane wing line start relative to the instrument center |
private static ScalerPair |
MINIATURE_AIRPLANE_LOOP_SCALE
the size scale of the airplane loop inner and outer radii relative to the instrument size |
private static Scaler |
PITCH_BAR_10_SCALE
the position scale of the +/-10-degree pitch bar relative to the horizon midpoint |
private static Scaler |
PITCH_BAR_20_SCALE
the position scale of the +/-20-degree pitch bar relative to the horizon midpoint |
private static Scaler |
PITCH_BAR_30_SCALE
the position scale of the +/-30-degree pitch bar relative to the horizon midpoint |
private static java.awt.Color |
PITCH_BAR_GROUND_COLOR
the color of the pitch bars overlaying the ground |
private static Scaler |
PITCH_BAR_SCALE
the size scale of the pitch bars relative to the instrument size |
private static java.awt.Color |
PITCH_BAR_SKY_COLOR
the color of the pitch bars overlaying the sky |
private static double |
PITCH_BAR_VERTICAL_SCALE
the position scale of the pitch bars relative to the instrument size |
private static java.awt.Color |
ROLL_TICK_COLOR
the color of the rolls ticks |
private static Scaler |
ROLL_TICK_MEDIUM_SCALE
the size scale of the medium roll tick relative to the instrument size |
private static Scaler |
ROLL_TICK_RADIUS_SCALE
the position scale of the medium roll tick relative to the instrument center |
private static Scaler |
ROLL_TICK_THICK_SCALE
the size scale of the thick roll tick relative to the instrument size |
private static Scaler |
ROLL_TICK_THIN_SCALE
the size scale of the thin roll tick relative to the instrument size |
private static java.awt.Color |
SKY_COLOR
the color of the sky |
private static java.awt.Color |
TUMBLE_COLOR
the color of the tumble indicator X |
private static Scaler |
TUMBLE_CROSSBAR_SCALE
the size scale of the tumble crossbar relative to the instrument size |
private static double |
VALID_PITCH_MAX
the maximum valid pitch, beyond which the tumble crossbar appears |
private static double |
VALID_PITCH_MIN
the minimum valid pitch, beyond which the tumble crossbar appears |
| 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 | |
|---|---|
AttitudeIndicator(java.lang.String id,
int canvasSize,
CoordinateCartesianAbsolute canvasAnchor)
Creates an attitude indicator. |
|
| Method Summary | |
|---|---|
private Interval<AngleMathematical> |
calculateHorizonInterval(Attitude attitude)
Calculates the angles where the sky portion of the horizon disk starts and ends based on the pitch and roll. |
private CoordinateCartesianAbsolute |
calculatePerspectiveLineIntercept(Attitude attitude,
CoordinateCartesianAbsolute midpoint,
AngleMathematical perspective)
Calculates the pixel coordinates where a ground line originating at the horizon midpoint intersects the perimeter of the horizon ring |
private CoordinateCartesianAbsolute |
calculatePitchBarMidpoint(Attitude attitude,
AttitudePitch pitchOffset)
Calculates the midpoint of a pitch bar. |
Attitude |
getAttitude()
Gets the attitude. |
AngleMathematical |
mapAngle_(AttitudeRoll roll)
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 |
renderBezel(Attitude attitude)
Renders the sky and ground portions on the bezel. |
private void |
renderBezel(Interval<AngleMathematical> horizon,
java.awt.Color color)
Renders the sky and ground portions of the bezel. |
private void |
renderBezelBug()
Renders the "up" bug at the top of the bezel. |
private void |
renderGroundLine(Attitude attitude,
CoordinateCartesianAbsolute midpoint,
AngleMathematical perspective,
Interval<AngleMathematical> horizon)
Renders the horizon line or ground perspective line on the ground portion. |
private void |
renderGroundLines(Attitude attitude)
Renders the horizon line and ground perspective lines on the ground portion. |
private void |
renderHorizon(Attitude attitude)
Renders the sky and ground portions of the disk. |
private void |
renderHorizon(Interval<AngleMathematical> horizon,
java.awt.Color color)
Renders the sky or ground portion of the disk. |
private void |
renderMiniaturePlane()
Renders the miniature airplane. |
private void |
renderPitchBar(Attitude attitude,
AttitudePitch pitchOffset,
Scaler lineWidthScaler,
java.awt.Color color)
Renders a pitch bar. |
private void |
renderPitchBars(Attitude attitude)
Renders the pitch bars on the horizon. |
private void |
renderRollTick(AttitudeRoll roll,
Scaler scale)
Renders the roll ticks on the bezel. |
private void |
renderRollTicks(Attitude attitude)
Renders the roll ticks on the bezel. |
private void |
renderTumbleIndicator()
Renders the sky and ground portions. |
java.lang.String |
toString()
|
void |
update(Attitude attitude)
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 |
|---|
private Attitude _attitude
private static final AttitudeIndicator.AttitudeMapper _attitudeMapper
private static final NeedleDescriptor BEZEL_BUG
private static final java.awt.Color BEZEL_GROUND_COLOR
private static final ScalerPair BEZEL_SCALER
private static final java.awt.Color BEZEL_SKY_COLOR
private static final java.awt.Color GROUND_COLOR
private static final java.awt.Color GROUND_LINE_COLOR
private static final Scaler GROUND_LINE_SCALE
private static final ScalerPair HORIZON_SCALER
private static final java.awt.Color MINIATURE_AIRPLANE_COLOR
private static final Scaler MINIATURE_AIRPLANE_DOT_SCALE
private static final Scaler MINIATURE_AIRPLANE_LINE_END_SCALE
private static final Scaler MINIATURE_AIRPLANE_LINE_SCALE
private static final Scaler MINIATURE_AIRPLANE_LINE_START_SCALE
private static final ScalerPair MINIATURE_AIRPLANE_LOOP_SCALE
private static final Scaler PITCH_BAR_10_SCALE
private static final Scaler PITCH_BAR_20_SCALE
private static final Scaler PITCH_BAR_30_SCALE
private static final java.awt.Color PITCH_BAR_GROUND_COLOR
private static final Scaler PITCH_BAR_SCALE
private static final java.awt.Color PITCH_BAR_SKY_COLOR
private static final double PITCH_BAR_VERTICAL_SCALE
private static final java.awt.Color ROLL_TICK_COLOR
private static final Scaler ROLL_TICK_MEDIUM_SCALE
private static final Scaler ROLL_TICK_RADIUS_SCALE
private static final Scaler ROLL_TICK_THICK_SCALE
private static final Scaler ROLL_TICK_THIN_SCALE
private static final java.awt.Color SKY_COLOR
private static final java.awt.Color TUMBLE_COLOR
private static final Scaler TUMBLE_CROSSBAR_SCALE
private static final double VALID_PITCH_MAX
private static final double VALID_PITCH_MIN
| Constructor Detail |
|---|
public AttitudeIndicator(java.lang.String id,
int canvasSize,
CoordinateCartesianAbsolute canvasAnchor)
id - - the unique instrument identifiercanvasSize - - the square size of the instrument footprint in pixelscanvasAnchor - - the anchor position for the center of the canvas in pixels| Method Detail |
|---|
private Interval<AngleMathematical> calculateHorizonInterval(Attitude attitude)
attitude - - the attitude
private CoordinateCartesianAbsolute calculatePerspectiveLineIntercept(Attitude attitude,
CoordinateCartesianAbsolute midpoint,
AngleMathematical perspective)
attitude - - the attitudemidpoint - - the horizon midpointperspective - - the angle from the midpoint
private CoordinateCartesianAbsolute calculatePitchBarMidpoint(Attitude attitude,
AttitudePitch pitchOffset)
attitude - - the attitudepitchOffset - - the offset from the horizon
public Attitude getAttitude()
public AngleMathematical mapAngle_(AttitudeRoll roll)
roll - - the unit
public void render(java.awt.Graphics graphics)
render in class A_CircularInstrument<AttitudeRoll>graphics - - the graphics contextprivate void renderBezel(Attitude attitude)
attitude - - the attitude
private void renderBezel(Interval<AngleMathematical> horizon,
java.awt.Color color)
horizon - - the angles defining the start and end of the horizoncolor - - the colorprivate void renderBezelBug()
private void renderGroundLine(Attitude attitude,
CoordinateCartesianAbsolute midpoint,
AngleMathematical perspective,
Interval<AngleMathematical> horizon)
attitude - - the attitudemidpoint - - the horizon midpointperspective - - the angle from the midpointhorizon - - the angles defining the start and end of the horizonprivate void renderGroundLines(Attitude attitude)
attitude - - the start angle for the attitude of the horizon disk in mathematical degreesprivate void renderHorizon(Attitude attitude)
attitude - - the attitude
private void renderHorizon(Interval<AngleMathematical> horizon,
java.awt.Color color)
horizon - - the angles defining the start and end of the horizoncolor - - the portion colorprivate void renderMiniaturePlane()
private final void renderPitchBar(Attitude attitude,
AttitudePitch pitchOffset,
Scaler lineWidthScaler,
java.awt.Color color)
attitude - - the attitudepitchOffset - - the offset from the horizonlineWidthScaler - - the bar widthcolor - - the bar colorprivate void renderPitchBars(Attitude attitude)
attitude - - the attitude
private void renderRollTick(AttitudeRoll roll,
Scaler scale)
roll - - the rollscale - - the tick scaleprivate void renderRollTicks(Attitude attitude)
attitude - - the rollprivate void renderTumbleIndicator()
public java.lang.String toString()
toString in class java.lang.Objectpublic void update(Attitude attitude)
attitude - - the attitude
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||