new TimeInterval
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.
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
start |
JulianDate | The start date of the interval. | ||
stop |
JulianDate | The stop date of the interval. | ||
isStartIncluded |
Boolean |
<optional> |
true | true if the start date is included in the interval, false otherwise. |
isStopIncluded |
Boolean |
<optional> |
true | true if the stop date is included in the interval, false otherwise. |
[data |
Object | The data associated with this interval. |
Throws:
-
DeveloperError : start must be specified.
-
DeveloperError : stop must be specified.
Example
// Construct an Timeinterval closed on one end with a Color payload. var interval = new TimeInterval(JulianDate.fromTotalDays(1000), JulianDate.fromTotalDays(1001), true, false, Color.WHITE);
Members
-
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.
-
<static> EMPTY
-
An empty interval.
Methods
-
clone
-
Creates a copy of this TimeInterval.
Returns:
A new TimeInterval that is equal to this interval. -
contains
-
Returns
true
if this interval contains the specified date.Parameters:
Name Type Description date
JulianDate The date to check for. Returns:
Booleantrue
if the TimeInterval contains the specified date,false
otherwise. -
equals
-
Compares this TimeInterval against the provided TimeInterval componentwise and returns
true
if they are equal,false
otherwise.Parameters:
Name Type Argument 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:
Booleantrue
if they are equal,false
otherwise. -
equalsEpsilon
-
Compares this TimeInterval against the provided TimeInterval componentwise and returns
true
if they are within the provided epsilon,false
otherwise.Parameters:
Name Type Argument 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. Throws:
DeveloperError : epsilon is required and must be a number.Returns:
Booleantrue
if they are within the provided epsilon,false
otherwise. -
<static> equals
-
Compares the provided TimeIntervals and returns
true
if they are equal,false
otherwise.Parameters:
Name Type Argument 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:
Booleantrue
if left and right are equal,false
otherwise. -
<static> equalsEpsilon
-
Compares the provided TimeIntervals componentwise and returns
true
if they are within the provided epsilon,false
otherwise.Parameters:
Name Type Argument 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. Throws:
DeveloperError : epsilon is required and must be number.Returns:
Booleantrue
if left and right are within the provided epsilon,false
otherwise. -
<static> fromIso8601
-
Creates an immutable TimeInterval from an ISO 8601 interval string.
Parameters:
Name Type Argument Default Description iso8601String
String A valid ISO8601 interval. isStartIncluded
Boolean <optional>
true true
if the start date is included in the interval,false
otherwise.isStopIncluded
Boolean <optional>
true true
if the stop date is included in the interval,false
otherwise.data
Object <optional>
The data associated with this interval. Returns:
Example
// Construct an open Timeinterval with a Cartesian data payload. var interval = TimeInterval.fromIso8601('2012-03-15T11:02:24.55Z/2012-03-15T12:28:24.03Z', false, false, new Cartesian3(1,2,3));
-
<static> prototype.intersect
-
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.
Parameters:
Name Type Argument 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:
TimeInterval 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.