TimeInterval

external class TimeInterval(source)

An interval defined by a start and a stop time; optionally including those times as part of the interval. Arbitrary data can optionally be associated with each instance for used with TimeIntervalCollection.

// Create an instance that spans August 1st, 1980 and is associated
// with a Cartesian position.
const timeInterval = new TimeInterval({
start : JulianDate.fromIso8601('1980-08-01T00:00:00Z'),
stop : JulianDate.fromIso8601('1980-08-02T00:00:00Z'),
isStartIncluded : true,
isStopIncluded : false,
data : Cartesian3.fromDegrees(39.921037, -75.170082)
});
// Create two instances from ISO 8601 intervals with associated numeric data
// then compute their intersection, summing the data they contain.
const left = TimeInterval.fromIso8601({
iso8601 : '2000/2010',
data : 2
});

const right = TimeInterval.fromIso8601({
iso8601 : '1995/2005',
data : 3
});

//The result of the below intersection will be an interval equivalent to
//const intersection = TimeInterval.fromIso8601({
// iso8601 : '2000/2005',
// data : 5
//});
const intersection = new TimeInterval();
TimeInterval.intersect(left, right, intersection, function(leftData, rightData) {
return leftData + rightData;
});
// Check if an interval contains a specific time.
const dateToCheck = JulianDate.fromIso8601('1982-09-08T11:30:00Z');
const containsDate = TimeInterval.contains(timeInterval, dateToCheck);

See also

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
var data: Any

Gets or sets the data associated with this interval.

Link copied to clipboard

Gets whether or not this interval is empty.

Link copied to clipboard

Gets or sets whether or not the start time is included in this interval.

Link copied to clipboard

Gets or sets whether or not the stop time is included in this interval.

Link copied to clipboard

Gets or sets the start time of this interval.

Link copied to clipboard

Gets or sets the stop time of this interval.

Functions

Link copied to clipboard
fun clone(result: TimeInterval? = definedExternally): TimeInterval

Duplicates this instance.

Link copied to clipboard
fun equals(right: TimeInterval? = definedExternally, dataComparer: DataComparer? = definedExternally): Boolean

Compares this instance against the provided instance componentwise and returns true if they are equal, false otherwise.

Link copied to clipboard
fun equalsEpsilon(right: TimeInterval? = definedExternally, epsilon: Double? = definedExternally, dataComparer: DataComparer? = definedExternally): Boolean

Compares this instance against the provided instance componentwise and returns true if they are within the provided epsilon, false otherwise.