English中文

TimeIntervalCollection

new Cesium.TimeIntervalCollection(intervals)

不重叠的集合 A non-overlapping collection of TimeInterval 实例按开始时间排序。 instances sorted by start time.
名称 Name 类型 Type 说明 Description
intervals Array.<TimeInterval> 可选 optional 要添加到集合中的间隔数组。 An array of intervals to add to the collection.

成员 Members

获取每当间隔集合发生更改时引发的事件。 Gets an event that is raised whenever the collection of intervals change.
获取集合是否为空。 Gets whether or not the collection is empty.

readonly isStartIncluded : boolean

获取开始时间是否包含在集合中。 Gets whether or not the start time is included in the collection.

readonly isStopIncluded : boolean

获取停止时间是否包含在集合中。 Gets whether or not the stop time is included in the collection.
获取集合中的间隔数。 Gets the number of intervals in the collection.
获取集合的开始时间。 Gets the start time of the collection.
获取集合的停止时间。 Gets the stop time of the collection.

方法 Methods

static Cesium.TimeIntervalCollection.fromIso8601(options, result)TimeIntervalCollection

从创建一个新实例 Creates a new instance from an ISO 8601 时间间隔(开始/结束/持续时间)。 time interval (start/end/duration).
名称 Name 类型 Type 说明 Description
options object 具有以下属性的对象: Object with the following properties:
名称 Name 类型 Type 默认值 Default 说明 Description
iso8601 string ISO 8601 间隔。 An ISO 8601 interval.
isStartIncluded boolean true 可选 optional true 如果开始时间包含在间隔中, if start time is included in the interval, false otherwise.
isStopIncluded boolean true 可选 optional true 如果间隔时间包含停止时间, if stop time is included in the interval, false otherwise.
leadingInterval boolean false 可选 optional true 如果您想添加从 Iso8601.MINIMUM_VALUE 到开始时间的间隔, if you want to add a interval from Iso8601.MINIMUM_VALUE to start time, false otherwise.
trailingInterval boolean false 可选 optional true 如果您想添加从停止时间到 Iso8601.MAXIMUM_VALUE 的间隔, if you want to add a interval from stop time to Iso8601.MAXIMUM_VALUE, false otherwise.
dataCallback function 可选 optional 一个函数,将返回在添加到集合之前每个间隔调用的数据。如果未指定,数据将是集合中的索引。 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 可选 optional 用于结果的现有实例。 An existing instance to use for the result.
返回: Returns:
修改后的结果参数或新实例(如果未提供)。 The modified result parameter or a new instance if none was provided.

static Cesium.TimeIntervalCollection.fromIso8601DateArray(options, result)TimeIntervalCollection

从创建一个新实例 Creates a new instance from a ISO 8601 日期数组。 date array.
名称 Name 类型 Type 说明 Description
options object 具有以下属性的对象: Object with the following properties:
名称 Name 类型 Type 默认值 Default 说明 Description
iso8601Dates Array.<string> ISO 8601 日期数组。 An array of ISO 8601 dates.
isStartIncluded boolean true 可选 optional true 如果开始时间包含在间隔中, if start time is included in the interval, false otherwise.
isStopIncluded boolean true 可选 optional true 如果间隔时间包含停止时间, if stop time is included in the interval, false otherwise.
leadingInterval boolean false 可选 optional true 如果您想添加从 Iso8601.MINIMUM_VALUE 到开始时间的间隔, if you want to add a interval from Iso8601.MINIMUM_VALUE to start time, false otherwise.
trailingInterval boolean false 可选 optional true 如果您想添加从停止时间到 Iso8601.MAXIMUM_VALUE 的间隔, if you want to add a interval from stop time to Iso8601.MAXIMUM_VALUE, false otherwise.
dataCallback function 可选 optional 一个函数,将返回在添加到集合之前每个间隔调用的数据。如果未指定,数据将是集合中的索引。 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 可选 optional 用于结果的现有实例。 An existing instance to use for the result.
返回: Returns:
修改后的结果参数或新实例(如果未提供)。 The modified result parameter or a new instance if none was provided.

static Cesium.TimeIntervalCollection.fromIso8601DurationArray(options, result)TimeIntervalCollection

