Hi,
I’m new to Cesium, company project needs to show multiple satellites and their path.
I tried following code, it show satellite images, but path can’t display, here is the code:
// Compute entity
var entity = new Cesium.Entity({id: sId});
// Availability
entity.availability = new Cesium.TimeIntervalCollection([
new Cesium.TimeInterval({
start: Cesium.JulianDate.fromIso8601("2012-03-15T10:00:00Z"),
stop: Cesium.JulianDate.fromIso8601("2012-03-16T02:40:00Z")
})]);
// Billboard
entity.billboard = new Cesium.BillboardGraphics();
entity.billboard.image = "/image/satellite.png";
entity.billboard.show = true;
// Position
entity.position = positions;
entity.orientation = new Cesium.VelocityOrientationProperty(positions);
var fadedLine = new Cesium.StripeMaterialProperty({
evenColor: Cesium.Color.YELLOW,
oddColor: Cesium.Color.BLACK,
repeat: 1,
offset: 0.2,
orientation: Cesium.StripeOrientation.VERTICAL
});
var path = new Cesium.PathGraphics();
path.material = fadedLine;
path.leadTime = new Cesium.ConstantProperty(0);
path.trailTime = new Cesium.ConstantProperty(3600 * 4);
entity.path = path;
// // Path
// entity.path = new Cesium.PathGraphics({
// resolution: 1200,
//
// material: new Cesium.PolylineGlowMaterialProperty({
// glowPower: 0.16,
// color: Cesium.Color.RED
// }),
// width: new Cesium.ConstantProperty(10),
// leadTime: new Cesium.ConstantProperty(1e10),
// trailTime: new Cesium.ConstantProperty(1e10)
// });
// Make a smooth path
entity.position.setInterpolationOptions({
interpolationDegree : 5,
interpolationAlgorithm : Cesium.LagrangePolynomialApproximation
});
entityCollection.add(entity);
Above is piece of code to add entity into view.entities.
I tried PolylineGlowMaterialProperty and StripeMaterialProperty, both not showing path.
I also tried Availability time range and leadTIme+trailTime, not working.
Also, when I add Availability time range and leadTime+trailTime, got "array length " exception.
Anyone can help.
Thanks,
John