| File was renamed from applications/task-work-order/src/utils/cesium/DrawPolygon.js |
| | |
| | | import * as Cesium from 'cesium' |
| | | import * as turf from '@turf/turf' |
| | | import { boxTransformScale } from '@/utils/turfFunc' |
| | | import { ElMessage } from 'element-plus' |
| | | import { getPointPositionsHeight } from '@/utils/cesium/mapUtil' |
| | | import { flyVisual } from '@ztzf/utils' |
| | | import { flyVisual, getPointPositionsHeight } from './index' |
| | | |
| | | /** |
| | | * 多边形绘制与编辑工具类 |
| | |
| | | this.addPosition(item, false) |
| | | }) |
| | | |
| | | const boxTransformScale = (data, multiple = 3) => { |
| | | const line = turf.lineString(data) |
| | | const bbox = turf.bbox(line) |
| | | const bboxPolygon = turf.bboxPolygon(bbox) |
| | | const scaledPolygon = turf.transformScale(bboxPolygon, multiple) |
| | | |
| | | return turf.bbox(scaledPolygon) |
| | | } |
| | | |
| | | // 视角飞入区域 |
| | | const newBox = boxTransformScale( |
| | | positions.map(item => [item.lng, item.lat]), |