1.矩形
const entities = this.viewer.entities; //将enities方法保存到变量中
//矩形
entities.add({
position: Cesium.Cartesian3.fromDegrees(104.09, 30.66), //矩形的位置
box: {
dimensions: new Cesium.Cartesian3(300, 300, 0), //长宽高
fill: true, //是否显示填充
material: Cesium.Color.fromCssColorString(`rgba(255,0,0,1)`), //立方体的颜色,
outline: true, //是否显示轮廓
outlineColor: Cesium.Color.fromCssColorString(`rgba(255,255,0,1)`), //立方体轮廓线的颜色,
outlineWidth: 1, //轮廓的跨度
},
});
2.立方体
entities.add({
position: Cesium.Cartesian3.fromDegrees(104.07, 30.66), //立方体的位置
box: {
dimensions: new Cesium.Cartesian3(300, 300, 600), //长宽高
fill: true, //是否显示填充
material: Cesium.Color.fromCssColorString(`rgba(255,0,0,1)`), //立方体的颜色,
outline: false, //是否显示轮廓
outlineColor: Cesium.Color.fromCssColorString(`rgba(255,255,0,1)`), //立方体轮廓线的颜色,
outlineWidth: 1, //轮廓的跨度
},
});