|
|||||||||
| 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<Time>
uavsim.graphics.instruments.clock.ClockEnhanced
public class ClockEnhanced
Defines an analog clock with a standard second hand and a timer second hand that can be reset to zero with a pushbutton. It also includes a gratuitous arc as a demonstration of this API feature.
| Field Summary | |
|---|---|
private PushButton |
_buttonReset
the reset pushbutton |
private static ButtonProperties |
_buttonResetProperties
the enable-button properties |
private Time |
_time
the time |
private Time |
_timeBase
the base time at which the timer was reset. |
private static ArcDescriptor<Time> |
ARC
the arc descriptor for the green arc |
private static TextProperties |
BUTTON_LABEL_PROPERTIES
the text properties of the button label |
private static CircularFaceplateDescriptor<Time> |
FACEPLATE
the faceplate descriptor |
private static java.awt.Color |
HAND_PIVOT_COLOR
the color of the pivot circle at the common base of the hands |
private static Scaler |
HAND_PIVOT_SCALE
the size scale of the pivot circle relative to the instrument size |
private static NeedleDescriptor |
HOUR_HAND
the needle for the hour hand |
private static TickDescriptor<Time> |
MAJOR_TICKS
the major-ticks descriptor |
private static TickDescriptor<Time> |
MINOR_TICKS
the minor-ticks descriptor |
private static NeedleDescriptor |
MINUTE_HAND
the needle for the minute hand |
private static NumberDescriptor<Time> |
NUMBERS
the numbers descriptor |
private static TextProperties |
NUMBERS_TEXT
the text properties of the numbers |
private static NeedleDescriptor |
SECOND_HAND
the needle for the second hand |
private static Time |
TIME_END
the end time on the faceplate |
private static Time |
TIME_START
the start time on the faceplate |
private static NeedleDescriptor |
TIMER_BUG
the needle for the timer bug |
| 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 | |
|---|---|
ClockEnhanced(java.lang.String id,
int canvasSize,
CoordinateCartesianAbsolute canvasAnchor)
Creates an analog clock. |
|
| Method Summary | |
|---|---|
private void |
configureControls()
Configures the controls. |
Time |
getTime()
Gets the time. |
Time |
getTimer()
Gets the timer time. |
void |
handleControlCallback(ControlCallbackEvent event)
Handles an event from a registered control. |
AngleMathematical |
mapAngle_(Time time)
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 |
renderArc()
Renders the arc. |
private void |
renderControl()
Renders the control. |
private void |
renderHands()
Renders the hands. |
private void |
renderNumbers()
Renders the numbers. |
private void |
renderTicks()
Renders the minor and major ticks. |
void |
resetTimer()
Resets the timer bug to 0 seconds. |
java.lang.String |
toString()
|
void |
update(Time time)
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 |
|---|
private final PushButton _buttonReset
private static final ButtonProperties _buttonResetProperties
private Time _time
private Time _timeBase
private static final ArcDescriptor<Time> ARC
private static final TextProperties BUTTON_LABEL_PROPERTIES
private static final CircularFaceplateDescriptor<Time> FACEPLATE
private static final java.awt.Color HAND_PIVOT_COLOR
private static final Scaler HAND_PIVOT_SCALE
private static final NeedleDescriptor HOUR_HAND
private static final TickDescriptor<Time> MAJOR_TICKS
private static final TickDescriptor<Time> MINOR_TICKS
private static final NeedleDescriptor MINUTE_HAND
private static final NumberDescriptor<Time> NUMBERS
private static final TextProperties NUMBERS_TEXT
private static final NeedleDescriptor SECOND_HAND
private static final Time TIME_END
private static final Time TIME_START
private static final NeedleDescriptor TIMER_BUG
| Constructor Detail |
|---|
public ClockEnhanced(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 void configureControls()
public Time getTime()
public Time getTimer()
public void handleControlCallback(ControlCallbackEvent event)
handleControlCallback in class A_Instrumentevent - - the callback eventpublic AngleMathematical mapAngle_(Time time)
time - - the unit
public void render(java.awt.Graphics graphics)
render in class A_CircularInstrument<Time>graphics - - the graphics contextprivate void renderArc()
private void renderControl()
private void renderHands()
private void renderNumbers()
private void renderTicks()
public void resetTimer()
public java.lang.String toString()
toString in class java.lang.Objectpublic void update(Time time)
time - - the time
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||