Cesium中绘制矩形,根据四角/对角坐标绘制矩形 import store from '@/store/index' import * as Cesium from 'cesium' export default function createReactangleArea(cesium: any) { const rectangleCoord: any = store.state.rectangle; return cesium.entities.add({ name: 'ractangle area', rectangle: { coordinates: Cesium.Rectangle.fromCartesianArray([ Cesium.Cartesian3.fromDegrees(rectangleCoord[0].Latitude, rectangleCoord[0].Longitude, rectangleCoord[0].Altitude), Cesium.Cartesian3.fromDegrees(rectangleCoord[1].Latitude, rectangleCoord[1].Longitude, rectangleCoord[1].Altitude), Cesium.Cartesian3.fromDegrees(rectangleCoord[2].Latitude, rectangleCoord[2].Longitude, rectangleCoord[2].Altitude), Cesium.Cartesian3.fromDegrees(rectangleCoord[3].Latitude, rectangleCoord[3].Longitude, rectangleCoord[3].Altitude), ]), material: Cesium.Color.WHITE.withAlpha(0.5), } }) }