我有一个 czml 文件,表示飞行指定路径的飞机。该文件基于 Cesiusm 提供的 Sancastle 示例(CZML 模型 + CZML 路径)构建。
这是 CZML 变量:
var czml = [{
"id" : "document",
"name" : "CZML Path",
"version" : "1.0",
"clock": {
"interval": "2012-08-04T10:00:00Z/2012-08-04T15:00:00Z",
"currentTime": "2012-08-04T10:00:00Z",
"multiplier": 10
}
}, {
"id" : "path",
"name" : "path with GPS flight data",
"description" : "<p>Hang gliding flight log data from Daniel H. Friedman.<br>Icon created by Larisa Skosyrska from the Noun Project</p>",
"availability" : "2012-08-04T10:00:00Z/2012-08-04T15:00:00Z",
"path" : {
"material" : {
"polylineOutline" : {
"color" : {
"rgba" : [255, 0, 255, 255]
},
"outlineColor" : {
"rgba" : [0, 255, 255, 255]
},
"outlineWidth" : 5
}
},
"width" : 8,
"leadTime" : 10,
"trailTime" : 1000,
"resolution" : 5
},
"model": {
"gltf" : "../../SampleData/models/CesiumAir/Cesium_Air.glb",
"scale" : 2.0,
"minimumPixelSize": 128
},
"position" : {
"epoch" : "2012-08-04T10:00:00Z",
"cartographicDegrees" : [
0,-122.93797,39.50935,1776,
10,-122.93822,39.50918,1773,
20,-122.9385,39.50883,1772,
30,-122.93855,39.50842,1770,
40,-122.93868,39.50792,1770,
50,-122.93877,39.50743,1767,
60,-122.93862,39.50697,1771,
70,-122.93828,39.50648,1765,
80,-122.93818,39.50608,1770,
90,-122.93783,39.5057,1754,
100,-122.93777,39.50513,1732,
110,-122.93793,39.50458,1727,
120,-122.93815,39.50415,1717,
130,-122.9382,39.50362,1713,
140,-122.93818,39.5031,1703,
150,-122.93812,39.50258,1706,
160,-122.93792,39.5022,1707,
170,-122.93775,39.50177,1698,
180,-122.93745,39.50125,1693,
190,-122.93723,39.50073,1694,
200,-122.9373,39.50023,1702
]
}
}];
为了能够运行代码,我还添加了以下几行:
var terrainProvider = new Cesium.CesiumTerrainProvider({
url : 'https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles',
requestVertexNormals : true
});
var viewer = new Cesium.Viewer('cesiumContainer', {
terrainProvider : terrainProvider,
baseLayerPicker : false
});
viewer.dataSources.add(Cesium.CzmlDataSource.load(czml)).then(function(ds) {
viewer.trackedEntity = ds.entities.getById('path');
});
如果你运行代码,你可以看到飞机的中心点是如何跟随轨迹的,但是它的航向没有与它对齐,因此给出了一个错误的 rap 表示飞行应该是什么样子:
您能否解释如何在不更改初始 czml 文件结构的情况下将飞机方向添加到代码中?
注意:我已经找到了这个问题的答案,但我无法解决我的问题。