surprise
2023-12-05 6ecef4176f6d9df60cd1a753a36e09cd96bce9b8
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
 <template>
  <Popup ref="pop" :title="form.title" left="calc(100% - 330px)">
    <div class="bufferArea">
      <el-form ref="form" :model="form" label-width="130px">
        <el-form-item class="nolabel-form-item">
          <el-button type="primary" @click="addPoint">点</el-button>
          <el-button type="primary" @click="addPolyline">线</el-button>
          <el-button type="primary" @click="addPolygon">面</el-button>
        </el-form-item>
        <hr />
        <el-form-item label="缓冲半径(米):">
          <el-input-number
            v-model="form.input"
            controls-position="right"
            @change="handleChange"
            :min="1"
            :max="300"
            style="width=200px;"
          ></el-input-number>
          <span></span>
        </el-form-item>
      </el-form>
    </div>
  </Popup>
</template>
<script>
import Popup from "@tools/Popup.vue";
let buffRadius;
let buff;
export default {
  name: "bufferArea",
  components: {
    Popup,
  },
  data() {
    return {
      form: {
        title: "缓冲区分析",
        input: 100,
      },
    };
  },
  computed: {},
  mounted() {},
  methods: {
    // 关闭弹窗
    close() {
      this.$refs.pop.close();
    },
    // 打开弹窗
    open() {
      this.$refs.pop.open();
    },
    // 添加点
    addPoint() {
      buffRadius = this.form.input;
      window.buff = sgworld.Analysis.DrawPointBuffer(
        buffRadius,
        function () {}
      );
    },
    // 添加线
    addPolyline() {
      buffRadius = this.form.input;
      window.buff = sgworld.Analysis.DrawPolylineBuffer(
        buffRadius,
        function () {}
      );
    },
    // 添加面
    addPolygon() {
      buffRadius = this.form.input;
      window.buff = sgworld.Analysis.DrawPolygonBuffer(
        buffRadius,
        function () {}
      );
    },
    // 设置缓冲半径
    handleChange(value) {
      if (buff) {
        buff.changeBurr(value);
      }
      buffRadius = value;
    },
  },
};
</script>
<style lang="less">
.bufferArea {
  .el-button {
    padding: 12px 30px;
  }
  .nolabel-form-item {
    text-align: center;
  }
  .el-input-number {
    width: 150px!important;
  }
}
</style>