|
|
@ -7,11 +7,12 @@
|
|
|
|
-->
|
|
|
|
-->
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<div id="cesium-viewer" ref="viewerDivRef"></div>
|
|
|
|
<div id="cesium-viewer" ref="viewerDivRef"></div>
|
|
|
|
|
|
|
|
<ProfileAnalysis ref="profileChart"></ProfileAnalysis>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
<script setup lang="ts">
|
|
|
|
import { onMounted, ref } from 'vue'
|
|
|
|
import {onMounted, ref, watch} from 'vue'
|
|
|
|
import { Viewer, Ion, Cartesian3, CustomDataSource, Color } from 'cesium'
|
|
|
|
import {Viewer, Ion, CustomDataSource, Cartesian3} from 'cesium'
|
|
|
|
import 'cesium/Build/Cesium/Widgets/widgets.css'
|
|
|
|
import 'cesium/Build/Cesium/Widgets/widgets.css'
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
TDTLayerType,
|
|
|
|
TDTLayerType,
|
|
|
@ -22,9 +23,8 @@ import {
|
|
|
|
import { initViewer, perfViewer, showNavigator } from '@/utils/map/sceneViewer'
|
|
|
|
import { initViewer, perfViewer, showNavigator } from '@/utils/map/sceneViewer'
|
|
|
|
import { flyToChina } from '@/utils/map/camera'
|
|
|
|
import { flyToChina } from '@/utils/map/camera'
|
|
|
|
import CreatePolyline from '@/utils/map/draw/drawPolyline'
|
|
|
|
import CreatePolyline from '@/utils/map/draw/drawPolyline'
|
|
|
|
import { inputGeoJson } from '@/utils/DataIO.ts'
|
|
|
|
import ProfileAnalysis from "@/components/ProfileAnalysis.vue";
|
|
|
|
// import DrawPoint from '@/utils/map/draw/drawPoint'
|
|
|
|
|
|
|
|
import { DrawPolygon } from '@/utils/map/draw/drawPolygon'
|
|
|
|
|
|
|
|
const viewerDivRef = ref<HTMLDivElement>()
|
|
|
|
const viewerDivRef = ref<HTMLDivElement>()
|
|
|
|
let viewer: Viewer
|
|
|
|
let viewer: Viewer
|
|
|
|
window.CESIUM_BASE_URL = 'node_modules/cesium/Build/Cesium/'
|
|
|
|
window.CESIUM_BASE_URL = 'node_modules/cesium/Build/Cesium/'
|
|
|
@ -32,14 +32,10 @@ window.CESIUM_BASE_URL = 'node_modules/cesium/Build/Cesium/'
|
|
|
|
|
|
|
|
|
|
|
|
Ion.defaultAccessToken =
|
|
|
|
Ion.defaultAccessToken =
|
|
|
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI3YjU4MjJlMS0wMWE4LTRhOWQtYjQ1OC04MTgzMzFhMzQ5ZjAiLCJpZCI6MTE1ODUxLCJpYXQiOjE2NjkyMDM1MzN9.8ajEuv3VKYg8wvFiQlUWWY6Ng6JfY4PuVgRyStL1B-E'
|
|
|
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI3YjU4MjJlMS0wMWE4LTRhOWQtYjQ1OC04MTgzMzFhMzQ5ZjAiLCJpZCI6MTE1ODUxLCJpYXQiOjE2NjkyMDM1MzN9.8ajEuv3VKYg8wvFiQlUWWY6Ng6JfY4PuVgRyStL1B-E'
|
|
|
|
// 修改相机的默认矩形范围
|
|
|
|
|
|
|
|
// window.Cesium.Camera.DEFAULT_VIEW_RECTANGLE =
|
|
|
|
// 绑定地形剖面图弹窗
|
|
|
|
// window.Cesium.Rectangle.fromDegrees(
|
|
|
|
let profileChart = ref<InstanceType<typeof ProfileAnalysis> | null>(null)
|
|
|
|
// 75.0, // 西经
|
|
|
|
let linePoints = ref<number>(-1)
|
|
|
|
// 0.0, // 南纬
|
|
|
|
|
|
|
|
// 140.0, // 东经
|
|
|
|
|
|
|
|
// 60.0, // 北纬
|
|
|
|
|
|
|
|
// )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
onMounted(() => {
|
|
|
|
//初始化
|
|
|
|
//初始化
|
|
|
@ -67,13 +63,22 @@ onMounted(() => {
|
|
|
|
|
|
|
|
|
|
|
|
// 挂载在window,供全局组件共享
|
|
|
|
// 挂载在window,供全局组件共享
|
|
|
|
window.viewer = viewer
|
|
|
|
window.viewer = viewer
|
|
|
|
inputGeoJson(viewer)
|
|
|
|
|
|
|
|
//绘制多边形
|
|
|
|
//绘制多边形
|
|
|
|
const drawPolyline = new CreatePolyline(viewer,true,true,{})
|
|
|
|
const drawPolyline = new CreatePolyline(viewer,false,true,{})
|
|
|
|
|
|
|
|
linePoints.value = drawPolyline.positions.length
|
|
|
|
drawPolyline.start()
|
|
|
|
drawPolyline.start()
|
|
|
|
// const drawPolygon = new DrawPolygon(viewer,true)
|
|
|
|
profileChart.value?.openDia()
|
|
|
|
// drawPolygon.start()
|
|
|
|
profileChart.value?.drawChart([0,1,2,3,4,5,6,7,8,9],
|
|
|
|
|
|
|
|
[-70,800,300,400,23,232,435,243,234,343],
|
|
|
|
|
|
|
|
[90,900,900,600,235,262,535,643,734,443])
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
watch(linePoints, (newValue, OldValue): void => {
|
|
|
|
|
|
|
|
console.log("数据变化了",linePoints.value, newValue, OldValue)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
<style scoped>
|
|
|
|