SampledProperty

new Cesium.SampledProperty(type, derivativeTypes)

一个Property,其值在给定时间内从 提供样本集和指定的插值算法和阶数。
Name Type Description
type Number | Packable 属性的类型。
derivativeTypes Array.<Packable> optional 指定的样本类型将包含指定的派生信息。
Examples:
//Create a linearly interpolated Cartesian2
var 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
var result = property.getValue(Cesium.JulianDate.fromIso8601('2012-08-01T12:00:00.00Z'));
//Create a simple numeric SampledProperty that uses third degree Hermite Polynomial Approximation
var 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
var result = property.getValue(Cesium.JulianDate.fromIso8601('2012-08-01T00:02:34.00Z'));
See:

Members

backwardExtrapolationDuration : Number

获取或设置向后推断的时间量 在属性未定义之前。值为0将永远外推。
Default Value: 0
获取或设置值 在任何可用样本之前请求。
Default Value: ExtrapolationType.NONE

readonly definitionChanged : Event

获取每当此属性的定义更改时引发的事件。 如果对getValue的调用将返回,则认为定义已更改 一个不同的结果在同一时间。

derivativeTypes : Array.<Packable>

获取此属性使用的派生类型。

forwardExtrapolationDuration : Number

获取或设置向前外推的时间量 属性变为未定义。值为0将永远外推。
Default Value: 0
获取或设置值 在任何可用样本之后请求。
Default Value: ExtrapolationType.NONE
获取检索值时要使用的插值算法。
Default Value: LinearApproximation

interpolationDegree : Number

获取检索值时要执行的插值度数。
Default Value: 1

readonly isConstant : Boolean

获取一个值,该值指示此属性是否为常量。考虑财产 如果getValue始终为当前定义返回相同的结果,则为常量。
获取属性的类型。

Methods

addSample(time, value, derivatives)

添加新示例。
Name Type Description
time JulianDate 取样时间。
value Packable 提供时间的值。
derivatives Array.<Packable> optional 指定时间的导数数组。

addSamples(times, values, derivativeValues)

添加一个样本数组。
Name Type Description
times Array.<JulianDate> JulianDate实例的数组,其中每个索引都是一个采样时间。
values Array.<Packable> 值的数组,其中每个值对应于提供的时间索引。
derivativeValues Array.<Array> optional 一种数组,其中每个项都是等价时间索引处的导数数组。
Throws:

addSamplesPackedArray(packedSamples, epoch)

将样本添加为单个压缩数组,其中每个新样本都表示为日期, 其次是相应值和导数的压缩表示。
Name Type Description
packedSamples Array.<Number> 一系列包装好的样品。
epoch JulianDate optional 如果packedSamples中的任何日期是数字,则将它们视为与此历元的偏移量(以秒为单位)。

equals(other)Boolean

将此属性与提供的属性进行比较并返回 如果相等,则为true,否则为false
Name Type Description
other Property optional 其他财产。
Returns:
如果左右相等,则为true,否则为false

getValue(time, result)Object

获取属性在提供的时间的值。
Name Type Description
time JulianDate 检索值的时间。
result Object optional 要将值存储到其中的对象(如果省略),将创建并返回一个新实例。
Returns:
修改后的结果参数或新实例(如果未提供结果参数)。

removeSample(time)Boolean

在给定时间移除样本(如果存在)。
Name Type Description
time JulianDate 取样时间。
Returns:
true,如果当时的样本被移除,则为false
移除给定时间间隔内的所有样本。
Name Type Description
time TimeInterval 移除所有样本的时间间隔。

setInterpolationOptions(options)

设置插值时要使用的算法和阶数。
Name Type Description
options Object optional 具有以下属性的对象:
Name Type Description
interpolationAlgorithm InterpolationAlgorithm optional 新的插值算法。如果未定义,则现有属性将保持不变。
interpolationDegree Number optional 新的插值度。如果未定义,则现有属性将保持不变。