Hi,
I am using a PathGraphics entity with SampledPositionProperty() to show a real-time line.
Depending on the situation I’d like to show the whole line, or only the last X seconds. The trailTime should be the way to make that happen.
I assumed that setting the (optional) trailTime to undefined would result in showing the complete line. But this does not work.
Should I simply set trailTime to e.g. 365 days, or are there other ways?
Thanks, Willem
Sandcastle example:
var viewer = new Cesium.Viewer(‘cesiumContainer’);
var sampledPositions = new Cesium.SampledPositionProperty();
sampledPositions.setInterpolationOptions({
interpolationDegree: 1,
interpolationAlgorithm: Cesium.LinearApproximation
});
sampledPositions.forwardExtrapolationType = Cesium.ExtrapolationType.HOLD;
sampledPositions.forwardExtrapolationDuration = 0;
var jsonTimedPoints = ‘[{“TimeStampUTC”:“2015-09-20T14:53:26.0000000Z”,“Latitude”:20.0,“Longitude”:7.0},{“TimeStampUTC”:“2015-10-20T14:53:26.0000000Z”,“Latitude”:44.0,“Longitude”:8.0}]’;
var latLonArrayDegrees = JSON.parse(jsonTimedPoints);
var scratchC3 = new Cesium.Cartesian3();
for (var idx = 0; idx < latLonArrayDegrees.length; idx++) {
var timedPoint = latLonArrayDegrees[idx]; // array with timestamp, latitude and longitude.
console.log('point t=' + timedPoint['TimeStampUTC'] + ' lon=' + timedPoint['Longitude']);
sampledPositions.addSample(Cesium.JulianDate.fromIso8601(timedPoint['TimeStampUTC']), Cesium.Cartesian3.fromDegrees(timedPoint['Longitude'], timedPoint['Latitude'], 0.0, undefined, scratchC3));
}
var entity = viewer.entities.add({
id: ‘TestLine’,
path: { // this is a PathGraphics
material: new Cesium.Color(1, 0, 0, 1),
leadTime: 0,
//trailTime: 3652460*60, // works
trailTime: undefined, // does not work
show: true,
width: 5
},
position: sampledPositions
});