A
Property 其值是根据提供的样本集和指定的插值算法和程度在给定时间内插值的。 whose value is interpolated for a given time from the provided set of samples and specified interpolation algorithm and degree.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
type |
number | Packable | 财产类型。 The type of property. |
derivativeTypes |
Array.<Packable> | 可选 optional 提供时,表示样本将包含指定类型的衍生信息。 When supplied, indicates that samples will contain derivative information of the specified types. |
示例: Examples:
//Create a linearly interpolated Cartesian2
const property = new Cesium.SampledProperty(Cesium.Cartesian2);
//Populate it with data
property.addSample(Cesium.JulianDate.fromIso8601('2012-08-01T00:00:00.00Z'), new Cesium.Cartesian2(0, 0));
property.addSample(Cesium.JulianDate.fromIso8601('2012-08-02T00:00:00.00Z'), new Cesium.Cartesian2(4, 7));
//Retrieve an interpolated value
const result = property.getValue(Cesium.JulianDate.fromIso8601('2012-08-01T12:00:00.00Z'));
//Create a simple numeric SampledProperty that uses third degree Hermite Polynomial Approximation
const property = new Cesium.SampledProperty(Number);
property.setInterpolationOptions({
interpolationDegree : 3,
interpolationAlgorithm : Cesium.HermitePolynomialApproximation
});
//Populate it with data
property.addSample(Cesium.JulianDate.fromIso8601('2012-08-01T00:00:00.00Z'), 1.0);
property.addSample(Cesium.JulianDate.fromIso8601('2012-08-01T00:01:00.00Z'), 6.0);
property.addSample(Cesium.JulianDate.fromIso8601('2012-08-01T00:02:00.00Z'), 12.0);
property.addSample(Cesium.JulianDate.fromIso8601('2012-08-01T00:03:30.00Z'), 5.0);
property.addSample(Cesium.JulianDate.fromIso8601('2012-08-01T00:06:30.00Z'), 2.0);
//Samples can be added in any order.
property.addSample(Cesium.JulianDate.fromIso8601('2012-08-01T00:00:30.00Z'), 6.2);
//Retrieve an interpolated value
const result = property.getValue(Cesium.JulianDate.fromIso8601('2012-08-01T00:02:34.00Z'));
另见: See:
成员 Members
获取或设置属性变为未定义之前向后推断的时间量。值为 0 将永远进行推断。 Gets or sets the amount of time to extrapolate backward before the property becomes undefined. A value of 0 will extrapolate forever.
-
默认值: Default Value:
0
backwardExtrapolationType : ExtrapolationType
获取或设置在任何可用样本之前每次请求值时要执行的外推类型。 Gets or sets the type of extrapolation to perform when a value is requested at a time before any available samples.
-
默认值: Default Value:
ExtrapolationType.NONE
readonly definitionChanged : Event
获取每当此属性的定义更改时引发的事件。如果对 getValue 的调用同时返回不同的结果,则认为定义已更改。 Gets the event that is raised whenever the definition of this property changes. The definition is considered to have changed if a call to getValue would return a different result for the same time.
derivativeTypes : Array.<Packable>
获取此属性使用的派生类型。 Gets the derivative types used by this property.
获取或设置属性变为未定义之前向前推断的时间量。值为 0 将永远进行推断。 Gets or sets the amount of time to extrapolate forward before the property becomes undefined. A value of 0 will extrapolate forever.
-
默认值: Default Value:
0
forwardExtrapolationType : ExtrapolationType
获取或设置在任何可用样本之后每次请求值时要执行的外推类型。 Gets or sets the type of extrapolation to perform when a value is requested at a time after any available samples.
-
默认值: Default Value:
ExtrapolationType.NONE
interpolationAlgorithm : InterpolationAlgorithm
获取检索值时要使用的插值算法。 Gets the interpolation algorithm to use when retrieving a value.
-
默认值: Default Value:
LinearApproximation
获取检索值时要执行的插值程度。 Gets the degree of interpolation to perform when retrieving a value.
-
默认值: Default Value:
1
获取一个值,该值指示该属性是否为常量。如果 getValue 始终为当前定义返回相同的结果,则属性被视为常量。 Gets a value indicating if this property is constant. A property is considered constant if getValue always returns the same result for the current definition.
获取属性的类型。 Gets the type of property.
方法 Methods
添加新样本。 Adds a new sample.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
time |
JulianDate | 采样时间。 The sample time. |
value |
Packable | 所提供时间的值。 The value at the provided time. |
derivatives |
Array.<Packable> | 可选 optional 所提供时间的导数数组。 The array of derivatives at the provided time. |
添加样本数组。 Adds an array of samples.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
times |
Array.<JulianDate> | JulianDate 实例的数组,其中每个索引都是采样时间。 An array of JulianDate instances where each index is a sample time. |
values |
Array.<Packable> | 值数组,其中每个值对应于提供的时间索引。 The array of values, where each value corresponds to the provided times index. |
derivativeValues |
Array.<Array> | 可选 optional 一个数组,其中每个项目都是等效时间索引处的导数数组。 An array where each item is the array of derivatives at the equivalent time index. |
抛出: Throws:
-
DeveloperError :时间和值的长度必须相同。 : times and values must be the same length.
-
DeveloperError : times and derivativeValues must be the same length.
将样本添加为单个打包数组,其中每个新样本都表示为日期,后跟相应值和导数的打包表示形式。 Adds samples as a single packed array where each new sample is represented as a date, followed by the packed representation of the corresponding value and derivatives.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
packedSamples |
Array.<number> | 包装样本的数组。 The array of packed samples. |
epoch |
JulianDate | 可选 optional 如果 PackedSamples 中的任何日期是数字,则它们被视为距该纪元的偏移量(以秒为单位)。 If any of the dates in packedSamples are numbers, they are considered an offset from this epoch, in seconds. |
将此属性与提供的属性进行比较并返回 Compares this property to the provided property and returns
true 如果它们相等, if they are equal, false otherwise.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
other |
Property | 可选 optional 其他财产。 The other property. |
返回: Returns:
true 如果左和右相等, if left and right are equal, false otherwise.
getSample(index) → JulianDate|undefined
检索与索引关联的所提供样本的时间。负索引以相反的顺序访问样本列表。 Retrieves the time of the provided sample associated with the index. A negative index accesses the list of samples in reverse order.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
index |
number | 样本列表索引。 The index of samples list. |
返回: Returns:
样本的 JulianDate 时间,如果失败则未定义。 The JulianDate time of the sample, or undefined if failed.
获取指定时间的属性值。 Gets the value of the property at the provided time.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
time |
JulianDate |
JulianDate.now()
|
可选 optional 检索值的时间。如果省略,则使用当前系统时间。 The time for which to retrieve the value. If omitted, the current system time is used. |
result |
object | 可选 optional 用于存储值的对象,如果省略,则会创建并返回一个新实例。 The object to store the value into, if omitted, a new instance is created and returned. |
返回: Returns:
修改后的结果参数或新实例(如果未提供结果参数)。 The modified result parameter or a new instance if the result parameter was not supplied.
在给定时间移除样本(如果存在)。 Removes a sample at the given time, if present.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
time |
JulianDate | 采样时间。 The sample time. |
返回: Returns:
true 如果当时移除了一个样本, if a sample at time was removed, false otherwise.
删除给定时间间隔内的所有样本。 Removes all samples for the given time interval.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
time |
TimeInterval | 删除所有样本的时间间隔。 The time interval for which to remove all samples. |
设置插值时要使用的算法和程度。 Sets the algorithm and degree to use when interpolating a value.
| 名称 Name | 类型 Type | 说明 Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
可选 optional
具有以下属性的对象: Object with the following properties:
|
