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
startis included in the interval or not. -
isStopIncluded
-
Indicates if
stopis 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
trueif this interval contains the specified date.Parameters:
Name Type Description dateJulianDate The date to check for. Returns:
Booleantrueif the TimeInterval contains the specified date,falseotherwise. -
equals
-
Compares this TimeInterval against the provided TimeInterval componentwise and returns
trueif they are equal,falseotherwise.Parameters:
Name Type Argument Description rightTimeInterval <optional>
The right hand side Cartesian. Returns:
Booleantrueif they are equal,falseotherwise. -
equalsEpsilon
-
Compares this TimeInterval against the provided TimeInterval componentwise and returns
trueif they are within the provided epsilon,falseotherwise.Parameters:
Name Type Argument Description rightTimeInterval <optional>
The right hand side Cartesian. epsilonNumber The epsilon to use for equality testing. Throws:
DeveloperError : epsilon is required and must be a number.Returns:
Booleantrueif they are within the provided epsilon,falseotherwise. -
<static> equals
-
Compares the provided TimeIntervals componentwise and returns
trueif they are equal,falseotherwise.Parameters:
Name Type Argument Description leftTimeInterval <optional>
The first Cartesian. rightTimeInterval <optional>
The second Cartesian. Returns:
Booleantrueif left and right are equal,falseotherwise. -
<static> equalsEpsilon
-
Compares the provided TimeIntervals componentwise and returns
trueif they are within the provided epsilon,falseotherwise.Parameters:
Name Type Argument Description leftTimeInterval <optional>
The first TimeInterval. rightTimeInterval <optional>
The second TimeInterval. epsilonNumber The epsilon to use for equality testing. Throws:
DeveloperError : epsilon is required and must be number.Returns:
Booleantrueif left and right are within the provided epsilon,falseotherwise. -
<static> fromIso8601
-
Creates an immutable TimeInterval from an ISO 8601 interval string.
Parameters:
Name Type Argument Default Description iso8601StringString A valid ISO8601 interval. isStartIncludedBoolean <optional>
true trueif the start date is included in the interval,falseotherwise.isStopIncludedBoolean <optional>
true trueif the stop date is included in the interval,falseotherwise.dataObject <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 otherTimeInterval The interval to intersect with this interval. mergeCallbackFunction <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.
