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>
| <Popup ref="pop" :title="form.title" left="calc(100% - 340px)" width="340px">
| <div class="terrainPress">
| <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="0"
| ></el-input-number>
| <el-button type="primary" @click="draw">开始分析</el-button>
| </el-form-item>
| </el-form>
| </div>
| </Popup>
| </template>
| <script>
| import Popup from "@tools/Popup.vue";
| let depth;
| let TerrainFlattening, positions;
| export default {
| name: "terrainPress",
| components: {
| Popup,
| },
| data() {
| return {
| form: {
| title: "地形压平",
| input: 50,
| },
| };
| },
| computed: {},
| mounted() {},
| methods: {
| // 关闭弹窗
| close() {
| this.$refs.pop.close();
| },
| // 打开弹窗
| open() {
| this.$refs.pop.open();
| },
| // 输入框数据修改
| handleChange(value) {
| depth = value;
| },
| // 绘制地形压平
| draw() {
| depth = this.form.input;
| sgworld.Creator.createSimpleGraphic(
| "polygon",
| {
| clampToGround: true,
| },
| (entity) => {
| positions = entity.polygon.hierarchy.getValue().positions;
| sgworld.Creator.SimpleGraphic.remove(entity.id);
| this.clear();
| window.TerrainFlattening = sgworld.Creator.createTerrainModifier(
| "地形压平",
| positions,
| depth,
| {}
| );
| }
| );
| },
| // 清除
| clear() {
| window.TerrainFlattening && window.TerrainFlattening.remove();
| },
| },
| };
| </script>
| <style lang="less">
| .terrainPress {
| .el-input-number {
| width: 100px !important;
| }
| .el-button {
| margin-left: 10px;
| padding: 12px 10px;
| }
| }
| </style>
|
|