从创建一个新实例 Creates a new instance from a ISO 8601 持续时间数组。 duration array.
名称 Name 类型 Type 说明 Description
options object 具有以下属性的对象: Object with the following properties:
名称 Name 类型 Type 默认值 Default 说明 Description
epoch JulianDate 与持续时间相关的日期。 An date that the durations are relative to.
iso8601Durations string ISO 8601 持续时间数组。 An array of ISO 8601 durations.
relativeToPrevious boolean false 可选 optional true 如果持续时间与前一个日期相关, if durations are relative to previous date, false 如果总是相对于时代。 if always relative to the epoch.
isStartIncluded boolean true 可选 optional true 如果开始时间包含在间隔中, if start time is included in the interval, false otherwise.
isStopIncluded boolean true 可选 optional true 如果间隔时间包含停止时间, if stop time is included in the interval, false otherwise.
leadingInterval boolean false 可选 optional true 如果您想添加从 Iso8601.MINIMUM_VALUE 到开始时间的间隔, if you want to add a interval from Iso8601.MINIMUM_VALUE to start time, false otherwise.
trailingInterval boolean false 可选 optional true 如果您想添加从停止时间到 Iso8601.MAXIMUM_VALUE 的间隔, if you want to add a interval from stop time to Iso8601.MAXIMUM_VALUE, false otherwise.
dataCallback function 可选 optional 一个函数,将返回在添加到集合之前每个间隔调用的数据。如果未指定,数据将是集合中的索引。 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 可选 optional 用于结果的现有实例。 An existing instance to use for the result.
返回: Returns:
修改后的结果参数或新实例(如果未提供)。 The modified result parameter or a new instance if none was provided.

static Cesium.TimeIntervalCollection.fromJulianDateArray(options, result)TimeIntervalCollection

从 JulianDate 数组创建一个新实例。 Creates a new instance from a JulianDate array.
名称 Name 类型 Type 说明 Description
options object 具有以下属性的对象: Object with the following properties:
名称 Name 类型 Type 默认值 Default 说明 Description
julianDates Array.<JulianDate> ISO 8601 日期数组。 An array of ISO 8601 dates.
isStartIncluded boolean true 可选 optional true 如果开始时间包含在间隔中, if start time is included in the interval, false otherwise.
isStopIncluded boolean true 可选 optional true 如果间隔时间包含停止时间, if stop time is included in the interval, false otherwise.
leadingInterval boolean false 可选 optional true 如果您想添加从 Iso8601.MINIMUM_VALUE 到开始时间的间隔, if you want to add a interval from Iso8601.MINIMUM_VALUE to start time, false otherwise.
trailingInterval boolean false 可选 optional true 如果您想添加从停止时间到 Iso8601.MAXIMUM_VALUE 的间隔, if you want to add a interval from stop time to Iso8601.MAXIMUM_VALUE, false otherwise.
dataCallback function 可选 optional 一个函数,将返回在添加到集合之前每个间隔调用的数据。如果未指定,数据将是集合中的索引。 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 可选 optional 用于结果的现有实例。 An existing instance to use for the result.
返回: Returns:
修改后的结果参数或新实例(如果未提供)。 The modified result parameter or a new instance if none was provided.

addInterval(interval, dataComparer)

将间隔添加到集合中,合并包含相同数据的间隔并根据需要分割不同数据的间隔,以维护不重叠的集合。新间隔中的数据优先于集合中的任何现有间隔。 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.
名称 Name 类型 Type 说明 Description
interval TimeInterval 要添加的间隔。 The interval to add.
dataComparer TimeInterval.DataComparer 可选 optional 比较两个间隔的数据的函数。如果省略,则使用引用相等。 A function which compares the data of the two intervals. If omitted, reference equality is used.

contains(julianDate)boolean

检查指定的日期是否在此集合内。 Checks if the specified date is inside this collection.
名称 Name 类型 Type 说明 Description
julianDate JulianDate 要检查的日期。 The date to check.
返回: Returns:
true 如果集合包含指定日期, if the collection contains the specified date, false otherwise.

equals(right, dataComparer)boolean

