TimeInterval

new TimeInterval(start, stop, isStartIncluded, isStopIncluded, [data)

An interval defined by a start date and a stop date. The end points are optionally included in the interval. The interval should be treated as immutable.
Name Type Default Description
start JulianDate The start date of the interval.
stop JulianDate The stop date of the interval.
isStartIncluded Boolean true optional true if the start date is included in the interval, false otherwise.
isStopIncluded Boolean true optional true if the stop date is included in the interval, false otherwise.
[data Object The data associated with this interval.
Throws:
Example:
// Construct an Timeinterval closed on one end with a Color payload.
var interval = new Cesium.TimeInterval(Cesium.JulianDate.fromTotalDays(1000), Cesium.JulianDate.fromTotalDays(1001), true, false, Cesium.Color.WHITE);
See:

Members

staticTimeInterval.EMPTY

An empty interval.

data

The data associated with this interval.

isEmpty

Indicates if the interval is empty.

isStartIncluded

Indicates if start is included in the interval or not.

isStopIncluded

Indicates if stop is included in the interval or not.

start

The start time of the interval.

stop

The stop time of the interval.

Methods

staticTimeInterval.equals(left, right, dataComparer)Boolean

Compares the provided TimeIntervals and returns true if they are equal, false otherwise.
Name Type Description
left TimeInterval optional The first interval.
right TimeInterval optional The second interval.
dataComparer function optional A function which compares the data of the two intervals. If ommitted, reference equality is used.
Returns:
true if left and right are equal, false otherwise.

staticTimeInterval.equalsEpsilon(left, right, epsilon, dataComparer)Boolean

Compares the provided TimeIntervals componentwise and returns true if they are within the provided epsilon, false otherwise.
Name Type Description
left TimeInterval optional The first TimeInterval.
right TimeInterval optional The second TimeInterval.
epsilon Number The epsilon to use for equality testing.
dataComparer function optional A function which compares the data of the two intervals. If ommitted, reference equality is used.
Returns:
true if left and right are within the provided epsilon, false otherwise.

staticTimeInterval.fromIso8601(iso8601String, isStartIncluded, isStopIncluded, data)TimeInterval

Creates an immutable TimeInterval from an ISO 8601 interval string.
Name Type Default Description
iso8601String String A valid ISO8601 interval.
isStartIncluded Boolean true optional true if the start date is included in the interval, false otherwise.
isStopIncluded Boolean true optional true if the stop date is included in the interval, false otherwise.
data Object optional The data associated with this interval.
Returns:
The new TimeInterval instance or undefined if an invalid ISO8601 string is provided.
Example:
// Construct an open Timeinterval with a Cartesian data payload.
var interval = Cesium.TimeInterval.fromIso8601('2012-03-15T11:02:24.55Z/2012-03-15T12:28:24.03Z', false, false, new Cesium.Cartesian3(1,2,3));
See:

clone()

Creates a copy of this TimeInterval.
Returns:
A new TimeInterval that is equal to this interval.

contains(date)Boolean

Returns true if this interval contains the specified date.
Name Type Description
date JulianDate The date to check for.
Returns:
true if the TimeInterval contains the specified date, false otherwise.

equals(right, dataComparer)Boolean

Compares this TimeInterval against the provided TimeInterval componentwise and returns true if they are equal, false otherwise.
Name Type Description
right TimeInterval optional The right hand side Cartesian.
dataComparer function optional A function which compares the data of the two intervals. If ommitted, reference equality is used.
Returns:
true if they are equal, false otherwise.

equalsEpsilon(right, epsilon, dataComparer)Boolean

Compares this TimeInterval against the provided TimeInterval componentwise and returns true if they are within the provided epsilon, false otherwise.
Name Type Description
right TimeInterval optional The right hand side Cartesian.
epsilon Number The epsilon to use for equality testing.
dataComparer function optional A function which compares the data of the two intervals. If ommitted, reference equality is used.
Returns:
true if they are within the provided epsilon, false otherwise.

intersect(other, mergeCallback)TimeInterval

Computes an interval which is the intersection of this interval with another while also providing a means to merge the data of the two intervals.
Name Type Description
other TimeInterval The interval to intersect with this interval.
mergeCallback function optional A callback which takes the data property from both intervals as input and merges it into a single new value. If the callback is undefined, this will intersect the two intervals and return the new interval with the data from this interval.
Returns:
The new TimeInterval that is the intersection of the two intervals, with its data representing the merge of the data in the two existing intervals.