SampledProperty

new Cesium.SampledProperty(type, derivativeTypes)

Property,在给定的时间内从提供的一组样本和指定的插值算法和度数中进行插值。
Name Type Description
type Number | Packable 插值类型。
derivativeTypes Array.<Packable> optional 提供时,表示样本将包含指定类型的派生信息。???
Examples:
// 创建一个线性二维插值。
var property = new Cesium.SampledProperty(Cesium.Cartesian2);

// 填充数据。
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));

// 检索插值。
var result = property.getValue(Cesium.JulianDate.fromIso8601('2012-08-01T12:00:00.00Z'));
// 创建一个简单的数值采样属性,使用三次Hermite多项式逼近。
var property = new Cesium.SampledProperty(Number);
property.setInterpolationOptions({
    interpolationDegree : 3,
    interpolationAlgorithm : Cesium.HermitePolynomialApproximation
});

// 填充数据。
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);

// 样本可以以任意顺序插入。
property.addSample(Cesium.JulianDate.fromIso8601('2012-08-01T00:00:30.00Z'), 6.2);

// 检索所插的值。
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

readonlydefinitionChanged : Event

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

derivativeTypes : Array.<Packable>

Gets the derivative types used by this property. 获取衍生物类型。

forwardExtrapolationDuration : Number

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

interpolationDegree : Number

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

readonlyisConstant : Boolean

获取该属性是是否是恒定的。 如果getValue总是返回同样的结果,则认为该属性是恒定的。
获取属性类型。

Methods

addSample(time, value, derivatives)

添加一个采样。
Name Type Description
time JulianDate 采样对应的时间。
value Packable 采样时间对应的值。
derivatives Array.<Packable> optional The array of derivatives at the provided time.

addSamples(times, values, derivativeValues)

添加一组采样。
Name Type Description
times Array.<JulianDate> 一组采样时间。
values Array.<Packable> 值数组,其中每个值对应于提供的时间索引。
derivativeValues Array.<Array> optional An array where each item is the array of derivatives at the equivalent time index.
Throws:

addSamplesPackedArray(packedSamples, epoch)

将样本添加为单个打包数组,其中每个新样本均以日期表示,然后是相应值和衍生产品的打包表示形式。
Name Type Description
packedSamples Array.<Number> 打包的采样数组。
epoch JulianDate optional 如果packedSamples中的任何日期是数字,则将它们视为从该时期的偏移量(以秒为单位)。

equals(other)Boolean

将此属性与提供的属性进行比较。
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:
如果已经被移除,就返回 false
根据给定的时间段,移除所有的样本。
Name Type Description
time TimeInterval 时间段。

setInterpolationOptions(options)

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