Class: Clock

Clock

new Clock()

A simple clock used to record simulation time.

Name Type Default Description
options.startTime JulianDate optional

The starting time of the clock.

options.stopTime JulianDate optional

The stop time of the clock.

options.currentTime JulianDate optional

The current time.

options.multiplier Number 1.0 optional

Determine the forward time when calling Clock # tick, negative values allow for backward movement.

options.clockStep ClockStep ClockStep.SYSTEM_CLOCK_MULTIPLIER optional

Determine whether the call to Clock # tick is frame related or system clock related.

options.clockRange ClockRange ClockRange.UNBOUNDED optional

Determine how the clock should behave when reaching # startTime or # stopTime.

options.canAnimate Boolean true optional

Can clock # tick be timed earlier. For example, if data is being buffered, the value may be false. The clock will only tick when both # canAnimate and # shouldered Animate are true.

options.shouldAnimate Boolean true optional

Indicate whether Clock # tick should attempt to advance the time. The clock will only tick when both # canAnimate and # shouldered Animate are true.

See:
  • ClockStep
  • ClockRange
  • JulianDate
Throws:

StartTime must be before stopTime.

Type
DeveloperError
Example
// Create a clock that loops and runs in real-time on Christmas Day 2013.
var clock = new SuperMap3D.Clock({
   startTime : SuperMap3D.JulianDate.fromIso8601("2013-12-25"),
   currentTime : SuperMap3D.JulianDate.fromIso8601("2013-12-25"),
   stopTime : SuperMap3D.JulianDate.fromIso8601("2013-12-26"),
   clockRange : SuperMap3D.ClockRange.LOOP_STOP,
   clockStep : SuperMap3D.ClockStep.SYSTEM_CLOCK_MULTIPLIER
});

Members

canAnimateBoolean

Can clock # tick be timed earlier. For example, if data is being buffered, the value may be false. The clock will only advance time when both # canAnimate and # shoutAnimate are true.

Default Value:
true

clockRangeClockRange

Determine how the clock should behave when reaching # startTime or # stopTime.

Default Value:
ClockRange.UNBOUNDED

clockStepClockStep

Determine whether the call to Clock # tick is frame related or system clock related. Change this attribute to ClockStep. SYSTEM will set Clock # multiplier to 1.0, Clock # should Animate to true, and Clock # current Time to the current system clock time.

Default Value:
ClockStep.SYSTEM_CLOCK_MULTIPLIER

currentTimeJulianDate

The current time. Changing this property will start from clockStep. From SYSTEM. CLOCK} to ClockStep. SYSTEM. CLOCK. MULTILIER.

multiplierNumber

Get or set the forward time when calling Clock # tick. Negative values allow for backward advancement. If Clock # clockStep is set to clockStep. TICK_DEPENDENT, This is the number of seconds moving forward. If Clock # clockStep is set to clockStep. SYSTEM_CLOCK_MULTIPLIER, This value is multiplied by the system time that has passed since the last call to tick. Changing this property will start from clockStep. From SYSTEM. CLOCK} to ClockStep. SYSTEM. CLOCK. MULTILIER.

Default Value:
1.0

onStopEvent

The event triggered when Clock # stopTime is called.

onTickEvent

The event triggered when Clock # tick is called.

shouldAnimateBoolean

Indicate whether Clock # tick should attempt to advance the time. The clock will only advance time when both # canAnimate and # shoutAnimate are true. Changing this property will switch from ClockStep to ClockStep. SYSTEM. CLOCK to ClockStep. SYSTEM. CLOCK. MULTIPLIER.

Default Value:
true

startTimeJulianDate

The starting time of the clock.

stopTimeJulianDate

The stop time of the clock.

Methods

tick(){JulianDate}

Adjust the clock forward from the current time according to the current configuration options. Tick should be called at every frame, regardless of whether the animation is happening or not. To control the animation, you can use the shoulder Animate property.

Returns:
Type Description
JulianDate The new value of the Clock#currentTime property.