将此实例与提供的实例按组件进行比较并返回 Compares this instance against the provided instance componentwise and returns true 如果它们相等, if they are equal, false otherwise.
名称 Name 类型 Type 说明 Description
right TimeIntervalCollection 可选 optional 右侧集合。 The right hand side collection.
dataComparer TimeInterval.DataComparer 可选 optional 比较两个间隔的数据的函数。如果省略,则使用引用相等。 A function which compares the data of the two intervals. If omitted, reference equality is used.
返回: Returns:
true 如果它们相等, if they are equal, false otherwise.

findDataForIntervalContainingDate(date)object

查找并返回包含指定日期的时间间隔的数据。 Finds and returns the data for the interval that contains the specified date.
名称 Name 类型 Type 说明 Description
date JulianDate 要搜索的日期。 The date to search for.
返回: Returns:
包含指定日期的时间间隔的数据,或 The data for the interval containing the specified date, or undefined 如果不存在这样的区间。 if no such interval exists.
返回集合中与指定参数匹配的第一个间隔。所有参数都是可选的并且 Returns the first interval in the collection that matches the specified parameters. All parameters are optional and undefined 参数被视为无关条件。 parameters are treated as a don't care condition.
名称 Name 类型 Type 说明 Description
options object 可选 optional 具有以下属性的对象: Object with the following properties:
名称 Name 类型 Type 说明 Description
start JulianDate 可选 optional 间隔的开始时间。 The start time of the interval.
stop JulianDate 可选 optional 间隔的停止时间。 The stop time of the interval.
isStartIncluded boolean 可选 optional true if options.start 包含在区间内, is included in the interval, false otherwise.
isStopIncluded boolean 可选 optional true if options.stop 包含在区间内, is included in the interval, false otherwise.
返回: Returns:
集合中与指定参数匹配的第一个间隔。 The first interval in the collection that matches the specified parameters.

findIntervalContainingDate(date)TimeInterval|undefined

查找并返回包含指定日期的时间间隔。 Finds and returns the interval that contains the specified date.
名称 Name 类型 Type 说明 Description
date JulianDate 要搜索的日期。 The date to search for.
返回: Returns:
包含指定日期的间隔, The interval containing the specified date, undefined 如果不存在这样的区间。 if no such interval exists.
获取指定索引处的间隔。 Gets the interval at the specified index.
名称 Name 类型 Type 说明 Description
index number 要检索的间隔的索引。 The index of the interval to retrieve.
返回: Returns:
指定索引处的间隔,或 The interval at the specified index, or undefined 如果不存在作为该索引的区间。 if no interval exists as that index.
查找并返回集合中包含指定日期的时间间隔的索引。 Finds and returns the index of the interval in the collection that contains the specified date.
名称 Name 类型 Type 说明 Description
date JulianDate 要搜索的日期。 The date to search for.
返回: Returns:
包含指定日期的区间的索引,如果不存在这样的区间,则返回一个负数,该负数是该日期之后开始的下一个区间的索引的按位补码,或者如果指定日期之后没有开始的区间,则返回集合长度的按位补码。 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.

intersect(other, dataComparer, mergeCallback)TimeIntervalCollection

创建一个新实例,该实例是该集合与提供的集合的交集。 Creates a new instance that is the intersection of this collection and the provided collection.
名称 Name 类型 Type 说明 Description
other TimeIntervalCollection 要相交的集合。 The collection to intersect with.
dataComparer TimeInterval.DataComparer 可选 optional 比较两个间隔的数据的函数。如果省略,则使用引用相等。 A function which compares the data of the two intervals. If omitted, reference equality is used.
mergeCallback TimeInterval.MergeCallback 可选 optional 合并两个区间数据的函数。如果省略,将使用左侧间隔的数据。 A function which merges the data of the two intervals. If omitted, the data from the left interval will be used.
返回: Returns:
一个新的 TimeIntervalCollection,它是该集合与提供的集合的交集。 A new TimeIntervalCollection which is the intersection of this collection and the provided collection.
从集合中删除所有间隔。 Removes all intervals from the collection.

removeInterval(interval)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.
名称 Name 类型 Type 说明 Description
interval TimeInterval 要删除的间隔。 The interval to remove.
返回: Returns:
true 如果删除间隔, if the interval was removed, false 如果集合中没有间隔的任何部分。 if no part of the interval was in the collection.
需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.