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
<template>
  <mars-pannel :visible="true" right="10" top="10">
    <div class="f-mb">
      <layer-state />
    </div>
    <div class="f-mb">
      <a-space>
        <span>标绘:</span>
        <mars-button @click="drawRectangle">贴地矩形</mars-button>
        <mars-button @click="drawPolygon">贴地面</mars-button>
        <mars-button @click="clampDrawPolygon">立体面</mars-button>
        <mars-button @click="clear">清除</mars-button>
      </a-space>
    </div>
 
    <div class="f-mb">
      <a-space>
        <span>方向:</span>
        <mars-slider @change="angleChange" v-model:value="angleValue" :min="0" :max="360" :step="1" />当前值:{{ angleValue }}
      </a-space>
    </div>
 
    <div class="f-mb">
      <a-space>
        <span>状态:</span>
        <mars-button @click="videoPlay">播放</mars-button>
        <mars-button @click="videoStop">暂停</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 angleValue = ref<number>(0) // y轴方向
const angleChange = () => {
  mapWork.angleChange(angleValue.value)
}
 
// 绘制矩形
const drawRectangle = () => {
  mapWork.drawRectangle()
}
// 绘贴地制面
const drawPolygon = () => {
  mapWork.drawPolygon(true)
}
 
// 绘制立体面
const clampDrawPolygon = () => {
  mapWork.drawPolygon(false)
}
 
// 清除
const clear = () => {
  mapWork.removeAll()
}
 
const videoPlay = () => {
  mapWork.videoPlay()
}
const videoStop = () => {
  mapWork.videoStop()
}
</script>
<style scoped lang="less">
.ant-slider {
  width: 160px;
}
</style>