Class: BasicTimeSequence

BasicTimeSequence(dates)

Represents a time sequence described as an array of Date objects as required by WMS. This class provides iteration over the sequence in steps specified by the period. If the start and end dates are different, iteration will start at the start date and end at the end date.

Constructor

new BasicTimeSequence(dates)

Constructs a time sequence from an array of Dates.
Parameters:
Name Type Description
dates Array.<Date> An array of Date objects.
Source:
Throws:
If the specified dates array is null, undefined or has a length less than two.
Type
ArgumentError

Members

currentIndex :Number

This sequence's current index.
Type:
  • Number
Default Value:
  • 0.
Source:

currentTime :Date

This sequence's current time.
Type:
  • Date
Default Value:
  • This sequence's start time.
Source:

dates :Array.<Date>

This sequence's list of Dates.
Type:
  • Array.<Date>
Source:

scaleForCurrentTime :Number

Indicates the position of this sequence's current time relative to the sequence's total interval, in the range [0, 1]. A value of 0 indicates this sequence's start time. A value of 1 indicates this sequence's end time. A value of 0.5 indicates a current time that's exactly mid-way between this sequence's start time and end time.
Type:
  • Number
Source:

Methods

getTimeForScale(scale) → {Date}

Returns the time associated with a specified value in the range [0, 1]. A value of 0 returns this sequence's start time. A value of 1 returns this sequence's end time. A value of 0.5 returs a time mid-way between this sequence's start and end times.
Parameters:
Name Type Description
scale The scale value. This value is clamped to the range [0, 1] before the time is determined.
Source:
Returns:
Type
Date

next() → {Date|null}

Sets this sequence's current time to the next time in the sequence and returns that time.
Source:
Returns:
The next time of this sequence, or null if no more times are in the sequence. Use reset to re-start this sequence. Use previous to step backwards through this sequence.
Type
Date | null

previous() → {Date|null}

Sets this sequence's current time to the previous time in the sequence and returns that time.
Source:
Returns:
The previous time of this sequence, or null if the sequence is currently at its start time. Use next to step forwards through this sequence.
Type
Date | null

reset()

Resets this sequence's current time to its start time. Use next to step forwards through this sequence. Use previous to step backwards through this sequence.
Source: