lixuliang
2024-04-18 b5c4921d0828500379502a916a2ccf2d9d4acc96
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<template>
  <Popup ref="pop" :title="form.title" left="calc(100% - 330px)" width="360px">
    <div class="terrainOutline">
      <el-form ref="form" :model="form" label-width="120px">
        <el-form-item label="采样间隔(米)">
          <el-input-number
            v-model="form.input"
            controls-position="right"
            @change="handleChange"
            :min="1"
            :max="100"
          ></el-input-number>
          <el-button type="primary" @click="startAnalysis">开始分析</el-button>
        </el-form-item>
      </el-form>
    </div>
  </Popup>
</template>
<script>
import Popup from "@tools/Popup.vue";
let distance = 50;
export default {
  name: "terrainOutline",
  components: {
    Popup,
  },
  data() {
    return {
      form: {
        title: "地形轮廓",
        input: 50,
      },
    };
  },
  computed: {},
  mounted() {},
  methods: {
    // 关闭弹窗
    close() {
      this.$refs.pop.close();
    },
    // 打开弹窗
    open() {
      this.$refs.pop.open();
    },
    // 输入框数据修改
    handleChange() {
      distance = this.form.input;
    },
    clear() {
      layer.close(this.layerIndex);
      this.layerIndex = undefined;
      if (window.AnalysisDXPM) {
        window.AnalysisDXPM.flyPoint &&
          Viewer.entities.remove(window.AnalysisDXPM.flyPoint);
        window.AnalysisDXPM && window.AnalysisDXPM.deleteObject();
        window.AnalysisDXPM = undefined;
      }
    },
    // 开始绘制
    startAnalysis() {
      this.clear();
 
      window.AnalysisDXPM = sgworld.Command.execute(
        2,
        6,
        { cyjj: distance, objid: 0 },
        (Distance) => {
          if (Distance.gcs && Distance.gcs.length) {
            window.AnalysisDXPM.analyseData = Distance;
            this.layerIndex = layer.open({
              type: 2,
              title: "分析结果",
              shade: false,
              area: ["80%", "280px"],
              offset: "b",
              skin: "other-class",
              content:
                window.SmartEarthRootUrl + "Workers/analysis/AnalysisDXPM.html",
              end: () => {
                this.layerIndex && this.clear();
              },
            });
          } else {
            //剖面
            window.AnalysisDXPM && window.AnalysisDXPM.deleteObject();
          }
        }
      );
    },
  },
};
</script>
<style lang="less">
.terrainOutline {
  .el-input-number {
    width: 100px !important;
  }
  .el-button {
    margin-left: 10px;
  }
}
</style>