@songcf/fy-map 1.0.0
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/README.md +5 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Button/index.vue.d.ts +4 -0
- package/dist/components/FyCircle/index.d.ts +2 -0
- package/dist/components/FyCircle/index.vue.d.ts +112 -0
- package/dist/components/FyClusterMarker/index.d.ts +2 -0
- package/dist/components/FyClusterMarker/index.vue.d.ts +129 -0
- package/dist/components/FyDrawCircle/index.d.ts +2 -0
- package/dist/components/FyDrawCircle/index.vue.d.ts +76 -0
- package/dist/components/FyDrawLine/index.d.ts +2 -0
- package/dist/components/FyDrawLine/index.vue.d.ts +72 -0
- package/dist/components/FyDrawPoint/index.d.ts +2 -0
- package/dist/components/FyDrawPoint/index.vue.d.ts +67 -0
- package/dist/components/FyDrawPolygon/index.d.ts +2 -0
- package/dist/components/FyDrawPolygon/index.vue.d.ts +75 -0
- package/dist/components/FyDrawTool/index.d.ts +2 -0
- package/dist/components/FyDrawTool/index.vue.d.ts +102 -0
- package/dist/components/FyLabel/index.d.ts +2 -0
- package/dist/components/FyLabel/index.vue.d.ts +112 -0
- package/dist/components/FyLineString/index.d.ts +2 -0
- package/dist/components/FyLineString/index.vue.d.ts +105 -0
- package/dist/components/FyMap/index.d.ts +2 -0
- package/dist/components/FyMap/index.vue.d.ts +69 -0
- package/dist/components/FyMarker/index.d.ts +2 -0
- package/dist/components/FyMarker/index.vue.d.ts +105 -0
- package/dist/components/FyPoint/index.d.ts +2 -0
- package/dist/components/FyPoint/index.vue.d.ts +98 -0
- package/dist/components/FyPolygon/index.d.ts +2 -0
- package/dist/components/FyPolygon/index.vue.d.ts +98 -0
- package/dist/components/FyPopup/index.d.ts +2 -0
- package/dist/components/FyPopup/index.vue.d.ts +114 -0
- package/dist/components/FyTileLayer/index.d.ts +2 -0
- package/dist/components/FyTileLayer/index.vue.d.ts +83 -0
- package/dist/components/FyVectorLayer/index.d.ts +2 -0
- package/dist/components/FyVectorLayer/index.vue.d.ts +89 -0
- package/dist/components/index.d.ts +20 -0
- package/dist/fy-map.css +623 -0
- package/dist/fy-map.es.js +3769 -0
- package/dist/fy-map.es.js.map +1 -0
- package/dist/fy-map.umd.js +4415 -0
- package/dist/fy-map.umd.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/package.json +48 -0
|
@@ -0,0 +1,4415 @@
|
|
|
1
|
+
(function(global, factory) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("maptalks")) : typeof define === "function" && define.amd ? define(["exports", "maptalks"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.FyMap = {}, global.maptalks));
|
|
3
|
+
})(this, (function(exports2, maptalks) {
|
|
4
|
+
"use strict";
|
|
5
|
+
var __vite_style__ = document.createElement("style");
|
|
6
|
+
__vite_style__.textContent = `
|
|
7
|
+
.my-btn[data-v-47deef6b] {\r
|
|
8
|
+
padding: 8px 16px;\r
|
|
9
|
+
border: none;\r
|
|
10
|
+
background: #409eff;\r
|
|
11
|
+
color: #fff;\r
|
|
12
|
+
border-radius: 4px;\r
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
}\r
|
|
15
|
+
|
|
16
|
+
.fy-map[data-v-1c68cf57] {\r
|
|
17
|
+
width: 100%;\r
|
|
18
|
+
height: 100%;\r
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
}\r
|
|
21
|
+
|
|
22
|
+
.fy-tile-layer[data-v-56cfee19] {\r
|
|
23
|
+
display: none;
|
|
24
|
+
}\r
|
|
25
|
+
|
|
26
|
+
.fy-vector-layer[data-v-cd2b9e14] {\r
|
|
27
|
+
display: none;
|
|
28
|
+
}\r
|
|
29
|
+
|
|
30
|
+
.fy-marker[data-v-249684eb] {\r
|
|
31
|
+
display: none;
|
|
32
|
+
}\r
|
|
33
|
+
|
|
34
|
+
.fy-label[data-v-2ad8e63e] {\r
|
|
35
|
+
display: none;
|
|
36
|
+
}\r
|
|
37
|
+
|
|
38
|
+
.fy-popup[data-v-03c6ffc0] {\r
|
|
39
|
+
display: none;
|
|
40
|
+
}\r
|
|
41
|
+
|
|
42
|
+
.fy-cluster-marker[data-v-ee36769c] {\r
|
|
43
|
+
display: none;
|
|
44
|
+
}\r
|
|
45
|
+
.maptalks-zoom {
|
|
46
|
+
text-align: center;
|
|
47
|
+
}
|
|
48
|
+
.maptalks-zoom .maptalks-zoom-zoomlevel {
|
|
49
|
+
display: block;
|
|
50
|
+
width: 30px;
|
|
51
|
+
height: 30px;
|
|
52
|
+
background: #fff;
|
|
53
|
+
color: #868686;
|
|
54
|
+
border: 1px solid #9d9d9d;
|
|
55
|
+
line-height: 26px;
|
|
56
|
+
text-align: center;
|
|
57
|
+
box-sizing: border-box;
|
|
58
|
+
}
|
|
59
|
+
.maptalks-zoom .maptalks-zoom-zoomlevel .maptalks-zoom-zoomlevel-text {
|
|
60
|
+
display: inline-block;
|
|
61
|
+
font-size: 12px;
|
|
62
|
+
transform: scale(0.8);
|
|
63
|
+
}
|
|
64
|
+
.maptalks-zoom-slider {
|
|
65
|
+
margin-top: 6px;
|
|
66
|
+
}
|
|
67
|
+
.maptalks-zoom-slider a.maptalks-zoom-zoomin,
|
|
68
|
+
.maptalks-zoom-slider a.maptalks-zoom-zoomout {
|
|
69
|
+
display: block;
|
|
70
|
+
font-size: 16px;
|
|
71
|
+
width: 30px;
|
|
72
|
+
height: 30px;
|
|
73
|
+
border: 1px solid #9d9d9d;
|
|
74
|
+
background: #fff;
|
|
75
|
+
line-height: 28px;
|
|
76
|
+
text-decoration: none;
|
|
77
|
+
background-repeat: no-repeat;
|
|
78
|
+
background-position: center;
|
|
79
|
+
box-sizing: border-box;
|
|
80
|
+
}
|
|
81
|
+
.maptalks-zoom-slider a.maptalks-zoom-zoomin {
|
|
82
|
+
background-image: url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%3e%3crect%20width='2'%20height='12'%20transform='translate(5)'%20fill='%23868686'/%3e%3crect%20width='2'%20height='12'%20transform='translate(12%205)%20rotate(90)'%20fill='%23868686'/%3e%3c/svg%3e");
|
|
83
|
+
}
|
|
84
|
+
.maptalks-zoom-slider a.maptalks-zoom-zoomout {
|
|
85
|
+
height: 29px;
|
|
86
|
+
background-image: url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='12'%20height='2'%20viewBox='0%200%2012%202'%3e%3crect%20id='矩形_2'%20data-name='矩形%202'%20width='2'%20height='12'%20transform='translate(12)%20rotate(90)'%20fill='%23868686'/%3e%3c/svg%3e");
|
|
87
|
+
border-top: none;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.maptalks-compass {
|
|
91
|
+
width: 30px;
|
|
92
|
+
height: 30px;
|
|
93
|
+
background: #fff;
|
|
94
|
+
border: 1px solid #9d9d9d;
|
|
95
|
+
border-radius: 50%;
|
|
96
|
+
box-sizing: border-box;
|
|
97
|
+
background-image: url("data:image/svg+xml,%3csvg%20id='指南针10x18'%20xmlns='http://www.w3.org/2000/svg'%20width='10'%20height='18'%20viewBox='0%200%2010%2018'%3e%3cpath%20id='路径_1'%20data-name='路径%201'%20d='M3,9H0L5,0l5,9H7A2,2,0,0,0,3,9Z'%20fill='red'/%3e%3cpath%20id='路径_2'%20data-name='路径%202'%20d='M5,11H5L0,2H3A2,2,0,1,0,7,2h3Z'%20transform='translate(0%207)'%20fill='%239d9d9d'/%3e%3c/svg%3e");
|
|
98
|
+
background-repeat: no-repeat;
|
|
99
|
+
background-position: center;
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.maptalks-reset {
|
|
104
|
+
width: 30px;
|
|
105
|
+
height: 30px;
|
|
106
|
+
background: #fff;
|
|
107
|
+
border: 1px solid #9d9d9d;
|
|
108
|
+
box-sizing: border-box;
|
|
109
|
+
background-image: url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='13.997'%20height='14'%20viewBox='0%200%2013.997%2014'%3e%3cpath%20id='路径_1'%20data-name='路径%201'%20d='M-1610.58-1267.16a5.468,5.468,0,0,1,3.521,1.421l.192.175-1.713,1.776c-.1.128-.179.284.008.389a.587.587,0,0,0,.172.049h4.454a.257.257,0,0,0,.183-.07.252.252,0,0,0,.071-.182v-4.481c0-.188-.089-.374-.208-.344a.342.342,0,0,0-.157.09l-1.565,1.549-.182-.173a7.078,7.078,0,0,0-3.151-1.737,6.758,6.758,0,0,0-3.535.063,7.3,7.3,0,0,0-3.1,1.816,7.192,7.192,0,0,0-1.833,3.069h0a6.846,6.846,0,0,0,.632,5.279,7.017,7.017,0,0,0,4.229,3.3h0a7,7,0,0,0,5.293-.6,7.055,7.055,0,0,0,3.369-4.14.871.871,0,0,0-.07-.626.84.84,0,0,0-1.113-.294.726.726,0,0,0-.365.471h0a5.542,5.542,0,0,1-1.7,2.661,5.585,5.585,0,0,1-2.9,1.287,5.468,5.468,0,0,1-3.143-.5,5.31,5.31,0,0,1-2.3-2.158h0a5.169,5.169,0,0,1-.645-3.649,5.489,5.489,0,0,1,1.948-3.249,5.454,5.454,0,0,1,3.608-1.192Z'%20transform='translate(1617.689%201268.903)'%20fill='%23868686'%20fill-rule='evenodd'/%3e%3c/svg%3e");
|
|
110
|
+
background-repeat: no-repeat;
|
|
111
|
+
background-position: center;
|
|
112
|
+
cursor: pointer;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.maptalks-toolbar-vertical {
|
|
116
|
+
/*border: 1px solid #3b3e44;*/
|
|
117
|
+
margin: 0;
|
|
118
|
+
border: 1px solid #b8b8b8;
|
|
119
|
+
overflow: visible;
|
|
120
|
+
}
|
|
121
|
+
.maptalks-toolbar-vertical ul,
|
|
122
|
+
.maptalks-toolbar-horizonal ul {
|
|
123
|
+
margin: 0;
|
|
124
|
+
padding: 0;
|
|
125
|
+
}
|
|
126
|
+
.maptalks-toolbar-vertical ul li + li {
|
|
127
|
+
border-top: 1px solid #ddd;
|
|
128
|
+
}
|
|
129
|
+
.maptalks-toolbar-vertical li {
|
|
130
|
+
text-align: center;
|
|
131
|
+
list-style: none;
|
|
132
|
+
line-height: 28px;
|
|
133
|
+
font-size: 12px;
|
|
134
|
+
color: #5a5a5a;
|
|
135
|
+
background: #fff;
|
|
136
|
+
min-width: 10px;
|
|
137
|
+
min-height: 28px; /*border-bottom: 1px solid #425568;*/
|
|
138
|
+
position: relative;
|
|
139
|
+
padding: 0px 10px;
|
|
140
|
+
}
|
|
141
|
+
.maptalks-toolbar-vertical li:hover {
|
|
142
|
+
color: #fff;
|
|
143
|
+
background: #6a97d9;
|
|
144
|
+
}
|
|
145
|
+
.maptalks-toolbar-vertical li .maptalks-dropMenu {
|
|
146
|
+
padding: 0;
|
|
147
|
+
position: absolute;
|
|
148
|
+
top: -1px;
|
|
149
|
+
overflow: visible;
|
|
150
|
+
border: 1px solid #b8b8b8; /*border: 1px solid #3e4f61; border-right: none; border-top: none;*/
|
|
151
|
+
}
|
|
152
|
+
.maptalks-toolbar-vertical li .maptalks-dropMenu li {
|
|
153
|
+
list-style: none;
|
|
154
|
+
min-width: 95px;
|
|
155
|
+
background: #606976;
|
|
156
|
+
height: 28px;
|
|
157
|
+
}
|
|
158
|
+
.maptalks-toolbar-vertical li .maptalks-dropMenu li + li {
|
|
159
|
+
border-top: 1px solid #ddd;
|
|
160
|
+
}
|
|
161
|
+
.maptalks-toolbar-vertical li .maptalks-dropMenu li a {
|
|
162
|
+
color: #fff;
|
|
163
|
+
display: block;
|
|
164
|
+
line-height: 27px;
|
|
165
|
+
text-indent: 33px;
|
|
166
|
+
text-decoration: none;
|
|
167
|
+
font-size: 12px;
|
|
168
|
+
}
|
|
169
|
+
.maptalks-toolbar-vertical li .maptalks-dropMenu em.maptalks-ico {
|
|
170
|
+
display: block;
|
|
171
|
+
width: 5px;
|
|
172
|
+
height: 6px; /*background: url(images/control/4_1.png) no-repeat;*/
|
|
173
|
+
position: absolute;
|
|
174
|
+
top: 12px;
|
|
175
|
+
right: -4px;
|
|
176
|
+
}
|
|
177
|
+
.maptalks-toolbar-vertical li .maptalks-dropMenu li.maptalks-on,
|
|
178
|
+
.maptalks-toolbar-vertical li .maptalks-dropMenu li:hover {
|
|
179
|
+
background: #4b545f;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.maptalks-toolbar-horizonal {
|
|
183
|
+
/*border: 1px solid #3b3e44;*/
|
|
184
|
+
margin: 0;
|
|
185
|
+
overflow: visible;
|
|
186
|
+
}
|
|
187
|
+
.maptalks-toolbar-horizonal li {
|
|
188
|
+
text-align: left;
|
|
189
|
+
line-height: 28px;
|
|
190
|
+
font-size: 12px;
|
|
191
|
+
color: #5a5a5a;
|
|
192
|
+
padding: 0px 10px;
|
|
193
|
+
list-style: none;
|
|
194
|
+
min-width: 28px;
|
|
195
|
+
min-height: 28px;
|
|
196
|
+
float: left;
|
|
197
|
+
background: #fff;
|
|
198
|
+
border: 1px solid #b8b8b8; /*border-right: 1px solid #425568;*/
|
|
199
|
+
position: relative;
|
|
200
|
+
}
|
|
201
|
+
.maptalks-toolbar-horizonal ul li:not(:last-child) {
|
|
202
|
+
border-right-color: #ddd;
|
|
203
|
+
}
|
|
204
|
+
.maptalks-toolbar-horizonal ul li + li {
|
|
205
|
+
border-left: none;
|
|
206
|
+
}
|
|
207
|
+
.maptalks-toolbar-horizonal li:hover {
|
|
208
|
+
color: #fff;
|
|
209
|
+
background: #6a97d9; /*border-right:1px solid #1bbc9b;*/
|
|
210
|
+
}
|
|
211
|
+
.maptalks-toolbar-horizonal li .maptalks-dropMenu {
|
|
212
|
+
display: block;
|
|
213
|
+
position: absolute;
|
|
214
|
+
left: -1px;
|
|
215
|
+
overflow: visible; /*border: 1px solid #3e4f61; border-top: none;*/
|
|
216
|
+
}
|
|
217
|
+
.maptalks-toolbar-horizonal li .maptalks-dropMenu li {
|
|
218
|
+
list-style: none;
|
|
219
|
+
min-width: 95px;
|
|
220
|
+
background: #606976;
|
|
221
|
+
height: 28px;
|
|
222
|
+
border: 1px solid #b8b8b8;
|
|
223
|
+
}
|
|
224
|
+
.maptalks-toolbar-horizonal li .maptalks-dropMenu ul li:first-child {
|
|
225
|
+
border-top: none;
|
|
226
|
+
}
|
|
227
|
+
.maptalks-toolbar-horizonal li .maptalks-dropMenu ul li:not(:last-child) {
|
|
228
|
+
border-bottom-color: #ddd;
|
|
229
|
+
}
|
|
230
|
+
.maptalks-toolbar-horizonal li .maptalks-dropMenu li + li {
|
|
231
|
+
border-top: none;
|
|
232
|
+
}
|
|
233
|
+
.maptalks-toolbar-horizonal li .maptalks-dropMenu li a {
|
|
234
|
+
color: #fff;
|
|
235
|
+
display: block;
|
|
236
|
+
line-height: 27px;
|
|
237
|
+
text-indent: 20px;
|
|
238
|
+
text-decoration: none;
|
|
239
|
+
font-size: 12px;
|
|
240
|
+
}
|
|
241
|
+
.maptalks-toolbar-horizonal li .maptalks-dropMenu em.maptalks-ico {
|
|
242
|
+
display: block;
|
|
243
|
+
width: 5px;
|
|
244
|
+
height: 6px; /*background: url(images/control/4.png) no-repeat; */
|
|
245
|
+
position: absolute;
|
|
246
|
+
top: -4px;
|
|
247
|
+
left: 12px;
|
|
248
|
+
}
|
|
249
|
+
.maptalks-toolbar-horizonal .maptalks-dropMenu li:hover {
|
|
250
|
+
background: #4b545f;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.maptalks-toolbar-vertical li .maptalks-dropMenu li a::before,
|
|
254
|
+
.maptalks-toolbar-horizonal li .maptalks-dropMenu li a::before {
|
|
255
|
+
content: "";
|
|
256
|
+
width: 0;
|
|
257
|
+
height: 0;
|
|
258
|
+
position: absolute;
|
|
259
|
+
top: 10px;
|
|
260
|
+
left: 14px;
|
|
261
|
+
border-top: 4px solid transparent;
|
|
262
|
+
border-left: 6px solid #fff;
|
|
263
|
+
border-bottom: 4px solid transparent;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.maptalks-menu {
|
|
267
|
+
background: #fff;
|
|
268
|
+
padding: 1px;
|
|
269
|
+
width: 172px;
|
|
270
|
+
border: 1px solid #b4b3b3; /*box-shadow: 3px 5px 10px #dbdada;*/
|
|
271
|
+
}
|
|
272
|
+
.maptalks-menu .maptalks-menu-items {
|
|
273
|
+
color: #5a5756;
|
|
274
|
+
margin: 0;
|
|
275
|
+
padding: 0;
|
|
276
|
+
font-size: 12px;
|
|
277
|
+
}
|
|
278
|
+
.maptalks-menu .maptalks-menu-items li {
|
|
279
|
+
list-style: none;
|
|
280
|
+
height: 30px;
|
|
281
|
+
line-height: 30px;
|
|
282
|
+
text-indent: 16px;
|
|
283
|
+
}
|
|
284
|
+
.maptalks-menu .maptalks-menu-items li:hover {
|
|
285
|
+
background: #007fbe;
|
|
286
|
+
color: #fff;
|
|
287
|
+
cursor: pointer;
|
|
288
|
+
}
|
|
289
|
+
.maptalks-menu .maptalks-menu-items li.maptalks-menu-splitter {
|
|
290
|
+
list-style: none;
|
|
291
|
+
height: 2px;
|
|
292
|
+
background: #ddd;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/* mesagebox style */
|
|
296
|
+
.maptalks-msgBox {
|
|
297
|
+
background: #fff;
|
|
298
|
+
border: 1px solid #b4b3b3;
|
|
299
|
+
border-radius: 3px; /*box-shadow: 3px 5px 5px #dbdada;*/
|
|
300
|
+
}
|
|
301
|
+
.maptalks-msgBox em.maptalks-ico {
|
|
302
|
+
display: block;
|
|
303
|
+
position: absolute;
|
|
304
|
+
left: 50%;
|
|
305
|
+
margin-left: -5px;
|
|
306
|
+
bottom: -10px;
|
|
307
|
+
width: 0;
|
|
308
|
+
height: 0;
|
|
309
|
+
border-left: 8px solid transparent;
|
|
310
|
+
border-right: 8px solid transparent;
|
|
311
|
+
border-top: 10px solid #b4b3b3;
|
|
312
|
+
}
|
|
313
|
+
.maptalks-msgBox em.maptalks-ico::after {
|
|
314
|
+
content: "";
|
|
315
|
+
width: 0;
|
|
316
|
+
height: 0;
|
|
317
|
+
position: absolute;
|
|
318
|
+
left: -7px;
|
|
319
|
+
top: -10px;
|
|
320
|
+
border-left: 7px solid transparent;
|
|
321
|
+
border-right: 7px solid transparent;
|
|
322
|
+
border-top: 9px solid #fff;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
:root {
|
|
326
|
+
--maptalks-ico-border: 8px solid #b4b3b3;
|
|
327
|
+
}
|
|
328
|
+
.maptalks-msgBox em.maptalks-ico-right-top {
|
|
329
|
+
left: 0%;
|
|
330
|
+
margin-left: 2px;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.maptalks-msgBox em.maptalks-ico-left-top {
|
|
334
|
+
left: 100%;
|
|
335
|
+
margin-left: -18px;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.maptalks-msgBox em.maptalks-ico-left-middle {
|
|
339
|
+
left: 100%;
|
|
340
|
+
bottom: calc(50% - 25px);
|
|
341
|
+
margin-left: 1px;
|
|
342
|
+
border: var(--maptalks-ico-border);
|
|
343
|
+
border-color: transparent transparent transparent #fff;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.maptalks-msgBox em.maptalks-ico-left-middle::after,
|
|
347
|
+
.maptalks-msgBox em.maptalks-ico-right-middle::after,
|
|
348
|
+
.maptalks-msgBox em.maptalks-ico-left-bottom::after,
|
|
349
|
+
.maptalks-msgBox em.maptalks-ico-middle-bottom::after,
|
|
350
|
+
.maptalks-msgBox em.maptalks-ico-right-bottom::after,
|
|
351
|
+
.maptalks-msgBox em.maptalks-ico-middle-middle::after {
|
|
352
|
+
content: none;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.maptalks-msgBox em.maptalks-ico-right-middle {
|
|
356
|
+
left: 0%;
|
|
357
|
+
bottom: calc(50% - 25px);
|
|
358
|
+
margin-left: -16px;
|
|
359
|
+
border: var(--maptalks-ico-border);
|
|
360
|
+
border-color: transparent #fff transparent transparent;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.maptalks-msgBox em.maptalks-ico-left-bottom {
|
|
364
|
+
left: 100%;
|
|
365
|
+
bottom: none;
|
|
366
|
+
top: -16px;
|
|
367
|
+
margin-left: -20px;
|
|
368
|
+
border: var(--maptalks-ico-border);
|
|
369
|
+
border-color: transparent transparent #fff transparent;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.maptalks-msgBox em.maptalks-ico-middle-bottom {
|
|
373
|
+
bottom: none;
|
|
374
|
+
top: -16px;
|
|
375
|
+
border: var(--maptalks-ico-border);
|
|
376
|
+
border-color: transparent transparent #fff transparent;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.maptalks-msgBox em.maptalks-ico-right-bottom {
|
|
380
|
+
left: 0%;
|
|
381
|
+
bottom: none;
|
|
382
|
+
top: -16px;
|
|
383
|
+
margin-left: 4px;
|
|
384
|
+
border: var(--maptalks-ico-border);
|
|
385
|
+
border-color: transparent transparent #fff transparent;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.maptalks-msgBox em.maptalks-ico-middle-middle {
|
|
389
|
+
display: none;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.maptalks-msgBox h2 {
|
|
393
|
+
display: block;
|
|
394
|
+
height: auto;
|
|
395
|
+
line-height: 30px;
|
|
396
|
+
font-weight: bold;
|
|
397
|
+
font-size: 14px;
|
|
398
|
+
padding: 0 10px;
|
|
399
|
+
margin: 0;
|
|
400
|
+
white-space: nowrap;
|
|
401
|
+
padding-right: 30px;
|
|
402
|
+
}
|
|
403
|
+
.maptalks-msgBox a.maptalks-close {
|
|
404
|
+
display: block;
|
|
405
|
+
width: 13px;
|
|
406
|
+
height: 13px;
|
|
407
|
+
text-decoration: none;
|
|
408
|
+
font-size: 14px;
|
|
409
|
+
color: #a5a5a5;
|
|
410
|
+
font-weight: bold;
|
|
411
|
+
position: absolute;
|
|
412
|
+
top: 3px;
|
|
413
|
+
right: 6px;
|
|
414
|
+
}
|
|
415
|
+
.maptalks-msgBox .maptalks-msgContent {
|
|
416
|
+
font-size: 12px;
|
|
417
|
+
padding: 10px;
|
|
418
|
+
min-width: 200px;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
.maptalks-panel {
|
|
422
|
+
background: #fff;
|
|
423
|
+
border: 1px solid #b4b3b3;
|
|
424
|
+
border-radius: 3px; /*box-shadow: 3px 5px 5px #dbdada;*/
|
|
425
|
+
}
|
|
426
|
+
.maptalks-panel .maptalks-panel-content {
|
|
427
|
+
padding: 10px;
|
|
428
|
+
min-width: 200px;
|
|
429
|
+
min-height: 60px;
|
|
430
|
+
}
|
|
431
|
+
.maptalks-panel a.maptalks-close {
|
|
432
|
+
display: block;
|
|
433
|
+
width: 13px;
|
|
434
|
+
height: 13px;
|
|
435
|
+
text-decoration: none;
|
|
436
|
+
font-size: 14px;
|
|
437
|
+
color: #a5a5a5;
|
|
438
|
+
font-weight: bold;
|
|
439
|
+
position: absolute;
|
|
440
|
+
top: 3px;
|
|
441
|
+
right: 6px;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
.maptalks-attribution {
|
|
445
|
+
display: inline-block;
|
|
446
|
+
opacity: 1;
|
|
447
|
+
color: #aeaeae;
|
|
448
|
+
background: #fff;
|
|
449
|
+
background-color: rgba(255, 255, 255, 0.7);
|
|
450
|
+
padding: 0px;
|
|
451
|
+
font-size: 13px;
|
|
452
|
+
font-family: "microsoft yahei", "Helvetica Neue", Helvetica, sans-serif;
|
|
453
|
+
}
|
|
454
|
+
.maptalks-attribution a {
|
|
455
|
+
text-decoration: none;
|
|
456
|
+
color: #8eafbe;
|
|
457
|
+
}
|
|
458
|
+
.maptalks-attribution a:hover {
|
|
459
|
+
text-decoration: underline;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
.maptalks-overview {
|
|
463
|
+
background: #fff;
|
|
464
|
+
border: 1px solid #b4b3b3;
|
|
465
|
+
width: 100%;
|
|
466
|
+
height: 100%;
|
|
467
|
+
}
|
|
468
|
+
.maptalks-overview-button {
|
|
469
|
+
cursor: pointer;
|
|
470
|
+
background: #fff;
|
|
471
|
+
width: 18px;
|
|
472
|
+
height: 18px;
|
|
473
|
+
position: absolute;
|
|
474
|
+
bottom: 1px;
|
|
475
|
+
right: 1px;
|
|
476
|
+
font: 16px sans-serif;
|
|
477
|
+
text-align: center;
|
|
478
|
+
line-height: 16px;
|
|
479
|
+
border: 1px solid #b4b3b3;
|
|
480
|
+
color: #363539;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
.maptalks-layer-switcher ul {
|
|
484
|
+
list-style: none;
|
|
485
|
+
}
|
|
486
|
+
.maptalks-layer-switcher .panel > ul {
|
|
487
|
+
padding-left: 1em;
|
|
488
|
+
}
|
|
489
|
+
.maptalks-layer-switcher .group > ul {
|
|
490
|
+
padding-left: 10px;
|
|
491
|
+
}
|
|
492
|
+
.maptalks-layer-switcher .group + .group {
|
|
493
|
+
padding-top: 1em;
|
|
494
|
+
}
|
|
495
|
+
.maptalks-layer-switcher label {
|
|
496
|
+
text-overflow: ellipsis;
|
|
497
|
+
overflow: hidden;
|
|
498
|
+
display: inline-block;
|
|
499
|
+
font-size: 14px;
|
|
500
|
+
white-space: nowrap;
|
|
501
|
+
color: #5a5a5a;
|
|
502
|
+
}
|
|
503
|
+
.maptalks-layer-switcher .group > label {
|
|
504
|
+
font-weight: bold;
|
|
505
|
+
color: #5a5a5a;
|
|
506
|
+
width: 100%;
|
|
507
|
+
}
|
|
508
|
+
.maptalks-layer-switcher .layer label {
|
|
509
|
+
padding-top: 5px;
|
|
510
|
+
width: 92%;
|
|
511
|
+
}
|
|
512
|
+
.maptalks-layer-switcher input {
|
|
513
|
+
margin: 0 5px;
|
|
514
|
+
position: relative;
|
|
515
|
+
top: -2px;
|
|
516
|
+
}
|
|
517
|
+
.maptalks-layer-switcher input[disabled="disabled"] {
|
|
518
|
+
cursor: not-allowed;
|
|
519
|
+
}
|
|
520
|
+
.maptalks-layer-switcher input[disabled="disabled"] + label {
|
|
521
|
+
color: #666;
|
|
522
|
+
}
|
|
523
|
+
.maptalks-layer-switcher button,
|
|
524
|
+
.maptalks-layer-switcher .panel {
|
|
525
|
+
border-radius: 4px;
|
|
526
|
+
}
|
|
527
|
+
.maptalks-layer-switcher button {
|
|
528
|
+
width: 28px;
|
|
529
|
+
height: 28px;
|
|
530
|
+
background: url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='18'%20height='16'%20viewBox='0%200%2018%2016'%3e%3cpath%20id='图层'%20d='M17.156,74.864a.833.833,0,0,0-.323.065h-.007L9,78.222l-7.826-3.29H1.166A.839.839,0,0,0,.088,75.4a.862.862,0,0,0,.433,1.109h0L8.67,79.939h.008a.825.825,0,0,0,.645,0H9.33l8.149-3.425h0a.86.86,0,0,0,.5-.959A.847.847,0,0,0,17.156,74.864ZM.521,69.085h0L8.67,72.51h.008a.822.822,0,0,0,.645,0H9.33l8.149-3.425h0a.862.862,0,0,0,0-1.584h0L9.33,64.075H9.323a.827.827,0,0,0-.645,0H8.67L.521,67.5h0a.862.862,0,0,0,0,1.583ZM17.156,71.15a.833.833,0,0,0-.323.065h0l0,0h0L9,74.508l-7.826-3.29h0l0,0h0a.839.839,0,0,0-1.082.472A.862.862,0,0,0,.521,72.8h0L8.67,76.225h.008a.825.825,0,0,0,.645,0H9.33L17.479,72.8h0a.86.86,0,0,0,.5-.959A.847.847,0,0,0,17.156,71.15Z'%20transform='translate(0%20-64.007)'%20fill='%236a97d9'/%3e%3c/svg%3e") no-repeat;
|
|
531
|
+
background-position: center;
|
|
532
|
+
background-color: #fff;
|
|
533
|
+
border: 1px solid #b8b8b8;
|
|
534
|
+
}
|
|
535
|
+
.maptalks-layer-switcher.shown button {
|
|
536
|
+
display: none;
|
|
537
|
+
}
|
|
538
|
+
.maptalks-layer-switcher .panel {
|
|
539
|
+
background-color: #fff;
|
|
540
|
+
display: none;
|
|
541
|
+
overflow-y: auto;
|
|
542
|
+
overflow-x: hidden;
|
|
543
|
+
min-width: 120px;
|
|
544
|
+
max-width: 400px;
|
|
545
|
+
max-height: 500px;
|
|
546
|
+
}
|
|
547
|
+
.maptalks-layer-switcher li {
|
|
548
|
+
white-space: nowrap;
|
|
549
|
+
}
|
|
550
|
+
.maptalks-layer-switcher li.group {
|
|
551
|
+
margin-right: 1em;
|
|
552
|
+
}
|
|
553
|
+
.maptalks-layer-switcher.shown .panel {
|
|
554
|
+
display: block;
|
|
555
|
+
}
|
|
556
|
+
.maptalks-layer-switcher ::-webkit-scrollbar {
|
|
557
|
+
width: 6px;
|
|
558
|
+
}
|
|
559
|
+
.maptalks-layer-switcher ::-webkit-scrollbar-track {
|
|
560
|
+
background-color: #1f1f1f;
|
|
561
|
+
}
|
|
562
|
+
.maptalks-layer-switcher ::-webkit-scrollbar-thumb {
|
|
563
|
+
border-radius: 5px;
|
|
564
|
+
background-color: #777;
|
|
565
|
+
}
|
|
566
|
+
.maptalks-tooltip {
|
|
567
|
+
display: block;
|
|
568
|
+
background: #fff;
|
|
569
|
+
border: 1px solid #b4b3b3;
|
|
570
|
+
padding: 0px 4px 0px 4px;
|
|
571
|
+
height: 24px;
|
|
572
|
+
line-height: 24px;
|
|
573
|
+
font-size: 14px;
|
|
574
|
+
white-space: nowrap;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
@keyframes maptalksfadeIn {
|
|
578
|
+
0% {
|
|
579
|
+
opacity: 0;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
100% {
|
|
583
|
+
opacity: 1;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
.mtk-ui-fadein {
|
|
587
|
+
animation: maptalksfadeIn 2s;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
.fy-draw-tool[data-v-f60f236f] {\r
|
|
591
|
+
display: none;
|
|
592
|
+
}\r
|
|
593
|
+
|
|
594
|
+
.fy-draw-point[data-v-6fa54668] {\r
|
|
595
|
+
display: none;
|
|
596
|
+
}\r
|
|
597
|
+
|
|
598
|
+
.fy-draw-line[data-v-37cf3549] {\r
|
|
599
|
+
display: none;
|
|
600
|
+
}\r
|
|
601
|
+
|
|
602
|
+
.fy-draw-polygon[data-v-515f74bf] {\r
|
|
603
|
+
display: none;
|
|
604
|
+
}\r
|
|
605
|
+
|
|
606
|
+
.fy-draw-circle[data-v-93e35e4d] {\r
|
|
607
|
+
display: none;
|
|
608
|
+
}\r
|
|
609
|
+
|
|
610
|
+
.fy-point[data-v-9191aada] {\r
|
|
611
|
+
display: none;
|
|
612
|
+
}\r
|
|
613
|
+
|
|
614
|
+
.fy-linestring[data-v-f5afe3b1] {\r
|
|
615
|
+
display: none;
|
|
616
|
+
}\r
|
|
617
|
+
|
|
618
|
+
.fy-polygon[data-v-762f4fba] {\r
|
|
619
|
+
display: none;
|
|
620
|
+
}\r
|
|
621
|
+
|
|
622
|
+
.fy-circle[data-v-96938291] {\r
|
|
623
|
+
display: none;
|
|
624
|
+
}\r
|
|
625
|
+
/* 这里可以设置全局样式 */\r
|
|
626
|
+
.water-map {\r
|
|
627
|
+
color: #917171;\r
|
|
628
|
+
}\r
|
|
629
|
+
/*$vite$:1*/`;
|
|
630
|
+
document.head.appendChild(__vite_style__);
|
|
631
|
+
function _interopNamespaceDefault(e) {
|
|
632
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
633
|
+
if (e) {
|
|
634
|
+
for (const k in e) {
|
|
635
|
+
if (k !== "default") {
|
|
636
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
637
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
638
|
+
enumerable: true,
|
|
639
|
+
get: () => e[k]
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
n.default = e;
|
|
645
|
+
return Object.freeze(n);
|
|
646
|
+
}
|
|
647
|
+
const maptalks__namespace = /* @__PURE__ */ _interopNamespaceDefault(maptalks);
|
|
648
|
+
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
649
|
+
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
650
|
+
if (render) {
|
|
651
|
+
options.render = render;
|
|
652
|
+
options.staticRenderFns = staticRenderFns;
|
|
653
|
+
options._compiled = true;
|
|
654
|
+
}
|
|
655
|
+
if (scopeId) {
|
|
656
|
+
options._scopeId = "data-v-" + scopeId;
|
|
657
|
+
}
|
|
658
|
+
return {
|
|
659
|
+
exports: scriptExports,
|
|
660
|
+
options
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
const _sfc_main$g = {
|
|
664
|
+
name: "MyButton"
|
|
665
|
+
};
|
|
666
|
+
var _sfc_render$g = function render() {
|
|
667
|
+
var _vm = this, _c = _vm._self._c;
|
|
668
|
+
return _c("button", { staticClass: "my-btn" }, [_vm._t("default")], 2);
|
|
669
|
+
};
|
|
670
|
+
var _sfc_staticRenderFns$g = [];
|
|
671
|
+
var __component__$g = /* @__PURE__ */ normalizeComponent(
|
|
672
|
+
_sfc_main$g,
|
|
673
|
+
_sfc_render$g,
|
|
674
|
+
_sfc_staticRenderFns$g,
|
|
675
|
+
false,
|
|
676
|
+
null,
|
|
677
|
+
"47deef6b"
|
|
678
|
+
);
|
|
679
|
+
const ButtonComponent = __component__$g.exports;
|
|
680
|
+
const MyButton = ButtonComponent;
|
|
681
|
+
MyButton.install = function(Vue) {
|
|
682
|
+
Vue.component(MyButton.name || "MyButton", MyButton);
|
|
683
|
+
};
|
|
684
|
+
const _sfc_main$f = {
|
|
685
|
+
name: "FyMap",
|
|
686
|
+
props: {
|
|
687
|
+
// 地图配置
|
|
688
|
+
options: {
|
|
689
|
+
type: Object,
|
|
690
|
+
default: () => ({})
|
|
691
|
+
},
|
|
692
|
+
// 中心点 [经度, 纬度]
|
|
693
|
+
center: {
|
|
694
|
+
type: Array,
|
|
695
|
+
default: () => [0, 0]
|
|
696
|
+
},
|
|
697
|
+
// 缩放级别
|
|
698
|
+
zoom: {
|
|
699
|
+
type: Number,
|
|
700
|
+
default: 13
|
|
701
|
+
},
|
|
702
|
+
// 最小缩放级别
|
|
703
|
+
minZoom: {
|
|
704
|
+
type: Number,
|
|
705
|
+
default: 1
|
|
706
|
+
},
|
|
707
|
+
// 最大缩放级别
|
|
708
|
+
maxZoom: {
|
|
709
|
+
type: Number,
|
|
710
|
+
default: 22
|
|
711
|
+
},
|
|
712
|
+
// 底图类型
|
|
713
|
+
baseLayer: {
|
|
714
|
+
type: String,
|
|
715
|
+
default: "osm"
|
|
716
|
+
// osm, cartoDB, google, custom
|
|
717
|
+
},
|
|
718
|
+
// 自定义底图URL模板
|
|
719
|
+
baseLayerUrl: {
|
|
720
|
+
type: String,
|
|
721
|
+
default: ""
|
|
722
|
+
},
|
|
723
|
+
// 底图子域名
|
|
724
|
+
subdomains: {
|
|
725
|
+
type: Array,
|
|
726
|
+
default: () => ["a", "b", "c"]
|
|
727
|
+
}
|
|
728
|
+
},
|
|
729
|
+
data() {
|
|
730
|
+
return {
|
|
731
|
+
map: null,
|
|
732
|
+
baseLayerInstance: null
|
|
733
|
+
};
|
|
734
|
+
},
|
|
735
|
+
mounted() {
|
|
736
|
+
this.initMap();
|
|
737
|
+
this.addBaseLayer();
|
|
738
|
+
this.$emit("ready", this.map);
|
|
739
|
+
},
|
|
740
|
+
beforeDestroy() {
|
|
741
|
+
if (this.map) {
|
|
742
|
+
this.map.remove();
|
|
743
|
+
}
|
|
744
|
+
},
|
|
745
|
+
methods: {
|
|
746
|
+
// 初始化地图
|
|
747
|
+
initMap() {
|
|
748
|
+
const config = {
|
|
749
|
+
...this.options,
|
|
750
|
+
center: this.center,
|
|
751
|
+
zoom: this.zoom,
|
|
752
|
+
minZoom: this.minZoom,
|
|
753
|
+
maxZoom: this.maxZoom
|
|
754
|
+
};
|
|
755
|
+
this.map = new maptalks__namespace.Map(this.$refs.mapContainer, config);
|
|
756
|
+
},
|
|
757
|
+
// 添加底图
|
|
758
|
+
addBaseLayer() {
|
|
759
|
+
if (!this.map) return;
|
|
760
|
+
let tileLayer;
|
|
761
|
+
switch (this.baseLayer) {
|
|
762
|
+
case "osm":
|
|
763
|
+
tileLayer = new maptalks__namespace.TileLayer("base", {
|
|
764
|
+
urlTemplate: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
765
|
+
subdomains: ["a", "b", "c"],
|
|
766
|
+
attribution: "© OpenStreetMap contributors"
|
|
767
|
+
});
|
|
768
|
+
break;
|
|
769
|
+
case "cartoDB":
|
|
770
|
+
tileLayer = new maptalks__namespace.TileLayer("base", {
|
|
771
|
+
urlTemplate: "https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",
|
|
772
|
+
subdomains: ["a", "b", "c", "d"],
|
|
773
|
+
attribution: "© CartoDB"
|
|
774
|
+
});
|
|
775
|
+
break;
|
|
776
|
+
case "google":
|
|
777
|
+
tileLayer = new maptalks__namespace.TileLayer("base", {
|
|
778
|
+
urlTemplate: "http://mt{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}",
|
|
779
|
+
subdomains: ["0", "1", "2", "3"],
|
|
780
|
+
attribution: "© Google"
|
|
781
|
+
});
|
|
782
|
+
break;
|
|
783
|
+
case "custom":
|
|
784
|
+
if (this.baseLayerUrl) {
|
|
785
|
+
tileLayer = new maptalks__namespace.TileLayer("base", {
|
|
786
|
+
urlTemplate: this.baseLayerUrl,
|
|
787
|
+
subdomains: this.subdomains
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
break;
|
|
791
|
+
default:
|
|
792
|
+
tileLayer = new maptalks__namespace.TileLayer("base", {
|
|
793
|
+
urlTemplate: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
794
|
+
subdomains: ["a", "b", "c"],
|
|
795
|
+
attribution: "© OpenStreetMap contributors"
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
if (tileLayer) {
|
|
799
|
+
this.baseLayerInstance = tileLayer;
|
|
800
|
+
this.map.addLayer(tileLayer);
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
// 切换底图
|
|
804
|
+
switchBaseLayer(layerType, urlTemplate = "") {
|
|
805
|
+
if (!this.map) return;
|
|
806
|
+
if (this.baseLayerInstance) {
|
|
807
|
+
this.map.removeLayer(this.baseLayerInstance);
|
|
808
|
+
}
|
|
809
|
+
this.baseLayer = layerType;
|
|
810
|
+
if (urlTemplate) {
|
|
811
|
+
this.baseLayerUrl = urlTemplate;
|
|
812
|
+
}
|
|
813
|
+
this.addBaseLayer();
|
|
814
|
+
},
|
|
815
|
+
// 设置中心点
|
|
816
|
+
setCenter(center) {
|
|
817
|
+
if (this.map) {
|
|
818
|
+
this.map.setCenter(center);
|
|
819
|
+
}
|
|
820
|
+
},
|
|
821
|
+
// 设置缩放级别
|
|
822
|
+
setZoom(zoom) {
|
|
823
|
+
if (this.map) {
|
|
824
|
+
this.map.setZoom(zoom);
|
|
825
|
+
}
|
|
826
|
+
},
|
|
827
|
+
// 飞到指定位置
|
|
828
|
+
flyTo(center, zoom, options = {}) {
|
|
829
|
+
if (this.map) {
|
|
830
|
+
this.map.animateTo(
|
|
831
|
+
{
|
|
832
|
+
center,
|
|
833
|
+
zoom
|
|
834
|
+
},
|
|
835
|
+
options
|
|
836
|
+
);
|
|
837
|
+
}
|
|
838
|
+
},
|
|
839
|
+
// 获取地图实例
|
|
840
|
+
getMap() {
|
|
841
|
+
return this.map;
|
|
842
|
+
}
|
|
843
|
+
},
|
|
844
|
+
provide() {
|
|
845
|
+
return {
|
|
846
|
+
mapInstance: this.map
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
};
|
|
850
|
+
var _sfc_render$f = function render() {
|
|
851
|
+
var _vm = this, _c = _vm._self._c;
|
|
852
|
+
return _c("div", { ref: "mapContainer", staticClass: "fy-map" });
|
|
853
|
+
};
|
|
854
|
+
var _sfc_staticRenderFns$f = [];
|
|
855
|
+
var __component__$f = /* @__PURE__ */ normalizeComponent(
|
|
856
|
+
_sfc_main$f,
|
|
857
|
+
_sfc_render$f,
|
|
858
|
+
_sfc_staticRenderFns$f,
|
|
859
|
+
false,
|
|
860
|
+
null,
|
|
861
|
+
"1c68cf57"
|
|
862
|
+
);
|
|
863
|
+
const FyMapComponent = __component__$f.exports;
|
|
864
|
+
const FyMap = FyMapComponent;
|
|
865
|
+
FyMap.install = function(Vue) {
|
|
866
|
+
Vue.component(FyMap.name || "FyMap", FyMap);
|
|
867
|
+
};
|
|
868
|
+
const _sfc_main$e = {
|
|
869
|
+
name: "FyTileLayer",
|
|
870
|
+
props: {
|
|
871
|
+
// 图层ID
|
|
872
|
+
id: {
|
|
873
|
+
type: String,
|
|
874
|
+
default: "tile-layer"
|
|
875
|
+
},
|
|
876
|
+
// 瓦片URL模板
|
|
877
|
+
urlTemplate: {
|
|
878
|
+
type: String,
|
|
879
|
+
required: true
|
|
880
|
+
},
|
|
881
|
+
// 子域名
|
|
882
|
+
subdomains: {
|
|
883
|
+
type: Array,
|
|
884
|
+
default: () => ["a", "b", "c"]
|
|
885
|
+
},
|
|
886
|
+
// 最小缩放级别
|
|
887
|
+
minZoom: {
|
|
888
|
+
type: Number,
|
|
889
|
+
default: null
|
|
890
|
+
},
|
|
891
|
+
// 最大缩放级别
|
|
892
|
+
maxZoom: {
|
|
893
|
+
type: Number,
|
|
894
|
+
default: null
|
|
895
|
+
},
|
|
896
|
+
// 透明度
|
|
897
|
+
opacity: {
|
|
898
|
+
type: Number,
|
|
899
|
+
default: 1
|
|
900
|
+
},
|
|
901
|
+
// 可见性
|
|
902
|
+
visible: {
|
|
903
|
+
type: Boolean,
|
|
904
|
+
default: true
|
|
905
|
+
},
|
|
906
|
+
// 版权信息
|
|
907
|
+
attribution: {
|
|
908
|
+
type: String,
|
|
909
|
+
default: ""
|
|
910
|
+
},
|
|
911
|
+
// 图层Z轴顺序
|
|
912
|
+
zIndex: {
|
|
913
|
+
type: Number,
|
|
914
|
+
default: 1
|
|
915
|
+
}
|
|
916
|
+
},
|
|
917
|
+
data() {
|
|
918
|
+
return {
|
|
919
|
+
layer: null
|
|
920
|
+
};
|
|
921
|
+
},
|
|
922
|
+
inject: {
|
|
923
|
+
mapInstance: {
|
|
924
|
+
default: null
|
|
925
|
+
}
|
|
926
|
+
},
|
|
927
|
+
mounted() {
|
|
928
|
+
if (this.mapInstance) {
|
|
929
|
+
this.initLayer();
|
|
930
|
+
}
|
|
931
|
+
},
|
|
932
|
+
beforeDestroy() {
|
|
933
|
+
this.removeLayer();
|
|
934
|
+
},
|
|
935
|
+
methods: {
|
|
936
|
+
// 初始化图层
|
|
937
|
+
initLayer() {
|
|
938
|
+
const config = {
|
|
939
|
+
id: this.id,
|
|
940
|
+
urlTemplate: this.urlTemplate,
|
|
941
|
+
subdomains: this.subdomains,
|
|
942
|
+
opacity: this.opacity,
|
|
943
|
+
visible: this.visible,
|
|
944
|
+
attribution: this.attribution,
|
|
945
|
+
zIndex: this.zIndex
|
|
946
|
+
};
|
|
947
|
+
if (this.minZoom !== null) {
|
|
948
|
+
config.minZoom = this.minZoom;
|
|
949
|
+
}
|
|
950
|
+
if (this.maxZoom !== null) {
|
|
951
|
+
config.maxZoom = this.maxZoom;
|
|
952
|
+
}
|
|
953
|
+
this.layer = new maptalks__namespace.TileLayer(this.id, config);
|
|
954
|
+
this.mapInstance.addLayer(this.layer);
|
|
955
|
+
this.$emit("ready", this.layer);
|
|
956
|
+
},
|
|
957
|
+
// 移除图层
|
|
958
|
+
removeLayer() {
|
|
959
|
+
if (this.layer && this.mapInstance) {
|
|
960
|
+
this.mapInstance.removeLayer(this.layer);
|
|
961
|
+
this.layer = null;
|
|
962
|
+
}
|
|
963
|
+
},
|
|
964
|
+
// 显示图层
|
|
965
|
+
show() {
|
|
966
|
+
if (this.layer) {
|
|
967
|
+
this.layer.show();
|
|
968
|
+
}
|
|
969
|
+
},
|
|
970
|
+
// 隐藏图层
|
|
971
|
+
hide() {
|
|
972
|
+
if (this.layer) {
|
|
973
|
+
this.layer.hide();
|
|
974
|
+
}
|
|
975
|
+
},
|
|
976
|
+
// 设置透明度
|
|
977
|
+
setOpacity(opacity) {
|
|
978
|
+
if (this.layer) {
|
|
979
|
+
this.layer.setOpacity(opacity);
|
|
980
|
+
}
|
|
981
|
+
},
|
|
982
|
+
// 设置Z轴顺序
|
|
983
|
+
setZIndex(zIndex) {
|
|
984
|
+
if (this.layer) {
|
|
985
|
+
this.layer.setZIndex(zIndex);
|
|
986
|
+
}
|
|
987
|
+
},
|
|
988
|
+
// 获取图层实例
|
|
989
|
+
getLayer() {
|
|
990
|
+
return this.layer;
|
|
991
|
+
}
|
|
992
|
+
},
|
|
993
|
+
watch: {
|
|
994
|
+
visible(newVal) {
|
|
995
|
+
if (newVal) {
|
|
996
|
+
this.show();
|
|
997
|
+
} else {
|
|
998
|
+
this.hide();
|
|
999
|
+
}
|
|
1000
|
+
},
|
|
1001
|
+
opacity(newVal) {
|
|
1002
|
+
this.setOpacity(newVal);
|
|
1003
|
+
},
|
|
1004
|
+
zIndex(newVal) {
|
|
1005
|
+
this.setZIndex(newVal);
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
};
|
|
1009
|
+
var _sfc_render$e = function render() {
|
|
1010
|
+
var _vm = this, _c = _vm._self._c;
|
|
1011
|
+
return _c("div", { staticClass: "fy-tile-layer" });
|
|
1012
|
+
};
|
|
1013
|
+
var _sfc_staticRenderFns$e = [];
|
|
1014
|
+
var __component__$e = /* @__PURE__ */ normalizeComponent(
|
|
1015
|
+
_sfc_main$e,
|
|
1016
|
+
_sfc_render$e,
|
|
1017
|
+
_sfc_staticRenderFns$e,
|
|
1018
|
+
false,
|
|
1019
|
+
null,
|
|
1020
|
+
"56cfee19"
|
|
1021
|
+
);
|
|
1022
|
+
const FyTileLayerComponent = __component__$e.exports;
|
|
1023
|
+
const FyTileLayer = FyTileLayerComponent;
|
|
1024
|
+
FyTileLayer.install = function(Vue) {
|
|
1025
|
+
Vue.component(FyTileLayer.name || "FyTileLayer", FyTileLayer);
|
|
1026
|
+
};
|
|
1027
|
+
const _sfc_main$d = {
|
|
1028
|
+
name: "FyVectorLayer",
|
|
1029
|
+
props: {
|
|
1030
|
+
// 图层ID
|
|
1031
|
+
id: {
|
|
1032
|
+
type: String,
|
|
1033
|
+
default: "vector-layer"
|
|
1034
|
+
},
|
|
1035
|
+
// 渲染类型
|
|
1036
|
+
renderer: {
|
|
1037
|
+
type: String,
|
|
1038
|
+
default: "canvas"
|
|
1039
|
+
// canvas, dom
|
|
1040
|
+
},
|
|
1041
|
+
// 透明度
|
|
1042
|
+
opacity: {
|
|
1043
|
+
type: Number,
|
|
1044
|
+
default: 1
|
|
1045
|
+
},
|
|
1046
|
+
// 可见性
|
|
1047
|
+
visible: {
|
|
1048
|
+
type: Boolean,
|
|
1049
|
+
default: true
|
|
1050
|
+
},
|
|
1051
|
+
// 最小缩放级别
|
|
1052
|
+
minZoom: {
|
|
1053
|
+
type: Number,
|
|
1054
|
+
default: null
|
|
1055
|
+
},
|
|
1056
|
+
// 最大缩放级别
|
|
1057
|
+
maxZoom: {
|
|
1058
|
+
type: Number,
|
|
1059
|
+
default: null
|
|
1060
|
+
},
|
|
1061
|
+
// 图层Z轴顺序
|
|
1062
|
+
zIndex: {
|
|
1063
|
+
type: Number,
|
|
1064
|
+
default: 10
|
|
1065
|
+
},
|
|
1066
|
+
// 是否启用碰撞检测
|
|
1067
|
+
enableCollision: {
|
|
1068
|
+
type: Boolean,
|
|
1069
|
+
default: false
|
|
1070
|
+
},
|
|
1071
|
+
// 图层样式
|
|
1072
|
+
style: {
|
|
1073
|
+
type: Object,
|
|
1074
|
+
default: () => ({})
|
|
1075
|
+
}
|
|
1076
|
+
},
|
|
1077
|
+
data() {
|
|
1078
|
+
return {
|
|
1079
|
+
layer: null
|
|
1080
|
+
};
|
|
1081
|
+
},
|
|
1082
|
+
inject: {
|
|
1083
|
+
mapInstance: {
|
|
1084
|
+
default: null
|
|
1085
|
+
}
|
|
1086
|
+
},
|
|
1087
|
+
mounted() {
|
|
1088
|
+
if (this.mapInstance) {
|
|
1089
|
+
this.initLayer();
|
|
1090
|
+
}
|
|
1091
|
+
},
|
|
1092
|
+
beforeDestroy() {
|
|
1093
|
+
this.removeLayer();
|
|
1094
|
+
},
|
|
1095
|
+
methods: {
|
|
1096
|
+
// 初始化图层
|
|
1097
|
+
initLayer() {
|
|
1098
|
+
const config = {
|
|
1099
|
+
id: this.id,
|
|
1100
|
+
renderer: this.renderer,
|
|
1101
|
+
opacity: this.opacity,
|
|
1102
|
+
visible: this.visible,
|
|
1103
|
+
zIndex: this.zIndex,
|
|
1104
|
+
enableCollision: this.enableCollision,
|
|
1105
|
+
style: this.style
|
|
1106
|
+
};
|
|
1107
|
+
if (this.minZoom !== null) {
|
|
1108
|
+
config.minZoom = this.minZoom;
|
|
1109
|
+
}
|
|
1110
|
+
if (this.maxZoom !== null) {
|
|
1111
|
+
config.maxZoom = this.maxZoom;
|
|
1112
|
+
}
|
|
1113
|
+
this.layer = new maptalks__namespace.VectorLayer(this.id, config);
|
|
1114
|
+
this.mapInstance.addLayer(this.layer);
|
|
1115
|
+
this.$emit("ready", this.layer);
|
|
1116
|
+
},
|
|
1117
|
+
// 移除图层
|
|
1118
|
+
removeLayer() {
|
|
1119
|
+
if (this.layer && this.mapInstance) {
|
|
1120
|
+
this.mapInstance.removeLayer(this.layer);
|
|
1121
|
+
this.layer = null;
|
|
1122
|
+
}
|
|
1123
|
+
},
|
|
1124
|
+
// 添加几何图形
|
|
1125
|
+
addGeometry(geometries) {
|
|
1126
|
+
if (this.layer && geometries) {
|
|
1127
|
+
if (Array.isArray(geometries)) {
|
|
1128
|
+
this.layer.addGeometry(geometries);
|
|
1129
|
+
} else {
|
|
1130
|
+
this.layer.addGeometry(geometries);
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
},
|
|
1134
|
+
// 移除几何图形
|
|
1135
|
+
removeGeometry(geometries) {
|
|
1136
|
+
if (this.layer && geometries) {
|
|
1137
|
+
if (Array.isArray(geometries)) {
|
|
1138
|
+
this.layer.removeGeometry(geometries);
|
|
1139
|
+
} else {
|
|
1140
|
+
this.layer.removeGeometry(geometries);
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
},
|
|
1144
|
+
// 清空图层
|
|
1145
|
+
clear() {
|
|
1146
|
+
if (this.layer) {
|
|
1147
|
+
this.layer.clear();
|
|
1148
|
+
}
|
|
1149
|
+
},
|
|
1150
|
+
// 显示图层
|
|
1151
|
+
show() {
|
|
1152
|
+
if (this.layer) {
|
|
1153
|
+
this.layer.show();
|
|
1154
|
+
}
|
|
1155
|
+
},
|
|
1156
|
+
// 隐藏图层
|
|
1157
|
+
hide() {
|
|
1158
|
+
if (this.layer) {
|
|
1159
|
+
this.layer.hide();
|
|
1160
|
+
}
|
|
1161
|
+
},
|
|
1162
|
+
// 设置透明度
|
|
1163
|
+
setOpacity(opacity) {
|
|
1164
|
+
if (this.layer) {
|
|
1165
|
+
this.layer.setOpacity(opacity);
|
|
1166
|
+
}
|
|
1167
|
+
},
|
|
1168
|
+
// 设置Z轴顺序
|
|
1169
|
+
setZIndex(zIndex) {
|
|
1170
|
+
if (this.layer) {
|
|
1171
|
+
this.layer.setZIndex(zIndex);
|
|
1172
|
+
}
|
|
1173
|
+
},
|
|
1174
|
+
// 设置样式
|
|
1175
|
+
setStyle(style) {
|
|
1176
|
+
if (this.layer) {
|
|
1177
|
+
this.layer.setStyle(style);
|
|
1178
|
+
}
|
|
1179
|
+
},
|
|
1180
|
+
// 获取图层实例
|
|
1181
|
+
getLayer() {
|
|
1182
|
+
return this.layer;
|
|
1183
|
+
},
|
|
1184
|
+
// 获取所有几何图形
|
|
1185
|
+
getGeometries() {
|
|
1186
|
+
if (this.layer) {
|
|
1187
|
+
return this.layer.getGeometries();
|
|
1188
|
+
}
|
|
1189
|
+
return [];
|
|
1190
|
+
}
|
|
1191
|
+
},
|
|
1192
|
+
watch: {
|
|
1193
|
+
visible(newVal) {
|
|
1194
|
+
if (newVal) {
|
|
1195
|
+
this.show();
|
|
1196
|
+
} else {
|
|
1197
|
+
this.hide();
|
|
1198
|
+
}
|
|
1199
|
+
},
|
|
1200
|
+
opacity(newVal) {
|
|
1201
|
+
this.setOpacity(newVal);
|
|
1202
|
+
},
|
|
1203
|
+
zIndex(newVal) {
|
|
1204
|
+
this.setZIndex(newVal);
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
};
|
|
1208
|
+
var _sfc_render$d = function render() {
|
|
1209
|
+
var _vm = this, _c = _vm._self._c;
|
|
1210
|
+
return _c("div", { staticClass: "fy-vector-layer" });
|
|
1211
|
+
};
|
|
1212
|
+
var _sfc_staticRenderFns$d = [];
|
|
1213
|
+
var __component__$d = /* @__PURE__ */ normalizeComponent(
|
|
1214
|
+
_sfc_main$d,
|
|
1215
|
+
_sfc_render$d,
|
|
1216
|
+
_sfc_staticRenderFns$d,
|
|
1217
|
+
false,
|
|
1218
|
+
null,
|
|
1219
|
+
"cd2b9e14"
|
|
1220
|
+
);
|
|
1221
|
+
const FyVectorLayerComponent = __component__$d.exports;
|
|
1222
|
+
const FyVectorLayer = FyVectorLayerComponent;
|
|
1223
|
+
FyVectorLayer.install = function(Vue) {
|
|
1224
|
+
Vue.component(FyVectorLayer.name || "FyVectorLayer", FyVectorLayer);
|
|
1225
|
+
};
|
|
1226
|
+
const _sfc_main$c = {
|
|
1227
|
+
name: "FyMarker",
|
|
1228
|
+
props: {
|
|
1229
|
+
// 位置坐标 [经度, 纬度]
|
|
1230
|
+
coordinates: {
|
|
1231
|
+
type: Array,
|
|
1232
|
+
required: true
|
|
1233
|
+
},
|
|
1234
|
+
// 图标图片URL
|
|
1235
|
+
icon: {
|
|
1236
|
+
type: String,
|
|
1237
|
+
default: ""
|
|
1238
|
+
},
|
|
1239
|
+
// 图标尺寸
|
|
1240
|
+
iconSize: {
|
|
1241
|
+
type: Array,
|
|
1242
|
+
default: () => [32, 32]
|
|
1243
|
+
},
|
|
1244
|
+
// 图标偏移
|
|
1245
|
+
iconOffset: {
|
|
1246
|
+
type: Array,
|
|
1247
|
+
default: () => [0, 0]
|
|
1248
|
+
},
|
|
1249
|
+
// 旋转角度
|
|
1250
|
+
rotation: {
|
|
1251
|
+
type: Number,
|
|
1252
|
+
default: 0
|
|
1253
|
+
},
|
|
1254
|
+
// 透明度
|
|
1255
|
+
opacity: {
|
|
1256
|
+
type: Number,
|
|
1257
|
+
default: 1
|
|
1258
|
+
},
|
|
1259
|
+
// 可见性
|
|
1260
|
+
visible: {
|
|
1261
|
+
type: Boolean,
|
|
1262
|
+
default: true
|
|
1263
|
+
},
|
|
1264
|
+
// 可拖拽
|
|
1265
|
+
draggable: {
|
|
1266
|
+
type: Boolean,
|
|
1267
|
+
default: false
|
|
1268
|
+
},
|
|
1269
|
+
// 弹曲程度
|
|
1270
|
+
curve: {
|
|
1271
|
+
type: Number,
|
|
1272
|
+
default: 0
|
|
1273
|
+
},
|
|
1274
|
+
// 自定义属性
|
|
1275
|
+
properties: {
|
|
1276
|
+
type: Object,
|
|
1277
|
+
default: () => ({})
|
|
1278
|
+
},
|
|
1279
|
+
// 层级
|
|
1280
|
+
zIndex: {
|
|
1281
|
+
type: Number,
|
|
1282
|
+
default: 1
|
|
1283
|
+
}
|
|
1284
|
+
},
|
|
1285
|
+
data() {
|
|
1286
|
+
return {
|
|
1287
|
+
marker: null
|
|
1288
|
+
};
|
|
1289
|
+
},
|
|
1290
|
+
inject: {
|
|
1291
|
+
mapInstance: {
|
|
1292
|
+
default: null
|
|
1293
|
+
}
|
|
1294
|
+
},
|
|
1295
|
+
mounted() {
|
|
1296
|
+
if (this.mapInstance) {
|
|
1297
|
+
this.initMarker();
|
|
1298
|
+
}
|
|
1299
|
+
},
|
|
1300
|
+
beforeDestroy() {
|
|
1301
|
+
this.removeMarker();
|
|
1302
|
+
},
|
|
1303
|
+
methods: {
|
|
1304
|
+
// 初始化 Marker
|
|
1305
|
+
initMarker() {
|
|
1306
|
+
const config = {
|
|
1307
|
+
coordinates: this.coordinates,
|
|
1308
|
+
visible: this.visible,
|
|
1309
|
+
draggable: this.draggable,
|
|
1310
|
+
curve: this.curve,
|
|
1311
|
+
properties: this.properties,
|
|
1312
|
+
zIndex: this.zIndex
|
|
1313
|
+
};
|
|
1314
|
+
if (this.icon) {
|
|
1315
|
+
config.symbol = {
|
|
1316
|
+
markerFile: this.icon,
|
|
1317
|
+
markerWidth: this.iconSize[0],
|
|
1318
|
+
markerHeight: this.iconSize[1],
|
|
1319
|
+
markerDx: this.iconOffset[0],
|
|
1320
|
+
markerDy: this.iconOffset[1],
|
|
1321
|
+
markerOpacity: this.opacity,
|
|
1322
|
+
markerRotation: this.rotation
|
|
1323
|
+
};
|
|
1324
|
+
} else {
|
|
1325
|
+
config.symbol = {
|
|
1326
|
+
markerType: "ellipse",
|
|
1327
|
+
markerFill: "#ff0000",
|
|
1328
|
+
markerFillOpacity: 1,
|
|
1329
|
+
markerLineColor: "#ffffff",
|
|
1330
|
+
markerLineWidth: 2,
|
|
1331
|
+
markerLineOpacity: 1,
|
|
1332
|
+
markerWidth: 30,
|
|
1333
|
+
markerHeight: 30,
|
|
1334
|
+
markerDx: 0,
|
|
1335
|
+
markerDy: 0,
|
|
1336
|
+
markerOpacity: this.opacity
|
|
1337
|
+
};
|
|
1338
|
+
}
|
|
1339
|
+
this.marker = new maptalks__namespace.Marker(this.coordinates, config);
|
|
1340
|
+
this.marker.on("click", this.handleClick);
|
|
1341
|
+
this.marker.on("mouseover", this.handleMouseover);
|
|
1342
|
+
this.marker.on("mouseout", this.handleMouseout);
|
|
1343
|
+
this.marker.on("dragstart", this.handleDragStart);
|
|
1344
|
+
this.marker.on("dragging", this.handleDragging);
|
|
1345
|
+
this.marker.on("dragend", this.handleDragEnd);
|
|
1346
|
+
this.mapInstance.addMarker(this.marker);
|
|
1347
|
+
this.$emit("ready", this.marker);
|
|
1348
|
+
},
|
|
1349
|
+
// 移除 Marker
|
|
1350
|
+
removeMarker() {
|
|
1351
|
+
if (this.marker && this.mapInstance) {
|
|
1352
|
+
this.marker.off("click", this.handleClick);
|
|
1353
|
+
this.marker.off("mouseover", this.handleMouseover);
|
|
1354
|
+
this.marker.off("mouseout", this.handleMouseout);
|
|
1355
|
+
this.marker.off("dragstart", this.handleDragStart);
|
|
1356
|
+
this.marker.off("dragging", this.handleDragging);
|
|
1357
|
+
this.marker.off("dragend", this.handleDragEnd);
|
|
1358
|
+
this.mapInstance.removeMarker(this.marker);
|
|
1359
|
+
this.marker = null;
|
|
1360
|
+
}
|
|
1361
|
+
},
|
|
1362
|
+
// 事件处理
|
|
1363
|
+
handleClick(e) {
|
|
1364
|
+
this.$emit("click", e);
|
|
1365
|
+
},
|
|
1366
|
+
handleMouseover(e) {
|
|
1367
|
+
this.$emit("mouseover", e);
|
|
1368
|
+
},
|
|
1369
|
+
handleMouseout(e) {
|
|
1370
|
+
this.$emit("mouseout", e);
|
|
1371
|
+
},
|
|
1372
|
+
handleDragStart(e) {
|
|
1373
|
+
this.$emit("dragstart", e);
|
|
1374
|
+
},
|
|
1375
|
+
handleDragging(e) {
|
|
1376
|
+
this.$emit("dragging", e);
|
|
1377
|
+
},
|
|
1378
|
+
handleDragEnd(e) {
|
|
1379
|
+
this.$emit("dragend", e);
|
|
1380
|
+
},
|
|
1381
|
+
// 设置位置
|
|
1382
|
+
setCoordinates(coordinates) {
|
|
1383
|
+
if (this.marker) {
|
|
1384
|
+
this.marker.setCoordinates(coordinates);
|
|
1385
|
+
}
|
|
1386
|
+
},
|
|
1387
|
+
// 设置图标
|
|
1388
|
+
setIcon(icon) {
|
|
1389
|
+
if (this.marker) {
|
|
1390
|
+
this.marker.setSymbol({
|
|
1391
|
+
markerFile: icon
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
},
|
|
1395
|
+
// 设置透明度
|
|
1396
|
+
setOpacity(opacity) {
|
|
1397
|
+
if (this.marker) {
|
|
1398
|
+
this.marker.setOpacity(opacity);
|
|
1399
|
+
}
|
|
1400
|
+
},
|
|
1401
|
+
// 显示
|
|
1402
|
+
show() {
|
|
1403
|
+
if (this.marker) {
|
|
1404
|
+
this.marker.show();
|
|
1405
|
+
}
|
|
1406
|
+
},
|
|
1407
|
+
// 隐藏
|
|
1408
|
+
hide() {
|
|
1409
|
+
if (this.marker) {
|
|
1410
|
+
this.marker.hide();
|
|
1411
|
+
}
|
|
1412
|
+
},
|
|
1413
|
+
// 打开信息窗口
|
|
1414
|
+
openInfoWindow(content, options = {}) {
|
|
1415
|
+
if (this.marker) {
|
|
1416
|
+
this.marker.openInfoWindow(content, options);
|
|
1417
|
+
}
|
|
1418
|
+
},
|
|
1419
|
+
// 关闭信息窗口
|
|
1420
|
+
closeInfoWindow() {
|
|
1421
|
+
if (this.marker) {
|
|
1422
|
+
this.marker.closeInfoWindow();
|
|
1423
|
+
}
|
|
1424
|
+
},
|
|
1425
|
+
// 获取 Marker 实例
|
|
1426
|
+
getMarker() {
|
|
1427
|
+
return this.marker;
|
|
1428
|
+
}
|
|
1429
|
+
},
|
|
1430
|
+
watch: {
|
|
1431
|
+
coordinates(newVal) {
|
|
1432
|
+
this.setCoordinates(newVal);
|
|
1433
|
+
},
|
|
1434
|
+
icon(newVal) {
|
|
1435
|
+
this.setIcon(newVal);
|
|
1436
|
+
},
|
|
1437
|
+
opacity(newVal) {
|
|
1438
|
+
this.setOpacity(newVal);
|
|
1439
|
+
},
|
|
1440
|
+
visible(newVal) {
|
|
1441
|
+
if (newVal) {
|
|
1442
|
+
this.show();
|
|
1443
|
+
} else {
|
|
1444
|
+
this.hide();
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
};
|
|
1449
|
+
var _sfc_render$c = function render() {
|
|
1450
|
+
var _vm = this, _c = _vm._self._c;
|
|
1451
|
+
return _c("div", { staticClass: "fy-marker" });
|
|
1452
|
+
};
|
|
1453
|
+
var _sfc_staticRenderFns$c = [];
|
|
1454
|
+
var __component__$c = /* @__PURE__ */ normalizeComponent(
|
|
1455
|
+
_sfc_main$c,
|
|
1456
|
+
_sfc_render$c,
|
|
1457
|
+
_sfc_staticRenderFns$c,
|
|
1458
|
+
false,
|
|
1459
|
+
null,
|
|
1460
|
+
"249684eb"
|
|
1461
|
+
);
|
|
1462
|
+
const FyMarkerComponent = __component__$c.exports;
|
|
1463
|
+
const FyMarker = FyMarkerComponent;
|
|
1464
|
+
FyMarker.install = function(Vue) {
|
|
1465
|
+
Vue.component(FyMarker.name || "FyMarker", FyMarker);
|
|
1466
|
+
};
|
|
1467
|
+
const _sfc_main$b = {
|
|
1468
|
+
name: "FyLabel",
|
|
1469
|
+
props: {
|
|
1470
|
+
// 位置坐标 [经度, 纬度]
|
|
1471
|
+
coordinates: {
|
|
1472
|
+
type: Array,
|
|
1473
|
+
required: true
|
|
1474
|
+
},
|
|
1475
|
+
// 文本内容
|
|
1476
|
+
content: {
|
|
1477
|
+
type: String,
|
|
1478
|
+
required: true
|
|
1479
|
+
},
|
|
1480
|
+
// 文本框宽度
|
|
1481
|
+
boxWidth: {
|
|
1482
|
+
type: Number,
|
|
1483
|
+
default: 160
|
|
1484
|
+
},
|
|
1485
|
+
// 文本样式
|
|
1486
|
+
textStyle: {
|
|
1487
|
+
type: Object,
|
|
1488
|
+
default: () => ({
|
|
1489
|
+
fontSize: 12,
|
|
1490
|
+
fill: "#333",
|
|
1491
|
+
weight: "bold"
|
|
1492
|
+
})
|
|
1493
|
+
},
|
|
1494
|
+
// 背景样式
|
|
1495
|
+
boxStyle: {
|
|
1496
|
+
type: Object,
|
|
1497
|
+
default: () => ({
|
|
1498
|
+
padding: [4, 4],
|
|
1499
|
+
symbol: {
|
|
1500
|
+
markerType: "square",
|
|
1501
|
+
markerFill: "rgba(255,255,255,0.8)",
|
|
1502
|
+
markerFillOpacity: 1,
|
|
1503
|
+
markerLineColor: "#ccc",
|
|
1504
|
+
markerLineWidth: 1,
|
|
1505
|
+
markerLineOpacity: 1,
|
|
1506
|
+
markerLineDasharray: [],
|
|
1507
|
+
markerWidth: 40,
|
|
1508
|
+
markerHeight: 20
|
|
1509
|
+
}
|
|
1510
|
+
})
|
|
1511
|
+
},
|
|
1512
|
+
// 透明度
|
|
1513
|
+
opacity: {
|
|
1514
|
+
type: Number,
|
|
1515
|
+
default: 1
|
|
1516
|
+
},
|
|
1517
|
+
// 可见性
|
|
1518
|
+
visible: {
|
|
1519
|
+
type: Boolean,
|
|
1520
|
+
default: true
|
|
1521
|
+
},
|
|
1522
|
+
// 文本方向
|
|
1523
|
+
textDirection: {
|
|
1524
|
+
type: String,
|
|
1525
|
+
default: "right"
|
|
1526
|
+
// right, left, center
|
|
1527
|
+
},
|
|
1528
|
+
// 自定义属性
|
|
1529
|
+
properties: {
|
|
1530
|
+
type: Object,
|
|
1531
|
+
default: () => ({})
|
|
1532
|
+
},
|
|
1533
|
+
// 层级
|
|
1534
|
+
zIndex: {
|
|
1535
|
+
type: Number,
|
|
1536
|
+
default: 10
|
|
1537
|
+
}
|
|
1538
|
+
},
|
|
1539
|
+
data() {
|
|
1540
|
+
return {
|
|
1541
|
+
label: null
|
|
1542
|
+
};
|
|
1543
|
+
},
|
|
1544
|
+
inject: {
|
|
1545
|
+
mapInstance: {
|
|
1546
|
+
default: null
|
|
1547
|
+
}
|
|
1548
|
+
},
|
|
1549
|
+
mounted() {
|
|
1550
|
+
if (this.mapInstance) {
|
|
1551
|
+
this.initLabel();
|
|
1552
|
+
}
|
|
1553
|
+
},
|
|
1554
|
+
beforeDestroy() {
|
|
1555
|
+
this.removeLabel();
|
|
1556
|
+
},
|
|
1557
|
+
methods: {
|
|
1558
|
+
// 初始化 Label
|
|
1559
|
+
initLabel() {
|
|
1560
|
+
const config = {
|
|
1561
|
+
coordinates: this.coordinates,
|
|
1562
|
+
content: this.content,
|
|
1563
|
+
visible: this.visible,
|
|
1564
|
+
properties: this.properties,
|
|
1565
|
+
zIndex: this.zIndex
|
|
1566
|
+
};
|
|
1567
|
+
const textSymbol = {
|
|
1568
|
+
textName: this.content,
|
|
1569
|
+
textSize: this.textStyle.fontSize || 12,
|
|
1570
|
+
textFill: this.textStyle.fill || "#333",
|
|
1571
|
+
textWeight: this.textStyle.weight || "normal",
|
|
1572
|
+
textOpacity: this.opacity,
|
|
1573
|
+
textHaloFill: "#ffffff",
|
|
1574
|
+
textHaloRadius: 2,
|
|
1575
|
+
textHaloOpacity: 1,
|
|
1576
|
+
textWrapWidth: this.boxWidth,
|
|
1577
|
+
textLineSpacing: 1
|
|
1578
|
+
};
|
|
1579
|
+
if (this.boxStyle && this.boxStyle.symbol) {
|
|
1580
|
+
textSymbol.markerType = this.boxStyle.symbol.markerType || "square";
|
|
1581
|
+
textSymbol.markerFill = this.boxStyle.symbol.markerFill || "rgba(255,255,255,0.8)";
|
|
1582
|
+
textSymbol.markerFillOpacity = this.boxStyle.symbol.markerFillOpacity || 1;
|
|
1583
|
+
textSymbol.markerLineColor = this.boxStyle.symbol.markerLineColor || "#ccc";
|
|
1584
|
+
textSymbol.markerLineWidth = this.boxStyle.symbol.markerLineWidth || 1;
|
|
1585
|
+
textSymbol.markerLineOpacity = this.boxStyle.symbol.markerLineOpacity || 1;
|
|
1586
|
+
textSymbol.markerDx = this.boxStyle.padding && this.boxStyle.padding[0] || 4;
|
|
1587
|
+
textSymbol.markerDy = this.boxStyle.padding && this.boxStyle.padding[1] || 4;
|
|
1588
|
+
}
|
|
1589
|
+
config.symbol = textSymbol;
|
|
1590
|
+
this.label = new maptalks__namespace.Label(this.content, this.coordinates, config);
|
|
1591
|
+
this.label.on("click", this.handleClick);
|
|
1592
|
+
this.label.on("mouseover", this.handleMouseover);
|
|
1593
|
+
this.label.on("mouseout", this.handleMouseout);
|
|
1594
|
+
this.mapInstance.addLabel(this.label);
|
|
1595
|
+
this.$emit("ready", this.label);
|
|
1596
|
+
},
|
|
1597
|
+
// 移除 Label
|
|
1598
|
+
removeLabel() {
|
|
1599
|
+
if (this.label && this.mapInstance) {
|
|
1600
|
+
this.label.off("click", this.handleClick);
|
|
1601
|
+
this.label.off("mouseover", this.handleMouseover);
|
|
1602
|
+
this.label.off("mouseout", this.handleMouseout);
|
|
1603
|
+
this.mapInstance.removeLabel(this.label);
|
|
1604
|
+
this.label = null;
|
|
1605
|
+
}
|
|
1606
|
+
},
|
|
1607
|
+
// 事件处理
|
|
1608
|
+
handleClick(e) {
|
|
1609
|
+
this.$emit("click", e);
|
|
1610
|
+
},
|
|
1611
|
+
handleMouseover(e) {
|
|
1612
|
+
this.$emit("mouseover", e);
|
|
1613
|
+
},
|
|
1614
|
+
handleMouseout(e) {
|
|
1615
|
+
this.$emit("mouseout", e);
|
|
1616
|
+
},
|
|
1617
|
+
// 设置内容
|
|
1618
|
+
setContent(content) {
|
|
1619
|
+
if (this.label) {
|
|
1620
|
+
this.label.setContent(content);
|
|
1621
|
+
}
|
|
1622
|
+
},
|
|
1623
|
+
// 设置位置
|
|
1624
|
+
setCoordinates(coordinates) {
|
|
1625
|
+
if (this.label) {
|
|
1626
|
+
this.label.setCoordinates(coordinates);
|
|
1627
|
+
}
|
|
1628
|
+
},
|
|
1629
|
+
// 设置样式
|
|
1630
|
+
setStyle(style) {
|
|
1631
|
+
if (this.label) {
|
|
1632
|
+
this.label.setStyle(style);
|
|
1633
|
+
}
|
|
1634
|
+
},
|
|
1635
|
+
// 设置透明度
|
|
1636
|
+
setOpacity(opacity) {
|
|
1637
|
+
if (this.label) {
|
|
1638
|
+
this.label.setOpacity(opacity);
|
|
1639
|
+
}
|
|
1640
|
+
},
|
|
1641
|
+
// 显示
|
|
1642
|
+
show() {
|
|
1643
|
+
if (this.label) {
|
|
1644
|
+
this.label.show();
|
|
1645
|
+
}
|
|
1646
|
+
},
|
|
1647
|
+
// 隐藏
|
|
1648
|
+
hide() {
|
|
1649
|
+
if (this.label) {
|
|
1650
|
+
this.label.hide();
|
|
1651
|
+
}
|
|
1652
|
+
},
|
|
1653
|
+
// 获取 Label 实例
|
|
1654
|
+
getLabel() {
|
|
1655
|
+
return this.label;
|
|
1656
|
+
}
|
|
1657
|
+
},
|
|
1658
|
+
watch: {
|
|
1659
|
+
content(newVal) {
|
|
1660
|
+
this.setContent(newVal);
|
|
1661
|
+
},
|
|
1662
|
+
coordinates(newVal) {
|
|
1663
|
+
this.setCoordinates(newVal);
|
|
1664
|
+
},
|
|
1665
|
+
opacity(newVal) {
|
|
1666
|
+
this.setOpacity(newVal);
|
|
1667
|
+
},
|
|
1668
|
+
visible(newVal) {
|
|
1669
|
+
if (newVal) {
|
|
1670
|
+
this.show();
|
|
1671
|
+
} else {
|
|
1672
|
+
this.hide();
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
};
|
|
1677
|
+
var _sfc_render$b = function render() {
|
|
1678
|
+
var _vm = this, _c = _vm._self._c;
|
|
1679
|
+
return _c("div", { staticClass: "fy-label" });
|
|
1680
|
+
};
|
|
1681
|
+
var _sfc_staticRenderFns$b = [];
|
|
1682
|
+
var __component__$b = /* @__PURE__ */ normalizeComponent(
|
|
1683
|
+
_sfc_main$b,
|
|
1684
|
+
_sfc_render$b,
|
|
1685
|
+
_sfc_staticRenderFns$b,
|
|
1686
|
+
false,
|
|
1687
|
+
null,
|
|
1688
|
+
"2ad8e63e"
|
|
1689
|
+
);
|
|
1690
|
+
const FyLabelComponent = __component__$b.exports;
|
|
1691
|
+
const FyLabel = FyLabelComponent;
|
|
1692
|
+
FyLabel.install = function(Vue) {
|
|
1693
|
+
Vue.component(FyLabel.name || "FyLabel", FyLabel);
|
|
1694
|
+
};
|
|
1695
|
+
const _sfc_main$a = {
|
|
1696
|
+
name: "FyPopup",
|
|
1697
|
+
props: {
|
|
1698
|
+
// 位置坐标 [经度, 纬度]
|
|
1699
|
+
coordinates: {
|
|
1700
|
+
type: Array,
|
|
1701
|
+
required: true
|
|
1702
|
+
},
|
|
1703
|
+
// 弹窗内容
|
|
1704
|
+
content: {
|
|
1705
|
+
type: String,
|
|
1706
|
+
required: true
|
|
1707
|
+
},
|
|
1708
|
+
// 标题
|
|
1709
|
+
title: {
|
|
1710
|
+
type: String,
|
|
1711
|
+
default: ""
|
|
1712
|
+
},
|
|
1713
|
+
// 宽度
|
|
1714
|
+
width: {
|
|
1715
|
+
type: Number,
|
|
1716
|
+
default: 300
|
|
1717
|
+
},
|
|
1718
|
+
// 高度
|
|
1719
|
+
height: {
|
|
1720
|
+
type: Number,
|
|
1721
|
+
default: null
|
|
1722
|
+
},
|
|
1723
|
+
// 最小宽度
|
|
1724
|
+
minWidth: {
|
|
1725
|
+
type: Number,
|
|
1726
|
+
default: 200
|
|
1727
|
+
},
|
|
1728
|
+
// 最小高度
|
|
1729
|
+
minHeight: {
|
|
1730
|
+
type: Number,
|
|
1731
|
+
default: null
|
|
1732
|
+
},
|
|
1733
|
+
// 最大宽度
|
|
1734
|
+
maxWidth: {
|
|
1735
|
+
type: Number,
|
|
1736
|
+
default: 600
|
|
1737
|
+
},
|
|
1738
|
+
// 自动关闭
|
|
1739
|
+
autoClose: {
|
|
1740
|
+
type: Boolean,
|
|
1741
|
+
default: false
|
|
1742
|
+
},
|
|
1743
|
+
// 自定义样式类名
|
|
1744
|
+
className: {
|
|
1745
|
+
type: String,
|
|
1746
|
+
default: ""
|
|
1747
|
+
},
|
|
1748
|
+
// 是否显示关闭按钮
|
|
1749
|
+
closeButton: {
|
|
1750
|
+
type: Boolean,
|
|
1751
|
+
default: true
|
|
1752
|
+
},
|
|
1753
|
+
// 偏移量
|
|
1754
|
+
offset: {
|
|
1755
|
+
type: Array,
|
|
1756
|
+
default: () => [0, 0]
|
|
1757
|
+
},
|
|
1758
|
+
// 自定义属性
|
|
1759
|
+
properties: {
|
|
1760
|
+
type: Object,
|
|
1761
|
+
default: () => ({})
|
|
1762
|
+
}
|
|
1763
|
+
},
|
|
1764
|
+
data() {
|
|
1765
|
+
return {
|
|
1766
|
+
popup: null
|
|
1767
|
+
};
|
|
1768
|
+
},
|
|
1769
|
+
inject: {
|
|
1770
|
+
mapInstance: {
|
|
1771
|
+
default: null
|
|
1772
|
+
}
|
|
1773
|
+
},
|
|
1774
|
+
mounted() {
|
|
1775
|
+
if (this.mapInstance) {
|
|
1776
|
+
this.initPopup();
|
|
1777
|
+
}
|
|
1778
|
+
},
|
|
1779
|
+
beforeDestroy() {
|
|
1780
|
+
this.removePopup();
|
|
1781
|
+
},
|
|
1782
|
+
methods: {
|
|
1783
|
+
// 初始化 Popup
|
|
1784
|
+
initPopup() {
|
|
1785
|
+
const config = {
|
|
1786
|
+
content: this.content,
|
|
1787
|
+
width: this.width,
|
|
1788
|
+
minWidth: this.minWidth,
|
|
1789
|
+
maxWidth: this.maxWidth,
|
|
1790
|
+
autoClose: this.autoClose,
|
|
1791
|
+
className: this.className,
|
|
1792
|
+
closeButton: this.closeButton,
|
|
1793
|
+
offset: this.offset,
|
|
1794
|
+
properties: this.properties
|
|
1795
|
+
};
|
|
1796
|
+
if (this.height !== null) {
|
|
1797
|
+
config.height = this.height;
|
|
1798
|
+
}
|
|
1799
|
+
if (this.minHeight !== null) {
|
|
1800
|
+
config.minHeight = this.minHeight;
|
|
1801
|
+
}
|
|
1802
|
+
if (this.title) {
|
|
1803
|
+
config.title = this.title;
|
|
1804
|
+
}
|
|
1805
|
+
this.popup = new maptalks__namespace.InfoWindow(config);
|
|
1806
|
+
this.popup.setCoordinates(this.coordinates);
|
|
1807
|
+
this.popup.on("open", this.handleOpen);
|
|
1808
|
+
this.popup.on("close", this.handleClose);
|
|
1809
|
+
this.popup.on("click", this.handleClick);
|
|
1810
|
+
this.$emit("ready", this.popup);
|
|
1811
|
+
},
|
|
1812
|
+
// 移除 Popup
|
|
1813
|
+
removePopup() {
|
|
1814
|
+
if (this.popup) {
|
|
1815
|
+
this.popup.off("open", this.handleOpen);
|
|
1816
|
+
this.popup.off("close", this.handleClose);
|
|
1817
|
+
this.popup.off("click", this.handleClick);
|
|
1818
|
+
this.popup.remove();
|
|
1819
|
+
this.popup = null;
|
|
1820
|
+
}
|
|
1821
|
+
},
|
|
1822
|
+
// 事件处理
|
|
1823
|
+
handleOpen(e) {
|
|
1824
|
+
this.$emit("open", e);
|
|
1825
|
+
},
|
|
1826
|
+
handleClose(e) {
|
|
1827
|
+
this.$emit("close", e);
|
|
1828
|
+
},
|
|
1829
|
+
handleClick(e) {
|
|
1830
|
+
this.$emit("click", e);
|
|
1831
|
+
},
|
|
1832
|
+
// 显示弹窗
|
|
1833
|
+
show() {
|
|
1834
|
+
if (this.popup && this.mapInstance) {
|
|
1835
|
+
this.mapInstance.openInfoWindow(this.popup, this.coordinates);
|
|
1836
|
+
}
|
|
1837
|
+
},
|
|
1838
|
+
// 隐藏弹窗
|
|
1839
|
+
hide() {
|
|
1840
|
+
if (this.popup) {
|
|
1841
|
+
this.popup.hide();
|
|
1842
|
+
}
|
|
1843
|
+
},
|
|
1844
|
+
// 关闭弹窗
|
|
1845
|
+
close() {
|
|
1846
|
+
if (this.popup) {
|
|
1847
|
+
this.popup.close();
|
|
1848
|
+
}
|
|
1849
|
+
},
|
|
1850
|
+
// 设置内容
|
|
1851
|
+
setContent(content) {
|
|
1852
|
+
if (this.popup) {
|
|
1853
|
+
this.popup.setContent(content);
|
|
1854
|
+
}
|
|
1855
|
+
},
|
|
1856
|
+
// 设置位置
|
|
1857
|
+
setCoordinates(coordinates) {
|
|
1858
|
+
if (this.popup) {
|
|
1859
|
+
this.popup.setCoordinates(coordinates);
|
|
1860
|
+
}
|
|
1861
|
+
},
|
|
1862
|
+
// 设置标题
|
|
1863
|
+
setTitle(title) {
|
|
1864
|
+
if (this.popup) {
|
|
1865
|
+
this.popup.setTitle(title);
|
|
1866
|
+
}
|
|
1867
|
+
},
|
|
1868
|
+
// 设置尺寸
|
|
1869
|
+
setSize(width, height) {
|
|
1870
|
+
if (this.popup) {
|
|
1871
|
+
this.popup.setSize(width, height);
|
|
1872
|
+
}
|
|
1873
|
+
},
|
|
1874
|
+
// 是否打开
|
|
1875
|
+
isOpen() {
|
|
1876
|
+
if (this.popup) {
|
|
1877
|
+
return this.popup.isOpen();
|
|
1878
|
+
}
|
|
1879
|
+
return false;
|
|
1880
|
+
},
|
|
1881
|
+
// 获取 Popup 实例
|
|
1882
|
+
getPopup() {
|
|
1883
|
+
return this.popup;
|
|
1884
|
+
}
|
|
1885
|
+
},
|
|
1886
|
+
watch: {
|
|
1887
|
+
coordinates(newVal) {
|
|
1888
|
+
this.setCoordinates(newVal);
|
|
1889
|
+
},
|
|
1890
|
+
content(newVal) {
|
|
1891
|
+
this.setContent(newVal);
|
|
1892
|
+
},
|
|
1893
|
+
title(newVal) {
|
|
1894
|
+
this.setTitle(newVal);
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
};
|
|
1898
|
+
var _sfc_render$a = function render() {
|
|
1899
|
+
var _vm = this, _c = _vm._self._c;
|
|
1900
|
+
return _c("div", { staticClass: "fy-popup" });
|
|
1901
|
+
};
|
|
1902
|
+
var _sfc_staticRenderFns$a = [];
|
|
1903
|
+
var __component__$a = /* @__PURE__ */ normalizeComponent(
|
|
1904
|
+
_sfc_main$a,
|
|
1905
|
+
_sfc_render$a,
|
|
1906
|
+
_sfc_staticRenderFns$a,
|
|
1907
|
+
false,
|
|
1908
|
+
null,
|
|
1909
|
+
"03c6ffc0"
|
|
1910
|
+
);
|
|
1911
|
+
const FyPopupComponent = __component__$a.exports;
|
|
1912
|
+
const FyPopup = FyPopupComponent;
|
|
1913
|
+
FyPopup.install = function(Vue) {
|
|
1914
|
+
Vue.component(FyPopup.name || "FyPopup", FyPopup);
|
|
1915
|
+
};
|
|
1916
|
+
const _sfc_main$9 = {
|
|
1917
|
+
name: "FyClusterMarker",
|
|
1918
|
+
props: {
|
|
1919
|
+
// Marker 数据数组
|
|
1920
|
+
markers: {
|
|
1921
|
+
type: Array,
|
|
1922
|
+
default: () => []
|
|
1923
|
+
},
|
|
1924
|
+
// 图层ID
|
|
1925
|
+
id: {
|
|
1926
|
+
type: String,
|
|
1927
|
+
default: "cluster-layer"
|
|
1928
|
+
},
|
|
1929
|
+
// 最大缩放级别,超过此级别不再聚合
|
|
1930
|
+
maxZoom: {
|
|
1931
|
+
type: Number,
|
|
1932
|
+
default: 16
|
|
1933
|
+
},
|
|
1934
|
+
// 是否显示文本
|
|
1935
|
+
showText: {
|
|
1936
|
+
type: Boolean,
|
|
1937
|
+
default: true
|
|
1938
|
+
},
|
|
1939
|
+
// 聚合 Marker 样式
|
|
1940
|
+
clusterStyle: {
|
|
1941
|
+
type: Object,
|
|
1942
|
+
default: () => ({
|
|
1943
|
+
symbol: {
|
|
1944
|
+
markerType: "ellipse",
|
|
1945
|
+
markerFill: "#ff0000",
|
|
1946
|
+
markerFillOpacity: 0.6,
|
|
1947
|
+
markerLineColor: "#fff",
|
|
1948
|
+
markerLineWidth: 3,
|
|
1949
|
+
markerLineOpacity: 1
|
|
1950
|
+
},
|
|
1951
|
+
textSize: 14,
|
|
1952
|
+
textFill: "#fff"
|
|
1953
|
+
})
|
|
1954
|
+
},
|
|
1955
|
+
// 单个 Marker 样式
|
|
1956
|
+
markerStyle: {
|
|
1957
|
+
type: Object,
|
|
1958
|
+
default: () => ({
|
|
1959
|
+
symbol: {
|
|
1960
|
+
markerType: "ellipse",
|
|
1961
|
+
markerFill: "#3399ff",
|
|
1962
|
+
markerFillOpacity: 1,
|
|
1963
|
+
markerLineColor: "#fff",
|
|
1964
|
+
markerLineWidth: 2,
|
|
1965
|
+
markerLineOpacity: 1,
|
|
1966
|
+
markerWidth: 24,
|
|
1967
|
+
markerHeight: 24
|
|
1968
|
+
}
|
|
1969
|
+
})
|
|
1970
|
+
},
|
|
1971
|
+
// 图层可见性
|
|
1972
|
+
visible: {
|
|
1973
|
+
type: Boolean,
|
|
1974
|
+
default: true
|
|
1975
|
+
},
|
|
1976
|
+
// 图层透明度
|
|
1977
|
+
opacity: {
|
|
1978
|
+
type: Number,
|
|
1979
|
+
default: 1
|
|
1980
|
+
}
|
|
1981
|
+
},
|
|
1982
|
+
data() {
|
|
1983
|
+
return {
|
|
1984
|
+
layer: null,
|
|
1985
|
+
clusterMarkers: []
|
|
1986
|
+
};
|
|
1987
|
+
},
|
|
1988
|
+
inject: {
|
|
1989
|
+
mapInstance: {
|
|
1990
|
+
default: null
|
|
1991
|
+
}
|
|
1992
|
+
},
|
|
1993
|
+
mounted() {
|
|
1994
|
+
if (this.mapInstance) {
|
|
1995
|
+
this.initClusterLayer();
|
|
1996
|
+
}
|
|
1997
|
+
},
|
|
1998
|
+
beforeDestroy() {
|
|
1999
|
+
this.removeClusterLayer();
|
|
2000
|
+
},
|
|
2001
|
+
methods: {
|
|
2002
|
+
// 初始化聚合图层
|
|
2003
|
+
initClusterLayer() {
|
|
2004
|
+
if (!this.mapInstance || this.markers.length === 0) return;
|
|
2005
|
+
this.layer = new maptalks__namespace.VectorLayer(this.id, {
|
|
2006
|
+
visible: this.visible,
|
|
2007
|
+
opacity: this.opacity
|
|
2008
|
+
});
|
|
2009
|
+
this.mapInstance.addLayer(this.layer);
|
|
2010
|
+
this.updateClusterMarkers();
|
|
2011
|
+
this.layer.on("click", this.handleClick);
|
|
2012
|
+
this.$emit("ready", this.layer);
|
|
2013
|
+
},
|
|
2014
|
+
// 更新聚合 Marker
|
|
2015
|
+
updateClusterMarkers() {
|
|
2016
|
+
if (!this.layer) return;
|
|
2017
|
+
this.clearClusterMarkers();
|
|
2018
|
+
const markerList = this.markers.map((item) => {
|
|
2019
|
+
return new maptalks__namespace.Marker(item.coordinates, {
|
|
2020
|
+
properties: item.properties || {}
|
|
2021
|
+
});
|
|
2022
|
+
});
|
|
2023
|
+
this.clusterMarkers = new maptalks__namespace.ClusterLayer(this.id + "-cluster", markerList, {
|
|
2024
|
+
noClusterWithHowManyPoints: 1,
|
|
2025
|
+
maxZoom: this.maxZoom,
|
|
2026
|
+
symbol: this.getClusterSymbol()
|
|
2027
|
+
});
|
|
2028
|
+
this.mapInstance.addLayer(this.clusterMarkers);
|
|
2029
|
+
this.setupClusterEvents();
|
|
2030
|
+
},
|
|
2031
|
+
// 获取聚合符号
|
|
2032
|
+
getClusterSymbol() {
|
|
2033
|
+
return {
|
|
2034
|
+
markerType: "ellipse",
|
|
2035
|
+
markerFill: "#ff0000",
|
|
2036
|
+
markerFillOpacity: 0.6,
|
|
2037
|
+
markerLineColor: "#fff",
|
|
2038
|
+
markerLineWidth: 3,
|
|
2039
|
+
markerLineOpacity: 1,
|
|
2040
|
+
textFaceName: "sans-serif",
|
|
2041
|
+
textName: "{count}",
|
|
2042
|
+
textFill: "#fff",
|
|
2043
|
+
textSize: 12,
|
|
2044
|
+
textWeight: "bold"
|
|
2045
|
+
};
|
|
2046
|
+
},
|
|
2047
|
+
// 设置聚合事件
|
|
2048
|
+
setupClusterEvents() {
|
|
2049
|
+
if (!this.clusterMarkers) return;
|
|
2050
|
+
this.clusterMarkers.on("click", this.handleClusterClick);
|
|
2051
|
+
this.clusterMarkers.on("mouseover", this.handleClusterMouseover);
|
|
2052
|
+
this.clusterMarkers.on("mouseout", this.handleClusterMouseout);
|
|
2053
|
+
},
|
|
2054
|
+
// 事件处理
|
|
2055
|
+
handleClick(e) {
|
|
2056
|
+
this.$emit("click", e);
|
|
2057
|
+
},
|
|
2058
|
+
handleClusterClick(e) {
|
|
2059
|
+
const cluster = e.target;
|
|
2060
|
+
const markers = cluster.getGeometries();
|
|
2061
|
+
this.$emit("cluster-click", {
|
|
2062
|
+
cluster,
|
|
2063
|
+
markers,
|
|
2064
|
+
coordinates: cluster.getCoordinates(),
|
|
2065
|
+
count: markers.length
|
|
2066
|
+
});
|
|
2067
|
+
if (markers.length > 1 && this.mapInstance.getZoom() < this.maxZoom) {
|
|
2068
|
+
this.mapInstance.fitExtent(cluster.getExtent(), {
|
|
2069
|
+
padding: [50, 50, 50, 50]
|
|
2070
|
+
});
|
|
2071
|
+
}
|
|
2072
|
+
},
|
|
2073
|
+
handleClusterMouseover(e) {
|
|
2074
|
+
const cluster = e.target;
|
|
2075
|
+
const markers = cluster.getGeometries();
|
|
2076
|
+
this.$emit("cluster-mouseover", {
|
|
2077
|
+
cluster,
|
|
2078
|
+
markers,
|
|
2079
|
+
coordinates: cluster.getCoordinates(),
|
|
2080
|
+
count: markers.length
|
|
2081
|
+
});
|
|
2082
|
+
},
|
|
2083
|
+
handleClusterMouseout(e) {
|
|
2084
|
+
const cluster = e.target;
|
|
2085
|
+
const markers = cluster.getGeometries();
|
|
2086
|
+
this.$emit("cluster-mouseout", {
|
|
2087
|
+
cluster,
|
|
2088
|
+
markers,
|
|
2089
|
+
coordinates: cluster.getCoordinates(),
|
|
2090
|
+
count: markers.length
|
|
2091
|
+
});
|
|
2092
|
+
},
|
|
2093
|
+
// 清除聚合 Marker
|
|
2094
|
+
clearClusterMarkers() {
|
|
2095
|
+
if (this.clusterMarkers) {
|
|
2096
|
+
this.clusterMarkers.off("click", this.handleClusterClick);
|
|
2097
|
+
this.clusterMarkers.off("mouseover", this.handleClusterMouseover);
|
|
2098
|
+
this.clusterMarkers.off("mouseout", this.handleClusterMouseout);
|
|
2099
|
+
if (this.mapInstance) {
|
|
2100
|
+
this.mapInstance.removeLayer(this.clusterMarkers);
|
|
2101
|
+
}
|
|
2102
|
+
this.clusterMarkers = null;
|
|
2103
|
+
}
|
|
2104
|
+
},
|
|
2105
|
+
// 移除聚合图层
|
|
2106
|
+
removeClusterLayer() {
|
|
2107
|
+
this.clearClusterMarkers();
|
|
2108
|
+
if (this.layer) {
|
|
2109
|
+
this.layer.off("click", this.handleClick);
|
|
2110
|
+
if (this.mapInstance) {
|
|
2111
|
+
this.mapInstance.removeLayer(this.layer);
|
|
2112
|
+
}
|
|
2113
|
+
this.layer = null;
|
|
2114
|
+
}
|
|
2115
|
+
},
|
|
2116
|
+
// 添加 Marker
|
|
2117
|
+
addMarker(markerData) {
|
|
2118
|
+
this.markers.push(markerData);
|
|
2119
|
+
this.updateClusterMarkers();
|
|
2120
|
+
},
|
|
2121
|
+
// 批量添加 Marker
|
|
2122
|
+
addMarkers(markerDataArray) {
|
|
2123
|
+
this.markers.push(...markerDataArray);
|
|
2124
|
+
this.updateClusterMarkers();
|
|
2125
|
+
},
|
|
2126
|
+
// 移除 Marker
|
|
2127
|
+
removeMarker(markerId) {
|
|
2128
|
+
const index2 = this.markers.findIndex((m) => m.id === markerId);
|
|
2129
|
+
if (index2 > -1) {
|
|
2130
|
+
this.markers.splice(index2, 1);
|
|
2131
|
+
this.updateClusterMarkers();
|
|
2132
|
+
}
|
|
2133
|
+
},
|
|
2134
|
+
// 清空所有 Marker
|
|
2135
|
+
clearMarkers() {
|
|
2136
|
+
this.markers = [];
|
|
2137
|
+
this.updateClusterMarkers();
|
|
2138
|
+
},
|
|
2139
|
+
// 显示图层
|
|
2140
|
+
show() {
|
|
2141
|
+
if (this.layer) {
|
|
2142
|
+
this.layer.show();
|
|
2143
|
+
}
|
|
2144
|
+
if (this.clusterMarkers) {
|
|
2145
|
+
this.clusterMarkers.show();
|
|
2146
|
+
}
|
|
2147
|
+
},
|
|
2148
|
+
// 隐藏图层
|
|
2149
|
+
hide() {
|
|
2150
|
+
if (this.layer) {
|
|
2151
|
+
this.layer.hide();
|
|
2152
|
+
}
|
|
2153
|
+
if (this.clusterMarkers) {
|
|
2154
|
+
this.clusterMarkers.hide();
|
|
2155
|
+
}
|
|
2156
|
+
},
|
|
2157
|
+
// 设置透明度
|
|
2158
|
+
setOpacity(opacity) {
|
|
2159
|
+
if (this.layer) {
|
|
2160
|
+
this.layer.setOpacity(opacity);
|
|
2161
|
+
}
|
|
2162
|
+
if (this.clusterMarkers) {
|
|
2163
|
+
this.clusterMarkers.setOpacity(opacity);
|
|
2164
|
+
}
|
|
2165
|
+
},
|
|
2166
|
+
// 获取图层实例
|
|
2167
|
+
getLayer() {
|
|
2168
|
+
return this.layer;
|
|
2169
|
+
},
|
|
2170
|
+
// 获取聚合实例
|
|
2171
|
+
getCluster() {
|
|
2172
|
+
return this.clusterMarkers;
|
|
2173
|
+
}
|
|
2174
|
+
},
|
|
2175
|
+
watch: {
|
|
2176
|
+
markers: {
|
|
2177
|
+
handler() {
|
|
2178
|
+
this.updateClusterMarkers();
|
|
2179
|
+
},
|
|
2180
|
+
deep: true
|
|
2181
|
+
},
|
|
2182
|
+
visible(newVal) {
|
|
2183
|
+
if (newVal) {
|
|
2184
|
+
this.show();
|
|
2185
|
+
} else {
|
|
2186
|
+
this.hide();
|
|
2187
|
+
}
|
|
2188
|
+
},
|
|
2189
|
+
opacity(newVal) {
|
|
2190
|
+
this.setOpacity(newVal);
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
};
|
|
2194
|
+
var _sfc_render$9 = function render() {
|
|
2195
|
+
var _vm = this, _c = _vm._self._c;
|
|
2196
|
+
return _c("div", { staticClass: "fy-cluster-marker" });
|
|
2197
|
+
};
|
|
2198
|
+
var _sfc_staticRenderFns$9 = [];
|
|
2199
|
+
var __component__$9 = /* @__PURE__ */ normalizeComponent(
|
|
2200
|
+
_sfc_main$9,
|
|
2201
|
+
_sfc_render$9,
|
|
2202
|
+
_sfc_staticRenderFns$9,
|
|
2203
|
+
false,
|
|
2204
|
+
null,
|
|
2205
|
+
"ee36769c"
|
|
2206
|
+
);
|
|
2207
|
+
const FyClusterMarkerComponent = __component__$9.exports;
|
|
2208
|
+
const FyClusterMarker = FyClusterMarkerComponent;
|
|
2209
|
+
FyClusterMarker.install = function(Vue) {
|
|
2210
|
+
Vue.component(FyClusterMarker.name || "FyClusterMarker", FyClusterMarker);
|
|
2211
|
+
};
|
|
2212
|
+
const _sfc_main$8 = {
|
|
2213
|
+
name: "FyDrawTool",
|
|
2214
|
+
props: {
|
|
2215
|
+
// 图层ID
|
|
2216
|
+
layerId: {
|
|
2217
|
+
type: String,
|
|
2218
|
+
default: "draw-layer"
|
|
2219
|
+
},
|
|
2220
|
+
// 默认绘制模式
|
|
2221
|
+
mode: {
|
|
2222
|
+
type: String,
|
|
2223
|
+
default: "none"
|
|
2224
|
+
// point, line, polygon, rectangle, circle, ellipse, none
|
|
2225
|
+
},
|
|
2226
|
+
// 绘制样式
|
|
2227
|
+
symbol: {
|
|
2228
|
+
type: Object,
|
|
2229
|
+
default: () => ({
|
|
2230
|
+
lineColor: "#ff0000",
|
|
2231
|
+
lineWidth: 2,
|
|
2232
|
+
lineOpacity: 0.8,
|
|
2233
|
+
polygonFill: "#ff0000",
|
|
2234
|
+
polygonOpacity: 0.3,
|
|
2235
|
+
markerFill: "#ff0000",
|
|
2236
|
+
markerFillOpacity: 1,
|
|
2237
|
+
markerLineColor: "#ffffff",
|
|
2238
|
+
markerLineWidth: 2,
|
|
2239
|
+
markerLineOpacity: 1,
|
|
2240
|
+
markerWidth: 16,
|
|
2241
|
+
markerHeight: 16
|
|
2242
|
+
})
|
|
2243
|
+
},
|
|
2244
|
+
// 是否允许编辑
|
|
2245
|
+
editable: {
|
|
2246
|
+
type: Boolean,
|
|
2247
|
+
default: true
|
|
2248
|
+
},
|
|
2249
|
+
// 是否允许删除
|
|
2250
|
+
deletable: {
|
|
2251
|
+
type: Boolean,
|
|
2252
|
+
default: true
|
|
2253
|
+
},
|
|
2254
|
+
// 是否显示提示信息
|
|
2255
|
+
showTooltip: {
|
|
2256
|
+
type: Boolean,
|
|
2257
|
+
default: true
|
|
2258
|
+
}
|
|
2259
|
+
},
|
|
2260
|
+
data() {
|
|
2261
|
+
return {
|
|
2262
|
+
layer: null,
|
|
2263
|
+
drawTool: null,
|
|
2264
|
+
isDrawing: false
|
|
2265
|
+
};
|
|
2266
|
+
},
|
|
2267
|
+
inject: {
|
|
2268
|
+
mapInstance: {
|
|
2269
|
+
default: null
|
|
2270
|
+
}
|
|
2271
|
+
},
|
|
2272
|
+
mounted() {
|
|
2273
|
+
if (this.mapInstance) {
|
|
2274
|
+
this.initDrawTool();
|
|
2275
|
+
}
|
|
2276
|
+
},
|
|
2277
|
+
beforeDestroy() {
|
|
2278
|
+
this.removeDrawTool();
|
|
2279
|
+
},
|
|
2280
|
+
methods: {
|
|
2281
|
+
// 初始化绘制工具
|
|
2282
|
+
initDrawTool() {
|
|
2283
|
+
if (!this.mapInstance) return;
|
|
2284
|
+
this.layer = new maptalks__namespace.VectorLayer(this.layerId, {
|
|
2285
|
+
enableAltitude: true,
|
|
2286
|
+
altitudeProperty: "altitude"
|
|
2287
|
+
});
|
|
2288
|
+
this.mapInstance.addLayer(this.layer);
|
|
2289
|
+
this.drawTool = new maptalks__namespace.DrawTool({
|
|
2290
|
+
mode: this.mode,
|
|
2291
|
+
symbol: this.symbol,
|
|
2292
|
+
once: false,
|
|
2293
|
+
editable: this.editable,
|
|
2294
|
+
autoSurface: true
|
|
2295
|
+
}).addTo(this.mapInstance);
|
|
2296
|
+
this.bindDrawToolEvents();
|
|
2297
|
+
this.$emit("ready", this.drawTool);
|
|
2298
|
+
},
|
|
2299
|
+
// 绑定绘制工具事件
|
|
2300
|
+
bindDrawToolEvents() {
|
|
2301
|
+
if (!this.drawTool) return;
|
|
2302
|
+
this.drawTool.on("drawstart", this.handleDrawStart);
|
|
2303
|
+
this.drawTool.on("drawvertex", this.handleDrawVertex);
|
|
2304
|
+
this.drawTool.on("mousemove", this.handleMouseMove);
|
|
2305
|
+
this.drawTool.on("drawend", this.handleDrawEnd);
|
|
2306
|
+
this.drawTool.on("disable", this.handleDisable);
|
|
2307
|
+
this.drawTool.on("editend", this.handleEditEnd);
|
|
2308
|
+
},
|
|
2309
|
+
// 事件处理
|
|
2310
|
+
handleDrawStart(param) {
|
|
2311
|
+
this.isDrawing = true;
|
|
2312
|
+
this.$emit("drawstart", param);
|
|
2313
|
+
},
|
|
2314
|
+
handleDrawVertex(param) {
|
|
2315
|
+
this.$emit("drawvertex", param);
|
|
2316
|
+
},
|
|
2317
|
+
handleMouseMove(param) {
|
|
2318
|
+
this.$emit("mousemove", param);
|
|
2319
|
+
},
|
|
2320
|
+
handleDrawEnd(param) {
|
|
2321
|
+
this.isDrawing = false;
|
|
2322
|
+
this.$emit("drawend", param);
|
|
2323
|
+
},
|
|
2324
|
+
handleDisable() {
|
|
2325
|
+
this.isDrawing = false;
|
|
2326
|
+
this.$emit("disable");
|
|
2327
|
+
},
|
|
2328
|
+
handleEditEnd(param) {
|
|
2329
|
+
this.$emit("editend", param);
|
|
2330
|
+
},
|
|
2331
|
+
// 设置绘制模式
|
|
2332
|
+
setMode(mode) {
|
|
2333
|
+
if (this.drawTool) {
|
|
2334
|
+
this.drawTool.setMode(mode);
|
|
2335
|
+
}
|
|
2336
|
+
},
|
|
2337
|
+
// 启用绘制
|
|
2338
|
+
enable() {
|
|
2339
|
+
if (this.drawTool) {
|
|
2340
|
+
this.drawTool.enable();
|
|
2341
|
+
}
|
|
2342
|
+
},
|
|
2343
|
+
// 禁用绘制
|
|
2344
|
+
disable() {
|
|
2345
|
+
if (this.drawTool) {
|
|
2346
|
+
this.drawTool.disable();
|
|
2347
|
+
}
|
|
2348
|
+
},
|
|
2349
|
+
// 获取当前模式
|
|
2350
|
+
getMode() {
|
|
2351
|
+
if (this.drawTool) {
|
|
2352
|
+
return this.drawTool.getMode();
|
|
2353
|
+
}
|
|
2354
|
+
return "none";
|
|
2355
|
+
},
|
|
2356
|
+
// 获取当前状态
|
|
2357
|
+
getStatus() {
|
|
2358
|
+
if (this.drawTool) {
|
|
2359
|
+
return this.drawTool.getStatus();
|
|
2360
|
+
}
|
|
2361
|
+
return null;
|
|
2362
|
+
},
|
|
2363
|
+
// 获取当前绘制的图形
|
|
2364
|
+
getCurrentGeometry() {
|
|
2365
|
+
if (this.drawTool) {
|
|
2366
|
+
return this.drawTool.getCurrentGeometry();
|
|
2367
|
+
}
|
|
2368
|
+
return null;
|
|
2369
|
+
},
|
|
2370
|
+
// 获取所有绘制的图形
|
|
2371
|
+
getGeometries() {
|
|
2372
|
+
if (this.layer) {
|
|
2373
|
+
return this.layer.getGeometries();
|
|
2374
|
+
}
|
|
2375
|
+
return [];
|
|
2376
|
+
},
|
|
2377
|
+
// 清除所有图形
|
|
2378
|
+
clear() {
|
|
2379
|
+
if (this.layer) {
|
|
2380
|
+
this.layer.clear();
|
|
2381
|
+
}
|
|
2382
|
+
this.$emit("clear");
|
|
2383
|
+
},
|
|
2384
|
+
// 撤销上一步
|
|
2385
|
+
undo() {
|
|
2386
|
+
if (this.drawTool && this.isDrawing) {
|
|
2387
|
+
this.drawTool.undo();
|
|
2388
|
+
}
|
|
2389
|
+
},
|
|
2390
|
+
// 重做
|
|
2391
|
+
redo() {
|
|
2392
|
+
if (this.drawTool && this.isDrawing) {
|
|
2393
|
+
this.drawTool.redo();
|
|
2394
|
+
}
|
|
2395
|
+
},
|
|
2396
|
+
// 设置符号
|
|
2397
|
+
setSymbol(symbol) {
|
|
2398
|
+
if (this.drawTool) {
|
|
2399
|
+
this.drawTool.setSymbol(symbol);
|
|
2400
|
+
}
|
|
2401
|
+
},
|
|
2402
|
+
// 添加几何图形
|
|
2403
|
+
addGeometry(geometry) {
|
|
2404
|
+
if (this.layer && geometry) {
|
|
2405
|
+
this.layer.addGeometry(geometry);
|
|
2406
|
+
}
|
|
2407
|
+
},
|
|
2408
|
+
// 移除几何图形
|
|
2409
|
+
removeGeometry(geometry) {
|
|
2410
|
+
if (this.layer && geometry) {
|
|
2411
|
+
this.layer.removeGeometry(geometry);
|
|
2412
|
+
}
|
|
2413
|
+
},
|
|
2414
|
+
// 测距
|
|
2415
|
+
measureDistance(coordinates) {
|
|
2416
|
+
if (coordinates && coordinates.length >= 2) {
|
|
2417
|
+
let distance = 0;
|
|
2418
|
+
for (let i = 0; i < coordinates.length - 1; i++) {
|
|
2419
|
+
const p1 = new maptalks__namespace.Coordinate(coordinates[i]);
|
|
2420
|
+
const p2 = new maptalks__namespace.Coordinate(coordinates[i + 1]);
|
|
2421
|
+
distance += p1.distanceTo(p2);
|
|
2422
|
+
}
|
|
2423
|
+
return distance;
|
|
2424
|
+
}
|
|
2425
|
+
return 0;
|
|
2426
|
+
},
|
|
2427
|
+
// 测面积
|
|
2428
|
+
measureArea(coordinates) {
|
|
2429
|
+
if (coordinates && coordinates.length >= 3) {
|
|
2430
|
+
const polygon = new maptalks__namespace.Polygon(coordinates);
|
|
2431
|
+
return polygon.getArea();
|
|
2432
|
+
}
|
|
2433
|
+
return 0;
|
|
2434
|
+
},
|
|
2435
|
+
// 获取绘制工具实例
|
|
2436
|
+
getDrawTool() {
|
|
2437
|
+
return this.drawTool;
|
|
2438
|
+
},
|
|
2439
|
+
// 获取图层实例
|
|
2440
|
+
getLayer() {
|
|
2441
|
+
return this.layer;
|
|
2442
|
+
}
|
|
2443
|
+
},
|
|
2444
|
+
watch: {
|
|
2445
|
+
mode(newVal) {
|
|
2446
|
+
this.setMode(newVal);
|
|
2447
|
+
},
|
|
2448
|
+
symbol: {
|
|
2449
|
+
handler(newVal) {
|
|
2450
|
+
this.setSymbol(newVal);
|
|
2451
|
+
},
|
|
2452
|
+
deep: true
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
};
|
|
2456
|
+
var _sfc_render$8 = function render() {
|
|
2457
|
+
var _vm = this, _c = _vm._self._c;
|
|
2458
|
+
return _c("div", { staticClass: "fy-draw-tool" });
|
|
2459
|
+
};
|
|
2460
|
+
var _sfc_staticRenderFns$8 = [];
|
|
2461
|
+
var __component__$8 = /* @__PURE__ */ normalizeComponent(
|
|
2462
|
+
_sfc_main$8,
|
|
2463
|
+
_sfc_render$8,
|
|
2464
|
+
_sfc_staticRenderFns$8,
|
|
2465
|
+
false,
|
|
2466
|
+
null,
|
|
2467
|
+
"f60f236f"
|
|
2468
|
+
);
|
|
2469
|
+
const FyDrawToolComponent = __component__$8.exports;
|
|
2470
|
+
const FyDrawTool = FyDrawToolComponent;
|
|
2471
|
+
FyDrawTool.install = function(Vue) {
|
|
2472
|
+
Vue.component(FyDrawTool.name || "FyDrawTool", FyDrawTool);
|
|
2473
|
+
};
|
|
2474
|
+
const _sfc_main$7 = {
|
|
2475
|
+
name: "FyDrawPoint",
|
|
2476
|
+
props: {
|
|
2477
|
+
// 图层ID
|
|
2478
|
+
layerId: {
|
|
2479
|
+
type: String,
|
|
2480
|
+
default: "draw-point-layer"
|
|
2481
|
+
},
|
|
2482
|
+
// 点样式
|
|
2483
|
+
symbol: {
|
|
2484
|
+
type: Object,
|
|
2485
|
+
default: () => ({
|
|
2486
|
+
markerType: "ellipse",
|
|
2487
|
+
markerFill: "#ff0000",
|
|
2488
|
+
markerFillOpacity: 1,
|
|
2489
|
+
markerLineColor: "#ffffff",
|
|
2490
|
+
markerLineWidth: 2,
|
|
2491
|
+
markerLineOpacity: 1,
|
|
2492
|
+
markerWidth: 20,
|
|
2493
|
+
markerHeight: 20
|
|
2494
|
+
})
|
|
2495
|
+
},
|
|
2496
|
+
// 是否自动开始绘制
|
|
2497
|
+
autoStart: {
|
|
2498
|
+
type: Boolean,
|
|
2499
|
+
default: true
|
|
2500
|
+
},
|
|
2501
|
+
// 是否显示提示信息
|
|
2502
|
+
showTooltip: {
|
|
2503
|
+
type: Boolean,
|
|
2504
|
+
default: true
|
|
2505
|
+
}
|
|
2506
|
+
},
|
|
2507
|
+
data() {
|
|
2508
|
+
return {
|
|
2509
|
+
layer: null,
|
|
2510
|
+
drawTool: null,
|
|
2511
|
+
points: []
|
|
2512
|
+
};
|
|
2513
|
+
},
|
|
2514
|
+
inject: {
|
|
2515
|
+
mapInstance: {
|
|
2516
|
+
default: null
|
|
2517
|
+
}
|
|
2518
|
+
},
|
|
2519
|
+
mounted() {
|
|
2520
|
+
if (this.mapInstance) {
|
|
2521
|
+
this.initDrawPoint();
|
|
2522
|
+
}
|
|
2523
|
+
},
|
|
2524
|
+
beforeDestroy() {
|
|
2525
|
+
this.removeDrawPoint();
|
|
2526
|
+
},
|
|
2527
|
+
methods: {
|
|
2528
|
+
// 初始化绘制点工具
|
|
2529
|
+
initDrawPoint() {
|
|
2530
|
+
if (!this.mapInstance) return;
|
|
2531
|
+
this.layer = new maptalks__namespace.VectorLayer(this.layerId);
|
|
2532
|
+
this.mapInstance.addLayer(this.layer);
|
|
2533
|
+
this.drawTool = new maptalks__namespace.DrawTool({
|
|
2534
|
+
mode: "point",
|
|
2535
|
+
symbol: this.symbol,
|
|
2536
|
+
once: true,
|
|
2537
|
+
enableAltitude: true
|
|
2538
|
+
}).addTo(this.mapInstance);
|
|
2539
|
+
this.bindDrawToolEvents();
|
|
2540
|
+
if (this.autoStart) {
|
|
2541
|
+
this.enable();
|
|
2542
|
+
}
|
|
2543
|
+
this.$emit("ready", this.drawTool);
|
|
2544
|
+
},
|
|
2545
|
+
// 绑定绘制工具事件
|
|
2546
|
+
bindDrawToolEvents() {
|
|
2547
|
+
if (!this.drawTool) return;
|
|
2548
|
+
this.drawTool.on("drawstart", this.handleDrawStart);
|
|
2549
|
+
this.drawTool.on("drawend", this.handleDrawEnd);
|
|
2550
|
+
this.drawTool.on("disable", this.handleDisable);
|
|
2551
|
+
},
|
|
2552
|
+
// 事件处理
|
|
2553
|
+
handleDrawStart(param) {
|
|
2554
|
+
this.$emit("drawstart", param);
|
|
2555
|
+
},
|
|
2556
|
+
handleDrawEnd(param) {
|
|
2557
|
+
const point = param.geometry;
|
|
2558
|
+
this.points.push(point);
|
|
2559
|
+
this.$emit("drawend", {
|
|
2560
|
+
point,
|
|
2561
|
+
coordinates: point.getCoordinates(),
|
|
2562
|
+
allPoints: this.points
|
|
2563
|
+
});
|
|
2564
|
+
},
|
|
2565
|
+
handleDisable() {
|
|
2566
|
+
this.$emit("disable");
|
|
2567
|
+
},
|
|
2568
|
+
// 启用绘制
|
|
2569
|
+
enable() {
|
|
2570
|
+
if (this.drawTool) {
|
|
2571
|
+
this.drawTool.enable();
|
|
2572
|
+
}
|
|
2573
|
+
},
|
|
2574
|
+
// 禁用绘制
|
|
2575
|
+
disable() {
|
|
2576
|
+
if (this.drawTool) {
|
|
2577
|
+
this.drawTool.disable();
|
|
2578
|
+
}
|
|
2579
|
+
},
|
|
2580
|
+
// 获取所有绘制的点
|
|
2581
|
+
getPoints() {
|
|
2582
|
+
return this.points;
|
|
2583
|
+
},
|
|
2584
|
+
// 清除所有点
|
|
2585
|
+
clear() {
|
|
2586
|
+
this.points = [];
|
|
2587
|
+
if (this.layer) {
|
|
2588
|
+
this.layer.clear();
|
|
2589
|
+
}
|
|
2590
|
+
this.$emit("clear");
|
|
2591
|
+
},
|
|
2592
|
+
// 添加点
|
|
2593
|
+
addPoint(coordinates) {
|
|
2594
|
+
const point = new maptalks__namespace.Marker(coordinates, {
|
|
2595
|
+
symbol: this.symbol
|
|
2596
|
+
});
|
|
2597
|
+
this.layer.addGeometry(point);
|
|
2598
|
+
this.points.push(point);
|
|
2599
|
+
this.$emit("add-point", { point, coordinates });
|
|
2600
|
+
},
|
|
2601
|
+
// 移除点
|
|
2602
|
+
removePoint(index2) {
|
|
2603
|
+
if (index2 >= 0 && index2 < this.points.length) {
|
|
2604
|
+
const point = this.points[index2];
|
|
2605
|
+
this.layer.removeGeometry(point);
|
|
2606
|
+
this.points.splice(index2, 1);
|
|
2607
|
+
this.$emit("remove-point", { point, index: index2 });
|
|
2608
|
+
}
|
|
2609
|
+
},
|
|
2610
|
+
// 设置样式
|
|
2611
|
+
setSymbol(symbol) {
|
|
2612
|
+
if (this.drawTool) {
|
|
2613
|
+
this.drawTool.setSymbol(symbol);
|
|
2614
|
+
}
|
|
2615
|
+
},
|
|
2616
|
+
// 获取绘制工具实例
|
|
2617
|
+
getDrawTool() {
|
|
2618
|
+
return this.drawTool;
|
|
2619
|
+
},
|
|
2620
|
+
// 获取图层实例
|
|
2621
|
+
getLayer() {
|
|
2622
|
+
return this.layer;
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
};
|
|
2626
|
+
var _sfc_render$7 = function render() {
|
|
2627
|
+
var _vm = this, _c = _vm._self._c;
|
|
2628
|
+
return _c("div", { staticClass: "fy-draw-point" });
|
|
2629
|
+
};
|
|
2630
|
+
var _sfc_staticRenderFns$7 = [];
|
|
2631
|
+
var __component__$7 = /* @__PURE__ */ normalizeComponent(
|
|
2632
|
+
_sfc_main$7,
|
|
2633
|
+
_sfc_render$7,
|
|
2634
|
+
_sfc_staticRenderFns$7,
|
|
2635
|
+
false,
|
|
2636
|
+
null,
|
|
2637
|
+
"6fa54668"
|
|
2638
|
+
);
|
|
2639
|
+
const FyDrawPointComponent = __component__$7.exports;
|
|
2640
|
+
const FyDrawPoint = FyDrawPointComponent;
|
|
2641
|
+
FyDrawPoint.install = function(Vue) {
|
|
2642
|
+
Vue.component(FyDrawPoint.name || "FyDrawPoint", FyDrawPoint);
|
|
2643
|
+
};
|
|
2644
|
+
const _sfc_main$6 = {
|
|
2645
|
+
name: "FyDrawLine",
|
|
2646
|
+
props: {
|
|
2647
|
+
// 图层ID
|
|
2648
|
+
layerId: {
|
|
2649
|
+
type: String,
|
|
2650
|
+
default: "draw-line-layer"
|
|
2651
|
+
},
|
|
2652
|
+
// 线样式
|
|
2653
|
+
symbol: {
|
|
2654
|
+
type: Object,
|
|
2655
|
+
default: () => ({
|
|
2656
|
+
lineColor: "#ff0000",
|
|
2657
|
+
lineWidth: 3,
|
|
2658
|
+
lineOpacity: 0.8,
|
|
2659
|
+
lineDasharray: []
|
|
2660
|
+
})
|
|
2661
|
+
},
|
|
2662
|
+
// 是否自动开始绘制
|
|
2663
|
+
autoStart: {
|
|
2664
|
+
type: Boolean,
|
|
2665
|
+
default: true
|
|
2666
|
+
},
|
|
2667
|
+
// 是否显示距离标注
|
|
2668
|
+
showDistance: {
|
|
2669
|
+
type: Boolean,
|
|
2670
|
+
default: true
|
|
2671
|
+
},
|
|
2672
|
+
// 是否显示提示信息
|
|
2673
|
+
showTooltip: {
|
|
2674
|
+
type: Boolean,
|
|
2675
|
+
default: true
|
|
2676
|
+
}
|
|
2677
|
+
},
|
|
2678
|
+
data() {
|
|
2679
|
+
return {
|
|
2680
|
+
layer: null,
|
|
2681
|
+
drawTool: null,
|
|
2682
|
+
lines: []
|
|
2683
|
+
};
|
|
2684
|
+
},
|
|
2685
|
+
inject: {
|
|
2686
|
+
mapInstance: {
|
|
2687
|
+
default: null
|
|
2688
|
+
}
|
|
2689
|
+
},
|
|
2690
|
+
mounted() {
|
|
2691
|
+
if (this.mapInstance) {
|
|
2692
|
+
this.initDrawLine();
|
|
2693
|
+
}
|
|
2694
|
+
},
|
|
2695
|
+
beforeDestroy() {
|
|
2696
|
+
this.removeDrawLine();
|
|
2697
|
+
},
|
|
2698
|
+
methods: {
|
|
2699
|
+
// 初始化绘制线工具
|
|
2700
|
+
initDrawLine() {
|
|
2701
|
+
if (!this.mapInstance) return;
|
|
2702
|
+
this.layer = new maptalks__namespace.VectorLayer(this.layerId);
|
|
2703
|
+
this.mapInstance.addLayer(this.layer);
|
|
2704
|
+
this.drawTool = new maptalks__namespace.DrawTool({
|
|
2705
|
+
mode: "linestring",
|
|
2706
|
+
symbol: this.symbol,
|
|
2707
|
+
once: true,
|
|
2708
|
+
enableAltitude: true
|
|
2709
|
+
}).addTo(this.mapInstance);
|
|
2710
|
+
this.bindDrawToolEvents();
|
|
2711
|
+
if (this.autoStart) {
|
|
2712
|
+
this.enable();
|
|
2713
|
+
}
|
|
2714
|
+
this.$emit("ready", this.drawTool);
|
|
2715
|
+
},
|
|
2716
|
+
// 绑定绘制工具事件
|
|
2717
|
+
bindDrawToolEvents() {
|
|
2718
|
+
if (!this.drawTool) return;
|
|
2719
|
+
this.drawTool.on("drawstart", this.handleDrawStart);
|
|
2720
|
+
this.drawTool.on("drawend", this.handleDrawEnd);
|
|
2721
|
+
this.drawTool.on("disable", this.handleDisable);
|
|
2722
|
+
},
|
|
2723
|
+
// 事件处理
|
|
2724
|
+
handleDrawStart(param) {
|
|
2725
|
+
this.$emit("drawstart", param);
|
|
2726
|
+
},
|
|
2727
|
+
handleDrawEnd(param) {
|
|
2728
|
+
const line = param.geometry;
|
|
2729
|
+
this.lines.push(line);
|
|
2730
|
+
const result = {
|
|
2731
|
+
line,
|
|
2732
|
+
coordinates: line.getCoordinates(),
|
|
2733
|
+
distance: this.calculateDistance(line.getCoordinates()),
|
|
2734
|
+
allLines: this.lines
|
|
2735
|
+
};
|
|
2736
|
+
if (this.showDistance) {
|
|
2737
|
+
this.addDistanceLabel(line, result.distance);
|
|
2738
|
+
}
|
|
2739
|
+
this.$emit("drawend", result);
|
|
2740
|
+
},
|
|
2741
|
+
handleDisable() {
|
|
2742
|
+
this.$emit("disable");
|
|
2743
|
+
},
|
|
2744
|
+
// 计算距离
|
|
2745
|
+
calculateDistance(coordinates) {
|
|
2746
|
+
if (coordinates && coordinates.length >= 2) {
|
|
2747
|
+
let distance = 0;
|
|
2748
|
+
for (let i = 0; i < coordinates.length - 1; i++) {
|
|
2749
|
+
const p1 = new maptalks__namespace.Coordinate(coordinates[i]);
|
|
2750
|
+
const p2 = new maptalks__namespace.Coordinate(coordinates[i + 1]);
|
|
2751
|
+
distance += p1.distanceTo(p2);
|
|
2752
|
+
}
|
|
2753
|
+
return distance;
|
|
2754
|
+
}
|
|
2755
|
+
return 0;
|
|
2756
|
+
},
|
|
2757
|
+
// 添加距离标注
|
|
2758
|
+
addDistanceLabel(line, distance) {
|
|
2759
|
+
if (!this.layer) return;
|
|
2760
|
+
const coordinates = line.getCoordinates();
|
|
2761
|
+
const centerIndex = Math.floor(coordinates.length / 2);
|
|
2762
|
+
const center = coordinates[centerIndex];
|
|
2763
|
+
const label = new maptalks__namespace.Label(this.formatDistance(distance), center, {
|
|
2764
|
+
boxStyle: {
|
|
2765
|
+
padding: [2, 2],
|
|
2766
|
+
symbol: {
|
|
2767
|
+
markerType: "square",
|
|
2768
|
+
markerFill: "rgba(255,255,255,0.9)",
|
|
2769
|
+
markerLineColor: "#666",
|
|
2770
|
+
markerLineWidth: 1
|
|
2771
|
+
}
|
|
2772
|
+
},
|
|
2773
|
+
textStyle: {
|
|
2774
|
+
fontSize: 12,
|
|
2775
|
+
fill: "#333",
|
|
2776
|
+
weight: "bold"
|
|
2777
|
+
}
|
|
2778
|
+
});
|
|
2779
|
+
this.layer.addGeometry(label);
|
|
2780
|
+
},
|
|
2781
|
+
// 格式化距离
|
|
2782
|
+
formatDistance(distance) {
|
|
2783
|
+
if (distance < 1e3) {
|
|
2784
|
+
return Math.round(distance) + "m";
|
|
2785
|
+
} else {
|
|
2786
|
+
return (distance / 1e3).toFixed(2) + "km";
|
|
2787
|
+
}
|
|
2788
|
+
},
|
|
2789
|
+
// 启用绘制
|
|
2790
|
+
enable() {
|
|
2791
|
+
if (this.drawTool) {
|
|
2792
|
+
this.drawTool.enable();
|
|
2793
|
+
}
|
|
2794
|
+
},
|
|
2795
|
+
// 禁用绘制
|
|
2796
|
+
disable() {
|
|
2797
|
+
if (this.drawTool) {
|
|
2798
|
+
this.drawTool.disable();
|
|
2799
|
+
}
|
|
2800
|
+
},
|
|
2801
|
+
// 获取所有绘制的线
|
|
2802
|
+
getLines() {
|
|
2803
|
+
return this.lines;
|
|
2804
|
+
},
|
|
2805
|
+
// 清除所有线
|
|
2806
|
+
clear() {
|
|
2807
|
+
this.lines = [];
|
|
2808
|
+
if (this.layer) {
|
|
2809
|
+
this.layer.clear();
|
|
2810
|
+
}
|
|
2811
|
+
this.$emit("clear");
|
|
2812
|
+
},
|
|
2813
|
+
// 添加线
|
|
2814
|
+
addLine(coordinates) {
|
|
2815
|
+
const line = new maptalks__namespace.LineString(coordinates, {
|
|
2816
|
+
symbol: this.symbol
|
|
2817
|
+
});
|
|
2818
|
+
this.layer.addGeometry(line);
|
|
2819
|
+
this.lines.push(line);
|
|
2820
|
+
const distance = this.calculateDistance(coordinates);
|
|
2821
|
+
if (this.showDistance) {
|
|
2822
|
+
this.addDistanceLabel(line, distance);
|
|
2823
|
+
}
|
|
2824
|
+
this.$emit("add-line", { line, coordinates, distance });
|
|
2825
|
+
},
|
|
2826
|
+
// 移除线
|
|
2827
|
+
removeLine(index2) {
|
|
2828
|
+
if (index2 >= 0 && index2 < this.lines.length) {
|
|
2829
|
+
const line = this.lines[index2];
|
|
2830
|
+
this.layer.removeGeometry(line);
|
|
2831
|
+
this.lines.splice(index2, 1);
|
|
2832
|
+
this.$emit("remove-line", { line, index: index2 });
|
|
2833
|
+
}
|
|
2834
|
+
},
|
|
2835
|
+
// 设置样式
|
|
2836
|
+
setSymbol(symbol) {
|
|
2837
|
+
if (this.drawTool) {
|
|
2838
|
+
this.drawTool.setSymbol(symbol);
|
|
2839
|
+
}
|
|
2840
|
+
},
|
|
2841
|
+
// 获取绘制工具实例
|
|
2842
|
+
getDrawTool() {
|
|
2843
|
+
return this.drawTool;
|
|
2844
|
+
},
|
|
2845
|
+
// 获取图层实例
|
|
2846
|
+
getLayer() {
|
|
2847
|
+
return this.layer;
|
|
2848
|
+
}
|
|
2849
|
+
}
|
|
2850
|
+
};
|
|
2851
|
+
var _sfc_render$6 = function render() {
|
|
2852
|
+
var _vm = this, _c = _vm._self._c;
|
|
2853
|
+
return _c("div", { staticClass: "fy-draw-line" });
|
|
2854
|
+
};
|
|
2855
|
+
var _sfc_staticRenderFns$6 = [];
|
|
2856
|
+
var __component__$6 = /* @__PURE__ */ normalizeComponent(
|
|
2857
|
+
_sfc_main$6,
|
|
2858
|
+
_sfc_render$6,
|
|
2859
|
+
_sfc_staticRenderFns$6,
|
|
2860
|
+
false,
|
|
2861
|
+
null,
|
|
2862
|
+
"37cf3549"
|
|
2863
|
+
);
|
|
2864
|
+
const FyDrawLineComponent = __component__$6.exports;
|
|
2865
|
+
const FyDrawLine = FyDrawLineComponent;
|
|
2866
|
+
FyDrawLine.install = function(Vue) {
|
|
2867
|
+
Vue.component(FyDrawLine.name || "FyDrawLine", FyDrawLine);
|
|
2868
|
+
};
|
|
2869
|
+
const _sfc_main$5 = {
|
|
2870
|
+
name: "FyDrawPolygon",
|
|
2871
|
+
props: {
|
|
2872
|
+
// 图层ID
|
|
2873
|
+
layerId: {
|
|
2874
|
+
type: String,
|
|
2875
|
+
default: "draw-polygon-layer"
|
|
2876
|
+
},
|
|
2877
|
+
// 面样式
|
|
2878
|
+
symbol: {
|
|
2879
|
+
type: Object,
|
|
2880
|
+
default: () => ({
|
|
2881
|
+
lineColor: "#ff0000",
|
|
2882
|
+
lineWidth: 2,
|
|
2883
|
+
lineOpacity: 0.8,
|
|
2884
|
+
polygonFill: "#ff0000",
|
|
2885
|
+
polygonOpacity: 0.3,
|
|
2886
|
+
lineDasharray: []
|
|
2887
|
+
})
|
|
2888
|
+
},
|
|
2889
|
+
// 是否自动开始绘制
|
|
2890
|
+
autoStart: {
|
|
2891
|
+
type: Boolean,
|
|
2892
|
+
default: true
|
|
2893
|
+
},
|
|
2894
|
+
// 是否显示面积标注
|
|
2895
|
+
showArea: {
|
|
2896
|
+
type: Boolean,
|
|
2897
|
+
default: true
|
|
2898
|
+
},
|
|
2899
|
+
// 是否显示提示信息
|
|
2900
|
+
showTooltip: {
|
|
2901
|
+
type: Boolean,
|
|
2902
|
+
default: true
|
|
2903
|
+
}
|
|
2904
|
+
},
|
|
2905
|
+
data() {
|
|
2906
|
+
return {
|
|
2907
|
+
layer: null,
|
|
2908
|
+
drawTool: null,
|
|
2909
|
+
polygons: []
|
|
2910
|
+
};
|
|
2911
|
+
},
|
|
2912
|
+
inject: {
|
|
2913
|
+
mapInstance: {
|
|
2914
|
+
default: null
|
|
2915
|
+
}
|
|
2916
|
+
},
|
|
2917
|
+
mounted() {
|
|
2918
|
+
if (this.mapInstance) {
|
|
2919
|
+
this.initDrawPolygon();
|
|
2920
|
+
}
|
|
2921
|
+
},
|
|
2922
|
+
beforeDestroy() {
|
|
2923
|
+
this.removeDrawPolygon();
|
|
2924
|
+
},
|
|
2925
|
+
methods: {
|
|
2926
|
+
// 初始化绘制面工具
|
|
2927
|
+
initDrawPolygon() {
|
|
2928
|
+
if (!this.mapInstance) return;
|
|
2929
|
+
this.layer = new maptalks__namespace.VectorLayer(this.layerId);
|
|
2930
|
+
this.mapInstance.addLayer(this.layer);
|
|
2931
|
+
this.drawTool = new maptalks__namespace.DrawTool({
|
|
2932
|
+
mode: "polygon",
|
|
2933
|
+
symbol: this.symbol,
|
|
2934
|
+
once: true,
|
|
2935
|
+
enableAltitude: true
|
|
2936
|
+
}).addTo(this.mapInstance);
|
|
2937
|
+
this.bindDrawToolEvents();
|
|
2938
|
+
if (this.autoStart) {
|
|
2939
|
+
this.enable();
|
|
2940
|
+
}
|
|
2941
|
+
this.$emit("ready", this.drawTool);
|
|
2942
|
+
},
|
|
2943
|
+
// 绑定绘制工具事件
|
|
2944
|
+
bindDrawToolEvents() {
|
|
2945
|
+
if (!this.drawTool) return;
|
|
2946
|
+
this.drawTool.on("drawstart", this.handleDrawStart);
|
|
2947
|
+
this.drawTool.on("drawend", this.handleDrawEnd);
|
|
2948
|
+
this.drawTool.on("disable", this.handleDisable);
|
|
2949
|
+
},
|
|
2950
|
+
// 事件处理
|
|
2951
|
+
handleDrawStart(param) {
|
|
2952
|
+
this.$emit("drawstart", param);
|
|
2953
|
+
},
|
|
2954
|
+
handleDrawEnd(param) {
|
|
2955
|
+
const polygon = param.geometry;
|
|
2956
|
+
this.polygons.push(polygon);
|
|
2957
|
+
const result = {
|
|
2958
|
+
polygon,
|
|
2959
|
+
coordinates: polygon.getCoordinates(),
|
|
2960
|
+
area: this.calculateArea(polygon),
|
|
2961
|
+
perimeter: this.calculatePerimeter(polygon.getCoordinates()[0]),
|
|
2962
|
+
allPolygons: this.polygons
|
|
2963
|
+
};
|
|
2964
|
+
if (this.showArea) {
|
|
2965
|
+
this.addAreaLabel(polygon, result.area);
|
|
2966
|
+
}
|
|
2967
|
+
this.$emit("drawend", result);
|
|
2968
|
+
},
|
|
2969
|
+
handleDisable() {
|
|
2970
|
+
this.$emit("disable");
|
|
2971
|
+
},
|
|
2972
|
+
// 计算面积
|
|
2973
|
+
calculateArea(polygon) {
|
|
2974
|
+
if (polygon) {
|
|
2975
|
+
return polygon.getArea();
|
|
2976
|
+
}
|
|
2977
|
+
return 0;
|
|
2978
|
+
},
|
|
2979
|
+
// 计算周长
|
|
2980
|
+
calculatePerimeter(coordinates) {
|
|
2981
|
+
if (coordinates && coordinates.length >= 2) {
|
|
2982
|
+
let perimeter = 0;
|
|
2983
|
+
for (let i = 0; i < coordinates.length - 1; i++) {
|
|
2984
|
+
const p1 = new maptalks__namespace.Coordinate(coordinates[i]);
|
|
2985
|
+
const p2 = new maptalks__namespace.Coordinate(coordinates[i + 1]);
|
|
2986
|
+
perimeter += p1.distanceTo(p2);
|
|
2987
|
+
}
|
|
2988
|
+
return perimeter;
|
|
2989
|
+
}
|
|
2990
|
+
return 0;
|
|
2991
|
+
},
|
|
2992
|
+
// 添加面积标注
|
|
2993
|
+
addAreaLabel(polygon, area) {
|
|
2994
|
+
if (!this.layer) return;
|
|
2995
|
+
const center = polygon.getCenter();
|
|
2996
|
+
const label = new maptalks__namespace.Label(this.formatArea(area), center, {
|
|
2997
|
+
boxStyle: {
|
|
2998
|
+
padding: [2, 2],
|
|
2999
|
+
symbol: {
|
|
3000
|
+
markerType: "square",
|
|
3001
|
+
markerFill: "rgba(255,255,255,0.9)",
|
|
3002
|
+
markerLineColor: "#666",
|
|
3003
|
+
markerLineWidth: 1
|
|
3004
|
+
}
|
|
3005
|
+
},
|
|
3006
|
+
textStyle: {
|
|
3007
|
+
fontSize: 12,
|
|
3008
|
+
fill: "#333",
|
|
3009
|
+
weight: "bold"
|
|
3010
|
+
}
|
|
3011
|
+
});
|
|
3012
|
+
this.layer.addGeometry(label);
|
|
3013
|
+
},
|
|
3014
|
+
// 格式化面积
|
|
3015
|
+
formatArea(area) {
|
|
3016
|
+
if (area < 1e6) {
|
|
3017
|
+
return Math.round(area) + "m²";
|
|
3018
|
+
} else {
|
|
3019
|
+
return (area / 1e6).toFixed(2) + "km²";
|
|
3020
|
+
}
|
|
3021
|
+
},
|
|
3022
|
+
// 启用绘制
|
|
3023
|
+
enable() {
|
|
3024
|
+
if (this.drawTool) {
|
|
3025
|
+
this.drawTool.enable();
|
|
3026
|
+
}
|
|
3027
|
+
},
|
|
3028
|
+
// 禁用绘制
|
|
3029
|
+
disable() {
|
|
3030
|
+
if (this.drawTool) {
|
|
3031
|
+
this.drawTool.disable();
|
|
3032
|
+
}
|
|
3033
|
+
},
|
|
3034
|
+
// 获取所有绘制的面
|
|
3035
|
+
getPolygons() {
|
|
3036
|
+
return this.polygons;
|
|
3037
|
+
},
|
|
3038
|
+
// 清除所有面
|
|
3039
|
+
clear() {
|
|
3040
|
+
this.polygons = [];
|
|
3041
|
+
if (this.layer) {
|
|
3042
|
+
this.layer.clear();
|
|
3043
|
+
}
|
|
3044
|
+
this.$emit("clear");
|
|
3045
|
+
},
|
|
3046
|
+
// 添加面
|
|
3047
|
+
addPolygon(coordinates) {
|
|
3048
|
+
const polygon = new maptalks__namespace.Polygon(coordinates, {
|
|
3049
|
+
symbol: this.symbol
|
|
3050
|
+
});
|
|
3051
|
+
this.layer.addGeometry(polygon);
|
|
3052
|
+
this.polygons.push(polygon);
|
|
3053
|
+
const area = this.calculateArea(polygon);
|
|
3054
|
+
if (this.showArea) {
|
|
3055
|
+
this.addAreaLabel(polygon, area);
|
|
3056
|
+
}
|
|
3057
|
+
this.$emit("add-polygon", { polygon, coordinates, area });
|
|
3058
|
+
},
|
|
3059
|
+
// 移除面
|
|
3060
|
+
removePolygon(index2) {
|
|
3061
|
+
if (index2 >= 0 && index2 < this.polygons.length) {
|
|
3062
|
+
const polygon = this.polygons[index2];
|
|
3063
|
+
this.layer.removeGeometry(polygon);
|
|
3064
|
+
this.polygons.splice(index2, 1);
|
|
3065
|
+
this.$emit("remove-polygon", { polygon, index: index2 });
|
|
3066
|
+
}
|
|
3067
|
+
},
|
|
3068
|
+
// 设置样式
|
|
3069
|
+
setSymbol(symbol) {
|
|
3070
|
+
if (this.drawTool) {
|
|
3071
|
+
this.drawTool.setSymbol(symbol);
|
|
3072
|
+
}
|
|
3073
|
+
},
|
|
3074
|
+
// 获取绘制工具实例
|
|
3075
|
+
getDrawTool() {
|
|
3076
|
+
return this.drawTool;
|
|
3077
|
+
},
|
|
3078
|
+
// 获取图层实例
|
|
3079
|
+
getLayer() {
|
|
3080
|
+
return this.layer;
|
|
3081
|
+
}
|
|
3082
|
+
}
|
|
3083
|
+
};
|
|
3084
|
+
var _sfc_render$5 = function render() {
|
|
3085
|
+
var _vm = this, _c = _vm._self._c;
|
|
3086
|
+
return _c("div", { staticClass: "fy-draw-polygon" });
|
|
3087
|
+
};
|
|
3088
|
+
var _sfc_staticRenderFns$5 = [];
|
|
3089
|
+
var __component__$5 = /* @__PURE__ */ normalizeComponent(
|
|
3090
|
+
_sfc_main$5,
|
|
3091
|
+
_sfc_render$5,
|
|
3092
|
+
_sfc_staticRenderFns$5,
|
|
3093
|
+
false,
|
|
3094
|
+
null,
|
|
3095
|
+
"515f74bf"
|
|
3096
|
+
);
|
|
3097
|
+
const FyDrawPolygonComponent = __component__$5.exports;
|
|
3098
|
+
const FyDrawPolygon = FyDrawPolygonComponent;
|
|
3099
|
+
FyDrawPolygon.install = function(Vue) {
|
|
3100
|
+
Vue.component(FyDrawPolygon.name || "FyDrawPolygon", FyDrawPolygon);
|
|
3101
|
+
};
|
|
3102
|
+
const _sfc_main$4 = {
|
|
3103
|
+
name: "FyDrawCircle",
|
|
3104
|
+
props: {
|
|
3105
|
+
// 图层ID
|
|
3106
|
+
layerId: {
|
|
3107
|
+
type: String,
|
|
3108
|
+
default: "draw-circle-layer"
|
|
3109
|
+
},
|
|
3110
|
+
// 圆样式
|
|
3111
|
+
symbol: {
|
|
3112
|
+
type: Object,
|
|
3113
|
+
default: () => ({
|
|
3114
|
+
lineColor: "#ff0000",
|
|
3115
|
+
lineWidth: 2,
|
|
3116
|
+
lineOpacity: 0.8,
|
|
3117
|
+
polygonFill: "#ff0000",
|
|
3118
|
+
polygonOpacity: 0.3
|
|
3119
|
+
})
|
|
3120
|
+
},
|
|
3121
|
+
// 是否自动开始绘制
|
|
3122
|
+
autoStart: {
|
|
3123
|
+
type: Boolean,
|
|
3124
|
+
default: true
|
|
3125
|
+
},
|
|
3126
|
+
// 是否显示半径和面积标注
|
|
3127
|
+
showLabels: {
|
|
3128
|
+
type: Boolean,
|
|
3129
|
+
default: true
|
|
3130
|
+
},
|
|
3131
|
+
// 是否显示提示信息
|
|
3132
|
+
showTooltip: {
|
|
3133
|
+
type: Boolean,
|
|
3134
|
+
default: true
|
|
3135
|
+
}
|
|
3136
|
+
},
|
|
3137
|
+
data() {
|
|
3138
|
+
return {
|
|
3139
|
+
layer: null,
|
|
3140
|
+
drawTool: null,
|
|
3141
|
+
circles: []
|
|
3142
|
+
};
|
|
3143
|
+
},
|
|
3144
|
+
inject: {
|
|
3145
|
+
mapInstance: {
|
|
3146
|
+
default: null
|
|
3147
|
+
}
|
|
3148
|
+
},
|
|
3149
|
+
mounted() {
|
|
3150
|
+
if (this.mapInstance) {
|
|
3151
|
+
this.initDrawCircle();
|
|
3152
|
+
}
|
|
3153
|
+
},
|
|
3154
|
+
beforeDestroy() {
|
|
3155
|
+
this.removeDrawCircle();
|
|
3156
|
+
},
|
|
3157
|
+
methods: {
|
|
3158
|
+
// 初始化绘制圆工具
|
|
3159
|
+
initDrawCircle() {
|
|
3160
|
+
if (!this.mapInstance) return;
|
|
3161
|
+
this.layer = new maptalks__namespace.VectorLayer(this.layerId);
|
|
3162
|
+
this.mapInstance.addLayer(this.layer);
|
|
3163
|
+
this.drawTool = new maptalks__namespace.DrawTool({
|
|
3164
|
+
mode: "circle",
|
|
3165
|
+
symbol: this.symbol,
|
|
3166
|
+
once: true,
|
|
3167
|
+
enableAltitude: true
|
|
3168
|
+
}).addTo(this.mapInstance);
|
|
3169
|
+
this.bindDrawToolEvents();
|
|
3170
|
+
if (this.autoStart) {
|
|
3171
|
+
this.enable();
|
|
3172
|
+
}
|
|
3173
|
+
this.$emit("ready", this.drawTool);
|
|
3174
|
+
},
|
|
3175
|
+
// 绑定绘制工具事件
|
|
3176
|
+
bindDrawToolEvents() {
|
|
3177
|
+
if (!this.drawTool) return;
|
|
3178
|
+
this.drawTool.on("drawstart", this.handleDrawStart);
|
|
3179
|
+
this.drawTool.on("drawend", this.handleDrawEnd);
|
|
3180
|
+
this.drawTool.on("disable", this.handleDisable);
|
|
3181
|
+
},
|
|
3182
|
+
// 事件处理
|
|
3183
|
+
handleDrawStart(param) {
|
|
3184
|
+
this.$emit("drawstart", param);
|
|
3185
|
+
},
|
|
3186
|
+
handleDrawEnd(param) {
|
|
3187
|
+
const circle = param.geometry;
|
|
3188
|
+
this.circles.push(circle);
|
|
3189
|
+
const result = {
|
|
3190
|
+
circle,
|
|
3191
|
+
center: circle.getCoordinates(),
|
|
3192
|
+
radius: this.calculateRadius(circle),
|
|
3193
|
+
area: this.calculateArea(circle),
|
|
3194
|
+
perimeter: this.calculatePerimeter(circle),
|
|
3195
|
+
allCircles: this.circles
|
|
3196
|
+
};
|
|
3197
|
+
if (this.showLabels) {
|
|
3198
|
+
this.addCircleLabels(circle, result.radius, result.area);
|
|
3199
|
+
}
|
|
3200
|
+
this.$emit("drawend", result);
|
|
3201
|
+
},
|
|
3202
|
+
handleDisable() {
|
|
3203
|
+
this.$emit("disable");
|
|
3204
|
+
},
|
|
3205
|
+
// 计算半径
|
|
3206
|
+
calculateRadius(circle) {
|
|
3207
|
+
if (circle) {
|
|
3208
|
+
return circle.getRadius();
|
|
3209
|
+
}
|
|
3210
|
+
return 0;
|
|
3211
|
+
},
|
|
3212
|
+
// 计算面积
|
|
3213
|
+
calculateArea(circle) {
|
|
3214
|
+
if (circle) {
|
|
3215
|
+
return circle.getArea();
|
|
3216
|
+
}
|
|
3217
|
+
return 0;
|
|
3218
|
+
},
|
|
3219
|
+
// 计算周长
|
|
3220
|
+
calculatePerimeter(circle) {
|
|
3221
|
+
if (circle) {
|
|
3222
|
+
const radius = circle.getRadius();
|
|
3223
|
+
return 2 * Math.PI * radius;
|
|
3224
|
+
}
|
|
3225
|
+
return 0;
|
|
3226
|
+
},
|
|
3227
|
+
// 添加圆的标注
|
|
3228
|
+
addCircleLabels(circle, radius, area) {
|
|
3229
|
+
if (!this.layer) return;
|
|
3230
|
+
const center = circle.getCoordinates();
|
|
3231
|
+
const radiusLabel = new maptalks__namespace.Label(this.formatDistance(radius), center, {
|
|
3232
|
+
boxStyle: {
|
|
3233
|
+
padding: [2, 2],
|
|
3234
|
+
symbol: {
|
|
3235
|
+
markerType: "square",
|
|
3236
|
+
markerFill: "rgba(255,255,255,0.9)",
|
|
3237
|
+
markerLineColor: "#666",
|
|
3238
|
+
markerLineWidth: 1
|
|
3239
|
+
}
|
|
3240
|
+
},
|
|
3241
|
+
textStyle: {
|
|
3242
|
+
fontSize: 12,
|
|
3243
|
+
fill: "#333",
|
|
3244
|
+
weight: "bold"
|
|
3245
|
+
}
|
|
3246
|
+
});
|
|
3247
|
+
this.layer.addGeometry(radiusLabel);
|
|
3248
|
+
const angle = Math.PI / 4;
|
|
3249
|
+
const labelCoords = {
|
|
3250
|
+
x: center.x + radius * Math.cos(angle),
|
|
3251
|
+
y: center.y + radius * Math.sin(angle)
|
|
3252
|
+
};
|
|
3253
|
+
const areaLabel = new maptalks__namespace.Label(this.formatArea(area), labelCoords, {
|
|
3254
|
+
boxStyle: {
|
|
3255
|
+
padding: [2, 2],
|
|
3256
|
+
symbol: {
|
|
3257
|
+
markerType: "square",
|
|
3258
|
+
markerFill: "rgba(255,255,255,0.9)",
|
|
3259
|
+
markerLineColor: "#666",
|
|
3260
|
+
markerLineWidth: 1
|
|
3261
|
+
}
|
|
3262
|
+
},
|
|
3263
|
+
textStyle: {
|
|
3264
|
+
fontSize: 11,
|
|
3265
|
+
fill: "#666",
|
|
3266
|
+
weight: "normal"
|
|
3267
|
+
}
|
|
3268
|
+
});
|
|
3269
|
+
this.layer.addGeometry(areaLabel);
|
|
3270
|
+
},
|
|
3271
|
+
// 格式化距离
|
|
3272
|
+
formatDistance(distance) {
|
|
3273
|
+
if (distance < 1e3) {
|
|
3274
|
+
return Math.round(distance) + "m";
|
|
3275
|
+
} else {
|
|
3276
|
+
return (distance / 1e3).toFixed(2) + "km";
|
|
3277
|
+
}
|
|
3278
|
+
},
|
|
3279
|
+
// 格式化面积
|
|
3280
|
+
formatArea(area) {
|
|
3281
|
+
if (area < 1e6) {
|
|
3282
|
+
return Math.round(area) + "m²";
|
|
3283
|
+
} else {
|
|
3284
|
+
return (area / 1e6).toFixed(2) + "km²";
|
|
3285
|
+
}
|
|
3286
|
+
},
|
|
3287
|
+
// 启用绘制
|
|
3288
|
+
enable() {
|
|
3289
|
+
if (this.drawTool) {
|
|
3290
|
+
this.drawTool.enable();
|
|
3291
|
+
}
|
|
3292
|
+
},
|
|
3293
|
+
// 禁用绘制
|
|
3294
|
+
disable() {
|
|
3295
|
+
if (this.drawTool) {
|
|
3296
|
+
this.drawTool.disable();
|
|
3297
|
+
}
|
|
3298
|
+
},
|
|
3299
|
+
// 获取所有绘制的圆
|
|
3300
|
+
getCircles() {
|
|
3301
|
+
return this.circles;
|
|
3302
|
+
},
|
|
3303
|
+
// 清除所有圆
|
|
3304
|
+
clear() {
|
|
3305
|
+
this.circles = [];
|
|
3306
|
+
if (this.layer) {
|
|
3307
|
+
this.layer.clear();
|
|
3308
|
+
}
|
|
3309
|
+
this.$emit("clear");
|
|
3310
|
+
},
|
|
3311
|
+
// 添加圆
|
|
3312
|
+
addCircle(center, radius) {
|
|
3313
|
+
const circle = new maptalks__namespace.Circle(center, radius, {
|
|
3314
|
+
symbol: this.symbol
|
|
3315
|
+
});
|
|
3316
|
+
this.layer.addGeometry(circle);
|
|
3317
|
+
this.circles.push(circle);
|
|
3318
|
+
const area = this.calculateArea(circle);
|
|
3319
|
+
if (this.showLabels) {
|
|
3320
|
+
this.addCircleLabels(circle, radius, area);
|
|
3321
|
+
}
|
|
3322
|
+
this.$emit("add-circle", { circle, center, radius, area });
|
|
3323
|
+
},
|
|
3324
|
+
// 移除圆
|
|
3325
|
+
removeCircle(index2) {
|
|
3326
|
+
if (index2 >= 0 && index2 < this.circles.length) {
|
|
3327
|
+
const circle = this.circles[index2];
|
|
3328
|
+
this.layer.removeGeometry(circle);
|
|
3329
|
+
this.circles.splice(index2, 1);
|
|
3330
|
+
this.$emit("remove-circle", { circle, index: index2 });
|
|
3331
|
+
}
|
|
3332
|
+
},
|
|
3333
|
+
// 设置样式
|
|
3334
|
+
setSymbol(symbol) {
|
|
3335
|
+
if (this.drawTool) {
|
|
3336
|
+
this.drawTool.setSymbol(symbol);
|
|
3337
|
+
}
|
|
3338
|
+
},
|
|
3339
|
+
// 获取绘制工具实例
|
|
3340
|
+
getDrawTool() {
|
|
3341
|
+
return this.drawTool;
|
|
3342
|
+
},
|
|
3343
|
+
// 获取图层实例
|
|
3344
|
+
getLayer() {
|
|
3345
|
+
return this.layer;
|
|
3346
|
+
}
|
|
3347
|
+
}
|
|
3348
|
+
};
|
|
3349
|
+
var _sfc_render$4 = function render() {
|
|
3350
|
+
var _vm = this, _c = _vm._self._c;
|
|
3351
|
+
return _c("div", { staticClass: "fy-draw-circle" });
|
|
3352
|
+
};
|
|
3353
|
+
var _sfc_staticRenderFns$4 = [];
|
|
3354
|
+
var __component__$4 = /* @__PURE__ */ normalizeComponent(
|
|
3355
|
+
_sfc_main$4,
|
|
3356
|
+
_sfc_render$4,
|
|
3357
|
+
_sfc_staticRenderFns$4,
|
|
3358
|
+
false,
|
|
3359
|
+
null,
|
|
3360
|
+
"93e35e4d"
|
|
3361
|
+
);
|
|
3362
|
+
const FyDrawCircleComponent = __component__$4.exports;
|
|
3363
|
+
const FyDrawCircle = FyDrawCircleComponent;
|
|
3364
|
+
FyDrawCircle.install = function(Vue) {
|
|
3365
|
+
Vue.component(FyDrawCircle.name || "FyDrawCircle", FyDrawCircle);
|
|
3366
|
+
};
|
|
3367
|
+
const _sfc_main$3 = {
|
|
3368
|
+
name: "FyPoint",
|
|
3369
|
+
props: {
|
|
3370
|
+
// 位置坐标 [经度, 纬度]
|
|
3371
|
+
coordinates: {
|
|
3372
|
+
type: Array,
|
|
3373
|
+
required: true
|
|
3374
|
+
},
|
|
3375
|
+
// 图层ID
|
|
3376
|
+
layerId: {
|
|
3377
|
+
type: String,
|
|
3378
|
+
default: "point-layer"
|
|
3379
|
+
},
|
|
3380
|
+
// 点样式
|
|
3381
|
+
symbol: {
|
|
3382
|
+
type: Object,
|
|
3383
|
+
default: () => ({
|
|
3384
|
+
markerType: "ellipse",
|
|
3385
|
+
markerFill: "#ff0000",
|
|
3386
|
+
markerFillOpacity: 1,
|
|
3387
|
+
markerLineColor: "#ffffff",
|
|
3388
|
+
markerLineWidth: 2,
|
|
3389
|
+
markerLineOpacity: 1,
|
|
3390
|
+
markerWidth: 24,
|
|
3391
|
+
markerHeight: 24,
|
|
3392
|
+
markerDx: 0,
|
|
3393
|
+
markerDy: 0
|
|
3394
|
+
})
|
|
3395
|
+
},
|
|
3396
|
+
// 透明度
|
|
3397
|
+
opacity: {
|
|
3398
|
+
type: Number,
|
|
3399
|
+
default: 1
|
|
3400
|
+
},
|
|
3401
|
+
// 可见性
|
|
3402
|
+
visible: {
|
|
3403
|
+
type: Boolean,
|
|
3404
|
+
default: true
|
|
3405
|
+
},
|
|
3406
|
+
// 层级
|
|
3407
|
+
zIndex: {
|
|
3408
|
+
type: Number,
|
|
3409
|
+
default: 10
|
|
3410
|
+
},
|
|
3411
|
+
// 自定义属性
|
|
3412
|
+
properties: {
|
|
3413
|
+
type: Object,
|
|
3414
|
+
default: () => ({})
|
|
3415
|
+
}
|
|
3416
|
+
},
|
|
3417
|
+
data() {
|
|
3418
|
+
return {
|
|
3419
|
+
layer: null,
|
|
3420
|
+
point: null
|
|
3421
|
+
};
|
|
3422
|
+
},
|
|
3423
|
+
inject: {
|
|
3424
|
+
mapInstance: {
|
|
3425
|
+
default: null
|
|
3426
|
+
}
|
|
3427
|
+
},
|
|
3428
|
+
mounted() {
|
|
3429
|
+
if (this.mapInstance) {
|
|
3430
|
+
this.initPoint();
|
|
3431
|
+
}
|
|
3432
|
+
},
|
|
3433
|
+
beforeDestroy() {
|
|
3434
|
+
this.removePoint();
|
|
3435
|
+
},
|
|
3436
|
+
methods: {
|
|
3437
|
+
// 初始化点
|
|
3438
|
+
initPoint() {
|
|
3439
|
+
if (!this.mapInstance) return;
|
|
3440
|
+
this.layer = this.mapInstance.getLayer(this.layerId);
|
|
3441
|
+
if (!this.layer) {
|
|
3442
|
+
this.layer = new maptalks__namespace.VectorLayer(this.layerId, {
|
|
3443
|
+
zIndex: this.zIndex
|
|
3444
|
+
});
|
|
3445
|
+
this.mapInstance.addLayer(this.layer);
|
|
3446
|
+
}
|
|
3447
|
+
const config = {
|
|
3448
|
+
symbol: this.symbol,
|
|
3449
|
+
visible: this.visible,
|
|
3450
|
+
opacity: this.opacity,
|
|
3451
|
+
properties: this.properties,
|
|
3452
|
+
zIndex: this.zIndex
|
|
3453
|
+
};
|
|
3454
|
+
this.point = new maptalks__namespace.Marker(this.coordinates, config);
|
|
3455
|
+
this.point.on("click", this.handleClick);
|
|
3456
|
+
this.point.on("mouseover", this.handleMouseover);
|
|
3457
|
+
this.point.on("mouseout", this.handleMouseout);
|
|
3458
|
+
this.point.on("dblclick", this.handleDblClick);
|
|
3459
|
+
this.point.on("mousedown", this.handleMouseDown);
|
|
3460
|
+
this.point.on("mouseup", this.handleMouseUp);
|
|
3461
|
+
this.layer.addGeometry(this.point);
|
|
3462
|
+
this.$emit("ready", this.point);
|
|
3463
|
+
},
|
|
3464
|
+
// 移除点
|
|
3465
|
+
removePoint() {
|
|
3466
|
+
if (this.point && this.layer) {
|
|
3467
|
+
this.point.off("click", this.handleClick);
|
|
3468
|
+
this.point.off("mouseover", this.handleMouseover);
|
|
3469
|
+
this.point.off("mouseout", this.handleMouseout);
|
|
3470
|
+
this.point.off("dblclick", this.handleDblClick);
|
|
3471
|
+
this.point.off("mousedown", this.handleMouseDown);
|
|
3472
|
+
this.point.off("mouseup", this.handleMouseUp);
|
|
3473
|
+
this.layer.removeGeometry(this.point);
|
|
3474
|
+
this.point = null;
|
|
3475
|
+
}
|
|
3476
|
+
},
|
|
3477
|
+
// 事件处理
|
|
3478
|
+
handleClick(e) {
|
|
3479
|
+
this.$emit("click", e);
|
|
3480
|
+
},
|
|
3481
|
+
handleMouseover(e) {
|
|
3482
|
+
this.$emit("mouseover", e);
|
|
3483
|
+
},
|
|
3484
|
+
handleMouseout(e) {
|
|
3485
|
+
this.$emit("mouseout", e);
|
|
3486
|
+
},
|
|
3487
|
+
handleDblClick(e) {
|
|
3488
|
+
this.$emit("dblclick", e);
|
|
3489
|
+
},
|
|
3490
|
+
handleMouseDown(e) {
|
|
3491
|
+
this.$emit("mousedown", e);
|
|
3492
|
+
},
|
|
3493
|
+
handleMouseUp(e) {
|
|
3494
|
+
this.$emit("mouseup", e);
|
|
3495
|
+
},
|
|
3496
|
+
// 设置位置
|
|
3497
|
+
setCoordinates(coordinates) {
|
|
3498
|
+
if (this.point) {
|
|
3499
|
+
this.point.setCoordinates(coordinates);
|
|
3500
|
+
}
|
|
3501
|
+
},
|
|
3502
|
+
// 设置样式
|
|
3503
|
+
setSymbol(symbol) {
|
|
3504
|
+
if (this.point) {
|
|
3505
|
+
this.point.setSymbol(symbol);
|
|
3506
|
+
}
|
|
3507
|
+
},
|
|
3508
|
+
// 设置透明度
|
|
3509
|
+
setOpacity(opacity) {
|
|
3510
|
+
if (this.point) {
|
|
3511
|
+
this.point.setOpacity(opacity);
|
|
3512
|
+
}
|
|
3513
|
+
},
|
|
3514
|
+
// 显示
|
|
3515
|
+
show() {
|
|
3516
|
+
if (this.point) {
|
|
3517
|
+
this.point.show();
|
|
3518
|
+
}
|
|
3519
|
+
},
|
|
3520
|
+
// 隐藏
|
|
3521
|
+
hide() {
|
|
3522
|
+
if (this.point) {
|
|
3523
|
+
this.point.hide();
|
|
3524
|
+
}
|
|
3525
|
+
},
|
|
3526
|
+
// 动画到指定位置
|
|
3527
|
+
animateTo(coordinates, options = {}) {
|
|
3528
|
+
if (this.point) {
|
|
3529
|
+
this.point.animateTo(
|
|
3530
|
+
{
|
|
3531
|
+
coordinates
|
|
3532
|
+
},
|
|
3533
|
+
options
|
|
3534
|
+
);
|
|
3535
|
+
}
|
|
3536
|
+
},
|
|
3537
|
+
// 获取坐标
|
|
3538
|
+
getCoordinates() {
|
|
3539
|
+
if (this.point) {
|
|
3540
|
+
return this.point.getCoordinates();
|
|
3541
|
+
}
|
|
3542
|
+
return null;
|
|
3543
|
+
},
|
|
3544
|
+
// 获取点实例
|
|
3545
|
+
getPoint() {
|
|
3546
|
+
return this.point;
|
|
3547
|
+
},
|
|
3548
|
+
// 获取图层实例
|
|
3549
|
+
getLayer() {
|
|
3550
|
+
return this.layer;
|
|
3551
|
+
}
|
|
3552
|
+
},
|
|
3553
|
+
watch: {
|
|
3554
|
+
coordinates(newVal) {
|
|
3555
|
+
this.setCoordinates(newVal);
|
|
3556
|
+
},
|
|
3557
|
+
symbol: {
|
|
3558
|
+
handler(newVal) {
|
|
3559
|
+
this.setSymbol(newVal);
|
|
3560
|
+
},
|
|
3561
|
+
deep: true
|
|
3562
|
+
},
|
|
3563
|
+
opacity(newVal) {
|
|
3564
|
+
this.setOpacity(newVal);
|
|
3565
|
+
},
|
|
3566
|
+
visible(newVal) {
|
|
3567
|
+
if (newVal) {
|
|
3568
|
+
this.show();
|
|
3569
|
+
} else {
|
|
3570
|
+
this.hide();
|
|
3571
|
+
}
|
|
3572
|
+
}
|
|
3573
|
+
}
|
|
3574
|
+
};
|
|
3575
|
+
var _sfc_render$3 = function render() {
|
|
3576
|
+
var _vm = this, _c = _vm._self._c;
|
|
3577
|
+
return _c("div", { staticClass: "fy-point" });
|
|
3578
|
+
};
|
|
3579
|
+
var _sfc_staticRenderFns$3 = [];
|
|
3580
|
+
var __component__$3 = /* @__PURE__ */ normalizeComponent(
|
|
3581
|
+
_sfc_main$3,
|
|
3582
|
+
_sfc_render$3,
|
|
3583
|
+
_sfc_staticRenderFns$3,
|
|
3584
|
+
false,
|
|
3585
|
+
null,
|
|
3586
|
+
"9191aada"
|
|
3587
|
+
);
|
|
3588
|
+
const FyPointComponent = __component__$3.exports;
|
|
3589
|
+
const FyPoint = FyPointComponent;
|
|
3590
|
+
FyPoint.install = function(Vue) {
|
|
3591
|
+
Vue.component(FyPoint.name || "FyPoint", FyPoint);
|
|
3592
|
+
};
|
|
3593
|
+
const _sfc_main$2 = {
|
|
3594
|
+
name: "FyLineString",
|
|
3595
|
+
props: {
|
|
3596
|
+
// 线的坐标数组 [[经度, 纬度], ...]
|
|
3597
|
+
coordinates: {
|
|
3598
|
+
type: Array,
|
|
3599
|
+
required: true
|
|
3600
|
+
},
|
|
3601
|
+
// 图层ID
|
|
3602
|
+
layerId: {
|
|
3603
|
+
type: String,
|
|
3604
|
+
default: "linestring-layer"
|
|
3605
|
+
},
|
|
3606
|
+
// 线样式
|
|
3607
|
+
symbol: {
|
|
3608
|
+
type: Object,
|
|
3609
|
+
default: () => ({
|
|
3610
|
+
lineColor: "#3388ff",
|
|
3611
|
+
lineWidth: 3,
|
|
3612
|
+
lineOpacity: 0.8,
|
|
3613
|
+
lineDasharray: [],
|
|
3614
|
+
lineCap: "butt",
|
|
3615
|
+
// butt, round, square
|
|
3616
|
+
lineJoin: "miter"
|
|
3617
|
+
// mitre, round, bevel
|
|
3618
|
+
})
|
|
3619
|
+
},
|
|
3620
|
+
// 透明度
|
|
3621
|
+
opacity: {
|
|
3622
|
+
type: Number,
|
|
3623
|
+
default: 1
|
|
3624
|
+
},
|
|
3625
|
+
// 可见性
|
|
3626
|
+
visible: {
|
|
3627
|
+
type: Boolean,
|
|
3628
|
+
default: true
|
|
3629
|
+
},
|
|
3630
|
+
// 层级
|
|
3631
|
+
zIndex: {
|
|
3632
|
+
type: Number,
|
|
3633
|
+
default: 10
|
|
3634
|
+
},
|
|
3635
|
+
// 是否平滑曲线
|
|
3636
|
+
smooth: {
|
|
3637
|
+
type: Boolean,
|
|
3638
|
+
default: false
|
|
3639
|
+
},
|
|
3640
|
+
// 自定义属性
|
|
3641
|
+
properties: {
|
|
3642
|
+
type: Object,
|
|
3643
|
+
default: () => ({})
|
|
3644
|
+
}
|
|
3645
|
+
},
|
|
3646
|
+
data() {
|
|
3647
|
+
return {
|
|
3648
|
+
layer: null,
|
|
3649
|
+
lineString: null
|
|
3650
|
+
};
|
|
3651
|
+
},
|
|
3652
|
+
inject: {
|
|
3653
|
+
mapInstance: {
|
|
3654
|
+
default: null
|
|
3655
|
+
}
|
|
3656
|
+
},
|
|
3657
|
+
mounted() {
|
|
3658
|
+
if (this.mapInstance) {
|
|
3659
|
+
this.initLineString();
|
|
3660
|
+
}
|
|
3661
|
+
},
|
|
3662
|
+
beforeDestroy() {
|
|
3663
|
+
this.removeLineString();
|
|
3664
|
+
},
|
|
3665
|
+
methods: {
|
|
3666
|
+
// 初始化线
|
|
3667
|
+
initLineString() {
|
|
3668
|
+
if (!this.mapInstance) return;
|
|
3669
|
+
this.layer = this.mapInstance.getLayer(this.layerId);
|
|
3670
|
+
if (!this.layer) {
|
|
3671
|
+
this.layer = new maptalks__namespace.VectorLayer(this.layerId, {
|
|
3672
|
+
zIndex: this.zIndex
|
|
3673
|
+
});
|
|
3674
|
+
this.mapInstance.addLayer(this.layer);
|
|
3675
|
+
}
|
|
3676
|
+
const config = {
|
|
3677
|
+
symbol: this.symbol,
|
|
3678
|
+
visible: this.visible,
|
|
3679
|
+
opacity: this.opacity,
|
|
3680
|
+
properties: this.properties,
|
|
3681
|
+
zIndex: this.zIndex
|
|
3682
|
+
};
|
|
3683
|
+
this.lineString = new maptalks__namespace.LineString(this.coordinates, config);
|
|
3684
|
+
this.lineString.on("click", this.handleClick);
|
|
3685
|
+
this.lineString.on("mouseover", this.handleMouseover);
|
|
3686
|
+
this.lineString.on("mouseout", this.handleMouseout);
|
|
3687
|
+
this.lineString.on("dblclick", this.handleDblClick);
|
|
3688
|
+
this.lineString.on("mousedown", this.handleMouseDown);
|
|
3689
|
+
this.lineString.on("mouseup", this.handleMouseUp);
|
|
3690
|
+
this.layer.addGeometry(this.lineString);
|
|
3691
|
+
this.$emit("ready", this.lineString);
|
|
3692
|
+
},
|
|
3693
|
+
// 移除线
|
|
3694
|
+
removeLineString() {
|
|
3695
|
+
if (this.lineString && this.layer) {
|
|
3696
|
+
this.lineString.off("click", this.handleClick);
|
|
3697
|
+
this.lineString.off("mouseover", this.handleMouseover);
|
|
3698
|
+
this.lineString.off("mouseout", this.handleMouseout);
|
|
3699
|
+
this.lineString.off("dblclick", this.handleDblClick);
|
|
3700
|
+
this.lineString.off("mousedown", this.handleMouseDown);
|
|
3701
|
+
this.lineString.off("mouseup", this.handleMouseUp);
|
|
3702
|
+
this.layer.removeGeometry(this.lineString);
|
|
3703
|
+
this.lineString = null;
|
|
3704
|
+
}
|
|
3705
|
+
},
|
|
3706
|
+
// 事件处理
|
|
3707
|
+
handleClick(e) {
|
|
3708
|
+
this.$emit("click", e);
|
|
3709
|
+
},
|
|
3710
|
+
handleMouseover(e) {
|
|
3711
|
+
this.$emit("mouseover", e);
|
|
3712
|
+
},
|
|
3713
|
+
handleMouseout(e) {
|
|
3714
|
+
this.$emit("mouseout", e);
|
|
3715
|
+
},
|
|
3716
|
+
handleDblClick(e) {
|
|
3717
|
+
this.$emit("dblclick", e);
|
|
3718
|
+
},
|
|
3719
|
+
handleMouseDown(e) {
|
|
3720
|
+
this.$emit("mousedown", e);
|
|
3721
|
+
},
|
|
3722
|
+
handleMouseUp(e) {
|
|
3723
|
+
this.$emit("mouseup", e);
|
|
3724
|
+
},
|
|
3725
|
+
// 设置坐标
|
|
3726
|
+
setCoordinates(coordinates) {
|
|
3727
|
+
if (this.lineString) {
|
|
3728
|
+
this.lineString.setCoordinates(coordinates);
|
|
3729
|
+
}
|
|
3730
|
+
},
|
|
3731
|
+
// 添加坐标点
|
|
3732
|
+
appendCoordinates(coordinates) {
|
|
3733
|
+
if (this.lineString) {
|
|
3734
|
+
this.lineString.appendCoordinates(coordinates);
|
|
3735
|
+
}
|
|
3736
|
+
},
|
|
3737
|
+
// 移除坐标点
|
|
3738
|
+
removeCoordinates(index2, count = 1) {
|
|
3739
|
+
if (this.lineString) {
|
|
3740
|
+
this.lineString.removeCoordinates(index2, count);
|
|
3741
|
+
}
|
|
3742
|
+
},
|
|
3743
|
+
// 插入坐标点
|
|
3744
|
+
insertCoordinates(index2, coordinates) {
|
|
3745
|
+
if (this.lineString) {
|
|
3746
|
+
this.lineString.insertCoordinates(index2, coordinates);
|
|
3747
|
+
}
|
|
3748
|
+
},
|
|
3749
|
+
// 设置样式
|
|
3750
|
+
setSymbol(symbol) {
|
|
3751
|
+
if (this.lineString) {
|
|
3752
|
+
this.lineString.setSymbol(symbol);
|
|
3753
|
+
}
|
|
3754
|
+
},
|
|
3755
|
+
// 设置透明度
|
|
3756
|
+
setOpacity(opacity) {
|
|
3757
|
+
if (this.lineString) {
|
|
3758
|
+
this.lineString.setOpacity(opacity);
|
|
3759
|
+
}
|
|
3760
|
+
},
|
|
3761
|
+
// 显示
|
|
3762
|
+
show() {
|
|
3763
|
+
if (this.lineString) {
|
|
3764
|
+
this.lineString.show();
|
|
3765
|
+
}
|
|
3766
|
+
},
|
|
3767
|
+
// 隐藏
|
|
3768
|
+
hide() {
|
|
3769
|
+
if (this.lineString) {
|
|
3770
|
+
this.lineString.hide();
|
|
3771
|
+
}
|
|
3772
|
+
},
|
|
3773
|
+
// 获取长度
|
|
3774
|
+
getLength() {
|
|
3775
|
+
if (this.lineString) {
|
|
3776
|
+
return this.lineString.getLength();
|
|
3777
|
+
}
|
|
3778
|
+
return 0;
|
|
3779
|
+
},
|
|
3780
|
+
// 获取坐标
|
|
3781
|
+
getCoordinates() {
|
|
3782
|
+
if (this.lineString) {
|
|
3783
|
+
return this.lineString.getCoordinates();
|
|
3784
|
+
}
|
|
3785
|
+
return [];
|
|
3786
|
+
},
|
|
3787
|
+
// 获取中心点
|
|
3788
|
+
getCenter() {
|
|
3789
|
+
if (this.lineString) {
|
|
3790
|
+
return this.lineString.getCenter();
|
|
3791
|
+
}
|
|
3792
|
+
return null;
|
|
3793
|
+
},
|
|
3794
|
+
// 获取范围
|
|
3795
|
+
getExtent() {
|
|
3796
|
+
if (this.lineString) {
|
|
3797
|
+
return this.lineString.getExtent();
|
|
3798
|
+
}
|
|
3799
|
+
return null;
|
|
3800
|
+
},
|
|
3801
|
+
// 获取线实例
|
|
3802
|
+
getLineString() {
|
|
3803
|
+
return this.lineString;
|
|
3804
|
+
},
|
|
3805
|
+
// 获取图层实例
|
|
3806
|
+
getLayer() {
|
|
3807
|
+
return this.layer;
|
|
3808
|
+
}
|
|
3809
|
+
},
|
|
3810
|
+
watch: {
|
|
3811
|
+
coordinates(newVal) {
|
|
3812
|
+
this.setCoordinates(newVal);
|
|
3813
|
+
},
|
|
3814
|
+
symbol: {
|
|
3815
|
+
handler(newVal) {
|
|
3816
|
+
this.setSymbol(newVal);
|
|
3817
|
+
},
|
|
3818
|
+
deep: true
|
|
3819
|
+
},
|
|
3820
|
+
opacity(newVal) {
|
|
3821
|
+
this.setOpacity(newVal);
|
|
3822
|
+
},
|
|
3823
|
+
visible(newVal) {
|
|
3824
|
+
if (newVal) {
|
|
3825
|
+
this.show();
|
|
3826
|
+
} else {
|
|
3827
|
+
this.hide();
|
|
3828
|
+
}
|
|
3829
|
+
}
|
|
3830
|
+
}
|
|
3831
|
+
};
|
|
3832
|
+
var _sfc_render$2 = function render() {
|
|
3833
|
+
var _vm = this, _c = _vm._self._c;
|
|
3834
|
+
return _c("div", { staticClass: "fy-linestring" });
|
|
3835
|
+
};
|
|
3836
|
+
var _sfc_staticRenderFns$2 = [];
|
|
3837
|
+
var __component__$2 = /* @__PURE__ */ normalizeComponent(
|
|
3838
|
+
_sfc_main$2,
|
|
3839
|
+
_sfc_render$2,
|
|
3840
|
+
_sfc_staticRenderFns$2,
|
|
3841
|
+
false,
|
|
3842
|
+
null,
|
|
3843
|
+
"f5afe3b1"
|
|
3844
|
+
);
|
|
3845
|
+
const FyLineStringComponent = __component__$2.exports;
|
|
3846
|
+
const FyLineString = FyLineStringComponent;
|
|
3847
|
+
FyLineString.install = function(Vue) {
|
|
3848
|
+
Vue.component(FyLineString.name || "FyLineString", FyLineString);
|
|
3849
|
+
};
|
|
3850
|
+
const _sfc_main$1 = {
|
|
3851
|
+
name: "FyPolygon",
|
|
3852
|
+
props: {
|
|
3853
|
+
// 多边形的坐标数组 [[[经度, 纬度], ...], ...]
|
|
3854
|
+
coordinates: {
|
|
3855
|
+
type: Array,
|
|
3856
|
+
required: true
|
|
3857
|
+
},
|
|
3858
|
+
// 图层ID
|
|
3859
|
+
layerId: {
|
|
3860
|
+
type: String,
|
|
3861
|
+
default: "polygon-layer"
|
|
3862
|
+
},
|
|
3863
|
+
// 多边形样式
|
|
3864
|
+
symbol: {
|
|
3865
|
+
type: Object,
|
|
3866
|
+
default: () => ({
|
|
3867
|
+
lineColor: "#3388ff",
|
|
3868
|
+
lineWidth: 2,
|
|
3869
|
+
lineOpacity: 0.8,
|
|
3870
|
+
polygonFill: "#3388ff",
|
|
3871
|
+
polygonOpacity: 0.3,
|
|
3872
|
+
lineDasharray: []
|
|
3873
|
+
})
|
|
3874
|
+
},
|
|
3875
|
+
// 透明度
|
|
3876
|
+
opacity: {
|
|
3877
|
+
type: Number,
|
|
3878
|
+
default: 1
|
|
3879
|
+
},
|
|
3880
|
+
// 可见性
|
|
3881
|
+
visible: {
|
|
3882
|
+
type: Boolean,
|
|
3883
|
+
default: true
|
|
3884
|
+
},
|
|
3885
|
+
// 层级
|
|
3886
|
+
zIndex: {
|
|
3887
|
+
type: Number,
|
|
3888
|
+
default: 10
|
|
3889
|
+
},
|
|
3890
|
+
// 自定义属性
|
|
3891
|
+
properties: {
|
|
3892
|
+
type: Object,
|
|
3893
|
+
default: () => ({})
|
|
3894
|
+
}
|
|
3895
|
+
},
|
|
3896
|
+
data() {
|
|
3897
|
+
return {
|
|
3898
|
+
layer: null,
|
|
3899
|
+
polygon: null
|
|
3900
|
+
};
|
|
3901
|
+
},
|
|
3902
|
+
inject: {
|
|
3903
|
+
mapInstance: {
|
|
3904
|
+
default: null
|
|
3905
|
+
}
|
|
3906
|
+
},
|
|
3907
|
+
mounted() {
|
|
3908
|
+
if (this.mapInstance) {
|
|
3909
|
+
this.initPolygon();
|
|
3910
|
+
}
|
|
3911
|
+
},
|
|
3912
|
+
beforeDestroy() {
|
|
3913
|
+
this.removePolygon();
|
|
3914
|
+
},
|
|
3915
|
+
methods: {
|
|
3916
|
+
// 初始化多边形
|
|
3917
|
+
initPolygon() {
|
|
3918
|
+
if (!this.mapInstance) return;
|
|
3919
|
+
this.layer = this.mapInstance.getLayer(this.layerId);
|
|
3920
|
+
if (!this.layer) {
|
|
3921
|
+
this.layer = new maptalks__namespace.VectorLayer(this.layerId, {
|
|
3922
|
+
zIndex: this.zIndex
|
|
3923
|
+
});
|
|
3924
|
+
this.mapInstance.addLayer(this.layer);
|
|
3925
|
+
}
|
|
3926
|
+
const config = {
|
|
3927
|
+
symbol: this.symbol,
|
|
3928
|
+
visible: this.visible,
|
|
3929
|
+
opacity: this.opacity,
|
|
3930
|
+
properties: this.properties,
|
|
3931
|
+
zIndex: this.zIndex
|
|
3932
|
+
};
|
|
3933
|
+
this.polygon = new maptalks__namespace.Polygon(this.coordinates, config);
|
|
3934
|
+
this.polygon.on("click", this.handleClick);
|
|
3935
|
+
this.polygon.on("mouseover", this.handleMouseover);
|
|
3936
|
+
this.polygon.on("mouseout", this.handleMouseout);
|
|
3937
|
+
this.polygon.on("dblclick", this.handleDblClick);
|
|
3938
|
+
this.polygon.on("mousedown", this.handleMouseDown);
|
|
3939
|
+
this.polygon.on("mouseup", this.handleMouseUp);
|
|
3940
|
+
this.layer.addGeometry(this.polygon);
|
|
3941
|
+
this.$emit("ready", this.polygon);
|
|
3942
|
+
},
|
|
3943
|
+
// 移除多边形
|
|
3944
|
+
removePolygon() {
|
|
3945
|
+
if (this.polygon && this.layer) {
|
|
3946
|
+
this.polygon.off("click", this.handleClick);
|
|
3947
|
+
this.polygon.off("mouseover", this.handleMouseover);
|
|
3948
|
+
this.polygon.off("mouseout", this.handleMouseout);
|
|
3949
|
+
this.polygon.off("dblclick", this.handleDblClick);
|
|
3950
|
+
this.polygon.off("mousedown", this.handleMouseDown);
|
|
3951
|
+
this.polygon.off("mouseup", this.handleMouseUp);
|
|
3952
|
+
this.layer.removeGeometry(this.polygon);
|
|
3953
|
+
this.polygon = null;
|
|
3954
|
+
}
|
|
3955
|
+
},
|
|
3956
|
+
// 事件处理
|
|
3957
|
+
handleClick(e) {
|
|
3958
|
+
this.$emit("click", e);
|
|
3959
|
+
},
|
|
3960
|
+
handleMouseover(e) {
|
|
3961
|
+
this.$emit("mouseover", e);
|
|
3962
|
+
},
|
|
3963
|
+
handleMouseout(e) {
|
|
3964
|
+
this.$emit("mouseout", e);
|
|
3965
|
+
},
|
|
3966
|
+
handleDblClick(e) {
|
|
3967
|
+
this.$emit("dblclick", e);
|
|
3968
|
+
},
|
|
3969
|
+
handleMouseDown(e) {
|
|
3970
|
+
this.$emit("mousedown", e);
|
|
3971
|
+
},
|
|
3972
|
+
handleMouseUp(e) {
|
|
3973
|
+
this.$emit("mouseup", e);
|
|
3974
|
+
},
|
|
3975
|
+
// 设置坐标
|
|
3976
|
+
setCoordinates(coordinates) {
|
|
3977
|
+
if (this.polygon) {
|
|
3978
|
+
this.polygon.setCoordinates(coordinates);
|
|
3979
|
+
}
|
|
3980
|
+
},
|
|
3981
|
+
// 设置样式
|
|
3982
|
+
setSymbol(symbol) {
|
|
3983
|
+
if (this.polygon) {
|
|
3984
|
+
this.polygon.setSymbol(symbol);
|
|
3985
|
+
}
|
|
3986
|
+
},
|
|
3987
|
+
// 设置透明度
|
|
3988
|
+
setOpacity(opacity) {
|
|
3989
|
+
if (this.polygon) {
|
|
3990
|
+
this.polygon.setOpacity(opacity);
|
|
3991
|
+
}
|
|
3992
|
+
},
|
|
3993
|
+
// 显示
|
|
3994
|
+
show() {
|
|
3995
|
+
if (this.polygon) {
|
|
3996
|
+
this.polygon.show();
|
|
3997
|
+
}
|
|
3998
|
+
},
|
|
3999
|
+
// 隐藏
|
|
4000
|
+
hide() {
|
|
4001
|
+
if (this.polygon) {
|
|
4002
|
+
this.polygon.hide();
|
|
4003
|
+
}
|
|
4004
|
+
},
|
|
4005
|
+
// 获取面积
|
|
4006
|
+
getArea() {
|
|
4007
|
+
if (this.polygon) {
|
|
4008
|
+
return this.polygon.getArea();
|
|
4009
|
+
}
|
|
4010
|
+
return 0;
|
|
4011
|
+
},
|
|
4012
|
+
// 获取坐标
|
|
4013
|
+
getCoordinates() {
|
|
4014
|
+
if (this.polygon) {
|
|
4015
|
+
return this.polygon.getCoordinates();
|
|
4016
|
+
}
|
|
4017
|
+
return [];
|
|
4018
|
+
},
|
|
4019
|
+
// 获取中心点
|
|
4020
|
+
getCenter() {
|
|
4021
|
+
if (this.polygon) {
|
|
4022
|
+
return this.polygon.getCenter();
|
|
4023
|
+
}
|
|
4024
|
+
return null;
|
|
4025
|
+
},
|
|
4026
|
+
// 获取范围
|
|
4027
|
+
getExtent() {
|
|
4028
|
+
if (this.polygon) {
|
|
4029
|
+
return this.polygon.getExtent();
|
|
4030
|
+
}
|
|
4031
|
+
return null;
|
|
4032
|
+
},
|
|
4033
|
+
// 获取外轮廓
|
|
4034
|
+
getShell() {
|
|
4035
|
+
if (this.polygon) {
|
|
4036
|
+
return this.polygon.getShell();
|
|
4037
|
+
}
|
|
4038
|
+
return [];
|
|
4039
|
+
},
|
|
4040
|
+
// 获取内孔
|
|
4041
|
+
getHoles() {
|
|
4042
|
+
if (this.polygon) {
|
|
4043
|
+
return this.polygon.getHoles();
|
|
4044
|
+
}
|
|
4045
|
+
return [];
|
|
4046
|
+
},
|
|
4047
|
+
// 获取多边形实例
|
|
4048
|
+
getPolygon() {
|
|
4049
|
+
return this.polygon;
|
|
4050
|
+
},
|
|
4051
|
+
// 获取图层实例
|
|
4052
|
+
getLayer() {
|
|
4053
|
+
return this.layer;
|
|
4054
|
+
}
|
|
4055
|
+
},
|
|
4056
|
+
watch: {
|
|
4057
|
+
coordinates(newVal) {
|
|
4058
|
+
this.setCoordinates(newVal);
|
|
4059
|
+
},
|
|
4060
|
+
symbol: {
|
|
4061
|
+
handler(newVal) {
|
|
4062
|
+
this.setSymbol(newVal);
|
|
4063
|
+
},
|
|
4064
|
+
deep: true
|
|
4065
|
+
},
|
|
4066
|
+
opacity(newVal) {
|
|
4067
|
+
this.setOpacity(newVal);
|
|
4068
|
+
},
|
|
4069
|
+
visible(newVal) {
|
|
4070
|
+
if (newVal) {
|
|
4071
|
+
this.show();
|
|
4072
|
+
} else {
|
|
4073
|
+
this.hide();
|
|
4074
|
+
}
|
|
4075
|
+
}
|
|
4076
|
+
}
|
|
4077
|
+
};
|
|
4078
|
+
var _sfc_render$1 = function render() {
|
|
4079
|
+
var _vm = this, _c = _vm._self._c;
|
|
4080
|
+
return _c("div", { staticClass: "fy-polygon" });
|
|
4081
|
+
};
|
|
4082
|
+
var _sfc_staticRenderFns$1 = [];
|
|
4083
|
+
var __component__$1 = /* @__PURE__ */ normalizeComponent(
|
|
4084
|
+
_sfc_main$1,
|
|
4085
|
+
_sfc_render$1,
|
|
4086
|
+
_sfc_staticRenderFns$1,
|
|
4087
|
+
false,
|
|
4088
|
+
null,
|
|
4089
|
+
"762f4fba"
|
|
4090
|
+
);
|
|
4091
|
+
const FyPolygonComponent = __component__$1.exports;
|
|
4092
|
+
const FyPolygon = FyPolygonComponent;
|
|
4093
|
+
FyPolygon.install = function(Vue) {
|
|
4094
|
+
Vue.component(FyPolygon.name || "FyPolygon", FyPolygon);
|
|
4095
|
+
};
|
|
4096
|
+
const _sfc_main = {
|
|
4097
|
+
name: "FyCircle",
|
|
4098
|
+
props: {
|
|
4099
|
+
// 圆心坐标 [经度, 纬度]
|
|
4100
|
+
coordinates: {
|
|
4101
|
+
type: Array,
|
|
4102
|
+
required: true
|
|
4103
|
+
},
|
|
4104
|
+
// 半径(米)
|
|
4105
|
+
radius: {
|
|
4106
|
+
type: Number,
|
|
4107
|
+
required: true
|
|
4108
|
+
},
|
|
4109
|
+
// 图层ID
|
|
4110
|
+
layerId: {
|
|
4111
|
+
type: String,
|
|
4112
|
+
default: "circle-layer"
|
|
4113
|
+
},
|
|
4114
|
+
// 圆样式
|
|
4115
|
+
symbol: {
|
|
4116
|
+
type: Object,
|
|
4117
|
+
default: () => ({
|
|
4118
|
+
lineColor: "#ff0000",
|
|
4119
|
+
lineWidth: 2,
|
|
4120
|
+
lineOpacity: 0.8,
|
|
4121
|
+
polygonFill: "#ff0000",
|
|
4122
|
+
polygonOpacity: 0.3
|
|
4123
|
+
})
|
|
4124
|
+
},
|
|
4125
|
+
// 透明度
|
|
4126
|
+
opacity: {
|
|
4127
|
+
type: Number,
|
|
4128
|
+
default: 1
|
|
4129
|
+
},
|
|
4130
|
+
// 可见性
|
|
4131
|
+
visible: {
|
|
4132
|
+
type: Boolean,
|
|
4133
|
+
default: true
|
|
4134
|
+
},
|
|
4135
|
+
// 层级
|
|
4136
|
+
zIndex: {
|
|
4137
|
+
type: Number,
|
|
4138
|
+
default: 10
|
|
4139
|
+
},
|
|
4140
|
+
// 圆弧数量(控制圆的平滑度)
|
|
4141
|
+
numberOfPoints: {
|
|
4142
|
+
type: Number,
|
|
4143
|
+
default: 60
|
|
4144
|
+
},
|
|
4145
|
+
// 自定义属性
|
|
4146
|
+
properties: {
|
|
4147
|
+
type: Object,
|
|
4148
|
+
default: () => ({})
|
|
4149
|
+
}
|
|
4150
|
+
},
|
|
4151
|
+
data() {
|
|
4152
|
+
return {
|
|
4153
|
+
layer: null,
|
|
4154
|
+
circle: null
|
|
4155
|
+
};
|
|
4156
|
+
},
|
|
4157
|
+
inject: {
|
|
4158
|
+
mapInstance: {
|
|
4159
|
+
default: null
|
|
4160
|
+
}
|
|
4161
|
+
},
|
|
4162
|
+
mounted() {
|
|
4163
|
+
if (this.mapInstance) {
|
|
4164
|
+
this.initCircle();
|
|
4165
|
+
}
|
|
4166
|
+
},
|
|
4167
|
+
beforeDestroy() {
|
|
4168
|
+
this.removeCircle();
|
|
4169
|
+
},
|
|
4170
|
+
methods: {
|
|
4171
|
+
// 初始化圆
|
|
4172
|
+
initCircle() {
|
|
4173
|
+
if (!this.mapInstance) return;
|
|
4174
|
+
this.layer = this.mapInstance.getLayer(this.layerId);
|
|
4175
|
+
if (!this.layer) {
|
|
4176
|
+
this.layer = new maptalks__namespace.VectorLayer(this.layerId, {
|
|
4177
|
+
zIndex: this.zIndex
|
|
4178
|
+
});
|
|
4179
|
+
this.mapInstance.addLayer(this.layer);
|
|
4180
|
+
}
|
|
4181
|
+
const config = {
|
|
4182
|
+
symbol: this.symbol,
|
|
4183
|
+
visible: this.visible,
|
|
4184
|
+
opacity: this.opacity,
|
|
4185
|
+
properties: this.properties,
|
|
4186
|
+
zIndex: this.zIndex,
|
|
4187
|
+
numberOfPoints: this.numberOfPoints
|
|
4188
|
+
};
|
|
4189
|
+
this.circle = new maptalks__namespace.Circle(this.coordinates, this.radius, config);
|
|
4190
|
+
this.circle.on("click", this.handleClick);
|
|
4191
|
+
this.circle.on("mouseover", this.handleMouseover);
|
|
4192
|
+
this.circle.on("mouseout", this.handleMouseout);
|
|
4193
|
+
this.circle.on("dblclick", this.handleDblClick);
|
|
4194
|
+
this.circle.on("mousedown", this.handleMouseDown);
|
|
4195
|
+
this.circle.on("mouseup", this.handleMouseUp);
|
|
4196
|
+
this.layer.addGeometry(this.circle);
|
|
4197
|
+
this.$emit("ready", this.circle);
|
|
4198
|
+
},
|
|
4199
|
+
// 移除圆
|
|
4200
|
+
removeCircle() {
|
|
4201
|
+
if (this.circle && this.layer) {
|
|
4202
|
+
this.circle.off("click", this.handleClick);
|
|
4203
|
+
this.circle.off("mouseover", this.handleMouseover);
|
|
4204
|
+
this.circle.off("mouseout", this.handleMouseout);
|
|
4205
|
+
this.circle.off("dblclick", this.handleDblClick);
|
|
4206
|
+
this.circle.off("mousedown", this.handleMouseDown);
|
|
4207
|
+
this.circle.off("mouseup", this.handleMouseUp);
|
|
4208
|
+
this.layer.removeGeometry(this.circle);
|
|
4209
|
+
this.circle = null;
|
|
4210
|
+
}
|
|
4211
|
+
},
|
|
4212
|
+
// 事件处理
|
|
4213
|
+
handleClick(e) {
|
|
4214
|
+
this.$emit("click", e);
|
|
4215
|
+
},
|
|
4216
|
+
handleMouseover(e) {
|
|
4217
|
+
this.$emit("mouseover", e);
|
|
4218
|
+
},
|
|
4219
|
+
handleMouseout(e) {
|
|
4220
|
+
this.$emit("mouseout", e);
|
|
4221
|
+
},
|
|
4222
|
+
handleDblClick(e) {
|
|
4223
|
+
this.$emit("dblclick", e);
|
|
4224
|
+
},
|
|
4225
|
+
handleMouseDown(e) {
|
|
4226
|
+
this.$emit("mousedown", e);
|
|
4227
|
+
},
|
|
4228
|
+
handleMouseUp(e) {
|
|
4229
|
+
this.$emit("mouseup", e);
|
|
4230
|
+
},
|
|
4231
|
+
// 设置圆心坐标
|
|
4232
|
+
setCoordinates(coordinates) {
|
|
4233
|
+
if (this.circle) {
|
|
4234
|
+
this.circle.setCoordinates(coordinates);
|
|
4235
|
+
}
|
|
4236
|
+
},
|
|
4237
|
+
// 设置半径
|
|
4238
|
+
setRadius(radius) {
|
|
4239
|
+
if (this.circle) {
|
|
4240
|
+
this.circle.setRadius(radius);
|
|
4241
|
+
}
|
|
4242
|
+
},
|
|
4243
|
+
// 设置样式
|
|
4244
|
+
setSymbol(symbol) {
|
|
4245
|
+
if (this.circle) {
|
|
4246
|
+
this.circle.setSymbol(symbol);
|
|
4247
|
+
}
|
|
4248
|
+
},
|
|
4249
|
+
// 设置透明度
|
|
4250
|
+
setOpacity(opacity) {
|
|
4251
|
+
if (this.circle) {
|
|
4252
|
+
this.circle.setOpacity(opacity);
|
|
4253
|
+
}
|
|
4254
|
+
},
|
|
4255
|
+
// 显示
|
|
4256
|
+
show() {
|
|
4257
|
+
if (this.circle) {
|
|
4258
|
+
this.circle.show();
|
|
4259
|
+
}
|
|
4260
|
+
},
|
|
4261
|
+
// 隐藏
|
|
4262
|
+
hide() {
|
|
4263
|
+
if (this.circle) {
|
|
4264
|
+
this.circle.hide();
|
|
4265
|
+
}
|
|
4266
|
+
},
|
|
4267
|
+
// 获取半径
|
|
4268
|
+
getRadius() {
|
|
4269
|
+
if (this.circle) {
|
|
4270
|
+
return this.circle.getRadius();
|
|
4271
|
+
}
|
|
4272
|
+
return 0;
|
|
4273
|
+
},
|
|
4274
|
+
// 获取面积
|
|
4275
|
+
getArea() {
|
|
4276
|
+
if (this.circle) {
|
|
4277
|
+
return this.circle.getArea();
|
|
4278
|
+
}
|
|
4279
|
+
return 0;
|
|
4280
|
+
},
|
|
4281
|
+
// 获取周长
|
|
4282
|
+
getLength() {
|
|
4283
|
+
if (this.circle) {
|
|
4284
|
+
const radius = this.circle.getRadius();
|
|
4285
|
+
return 2 * Math.PI * radius;
|
|
4286
|
+
}
|
|
4287
|
+
return 0;
|
|
4288
|
+
},
|
|
4289
|
+
// 获取坐标
|
|
4290
|
+
getCoordinates() {
|
|
4291
|
+
if (this.circle) {
|
|
4292
|
+
return this.circle.getCoordinates();
|
|
4293
|
+
}
|
|
4294
|
+
return null;
|
|
4295
|
+
},
|
|
4296
|
+
// 获取中心点
|
|
4297
|
+
getCenter() {
|
|
4298
|
+
if (this.circle) {
|
|
4299
|
+
return this.circle.getCenter();
|
|
4300
|
+
}
|
|
4301
|
+
return null;
|
|
4302
|
+
},
|
|
4303
|
+
// 获取范围
|
|
4304
|
+
getExtent() {
|
|
4305
|
+
if (this.circle) {
|
|
4306
|
+
return this.circle.getExtent();
|
|
4307
|
+
}
|
|
4308
|
+
return null;
|
|
4309
|
+
},
|
|
4310
|
+
// 获取边界
|
|
4311
|
+
getBounds() {
|
|
4312
|
+
if (this.circle) {
|
|
4313
|
+
return this.circle.getBounds();
|
|
4314
|
+
}
|
|
4315
|
+
return null;
|
|
4316
|
+
},
|
|
4317
|
+
// 获取圆实例
|
|
4318
|
+
getCircle() {
|
|
4319
|
+
return this.circle;
|
|
4320
|
+
},
|
|
4321
|
+
// 获取图层实例
|
|
4322
|
+
getLayer() {
|
|
4323
|
+
return this.layer;
|
|
4324
|
+
}
|
|
4325
|
+
},
|
|
4326
|
+
watch: {
|
|
4327
|
+
coordinates(newVal) {
|
|
4328
|
+
this.setCoordinates(newVal);
|
|
4329
|
+
},
|
|
4330
|
+
radius(newVal) {
|
|
4331
|
+
this.setRadius(newVal);
|
|
4332
|
+
},
|
|
4333
|
+
symbol: {
|
|
4334
|
+
handler(newVal) {
|
|
4335
|
+
this.setSymbol(newVal);
|
|
4336
|
+
},
|
|
4337
|
+
deep: true
|
|
4338
|
+
},
|
|
4339
|
+
opacity(newVal) {
|
|
4340
|
+
this.setOpacity(newVal);
|
|
4341
|
+
},
|
|
4342
|
+
visible(newVal) {
|
|
4343
|
+
if (newVal) {
|
|
4344
|
+
this.show();
|
|
4345
|
+
} else {
|
|
4346
|
+
this.hide();
|
|
4347
|
+
}
|
|
4348
|
+
}
|
|
4349
|
+
}
|
|
4350
|
+
};
|
|
4351
|
+
var _sfc_render = function render() {
|
|
4352
|
+
var _vm = this, _c = _vm._self._c;
|
|
4353
|
+
return _c("div", { staticClass: "fy-circle" });
|
|
4354
|
+
};
|
|
4355
|
+
var _sfc_staticRenderFns = [];
|
|
4356
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(
|
|
4357
|
+
_sfc_main,
|
|
4358
|
+
_sfc_render,
|
|
4359
|
+
_sfc_staticRenderFns,
|
|
4360
|
+
false,
|
|
4361
|
+
null,
|
|
4362
|
+
"96938291"
|
|
4363
|
+
);
|
|
4364
|
+
const FyCircleComponent = __component__.exports;
|
|
4365
|
+
const FyCircle = FyCircleComponent;
|
|
4366
|
+
FyCircle.install = function(Vue) {
|
|
4367
|
+
Vue.component(FyCircle.name || "FyCircle", FyCircle);
|
|
4368
|
+
};
|
|
4369
|
+
const components = [
|
|
4370
|
+
MyButton,
|
|
4371
|
+
FyMap,
|
|
4372
|
+
FyTileLayer,
|
|
4373
|
+
FyVectorLayer,
|
|
4374
|
+
FyMarker,
|
|
4375
|
+
FyLabel,
|
|
4376
|
+
FyPopup,
|
|
4377
|
+
FyClusterMarker,
|
|
4378
|
+
FyDrawTool,
|
|
4379
|
+
FyDrawPoint,
|
|
4380
|
+
FyDrawLine,
|
|
4381
|
+
FyDrawPolygon,
|
|
4382
|
+
FyDrawCircle,
|
|
4383
|
+
FyPoint,
|
|
4384
|
+
FyLineString,
|
|
4385
|
+
FyPolygon,
|
|
4386
|
+
FyCircle
|
|
4387
|
+
];
|
|
4388
|
+
const index = {
|
|
4389
|
+
install(Vue) {
|
|
4390
|
+
components.forEach((comp) => {
|
|
4391
|
+
Vue.component(comp.name || comp.__name, comp);
|
|
4392
|
+
});
|
|
4393
|
+
}
|
|
4394
|
+
};
|
|
4395
|
+
exports2.FyCircle = FyCircle;
|
|
4396
|
+
exports2.FyClusterMarker = FyClusterMarker;
|
|
4397
|
+
exports2.FyDrawCircle = FyDrawCircle;
|
|
4398
|
+
exports2.FyDrawLine = FyDrawLine;
|
|
4399
|
+
exports2.FyDrawPoint = FyDrawPoint;
|
|
4400
|
+
exports2.FyDrawPolygon = FyDrawPolygon;
|
|
4401
|
+
exports2.FyDrawTool = FyDrawTool;
|
|
4402
|
+
exports2.FyLabel = FyLabel;
|
|
4403
|
+
exports2.FyLineString = FyLineString;
|
|
4404
|
+
exports2.FyMap = FyMap;
|
|
4405
|
+
exports2.FyMarker = FyMarker;
|
|
4406
|
+
exports2.FyPoint = FyPoint;
|
|
4407
|
+
exports2.FyPolygon = FyPolygon;
|
|
4408
|
+
exports2.FyPopup = FyPopup;
|
|
4409
|
+
exports2.FyTileLayer = FyTileLayer;
|
|
4410
|
+
exports2.FyVectorLayer = FyVectorLayer;
|
|
4411
|
+
exports2.MyButton = MyButton;
|
|
4412
|
+
exports2.default = index;
|
|
4413
|
+
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
4414
|
+
}));
|
|
4415
|
+
//# sourceMappingURL=fy-map.umd.js.map
|