效果
可视域在三维中是比较常用的分析功能,很多领域中都能应用到。
代码
创建起终点,模拟相机的视锥绘制视锥体,创建点光源添加阴影效果。
可视域分析代码
import Coordinate from '../../BaseTool/Coordinate';
import Cesium from 'Cesium'
import PointDrawer from '../../BaseTool/Draw/DrawPoint';
export default class Viewshed {
// viewer: any;
// vishedfrustum: any = null;
// pointEntities: any[] = [];
constructor(viewer) {
this.viewer = viewer;
this.pointEntities = [];
}
init(pointArr) {
if(pointArr.length === 1){
this.pointEntities.push(PointDrawer.draw(this.viewer, pointArr[0], 10, Cesium.Color.AQUAMARINE))
}
else if(pointArr.length === 2){
this.pointEntities.push(PointDrawer.draw(this.viewer, pointArr[0], 10, Cesium.Color.AQUAMARINE));
this.pointEntities.push(PointDrawer.draw(this.viewer, pointArr[1], 10, Cesium.Color.AQUAMARINE));
this.createViewshedMap(pointArr[0], pointArr[1]);
}