xiaxin 7 months ago
parent
commit
cf324394e9

+ 26 - 2
src/views/components/LayersTools/components/analysePannel/Section.vue

@@ -35,7 +35,9 @@
 <script setup>
 import { ref, watch, onBeforeUnmount, getCurrentInstance, shallowRef, nextTick, onMounted } from "vue";
 import { message } from 'ant-design-vue';
-import Empty from '/@/components/Empty/index.vue'
+import Empty from '/@/components/Empty/index.vue';
+import * as turf from '@turf/turf';
+
 const ifShowEchart = ref(false);
 const { proxy } = getCurrentInstance();
 const echarts = proxy.$echarts;
@@ -146,9 +148,11 @@ const handleAnalyse = (type, immediate) => {
         console.log('剖面分析:', e);
         // 绘制高程走势图,可视化
         let pos = e.pos;
+        let x = XAxle(pos)
         ifShowEchart.value = true;
+        addPoint(pos);
         nextTick(() => {
-            setOption(e, pos);
+            setOption(e, x);
         })
     })
 }
@@ -160,6 +164,25 @@ const handleClear = () => {
 onMounted(() => {
     initChart();
 });
+// 插入点
+const addPoint = (e) => {
+    e.maps(i => window.map.addOverlay(new TFMap.Point(i.split(","), "#ff0000", 5).init().setClassify("BufferAction*")))
+}
+
+const XAxle = (e) => {
+    return e.mapr(i => {
+        var p1 = e[0].split(",")
+        var p2 = i.split(",")
+        return getDistance(p1, p2);
+    })
+}
+const getDistance = (p1, p2) => {
+    var from = turf.point(p1);
+    var to = turf.point(p2);
+    var dis = turf.rhumbDistance(from, to);
+    return (dis * 1000).toFixed(0);
+}
+
 const clear = () => {
     if (myChart.value) {
         myChart.value.clear();
@@ -168,6 +191,7 @@ const clear = () => {
     }
     ifShowEchart.value = false;
     window.map?.analysisObj?.remove()
+    window.map.removeOverlay("BufferAction*");
 }
 const emit = defineEmits(['onClose'])
 const handleClose = () => {

+ 1 - 1
src/views/index.vue

@@ -118,7 +118,7 @@ const popInfo = reactive({
   formStatus: 'edit',
   formData: {}
 })
-const ifShowPopup = ref(true)
+const ifShowPopup = ref(false)
 const onClosePopup = () => {
   ifShowPopup.value = false
   mapToolsStore.setRightPannel('0px');