无人机管理后台前端(已迁走)
shuishen
2025-04-25 66c972f20bf084b8967ead03bd9e479469d08527
src/components/map-container/mapContainer.vue
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2024-10-25 15:07:51
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2025-04-15 21:54:01
 * @LastEditTime: 2025-04-24 22:12:05
 * @FilePath: \drone-web-manage\src\components\map-container\mapContainer.vue
 * @Description: 
 * 
@@ -19,6 +19,8 @@
</template>
<script setup>
import * as turf from '@turf/turf'
import { nextTick, onMounted, onUnmounted } from 'vue'
import { read } from 'xlsx'
@@ -141,7 +143,19 @@
        clampToGround: true
    })
    polylineLayer.addOverlay(polyline)
    window.$viewer?.zoomTo(polylineLayer)
    const line = turf.lineString(positionStr.split(';').map(i => i.split(',')))
    const bbox = turf.bbox(line)
    const bboxPolygon = turf.bboxPolygon(bbox)
    const scaledPolygon = turf.transformScale(bboxPolygon, 3)
    const newBbox = turf.bbox(scaledPolygon)
    window.$viewer?.flyToBounds(
        newBbox,
        { heading: 0, pitch: -90, roll: 0 },
        () => { },
        0
    )
}
onMounted(() => {