Class: SampledProperty

SampledProperty

new SampledProperty(type, derivativeTypes)

The value of Property is calculated based on the provided sample set, specified interpolation algorithm, and degree interpolation value within a given time.

Name Type Description
type Number | Packable

The type of attribute.

derivativeTypes Array.<Packable> optional

When provided, it indicates that the sample will contain derivative information of the specified type.

See:
Examples
//Create a linearly interpolated Cartesian2
var property = new SuperMap3D.SampledProperty(SuperMap3D.Cartesian2);

//Populate it with data
property.addSample(SuperMap3D.JulianDate.fromIso8601('2012-08-01T00:00:00.00Z'), new SuperMap3D.Cartesian2(0, 0));
property.addSample(SuperMap3D.JulianDate.fromIso8601('2012-08-02T00:00:00.00Z'), new SuperMap3D.Cartesian2(4, 7));

//Retrieve an interpolated value
var result = property.getValue(SuperMap3D.JulianDate.fromIso8601('2012-08-01T12:00:00.00Z'));
//Create a simple numeric SampledProperty that uses third degree Hermite Polynomial Approximation
var property = new SuperMap3D.SampledProperty(Number);
property.setInterpolationOptions({
    interpolationDegree : 3,
    interpolationAlgorithm : SuperMap3D.HermitePolynomialApproximation
});

//Populate it with data
property.addSample(SuperMap3D.JulianDate.fromIso8601('2012-08-01T00:00:00.00Z'), 1.0);
property.addSample(SuperMap3D.JulianDate.fromIso8601('2012-08-01T00:01:00.00Z'), 6.0);
property.addSample(SuperMap3D.JulianDate.fromIso8601('2012-08-01T00:02:00.00Z'), 12.0);
property.addSample(SuperMap3D.JulianDate.fromIso8601('2012-08-01T00:03:30.00Z'), 5.0);
property.addSample(SuperMap3D.JulianDate.fromIso8601('2012-08-01T00:06:30.00Z'), 2.0);

//Samples can be added in any order.
property.addSample(SuperMap3D.JulianDate.fromIso8601('2012-08-01T00:00:30.00Z'), 6.2);

//Retrieve an interpolated value
var result = property.getValue(SuperMap3D.JulianDate.fromIso8601('2012-08-01T00:02:34.00Z'));

Members

backwardExtrapolationDurationNumber

Gets or sets the amount of time to infer backwards before the attribute becomes undefined. If the value is 0, it will be extrapolated forever.

Default Value:
0

backwardExtrapolationTypeExtrapolationType

Get or set the type of extrapolation method, which is executed when the requested value is earlier than any available sample.

Default Value:
ExtrapolationType.NONE

readonly definitionChangedEvent

Get the event thrown when the property definition changes. If calling getValue returns different results within the same time frame, it is considered that the definition has changed.

derivativeTypesArray.<Packable>

Get the derivative type used for this attribute.

forwardExtrapolationDurationNumber

Gets or sets the amount of time to infer forward before the attribute becomes undefined. If the value is 0, it will be extrapolated forever.

Default Value:
0

forwardExtrapolationTypeExtrapolationType

Retrieve or set the type of extrapolation method to be executed when requesting values after any available samples.

Default Value:
ExtrapolationType.NONE

interpolationAlgorithmInterpolationAlgorithm

Obtain the interpolation algorithm used when obtaining numerical values.

Default Value:
LinearApproximation

interpolationDegreeNumber

The degree of interpolation to be performed when obtaining numerical values.

Default Value:
1

readonly isConstantBoolean

Get a value indicating whether the attribute is a constant. If getValue always returns the same result in the current definition, then the property is considered a constant.

type*

Get the attribute type.

Methods

addSample(time, value, derivatives)

Add new sample

Name Type Description
time JulianDate

Sampling time.

value Packable

The numerical value of the provided time.

derivatives Array.<Packable> optional

The derivative array of the provided time.

addSamples(times, values, derivativeValues)

Add sample array

Name Type Description
times Array.<JulianDate>

An array of JulianDate instances, where each index is a sample time.

values Array.<Packable>

A value array, where each value corresponds to the provided time index.

derivativeValues Array.<Array> optional

An array, where each item is a derivative array under the equivalent time index.

Throws:
  • The number of times and the length of the numerical value must be the same.

    Type
    DeveloperError
  • The length of the number and derivative values must be the same.

    Type
    DeveloperError

addSamplesPackedArray(packedSamples, epoch)

Add samples in the form of a single packaged array, where each new sample is represented by a date, followed by a packaged representation of the corresponding value and derivative.

Name Type Description
packedSamples Array.<Number>

An array of packaged samples.

epoch JulianDate optional

If any date in packkedsamples is a number, they are considered as the offset of that epoch, measured in seconds.

equals(other){Boolean}

Compare this attribute with the provided attribute, return true if they are equal, otherwise return false.

Name Type Description
other Property optional

A property value.

Returns:
Type Description
Boolean If left and right are equal, it is true; otherwise, it is false.

getValue(time, result){Object}

Retrieve the attribute value for the specified time.

Name Type Description
time JulianDate

The time to retrieve the attribute value.

result Object optional

If the object to store attributes is omitted, a new instance will be created and returned.

Returns:
Type Description
Object The modified result parameters, or a new instance (if no result parameters are provided).

removeSample(time){Boolean}

Delete samples at a specified time

Name Type Description
time JulianDate

Specify the time

Returns:
Type Description
Boolean If the sample is deleted, return true; otherwise, return false.

removeSamples(time)

Remove samples from the specified time period

Name Type Description
time TimeInterval

specified time period

setInterpolationOptions()

Set the algorithm and degree used for interpolation.

Name Type Description
options.interpolationAlgorithm InterpolationAlgorithm optional

New interpolation algorithm. If not defined, existing attributes will remain unchanged.

options.interpolationDegree Number optional

New interpolation degree. If not defined, existing attributes will remain unchanged.