【发布时间】:2015-05-21 23:15:31
【问题描述】:
谁能告诉我这段代码有什么问题?
Cesium.Math.setRandomNumberSeed(1234);
var viewer = new Cesium.Viewer('cesiumContainer');
var entities = viewer.entities;
var boxes = entities.add(new Cesium.Entity());
var polylines = new Cesium.PolylineCollection();
//Create the entities and assign each entity's parent to the group to which it belongs.
for (var i = 0; i < 5; ++i) {
var height = 100000.0 + (200000.0 * i);
entities.add({
parent : boxes,
position : Cesium.Cartesian3.fromDegrees(-106.0, 45.0, height),
box : {
dimensions : new Cesium.Cartesian3(90000.0, 90000.0, 90000.0),
material : Cesium.Color.fromRandom({alpha : 1.0})
}
});
entities.add({
parent : polylines,
position : Cesium.Cartesian3.fromDegrees(-86.0, 55.0, height),
polyline : {
width : new Cesium.ConstantProperty(2),
material : Cesium.Color.fromRandom({alpha : 1.0}),
followSurface : new Cesium.ConstantProperty(false)
}
});
}
viewer.zoomTo(viewer.entities);
它在给定坐标处显示框,但是当我尝试绘制折线时,会出现以下错误: 未捕获的类型错误:无法读取未定义的属性“推送”(https://cesiumjs.org/Cesium/Source/DataSources/Entity.js 的第 300 行)
我想要这样的东西 https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Custom%20DataSource.html&label=Showcases
提前致谢。
【问题讨论】: