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.
alias TimeInterval
- The options object takes the following properties
- {JulianDate} [options.start=new JulianDate()] The start time of the interval.
- {JulianDate} [options.stop=new JulianDate()] The stop time of the interval.
- {Boolean} [options.isStartIncluded=true] true if options.start is included in the interval, false otherwise.
- {Boolean} [options.isStopIncluded=true] true if options.stop is included in the interval, false otherwise.
- {Object} [options.data] Arbitrary data associated with this interval.
// Check if an interval contains a specific time.
var dateToCheck = Cesium.JulianDate.fromIso8601('1982-09-08T11:30:00Z');
var containsDate = Cesium.TimeInterval.contains(timeInterval, dateToCheck);
,
// Create two instances from ISO 8601 intervals with associated numeric data
// then compute their intersection, summing the data they contain.
var left = Cesium.TimeInterval.fromIso8601({
iso8601 : '2000/2010',
data : 2
});
var right = Cesium.TimeInterval.fromIso8601({
iso8601 : '1995/2005',
data : 3
});
//The result of the below intersection will be an interval equivalent to
//var intersection = Cesium.TimeInterval.fromIso8601({
// iso8601 : '2000/2005',
// data : 5
//});
var intersection = new Cesium.TimeInterval();
Cesium.TimeInterval.intersect(left, right, intersection, function(leftData, rightData) {
return leftData + rightData;
});
,
// Create an instance that spans August 1st, 1980 and is associated
// with a Cartesian position.
var timeInterval = new Cesium.TimeInterval({
start : Cesium.JulianDate.fromIso8601('1980-08-01T00:00:00Z'),
stop : Cesium.JulianDate.fromIso8601('1980-08-02T00:00:00Z'),
isStartIncluded : true,
isStopIncluded : false,
data : Cesium.Cartesian3.fromDegrees(39.921037, -75.170082)
});
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.
alias TimeInterval
- The options object takes the following properties - {JulianDate} [options.start=new JulianDate()] The start time of the interval. - {JulianDate} [options.stop=new JulianDate()] The stop time of the interval. - {Boolean} [options.isStartIncluded=true]
true
ifoptions.start
is included in the interval,false
otherwise. - {Boolean} [options.isStopIncluded=true]true
ifoptions.stop
is included in the interval,false
otherwise. - {Object} [options.data] Arbitrary data associated with this interval.// Check if an interval contains a specific time. var dateToCheck = Cesium.JulianDate.fromIso8601('1982-09-08T11:30:00Z'); var containsDate = Cesium.TimeInterval.contains(timeInterval, dateToCheck);
// Create two instances from ISO 8601 intervals with associated numeric data // then compute their intersection, summing the data they contain. var left = Cesium.TimeInterval.fromIso8601({ iso8601 : '2000/2010', data : 2 }); var right = Cesium.TimeInterval.fromIso8601({ iso8601 : '1995/2005', data : 3 }); //The result of the below intersection will be an interval equivalent to //var intersection = Cesium.TimeInterval.fromIso8601({ // iso8601 : '2000/2005', // data : 5 //}); var intersection = new Cesium.TimeInterval(); Cesium.TimeInterval.intersect(left, right, intersection, function(leftData, rightData) { return leftData + rightData; });
// Create an instance that spans August 1st, 1980 and is associated // with a Cartesian position. var timeInterval = new Cesium.TimeInterval({ start : Cesium.JulianDate.fromIso8601('1980-08-01T00:00:00Z'), stop : Cesium.JulianDate.fromIso8601('1980-08-02T00:00:00Z'), isStartIncluded : true, isStopIncluded : false, data : Cesium.Cartesian3.fromDegrees(39.921037, -75.170082) });