xy-map 1.0.41 → 1.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/map.js
CHANGED
|
@@ -44,6 +44,7 @@ class mapSdk {
|
|
|
44
44
|
this.accessToken = 'pk.eyJ1IjoiaGo0NjI3NzEzOTYiLCJhIjoiY2w5YzNjOTZvMDF6NDNwb2d6YmJkYWRpMCJ9.-fW-OChGB1oY2DCMO_c8sg'
|
|
45
45
|
this.options = defaultOptions // 初始参数
|
|
46
46
|
this.map = null
|
|
47
|
+
this.setInterval = '' // 定时器
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
/**
|
|
@@ -441,15 +442,15 @@ class mapSdk {
|
|
|
441
442
|
*/
|
|
442
443
|
mapRotate(isStart = true, sheep = 5) {
|
|
443
444
|
let map = this.map
|
|
444
|
-
|
|
445
|
-
|
|
445
|
+
if (isStart) {
|
|
446
|
+
this.setInterval = setInterval(() => {
|
|
446
447
|
map.jumpTo({
|
|
447
448
|
bearing: (map.getBearing() + (sheep / 100)) % 360
|
|
448
449
|
})
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
}
|
|
450
|
+
})
|
|
451
|
+
} else {
|
|
452
|
+
clearInterval(this.setInterval)
|
|
453
|
+
}
|
|
453
454
|
}
|
|
454
455
|
}
|
|
455
456
|
|
|
@@ -18,6 +18,11 @@
|
|
|
18
18
|
</div>
|
|
19
19
|
<div class="ml-20"
|
|
20
20
|
@click="drawDelete"
|
|
21
|
+
title="删除">
|
|
22
|
+
<i class="el-icon-close mr-5"></i>删除
|
|
23
|
+
</div>
|
|
24
|
+
<div class="ml-20"
|
|
25
|
+
@click="clear"
|
|
21
26
|
title="清空">
|
|
22
27
|
<i class="el-icon-delete mr-5"></i>清空
|
|
23
28
|
</div>
|
|
@@ -61,6 +66,7 @@ export default {
|
|
|
61
66
|
type: 'move',
|
|
62
67
|
isEdit: false, //是否编辑模式
|
|
63
68
|
draw: '',
|
|
69
|
+
activeFeatures: ''
|
|
64
70
|
}
|
|
65
71
|
},
|
|
66
72
|
computed: {
|
|
@@ -106,11 +112,15 @@ export default {
|
|
|
106
112
|
// }
|
|
107
113
|
// })
|
|
108
114
|
},
|
|
115
|
+
getDraw () { // 获取绘制内容
|
|
116
|
+
const data = this.draw.getAll()
|
|
117
|
+
return data
|
|
118
|
+
},
|
|
109
119
|
startDraw (type) {
|
|
110
120
|
this.type = type
|
|
111
121
|
if (type === 'move') return
|
|
112
122
|
if (this.single) {
|
|
113
|
-
this.
|
|
123
|
+
this.clear()
|
|
114
124
|
}
|
|
115
125
|
console.log('开始绘制')
|
|
116
126
|
this.draw.changeMode(type)
|
|
@@ -118,15 +128,15 @@ export default {
|
|
|
118
128
|
},
|
|
119
129
|
drawEnd (e) {
|
|
120
130
|
// console.log(e)
|
|
121
|
-
const data = this.
|
|
122
|
-
console.log('绘制结束')
|
|
131
|
+
const data = this.getDraw()
|
|
132
|
+
console.log('绘制结束', data)
|
|
123
133
|
this.type = 'move'
|
|
124
134
|
this.$emit('end', data)
|
|
125
135
|
},
|
|
126
136
|
drawUpdate (e) {
|
|
127
137
|
// console.log(e)
|
|
128
|
-
const data = this.
|
|
129
|
-
console.log('修改结束')
|
|
138
|
+
const data = this.getDraw()
|
|
139
|
+
console.log('修改结束', data)
|
|
130
140
|
this.$emit('update', data)
|
|
131
141
|
},
|
|
132
142
|
drawEdit (geometry) { // 修改回填元素
|
|
@@ -136,16 +146,26 @@ export default {
|
|
|
136
146
|
// }
|
|
137
147
|
this.draw.add(geometry)
|
|
138
148
|
},
|
|
139
|
-
drawDelete () {
|
|
149
|
+
drawDelete () { // 删除选中对象
|
|
150
|
+
if (this.activeFeatures && this.activeFeatures.length > 0) {
|
|
151
|
+
this.activeFeatures.forEach(item => {
|
|
152
|
+
this.draw.delete(item.id)
|
|
153
|
+
const data = this.getDraw()
|
|
154
|
+
console.log('删除选中对象', data)
|
|
155
|
+
this.$emit('delete', data)
|
|
156
|
+
})
|
|
157
|
+
} else {
|
|
158
|
+
this.$message.warning('未选择删除的对象')
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
clear () {
|
|
140
162
|
if (this.draw) {
|
|
141
163
|
this.draw.deleteAll()
|
|
142
164
|
this.$emit('clear')
|
|
143
165
|
}
|
|
144
166
|
},
|
|
145
|
-
clear () {
|
|
146
|
-
this.drawDelete()
|
|
147
|
-
},
|
|
148
167
|
select (e) {
|
|
168
|
+
this.activeFeatures = e.features
|
|
149
169
|
this.$emit('select', e.features)
|
|
150
170
|
}
|
|
151
171
|
}
|