我正在尝试从先前在 czml 文件中声明的数据包中更新一些属性(即“semiMinorAxis”和“semiMajorAxis”)。
我尝试这样做的方法是覆盖“semiMinorAxis”和“semiMajorAxis”的值。
即:12:00:00 到 13:00:00 之间,ellipse_1 的大小为 300000,13:00:00 到 14:00:00 之间,ellipse_1 的大小为 600000。
这是我尝试在一个简单的 csml 中执行此操作的方法:
[
{
"id" : "document",
"name" : "name",
"version" : "1.0",
"clock":
{
"interval": "2010-02-04T12:00:00Z/2010-02-04T14:00:00Z",
"currentTime": "2010-02-04T12:00:00Z",
"multiplier": 100
}
},
// I create ellipse_1
{
"id" : "ellipse_1",
"name" : "ellipse_1 (61.0666922, -107.9917071)",
"availability" : "2010-02-04T12:00:00Z/2010-02-04T13:00:00ZZ",
"position" : {
"cartographicDegrees" : [-107.9917071,61.0666922, 0.0]
},
"ellipse" : {
"semiMinorAxis" : 300000,
"semiMajorAxis" : 300000,
"height" : 0.0,
"material" : {
"solidColor" : {
"color" : {
"rgba" :[151,20,150, 255]
}
}
}
}
},
// I reuse the id and only change the values that I want the change
{
"id" : "ellipse_1"
},
"ellipse" : {
"interval" : "2010-02-04T13:00:00Z/2010-02-04T14:00:00ZZ",
"semiMinorAxis" : 600000,
"semiMajorAxis" : 600000
}
}
]
另一种选择似乎是这样做的:
{
"id" : "ellipse_1",
"name" : "ellipse_1 (61.0666922, -107.9917071)",
"availability" : "2010-02-04T12:00:00.00Z/2010-02-04T14:00:00.00Z",
"position" : {
"cartographicDegrees" : [-137.9917071,51.0666922, 0.0]
},
"ellipse" : [
{
"interval" : "2010-02-04T12:00:00.00Z/2010-02-04T13:00:00.00Z",
"semiMinorAxis" : 300000,
"semiMajorAxis" : 300000,
"height" : 200000.0,
"material" : {
"solidColor" : {
"color" : {
"rgba" :[253,152,38, 255]
}
}
}
},
{
"interval" : "2010-02-04T13:00:00.00Z/2010-02-04T14:00:00.00Z",
"semiMinorAxis" : 600000,
"semiMajorAxis" : 600000,
"height" : 200000.0,
"material" : {
"solidColor" : {
"color" : {
"rgba" :[253,152,38, 255]
}
}
}
}
]
}
顺便说一下,这是查看它的脚本:
<script>
var viewer = new Cesium.Viewer('cesiumContainer', {
imageryProvider : new Cesium.ArcGisMapServerImageryProvider({url : 'http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer'
}),
baseLayerPicker : false,
animation : true,
timeline : true,
});
var dataSourcePromise = Cesium.CzmlDataSource.load('../Apps/oscar.czml');
viewer.dataSources.add(dataSourcePromise);
viewer.flyTo(dataSourcePromise).then(function(result){
});
</script>
不幸的是,这些显然不是更新 csml 文件中对象值的方法。我错过了一些明显的东西吗?
谢谢!