Appearance
KBE3D / KBCore / Cesium / TimeIntervalCollection
类: TimeIntervalCollection
A non-overlapping collection of TimeInterval instances sorted by start time.
参数
An array of intervals to add to the collection.
属性
changedEvent
readonlychangedEvent:Event
Gets an event that is raised whenever the collection of intervals change.
start
readonlystart:JulianDate
Gets the start time of the collection.
isStartIncluded
readonlyisStartIncluded:boolean
Gets whether or not the start time is included in the collection.
stop
readonlystop:JulianDate
Gets the stop time of the collection.
isStopIncluded
readonlyisStopIncluded:boolean
Gets whether or not the stop time is included in the collection.
length
readonlylength:number
Gets the number of intervals in the collection.
isEmpty
readonlyisEmpty:boolean
Gets whether or not the collection is empty.
方法
fromJulianDateArray()
staticfromJulianDateArray(options: {julianDates:JulianDate[];isStartIncluded?:boolean;isStopIncluded?:boolean;leadingInterval?:boolean;trailingInterval?:boolean;dataCallback?: (...params:any[]) =>any; },result?:TimeIntervalCollection):TimeIntervalCollection
Creates a new instance from a JulianDate array.
参数
options
Object with the following properties:
julianDates
An array of ISO 8601 dates.
isStartIncluded?
boolean
<code>true</code> if start time is included in the interval, <code>false</code> otherwise.
isStopIncluded?
boolean
<code>true</code> if stop time is included in the interval, <code>false</code> otherwise.
leadingInterval?
boolean
<code>true</code> if you want to add a interval from Iso8601.MINIMUM_VALUE to start time, <code>false</code> otherwise.
trailingInterval?
boolean
<code>true</code> if you want to add a interval from stop time to Iso8601.MAXIMUM_VALUE, <code>false</code> otherwise.
dataCallback?
(...params: any[]) => any
A function that will be return the data that is called with each interval before it is added to the collection. If unspecified, the data will be the index in the collection.
result?
TimeIntervalCollection
An existing instance to use for the result.
返回
TimeIntervalCollection
The modified result parameter or a new instance if none was provided.
fromIso8601()
staticfromIso8601(options: {iso8601:string;isStartIncluded?:boolean;isStopIncluded?:boolean;leadingInterval?:boolean;trailingInterval?:boolean;dataCallback?: (...params:any[]) =>any; },result?:TimeIntervalCollection):TimeIntervalCollection
Creates a new instance from an ISO 8601 time interval (start/end/duration).
参数
options
Object with the following properties:
iso8601
string
An ISO 8601 interval.
isStartIncluded?
boolean
<code>true</code> if start time is included in the interval, <code>false</code> otherwise.
isStopIncluded?
boolean
<code>true</code> if stop time is included in the interval, <code>false</code> otherwise.
leadingInterval?
boolean
<code>true</code> if you want to add a interval from Iso8601.MINIMUM_VALUE to start time, <code>false</code> otherwise.
trailingInterval?
boolean
<code>true</code> if you want to add a interval from stop time to Iso8601.MAXIMUM_VALUE, <code>false</code> otherwise.
dataCallback?
(...params: any[]) => any
A function that will be return the data that is called with each interval before it is added to the collection. If unspecified, the data will be the index in the collection.
result?
TimeIntervalCollection
An existing instance to use for the result.
返回
TimeIntervalCollection
The modified result parameter or a new instance if none was provided.
fromIso8601DateArray()
staticfromIso8601DateArray(options: {iso8601Dates:string[];isStartIncluded?:boolean;isStopIncluded?:boolean;leadingInterval?:boolean;trailingInterval?:boolean;dataCallback?: (...params:any[]) =>any; },result?:TimeIntervalCollection):TimeIntervalCollection
Creates a new instance from a ISO 8601 date array.
参数
options
Object with the following properties:
iso8601Dates
string[]
An array of ISO 8601 dates.
isStartIncluded?
boolean
<code>true</code> if start time is included in the interval, <code>false</code> otherwise.
isStopIncluded?
boolean
<code>true</code> if stop time is included in the interval, <code>false</code> otherwise.
leadingInterval?
boolean
<code>true</code> if you want to add a interval from Iso8601.MINIMUM_VALUE to start time, <code>false</code> otherwise.
trailingInterval?
boolean
<code>true</code> if you want to add a interval from stop time to Iso8601.MAXIMUM_VALUE, <code>false</code> otherwise.
dataCallback?
(...params: any[]) => any
A function that will be return the data that is called with each interval before it is added to the collection. If unspecified, the data will be the index in the collection.
result?
TimeIntervalCollection
An existing instance to use for the result.
返回
TimeIntervalCollection
The modified result parameter or a new instance if none was provided.
fromIso8601DurationArray()
staticfromIso8601DurationArray(options: {epoch:JulianDate;iso8601Durations:string;relativeToPrevious?:boolean;isStartIncluded?:boolean;isStopIncluded?:boolean;leadingInterval?:boolean;trailingInterval?:boolean;dataCallback?: (...params:any[]) =>any; },result?:TimeIntervalCollection):TimeIntervalCollection
Creates a new instance from a ISO 8601 duration array.
参数
options
Object with the following properties:
epoch
An date that the durations are relative to.
iso8601Durations
string
An array of ISO 8601 durations.
relativeToPrevious?
boolean
<code>true</code> if durations are relative to previous date, <code>false</code> if always relative to the epoch.
isStartIncluded?
boolean
<code>true</code> if start time is included in the interval, <code>false</code> otherwise.
isStopIncluded?
boolean
<code>true</code> if stop time is included in the interval, <code>false</code> otherwise.
leadingInterval?
boolean
<code>true</code> if you want to add a interval from Iso8601.MINIMUM_VALUE to start time, <code>false</code> otherwise.
trailingInterval?
boolean
<code>true</code> if you want to add a interval from stop time to Iso8601.MAXIMUM_VALUE, <code>false</code> otherwise.
dataCallback?
(...params: any[]) => any
A function that will be return the data that is called with each interval before it is added to the collection. If unspecified, the data will be the index in the collection.
result?
TimeIntervalCollection
An existing instance to use for the result.
返回
TimeIntervalCollection
The modified result parameter or a new instance if none was provided.
equals()
equals(
right?:TimeIntervalCollection,dataComparer?:DataComparer):boolean
Compares this instance against the provided instance componentwise and returns <code>true</code> if they are equal, <code>false</code> otherwise.
参数
right?
TimeIntervalCollection
The right hand side collection.
dataComparer?
A function which compares the data of the two intervals. If omitted, reference equality is used.
返回
boolean
true if they are equal, false otherwise.
get()
get(
index:number):TimeInterval|undefined
Gets the interval at the specified index.
参数
index
number
The index of the interval to retrieve.
返回
TimeInterval | undefined
The interval at the specified index, or undefined if no interval exists as that index.
removeAll()
removeAll():
void
Removes all intervals from the collection.
返回
void
findIntervalContainingDate()
findIntervalContainingDate(
date:JulianDate):TimeInterval|undefined
Finds and returns the interval that contains the specified date.
参数
date
The date to search for.
返回
TimeInterval | undefined
The interval containing the specified date, undefined if no such interval exists.
findDataForIntervalContainingDate()
findDataForIntervalContainingDate(
date:JulianDate):any
Finds and returns the data for the interval that contains the specified date.
参数
date
The date to search for.
返回
any
The data for the interval containing the specified date, or undefined if no such interval exists.
contains()
contains(
julianDate:JulianDate):boolean
Checks if the specified date is inside this collection.
参数
julianDate
The date to check.
返回
boolean
true if the collection contains the specified date, false otherwise.
indexOf()
indexOf(
date:JulianDate):number
Finds and returns the index of the interval in the collection that contains the specified date.
参数
date
The date to search for.
返回
number
The index of the interval that contains the specified date, if no such interval exists, it returns a negative number which is the bitwise complement of the index of the next interval that starts after the date, or if no interval starts after the specified date, the bitwise complement of the length of the collection.
findInterval()
findInterval(
options?: {start?:JulianDate;stop?:JulianDate;isStartIncluded?:boolean;isStopIncluded?:boolean; }):TimeInterval|undefined
Returns the first interval in the collection that matches the specified parameters. All parameters are optional and <code>undefined</code> parameters are treated as a don't care condition.
参数
options?
Object with the following properties:
start?
The start time of the interval.
stop?
The stop time of the interval.
isStartIncluded?
boolean
<code>true</code> if <code>options.start</code> is included in the interval, <code>false</code> otherwise.
isStopIncluded?
boolean
<code>true</code> if <code>options.stop</code> is included in the interval, <code>false</code> otherwise.
返回
TimeInterval | undefined
The first interval in the collection that matches the specified parameters.
addInterval()
addInterval(
interval:TimeInterval,dataComparer?:DataComparer):void
Adds an interval to the collection, merging intervals that contain the same data and splitting intervals of different data as needed in order to maintain a non-overlapping collection. The data in the new interval takes precedence over any existing intervals in the collection.
参数
interval
The interval to add.
dataComparer?
A function which compares the data of the two intervals. If omitted, reference equality is used.
返回
void
removeInterval()
removeInterval(
interval:TimeInterval):boolean
Removes the specified interval from this interval collection, creating a hole over the specified interval. The data property of the input interval is ignored.
参数
interval
The interval to remove.
返回
boolean
true if the interval was removed, false if no part of the interval was in the collection.
intersect()
intersect(
other:TimeIntervalCollection,dataComparer?:DataComparer,mergeCallback?:MergeCallback):TimeIntervalCollection
Creates a new instance that is the intersection of this collection and the provided collection.
参数
other
TimeIntervalCollection
The collection to intersect with.
dataComparer?
A function which compares the data of the two intervals. If omitted, reference equality is used.
mergeCallback?
A function which merges the data of the two intervals. If omitted, the data from the left interval will be used.
返回
TimeIntervalCollection
A new TimeIntervalCollection which is the intersection of this collection and the provided collection.
构造函数
构造函数
new TimeIntervalCollection(
intervals?:TimeInterval[]):TimeIntervalCollection
参数
intervals?
返回
TimeIntervalCollection
