fuchengshen
2022-07-09 3a25c05b5ab837714f30469cdcb1e2a77d8d7f6c
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
<template>
  <mars-pannel :visible="true" right="10" top="10">
    <layer-state />
 
    <div class="f-mb">
      <span>建议:顺着水流方向选点,直线时多采集点</span>
    </div>
    <div class="f-mb">
      <a-space>
        <span class="mars-pannel-item-label">河宽度(米):</span>
        <mars-input-number @change="widthChange" v-model:value="widthValue"></mars-input-number>
      </a-space>
    </div>
    <div class="f-mb">
      <a-space>
        <span class="mars-pannel-item-label">河高度(米):</span>
        <mars-input-number @change="heightChange" v-model:value="heightValue"></mars-input-number>
      </a-space>
    </div>
 
    <div class="f-mb">
      <a-space>
        <span class="mars-pannel-item-label">水流速:</span>
        <mars-slider @change="speedChange" v-model:value="speedValue" :min="0" :max="50" />当前速度{{ speedValue }}米/秒
      </a-space>
    </div>
 
    <div>
      <a-space>
        <mars-button @click="drawLine">绘制河流</mars-button>
        <mars-button @click="addHeight">升高30米</mars-button>
        <mars-button @click="lowerHeight">降低30米</mars-button>
        <mars-button @click="clear">清除</mars-button>
      </a-space>
    </div>
  </mars-pannel>
</template>
 
<script lang="ts" setup>
import { ref } from "vue"
import LayerState from "@mars/components/mars-sample/layer-state.vue"
import * as mapWork from "./map.js"
 
// 宽度
const widthValue = ref<number>(280)
const widthChange = () => {
  mapWork.widthChange(widthValue.value)
}
 
// 高度
const heightValue = ref<number>(30)
const heightChange = () => {
  mapWork.heightChange(heightValue.value)
}
 
// 流速
const speedValue = ref<number>(10)
const speedChange = () => {
  mapWork.speedChange(speedValue.value)
}
 
// 绘制河流
const drawLine = () => {
  mapWork.drawLine(widthValue.value, heightValue.value, speedValue.value)
}
 
// 升高
const addHeight = () => {
  mapWork.addHeight()
}
 
// 降低
const lowerHeight = () => {
  mapWork.lowerHeight()
}
 
const clear = () => {
  mapWork.clear()
}
</script>
<style scoped lang="less">
.ant-slider {
  width: 100px;
}
.mars-pannel-item-label {
  width: 75px;
}
</style>