@summeruse/ol 0.2.0-alpha.0 → 0.2.0-alpha.1
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/CHANGELOG.md +8 -0
- package/dist/index.js +689 -816
- package/es/components/index.mjs +3 -0
- package/es/components/ol-map/index.mjs +3 -0
- package/es/components/ol-map/index.vue_vue_type_script_setup_true_lang.mjs +114 -0
- package/es/components/ol-map/index2.mjs +2 -0
- package/es/components/ol-map/props.mjs +5 -8
- package/es/composables/common/index.mjs +4 -6
- package/es/composables/index.mjs +6 -0
- package/es/composables/useContextmenu/index.mjs +70 -76
- package/es/composables/useDrawLineString/index.mjs +104 -112
- package/es/composables/useDrawPolygon/index.mjs +105 -115
- package/es/composables/useGraticule/index.mjs +22 -36
- package/es/composables/usePointermove/index.mjs +100 -99
- package/es/composables/useSwitchBaseLayer/index.mjs +16 -24
- package/es/constants/distance.mjs +2 -4
- package/es/constants/projection.mjs +2 -7
- package/es/index.mjs +19 -76
- package/es/utils/distance/index.mjs +6 -9
- package/es/utils/feature/index.mjs +66 -82
- package/es/utils/index.d.ts +0 -3
- package/es/utils/index.mjs +5 -0
- package/es/utils/layer/index.d.ts +1 -1
- package/es/utils/layer/index.mjs +47 -60
- package/es/utils/projection/index.mjs +15 -24
- package/es/utils/style/index.mjs +27 -31
- package/lib/_virtual/rolldown_runtime.js +1 -0
- package/lib/components/index.js +1 -0
- package/lib/components/ol-map/index.js +1 -0
- package/lib/components/ol-map/index.vue_vue_type_script_setup_true_lang.js +1 -0
- package/lib/components/ol-map/index2.js +1 -0
- package/lib/components/ol-map/props.js +1 -1
- package/lib/composables/common/index.js +1 -1
- package/lib/composables/index.js +1 -0
- package/lib/composables/useContextmenu/index.js +1 -1
- package/lib/composables/useDrawLineString/index.js +1 -1
- package/lib/composables/useDrawPolygon/index.js +1 -1
- package/lib/composables/useGraticule/index.js +1 -1
- package/lib/composables/usePointermove/index.js +1 -1
- package/lib/composables/useSwitchBaseLayer/index.js +1 -1
- package/lib/constants/distance.js +1 -1
- package/lib/constants/projection.js +1 -1
- package/lib/index.js +1 -1
- package/lib/utils/distance/index.js +1 -1
- package/lib/utils/feature/index.js +1 -1
- package/lib/utils/index.d.ts +0 -3
- package/lib/utils/index.js +1 -0
- package/lib/utils/layer/index.d.ts +1 -1
- package/lib/utils/layer/index.js +1 -1
- package/lib/utils/projection/index.js +1 -1
- package/lib/utils/style/index.js +1 -1
- package/package.json +4 -11
- package/es/components/ol-map/index.vue.mjs +0 -124
- package/es/components/ol-map/index.vue2.mjs +0 -4
- package/es/utils/calculate/index.d.ts +0 -24
- package/es/utils/calculate/index.mjs +0 -29
- package/es/utils/calculate/index.test.d.ts +0 -1
- package/es/utils/format/index.d.ts +0 -4
- package/es/utils/format/index.mjs +0 -10
- package/es/utils/realCircle/index.d.ts +0 -9
- package/es/utils/realCircle/index.mjs +0 -10
- package/lib/components/ol-map/index.vue.js +0 -1
- package/lib/components/ol-map/index.vue2.js +0 -1
- package/lib/utils/calculate/index.d.ts +0 -24
- package/lib/utils/calculate/index.js +0 -1
- package/lib/utils/calculate/index.test.d.ts +0 -1
- package/lib/utils/format/index.d.ts +0 -4
- package/lib/utils/format/index.js +0 -1
- package/lib/utils/realCircle/index.d.ts +0 -9
- package/lib/utils/realCircle/index.js +0 -1
package/dist/index.js
CHANGED
|
@@ -1,817 +1,690 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { Circle as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { transform
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
ref_key: "mapRef",
|
|
125
|
-
ref: i
|
|
126
|
-
}, [
|
|
127
|
-
Be(n.$slots, "default", {
|
|
128
|
-
olMap: Ve(r),
|
|
129
|
-
mapRef: i.value
|
|
130
|
-
})
|
|
131
|
-
], 512));
|
|
132
|
-
}
|
|
1
|
+
import { computed, createElementBlock, defineComponent, inject, onBeforeUnmount, onMounted, onUnmounted, openBlock, provide, ref, render, renderSlot, toValue, unref, watch } from "vue";
|
|
2
|
+
import { Feature, Map, Overlay, View } from "ol";
|
|
3
|
+
import { Attribution, FullScreen, OverviewMap, Rotate, ScaleLine, Zoom } from "ol/control";
|
|
4
|
+
import { DoubleClickZoom, DragPan, DragRotate, Draw, KeyboardPan, KeyboardZoom, Modify, MouseWheelZoom, PinchRotate, PinchZoom } from "ol/interaction";
|
|
5
|
+
import { getCenter } from "ol/extent";
|
|
6
|
+
import { Circle, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon } from "ol/geom";
|
|
7
|
+
import VectorLayer from "ol/layer/Vector";
|
|
8
|
+
import VectorSource from "ol/source/Vector";
|
|
9
|
+
import { Circle as Circle$1, Fill, Icon, Stroke, Style, Text } from "ol/style";
|
|
10
|
+
import { Graticule, Tile } from "ol/layer";
|
|
11
|
+
import { BingMaps, OSM, XYZ } from "ol/source";
|
|
12
|
+
import { transform, transformExtent } from "ol/proj";
|
|
13
|
+
const olMapInjectionKey = Symbol("olMapInjectionKey");
|
|
14
|
+
function useOlMap() {
|
|
15
|
+
return inject(olMapInjectionKey);
|
|
16
|
+
}
|
|
17
|
+
var ol_map_default = /* @__PURE__ */ defineComponent({
|
|
18
|
+
__name: "index",
|
|
19
|
+
props: {
|
|
20
|
+
olMap: { default: () => new Map() },
|
|
21
|
+
center: { default: () => [0, 0] },
|
|
22
|
+
zoom: { default: 2 },
|
|
23
|
+
minZoom: { default: 2 },
|
|
24
|
+
maxZoom: { default: 18 },
|
|
25
|
+
constrainResolution: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: !0
|
|
28
|
+
},
|
|
29
|
+
projection: {},
|
|
30
|
+
extent: {},
|
|
31
|
+
showZoom: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: !1
|
|
34
|
+
},
|
|
35
|
+
showAttribution: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: !1
|
|
38
|
+
},
|
|
39
|
+
showRotate: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: !1
|
|
42
|
+
},
|
|
43
|
+
showFullScreen: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: !1
|
|
46
|
+
},
|
|
47
|
+
showOverview: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: !1
|
|
50
|
+
},
|
|
51
|
+
showScale: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: !1
|
|
54
|
+
},
|
|
55
|
+
dragPan: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: !0
|
|
58
|
+
},
|
|
59
|
+
mouseWheelZoom: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: !0
|
|
62
|
+
},
|
|
63
|
+
doubleClickZoom: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: !1
|
|
66
|
+
},
|
|
67
|
+
pinchRotate: { type: Boolean },
|
|
68
|
+
pinchZoom: { type: Boolean },
|
|
69
|
+
altShiftDragRotate: { type: Boolean }
|
|
70
|
+
},
|
|
71
|
+
setup(e, { expose: x }) {
|
|
72
|
+
let S = e, C = ref(), w = S.olMap, T = new View({
|
|
73
|
+
projection: S.projection,
|
|
74
|
+
extent: S.extent
|
|
75
|
+
});
|
|
76
|
+
w.setView(T), watch(() => S.zoom, (e) => {
|
|
77
|
+
T.setZoom(e);
|
|
78
|
+
}, { immediate: !0 }), watch(() => S.center, (e) => {
|
|
79
|
+
T.setCenter(e);
|
|
80
|
+
}, { immediate: !0 }), watch(() => S.constrainResolution, (e) => {
|
|
81
|
+
T.setConstrainResolution(e);
|
|
82
|
+
}, { immediate: !0 }), watch(() => S.minZoom, (e) => {
|
|
83
|
+
e && T.setMinZoom(e);
|
|
84
|
+
}, { immediate: !0 }), watch(() => S.maxZoom, (e) => {
|
|
85
|
+
e && T.setMaxZoom(e);
|
|
86
|
+
}, { immediate: !0 }), watch(C, (e) => {
|
|
87
|
+
e && w.setTarget(e);
|
|
88
|
+
}), x({ olMap: w }), provide(olMapInjectionKey, w);
|
|
89
|
+
let k = w.getControls().getArray(), j = k.find((e) => e instanceof Zoom) || new Zoom(), P = k.find((e) => e instanceof Attribution) || new Attribution(), F = k.find((e) => e instanceof Rotate) || new Rotate(), I = k.find((e) => e instanceof FullScreen) || new FullScreen(), U = k.find((e) => e instanceof OverviewMap) || new OverviewMap(), W = k.find((e) => e instanceof ScaleLine) || new ScaleLine();
|
|
90
|
+
watch(() => S.showZoom, (e) => {
|
|
91
|
+
j.setMap(e ? w : null);
|
|
92
|
+
}, { immediate: !0 }), watch(() => S.showAttribution, (e) => {
|
|
93
|
+
P.setMap(e ? w : null);
|
|
94
|
+
}, { immediate: !0 }), watch(() => S.showRotate, (e) => {
|
|
95
|
+
F.setMap(e ? w : null);
|
|
96
|
+
}, { immediate: !0 }), watch(() => S.showFullScreen, (e) => {
|
|
97
|
+
I.setMap(e ? w : null);
|
|
98
|
+
}, { immediate: !0 }), watch(() => S.showOverview, (e) => {
|
|
99
|
+
U.setMap(e ? w : null);
|
|
100
|
+
}, { immediate: !0 }), watch(() => S.showScale, (e) => {
|
|
101
|
+
W.setMap(e ? w : null);
|
|
102
|
+
}, { immediate: !0 });
|
|
103
|
+
let G = w.getInteractions().getArray(), K = G.find((e) => e instanceof DragPan) || new DragPan(), q = G.find((e) => e instanceof MouseWheelZoom) || new MouseWheelZoom(), J = G.find((e) => e instanceof DoubleClickZoom) || new DoubleClickZoom(), Y = G.find((e) => e instanceof PinchRotate) || new PinchRotate(), X = G.find((e) => e instanceof PinchZoom) || new PinchZoom(), Z = G.find((e) => e instanceof DragRotate) || new DragRotate(), Q = G.find((e) => e instanceof KeyboardPan) || new KeyboardPan(), $ = G.find((e) => e instanceof KeyboardZoom) || new KeyboardZoom();
|
|
104
|
+
return w.removeInteraction(K), w.addInteraction(K), w.removeInteraction(q), w.addInteraction(q), w.removeInteraction(J), w.addInteraction(J), w.removeInteraction(Y), w.addInteraction(Y), w.removeInteraction(X), w.addInteraction(X), w.removeInteraction(Z), w.addInteraction(Z), w.removeInteraction(Q), w.removeInteraction($), watch(() => S.dragPan, (e) => {
|
|
105
|
+
K.setActive(e);
|
|
106
|
+
}, { immediate: !0 }), watch(() => S.mouseWheelZoom, (e) => {
|
|
107
|
+
q.setActive(e);
|
|
108
|
+
}, { immediate: !0 }), watch(() => S.doubleClickZoom, (e) => {
|
|
109
|
+
J.setActive(e);
|
|
110
|
+
}, { immediate: !0 }), watch(() => S.pinchRotate, (e) => {
|
|
111
|
+
Y.setActive(e);
|
|
112
|
+
}, { immediate: !0 }), watch(() => S.pinchZoom, (e) => {
|
|
113
|
+
X.setActive(e);
|
|
114
|
+
}, { immediate: !0 }), watch(() => S.altShiftDragRotate, (e) => {
|
|
115
|
+
Z.setActive(e);
|
|
116
|
+
}, { immediate: !0 }), (e, x) => (openBlock(), createElementBlock("div", {
|
|
117
|
+
ref_key: "mapRef",
|
|
118
|
+
ref: C
|
|
119
|
+
}, [renderSlot(e.$slots, "default", {
|
|
120
|
+
olMap: unref(w),
|
|
121
|
+
mapRef: C.value
|
|
122
|
+
})], 512));
|
|
123
|
+
}
|
|
133
124
|
});
|
|
134
|
-
function
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
function
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
function
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
function
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
273
|
-
function
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
}
|
|
360
|
-
function
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
function
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
o.value = !0;
|
|
701
|
-
}
|
|
702
|
-
function f() {
|
|
703
|
-
if (o.value = !1, r.value = void 0, m && h !== void 0) {
|
|
704
|
-
const l = m.getViewport();
|
|
705
|
-
l.style.cursor = h, h = "";
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
function L(l) {
|
|
709
|
-
if (!l)
|
|
710
|
-
return;
|
|
711
|
-
const v = l.getViewport();
|
|
712
|
-
v.addEventListener("pointermove", u), v.addEventListener("pointerout", f);
|
|
713
|
-
}
|
|
714
|
-
function s(l) {
|
|
715
|
-
if (!l)
|
|
716
|
-
return;
|
|
717
|
-
const v = l.getViewport();
|
|
718
|
-
v.removeEventListener("pointermove", u), v.removeEventListener("pointerout", f);
|
|
719
|
-
}
|
|
720
|
-
return p(
|
|
721
|
-
() => G(t),
|
|
722
|
-
(l, v) => {
|
|
723
|
-
v !== l && (s(v), L(l), m = l);
|
|
724
|
-
},
|
|
725
|
-
{ immediate: !0 }
|
|
726
|
-
), xe(() => {
|
|
727
|
-
s(m);
|
|
728
|
-
}), {
|
|
729
|
-
visible: P(() => o.value),
|
|
730
|
-
position: P(() => y.value),
|
|
731
|
-
originalPosition: P(() => i.value),
|
|
732
|
-
feature: P(() => r.value),
|
|
733
|
-
content: P(() => c.value),
|
|
734
|
-
coordinate: P(() => w.value),
|
|
735
|
-
option: P(() => O.value),
|
|
736
|
-
hide: f
|
|
737
|
-
};
|
|
738
|
-
}
|
|
739
|
-
function yn(t) {
|
|
740
|
-
const e = E(t.defaultLayerName || Object.keys(t.layers)[0]);
|
|
741
|
-
return Object.values(t.layers).forEach((o) => {
|
|
742
|
-
o.forEach((i) => {
|
|
743
|
-
t.olMap.addLayer(i);
|
|
744
|
-
});
|
|
745
|
-
}), p(
|
|
746
|
-
e,
|
|
747
|
-
() => {
|
|
748
|
-
Object.entries(t.layers).forEach(([o, i]) => {
|
|
749
|
-
const r = o === e.value;
|
|
750
|
-
i.forEach((c) => {
|
|
751
|
-
c.setVisible(r);
|
|
752
|
-
});
|
|
753
|
-
});
|
|
754
|
-
},
|
|
755
|
-
{
|
|
756
|
-
immediate: !0
|
|
757
|
-
}
|
|
758
|
-
), { visibleLayerName: e };
|
|
759
|
-
}
|
|
760
|
-
export {
|
|
761
|
-
B as EPSG_3857,
|
|
762
|
-
ln as EPSG_3857ExtentToEPSG_4326,
|
|
763
|
-
rn as EPSG_3857ToEPSG_4326,
|
|
764
|
-
V as EPSG_4326,
|
|
765
|
-
cn as EPSG_4326ExtentToEPSG_3857,
|
|
766
|
-
on as EPSG_4326ToEPSG_3857,
|
|
767
|
-
Ae as ONE_NM,
|
|
768
|
-
Bt as OlMap,
|
|
769
|
-
dt as WGS84Projection,
|
|
770
|
-
be as WebMercatorProjection,
|
|
771
|
-
wt as createCircle,
|
|
772
|
-
Ut as createCircleFeature,
|
|
773
|
-
yt as createCircleStyle,
|
|
774
|
-
M as createFeature,
|
|
775
|
-
vt as createLineString,
|
|
776
|
-
Yt as createLineStringFeature,
|
|
777
|
-
St as createMultiLineString,
|
|
778
|
-
Qt as createMultiLineStringFeature,
|
|
779
|
-
pt as createMultiPoint,
|
|
780
|
-
Ht as createMultiPointFeature,
|
|
781
|
-
ht as createMultiPolygon,
|
|
782
|
-
qt as createMultiPolygonFeature,
|
|
783
|
-
mt as createPoint,
|
|
784
|
-
Xt as createPointFeature,
|
|
785
|
-
gt as createPolygon,
|
|
786
|
-
Kt as createPolygonFeature,
|
|
787
|
-
T as createStyle,
|
|
788
|
-
W as createTextStyle,
|
|
789
|
-
nn as createVectorLayer,
|
|
790
|
-
Wt as getAngle,
|
|
791
|
-
Dt as getArea,
|
|
792
|
-
en as getBingLayer,
|
|
793
|
-
ft as getCenter,
|
|
794
|
-
ut as getDestinationPoint,
|
|
795
|
-
ke as getExtentCenter,
|
|
796
|
-
jt as getLineLength,
|
|
797
|
-
tn as getOSMLayer,
|
|
798
|
-
an as getRealCircleCoordinates,
|
|
799
|
-
Jt as getTianDiTuLayer,
|
|
800
|
-
Et as getTianDiTuUrl,
|
|
801
|
-
Nt as kmToNauticalMiles,
|
|
802
|
-
re as mercatorExtentToWgs84,
|
|
803
|
-
bt as mercatorToWgs84,
|
|
804
|
-
$t as nauticalMilesToKm,
|
|
805
|
-
Te as olMapInjectionKey,
|
|
806
|
-
Q as toOlAngle,
|
|
807
|
-
q as toTurfAngle,
|
|
808
|
-
Vt as useContextmenu,
|
|
809
|
-
sn as useDrawLineString,
|
|
810
|
-
un as useDrawPolygon,
|
|
811
|
-
fn as useGraticule,
|
|
812
|
-
_t as useOlMap,
|
|
813
|
-
dn as usePointermove,
|
|
814
|
-
yn as useSwitchBaseLayer,
|
|
815
|
-
xt as wgs84ExtentToMercator,
|
|
816
|
-
oe as wgs84ToMercator
|
|
817
|
-
};
|
|
125
|
+
function useContextmenu(b, x) {
|
|
126
|
+
let S = ref(!1), w = ref({
|
|
127
|
+
x: 0,
|
|
128
|
+
y: 0
|
|
129
|
+
}), T = ref(), E = ref([]), D = ref(), k;
|
|
130
|
+
function A(e, b) {
|
|
131
|
+
let x = [];
|
|
132
|
+
return e.filter((e) => {
|
|
133
|
+
let x = e.visible;
|
|
134
|
+
return typeof x == "function" ? x(b) : x ?? !0;
|
|
135
|
+
}).filter((e) => !e.children || e.children.length > 0).sort((e, b) => (e.order ?? 0) - (b.order ?? 0)).forEach((e) => {
|
|
136
|
+
let S = e.icon, C = e.label;
|
|
137
|
+
x.push({
|
|
138
|
+
...e,
|
|
139
|
+
children: e.children ? A(e.children, b) : void 0,
|
|
140
|
+
visible: !0,
|
|
141
|
+
action: () => {
|
|
142
|
+
e.action?.(b), P();
|
|
143
|
+
},
|
|
144
|
+
icon: typeof S == "function" ? () => S(b) : S,
|
|
145
|
+
label: typeof C == "function" ? () => C(b) : C,
|
|
146
|
+
disabled: typeof e.disabled == "function" ? e.disabled(b) : e.disabled ?? !1
|
|
147
|
+
});
|
|
148
|
+
}), x;
|
|
149
|
+
}
|
|
150
|
+
function M(e) {
|
|
151
|
+
if (e.preventDefault(), !k) return;
|
|
152
|
+
let b = k.getEventCoordinate(e);
|
|
153
|
+
D.value = b;
|
|
154
|
+
let C = k.getEventPixel(e), O, M;
|
|
155
|
+
k.forEachFeatureAtPixel(C, (e, b) => (O = e, M = b, !0)), T.value = O;
|
|
156
|
+
let [N, P] = [e.clientX, e.clientY];
|
|
157
|
+
w.value = {
|
|
158
|
+
x: N,
|
|
159
|
+
y: P
|
|
160
|
+
}, E.value = A(toValue(x), {
|
|
161
|
+
map: k,
|
|
162
|
+
position: { ...w.value },
|
|
163
|
+
coordinate: b,
|
|
164
|
+
feature: O,
|
|
165
|
+
layer: M
|
|
166
|
+
}), S.value = !0;
|
|
167
|
+
}
|
|
168
|
+
function P() {
|
|
169
|
+
S.value = !1;
|
|
170
|
+
}
|
|
171
|
+
function F(e) {
|
|
172
|
+
if (!e) return;
|
|
173
|
+
let b = e.getViewport();
|
|
174
|
+
b.addEventListener("contextmenu", M), b.addEventListener("click", P);
|
|
175
|
+
}
|
|
176
|
+
function I(e) {
|
|
177
|
+
if (!e) return;
|
|
178
|
+
let b = e.getViewport();
|
|
179
|
+
b.removeEventListener("contextmenu", M), b.removeEventListener("click", P);
|
|
180
|
+
}
|
|
181
|
+
return watch(() => toValue(b), (e, b) => {
|
|
182
|
+
b !== e && (I(b), F(e), k = e);
|
|
183
|
+
}, { immediate: !0 }), onBeforeUnmount(() => {
|
|
184
|
+
I(k);
|
|
185
|
+
}), {
|
|
186
|
+
visible: computed(() => S.value),
|
|
187
|
+
position: computed(() => w.value),
|
|
188
|
+
feature: computed(() => T.value),
|
|
189
|
+
options: computed(() => E.value),
|
|
190
|
+
coordinate: computed(() => D.value),
|
|
191
|
+
hide: P
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
const ONE_NM = 1852, EPSG_3857 = "EPSG:3857", EPSG_4326 = "EPSG:4326", WebMercatorProjection = EPSG_3857, WGS84Projection = EPSG_4326;
|
|
195
|
+
function kmToNauticalMiles(e) {
|
|
196
|
+
return e * 1e3 / ONE_NM;
|
|
197
|
+
}
|
|
198
|
+
function nauticalMilesToKm(e) {
|
|
199
|
+
return e * ONE_NM / 1e3;
|
|
200
|
+
}
|
|
201
|
+
function createCircleStyle(e) {
|
|
202
|
+
let { fillOptions: b, strokeOptions: x,...S } = e;
|
|
203
|
+
return new Circle$1({
|
|
204
|
+
...S,
|
|
205
|
+
fill: b ? new Fill(b) : void 0,
|
|
206
|
+
stroke: x ? new Stroke(x) : void 0
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
function createTextStyle(e) {
|
|
210
|
+
let { fillOptions: b, strokeOptions: x, backgroundFillOptions: S, backgroundStrokeOptions: C,...w } = e;
|
|
211
|
+
return new Text({
|
|
212
|
+
...w,
|
|
213
|
+
fill: b ? new Fill(b) : void 0,
|
|
214
|
+
stroke: x ? new Stroke(x) : void 0,
|
|
215
|
+
backgroundFill: S ? new Fill(S) : void 0,
|
|
216
|
+
backgroundStroke: C ? new Stroke(C) : void 0
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
function createStyle(e) {
|
|
220
|
+
let { fillOptions: b, strokeOptions: x, iconOptions: S, circleOptions: C, textOptions: w,...T } = e, E = b ? new Fill(b) : void 0, D = x ? new Stroke(x) : void 0, O = S ? new Icon(S) : void 0, k = C ? createCircleStyle(C) : void 0, A = w ? createTextStyle(w) : void 0;
|
|
221
|
+
return new Style({
|
|
222
|
+
...T,
|
|
223
|
+
fill: E,
|
|
224
|
+
stroke: D,
|
|
225
|
+
image: O || k,
|
|
226
|
+
text: A
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
function createPoint(e) {
|
|
230
|
+
return new Point(e);
|
|
231
|
+
}
|
|
232
|
+
function createLineString(e) {
|
|
233
|
+
return new LineString(e);
|
|
234
|
+
}
|
|
235
|
+
function createPolygon(e) {
|
|
236
|
+
return new Polygon(e);
|
|
237
|
+
}
|
|
238
|
+
function createCircle(e, b) {
|
|
239
|
+
return new Circle(e, b);
|
|
240
|
+
}
|
|
241
|
+
function createMultiPoint(e) {
|
|
242
|
+
return new MultiPoint(e);
|
|
243
|
+
}
|
|
244
|
+
function createMultiLineString(e) {
|
|
245
|
+
return new MultiLineString(e);
|
|
246
|
+
}
|
|
247
|
+
function createMultiPolygon(e) {
|
|
248
|
+
return new MultiPolygon(e);
|
|
249
|
+
}
|
|
250
|
+
function createFeature(e) {
|
|
251
|
+
let { styleOptions: b, style: x, geometry: S,...C } = e ?? {}, w = b ? createStyle(b) : x, T = new Feature({
|
|
252
|
+
geometry: S,
|
|
253
|
+
...C
|
|
254
|
+
});
|
|
255
|
+
return T.setStyle(w), T;
|
|
256
|
+
}
|
|
257
|
+
function createPointFeature(e, b) {
|
|
258
|
+
let x = createPoint(e);
|
|
259
|
+
return createFeature({
|
|
260
|
+
...b,
|
|
261
|
+
geometry: x
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
function createLineStringFeature(e, b) {
|
|
265
|
+
let x = createLineString(e);
|
|
266
|
+
return createFeature({
|
|
267
|
+
...b,
|
|
268
|
+
geometry: x
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
function createPolygonFeature(e, b) {
|
|
272
|
+
let x = createPolygon(e);
|
|
273
|
+
return createFeature({
|
|
274
|
+
...b,
|
|
275
|
+
geometry: x
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
function createCircleFeature(e, b, x) {
|
|
279
|
+
let S = createCircle(e, b);
|
|
280
|
+
return createFeature({
|
|
281
|
+
...x,
|
|
282
|
+
geometry: S
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
function createMultiPointFeature(e, b) {
|
|
286
|
+
let x = createMultiPoint(e);
|
|
287
|
+
return createFeature({
|
|
288
|
+
...b,
|
|
289
|
+
geometry: x
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
function createMultiLineStringFeature(e, b) {
|
|
293
|
+
let x = createMultiLineString(e);
|
|
294
|
+
return createFeature({
|
|
295
|
+
...b,
|
|
296
|
+
geometry: x
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
function createMultiPolygonFeature(e, b) {
|
|
300
|
+
let x = createMultiPolygon(e);
|
|
301
|
+
return createFeature({
|
|
302
|
+
...b,
|
|
303
|
+
geometry: x
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
function getTianDiTuUrl(e) {
|
|
307
|
+
let { type: b = "img", projection: x = WebMercatorProjection, key: S } = e, C = e.url || "https://t{0-4}.tianditu.gov.cn", w = `&tk=${S}&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}`;
|
|
308
|
+
return `${C}/${b}_${x === "EPSG:4326" ? "c" : x === "EPSG:3857" ? "w" : "c"}/wmts?LAYER=${b}${w}`;
|
|
309
|
+
}
|
|
310
|
+
function getTianDiTuLayer(e) {
|
|
311
|
+
let { zIndex: b, projection: x, className: S } = e;
|
|
312
|
+
return new Tile({
|
|
313
|
+
className: S,
|
|
314
|
+
source: new XYZ({
|
|
315
|
+
url: getTianDiTuUrl(e),
|
|
316
|
+
projection: x,
|
|
317
|
+
crossOrigin: "Anonymous"
|
|
318
|
+
}),
|
|
319
|
+
zIndex: b
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
function getBingLayer({ name: e, zIndex: b, key: x, className: S }) {
|
|
323
|
+
return new Tile({
|
|
324
|
+
className: S,
|
|
325
|
+
source: new BingMaps({
|
|
326
|
+
key: x,
|
|
327
|
+
imagerySet: e,
|
|
328
|
+
placeholderTiles: !1
|
|
329
|
+
}),
|
|
330
|
+
zIndex: b
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
function getOSMLayer(e) {
|
|
334
|
+
return new Tile({
|
|
335
|
+
className: e?.className,
|
|
336
|
+
source: new OSM({ crossOrigin: "Anonymous" }),
|
|
337
|
+
zIndex: e?.zIndex
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
function createVectorLayer(e) {
|
|
341
|
+
let { styleOptions: b,...x } = e || {}, S = b ? createStyle(b) : void 0, C = new VectorSource();
|
|
342
|
+
return {
|
|
343
|
+
source: C,
|
|
344
|
+
layer: new VectorLayer({
|
|
345
|
+
source: C,
|
|
346
|
+
...x,
|
|
347
|
+
style: S || x.style
|
|
348
|
+
})
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
function wgs84ToMercator(e) {
|
|
352
|
+
return transform(e, EPSG_4326, EPSG_3857);
|
|
353
|
+
}
|
|
354
|
+
const EPSG_4326ToEPSG_3857 = wgs84ToMercator;
|
|
355
|
+
function mercatorToWgs84(e) {
|
|
356
|
+
return transform(e, EPSG_3857, EPSG_4326);
|
|
357
|
+
}
|
|
358
|
+
const EPSG_3857ToEPSG_4326 = mercatorToWgs84;
|
|
359
|
+
function wgs84ExtentToMercator(e) {
|
|
360
|
+
return transformExtent(e, EPSG_4326, EPSG_3857);
|
|
361
|
+
}
|
|
362
|
+
const EPSG_4326ExtentToEPSG_3857 = wgs84ExtentToMercator;
|
|
363
|
+
function mercatorExtentToWgs84(e) {
|
|
364
|
+
return transformExtent(e, EPSG_3857, EPSG_4326);
|
|
365
|
+
}
|
|
366
|
+
const EPSG_3857ExtentToEPSG_4326 = mercatorExtentToWgs84;
|
|
367
|
+
function createToolTipElement(e) {
|
|
368
|
+
let b = document.createElement("div");
|
|
369
|
+
return b.innerHTML = e, b.style.cursor = "pointer", b.style.userSelect = "none", b.style.backgroundColor = "red", b.style.color = "white", b.style.borderRadius = "5px", b.style.padding = "0 5px", b.style.fontSize = "12px", b.style.border = "2px solid white", b;
|
|
370
|
+
}
|
|
371
|
+
function useDrawLineString(b, x) {
|
|
372
|
+
let S = ref(!0), C = ref([]), E = computed(() => C.value.map((e) => e.getGeometry().getCoordinates())), D = new VectorSource(), A = x.styleOptions ? createStyle(x.styleOptions) : x?.style, j = new VectorLayer({
|
|
373
|
+
source: D,
|
|
374
|
+
style: A,
|
|
375
|
+
zIndex: x?.zIndex
|
|
376
|
+
});
|
|
377
|
+
b.addLayer(j);
|
|
378
|
+
let M = new Draw({
|
|
379
|
+
source: D,
|
|
380
|
+
style: (x.drawStyleOptions ? createStyle(x.drawStyleOptions) : x?.drawStyle) || A,
|
|
381
|
+
type: "LineString"
|
|
382
|
+
});
|
|
383
|
+
M.setActive(!1);
|
|
384
|
+
let N = new Modify({
|
|
385
|
+
source: D,
|
|
386
|
+
style: (x.modifyStyleOptions ? createStyle(x.modifyStyleOptions) : x?.modifyStyle) || A
|
|
387
|
+
}), F = /* @__PURE__ */ new Set();
|
|
388
|
+
b.addInteraction(M), onMounted(() => {
|
|
389
|
+
b.addInteraction(N);
|
|
390
|
+
}), D.on("addfeature", () => {
|
|
391
|
+
x.size && D.getFeatures().length >= x.size && M.setActive(!1);
|
|
392
|
+
}), D.on("removefeature", () => {
|
|
393
|
+
x.size && D.getFeatures().length < x.size && M.setActive(!0);
|
|
394
|
+
});
|
|
395
|
+
let L = () => {
|
|
396
|
+
F.forEach((e) => {
|
|
397
|
+
b.removeOverlay(e);
|
|
398
|
+
}), F.clear();
|
|
399
|
+
};
|
|
400
|
+
D.on("change", () => {
|
|
401
|
+
L(), D.getFeatures().forEach((e) => {
|
|
402
|
+
let S = e.getGeometry();
|
|
403
|
+
S.getCoordinates();
|
|
404
|
+
let C = getCenter(S.getExtent()), w = document.createElement("div");
|
|
405
|
+
x.deleteFeatureLabel ? render(x.deleteFeatureLabel, w) : w = createToolTipElement("删除线"), w.addEventListener("click", () => {
|
|
406
|
+
D.removeFeature(e);
|
|
407
|
+
});
|
|
408
|
+
let T = new Overlay({
|
|
409
|
+
position: C,
|
|
410
|
+
positioning: "center-center",
|
|
411
|
+
element: w
|
|
412
|
+
});
|
|
413
|
+
F.add(T), b.addOverlay(T);
|
|
414
|
+
let E = S.getCoordinates();
|
|
415
|
+
E.length < 3 || E.forEach((S, C) => {
|
|
416
|
+
let w = document.createElement("div");
|
|
417
|
+
x.deletePointLabel ? render(x.deletePointLabel, w) : w = createToolTipElement("删除点"), w.addEventListener("click", () => {
|
|
418
|
+
e.setGeometry(new LineString(E.filter((e, b) => b !== C)));
|
|
419
|
+
});
|
|
420
|
+
let T = new Overlay({
|
|
421
|
+
position: S,
|
|
422
|
+
positioning: "top-center",
|
|
423
|
+
offset: [0, -30],
|
|
424
|
+
element: w
|
|
425
|
+
});
|
|
426
|
+
F.add(T), b.addOverlay(T);
|
|
427
|
+
});
|
|
428
|
+
});
|
|
429
|
+
}), M.on("change:active", () => {
|
|
430
|
+
S.value = M.getActive();
|
|
431
|
+
}), D.on("change", () => {
|
|
432
|
+
C.value = D.getFeatures();
|
|
433
|
+
});
|
|
434
|
+
let R = () => {
|
|
435
|
+
L(), b.removeLayer(j), b.removeInteraction(M), b.removeInteraction(N);
|
|
436
|
+
}, z = () => {
|
|
437
|
+
x.size && C.value.length >= x.size || M.setActive(!0);
|
|
438
|
+
}, B = () => {
|
|
439
|
+
M.setActive(!1);
|
|
440
|
+
}, V = (e) => {
|
|
441
|
+
D.clear(), e.forEach((e) => {
|
|
442
|
+
if (e.length < 2) return;
|
|
443
|
+
let b = new Feature({ geometry: new LineString(e) });
|
|
444
|
+
D.addFeature(b);
|
|
445
|
+
});
|
|
446
|
+
}, H = () => {
|
|
447
|
+
V(x.defaultCoordinates || []);
|
|
448
|
+
};
|
|
449
|
+
return H(), onUnmounted(() => {
|
|
450
|
+
R();
|
|
451
|
+
}), {
|
|
452
|
+
inDraw: S,
|
|
453
|
+
start: z,
|
|
454
|
+
stop: B,
|
|
455
|
+
clear: () => {
|
|
456
|
+
D.clear(), B();
|
|
457
|
+
},
|
|
458
|
+
setFeatures: V,
|
|
459
|
+
reset: H,
|
|
460
|
+
features: C,
|
|
461
|
+
coordinates: E,
|
|
462
|
+
destroy: R
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
function useDrawPolygon(b, x) {
|
|
466
|
+
let S = ref(!0), C = ref([]), E = computed(() => C.value.map((e) => e.getGeometry().getCoordinates())), D = x.styleOptions ? createStyle(x.styleOptions) : x?.style, A = new VectorSource(), j = new VectorLayer({
|
|
467
|
+
source: A,
|
|
468
|
+
style: D,
|
|
469
|
+
zIndex: x?.zIndex
|
|
470
|
+
});
|
|
471
|
+
b.addLayer(j);
|
|
472
|
+
let M = new Draw({
|
|
473
|
+
source: A,
|
|
474
|
+
style: (x.drawStyleOptions ? createStyle(x.drawStyleOptions) : x?.drawStyle) || D,
|
|
475
|
+
type: "Polygon"
|
|
476
|
+
});
|
|
477
|
+
M.setActive(!1);
|
|
478
|
+
let N = new Modify({
|
|
479
|
+
source: A,
|
|
480
|
+
style: (x.modifyStyleOptions ? createStyle(x.modifyStyleOptions) : x?.modifyStyle) || D
|
|
481
|
+
}), F = /* @__PURE__ */ new Set();
|
|
482
|
+
b.addInteraction(M), onMounted(() => {
|
|
483
|
+
b.addInteraction(N);
|
|
484
|
+
}), A.on("addfeature", () => {
|
|
485
|
+
x.size && A.getFeatures().length >= x.size && M.setActive(!1);
|
|
486
|
+
}), A.on("removefeature", () => {
|
|
487
|
+
x.size && A.getFeatures().length < x.size && M.setActive(!0);
|
|
488
|
+
});
|
|
489
|
+
let L = () => {
|
|
490
|
+
F.forEach((e) => {
|
|
491
|
+
b.removeOverlay(e);
|
|
492
|
+
}), F.clear();
|
|
493
|
+
};
|
|
494
|
+
A.on("change", () => {
|
|
495
|
+
L(), A.getFeatures().forEach((e) => {
|
|
496
|
+
let S = e.getGeometry(), C = getCenter(S.getExtent()), w = document.createElement("div");
|
|
497
|
+
x.deleteFeatureLabel ? render(x.deleteFeatureLabel, w) : w = createToolTipElement("删除区域"), w.addEventListener("click", () => {
|
|
498
|
+
A.removeFeature(e);
|
|
499
|
+
});
|
|
500
|
+
let T = new Overlay({
|
|
501
|
+
position: C,
|
|
502
|
+
positioning: "center-center",
|
|
503
|
+
element: w
|
|
504
|
+
});
|
|
505
|
+
F.add(T), b.addOverlay(T);
|
|
506
|
+
let E = S.getCoordinates()[0];
|
|
507
|
+
E.length < 3 || E.forEach((S, C) => {
|
|
508
|
+
let w = document.createElement("div");
|
|
509
|
+
x.deletePointLabel ? render(x.deletePointLabel, w) : w = createToolTipElement("删除点"), w.addEventListener("click", () => {
|
|
510
|
+
e.setGeometry(new Polygon([E.filter((e, b) => b !== C)]));
|
|
511
|
+
});
|
|
512
|
+
let T = new Overlay({
|
|
513
|
+
position: S,
|
|
514
|
+
positioning: "top-center",
|
|
515
|
+
offset: [0, -30],
|
|
516
|
+
element: w
|
|
517
|
+
});
|
|
518
|
+
F.add(T), b.addOverlay(T);
|
|
519
|
+
});
|
|
520
|
+
});
|
|
521
|
+
}), M.on("change:active", () => {
|
|
522
|
+
S.value = M.getActive();
|
|
523
|
+
}), A.on("change", () => {
|
|
524
|
+
C.value = A.getFeatures();
|
|
525
|
+
});
|
|
526
|
+
let R = () => {
|
|
527
|
+
L(), b.removeLayer(j), b.removeInteraction(M), b.removeInteraction(N);
|
|
528
|
+
}, z = () => {
|
|
529
|
+
x.size && C.value.length >= x.size || M.setActive(!0);
|
|
530
|
+
}, B = () => {
|
|
531
|
+
M.setActive(!1);
|
|
532
|
+
}, V = (e) => {
|
|
533
|
+
A.clear(), e?.forEach((e) => {
|
|
534
|
+
e.forEach((e) => {
|
|
535
|
+
if (e.length < 2) return;
|
|
536
|
+
e[0] !== e[e.length - 1] && e.push(e[0]);
|
|
537
|
+
let b = new Feature({ geometry: new Polygon([e]) });
|
|
538
|
+
A.addFeature(b);
|
|
539
|
+
});
|
|
540
|
+
});
|
|
541
|
+
}, H = () => {
|
|
542
|
+
V(x.defaultCoordinates);
|
|
543
|
+
};
|
|
544
|
+
return H(), onUnmounted(() => {
|
|
545
|
+
R();
|
|
546
|
+
}), {
|
|
547
|
+
inDraw: S,
|
|
548
|
+
start: z,
|
|
549
|
+
stop: B,
|
|
550
|
+
clear: () => {
|
|
551
|
+
A.clear(), B();
|
|
552
|
+
},
|
|
553
|
+
setFeatures: V,
|
|
554
|
+
reset: H,
|
|
555
|
+
features: C,
|
|
556
|
+
coordinates: E,
|
|
557
|
+
destroy: R
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
function useGraticule(e) {
|
|
561
|
+
let b = ref(e.defaultShow || !1), { strokeStyleOption: x, strokeStyle: S, labelStyleOption: C, latLabelStyleOption: w, lonLabelStyleOption: T, latLabelStyle: E, lonLabelStyle: D,...k } = e.graticuleOptions || {}, A = x ? new Stroke(x) : S, M = C ? createTextStyle(C) : void 0, P = (w ? createTextStyle(w) : E) || M, F = (T ? createTextStyle(T) : D) || M, I = new Graticule({
|
|
562
|
+
...k,
|
|
563
|
+
strokeStyle: A,
|
|
564
|
+
latLabelStyle: P,
|
|
565
|
+
lonLabelStyle: F
|
|
566
|
+
});
|
|
567
|
+
return watch(b, (b) => {
|
|
568
|
+
if (I.setMap(null), b) {
|
|
569
|
+
let b = toValue(e.olMap);
|
|
570
|
+
b && I.setMap(b);
|
|
571
|
+
}
|
|
572
|
+
}, {
|
|
573
|
+
immediate: !0,
|
|
574
|
+
deep: !0
|
|
575
|
+
}), { showGraticule: b };
|
|
576
|
+
}
|
|
577
|
+
function usePointermove(b, x) {
|
|
578
|
+
let S = ref(!1), w = ref({
|
|
579
|
+
x: 0,
|
|
580
|
+
y: 0
|
|
581
|
+
}), T = ref(), E = ref(), D = ref({
|
|
582
|
+
x: 0,
|
|
583
|
+
y: 0
|
|
584
|
+
}), k = ref(), A = ref(), M = computed(() => ({
|
|
585
|
+
x: w.value.x + D.value.x,
|
|
586
|
+
y: w.value.y + D.value.y
|
|
587
|
+
})), P, F = "";
|
|
588
|
+
function I(e) {
|
|
589
|
+
let b = toValue(x).filter((b) => {
|
|
590
|
+
let x = b.visible;
|
|
591
|
+
return typeof x == "function" ? x(e) : x ?? !0;
|
|
592
|
+
});
|
|
593
|
+
return b.length === 0 ? null : b.sort((e, b) => (b.priority ?? 0) - (e.priority ?? 0))[0];
|
|
594
|
+
}
|
|
595
|
+
function L(e) {
|
|
596
|
+
if (!P) return;
|
|
597
|
+
let b = P.getEventCoordinate(e);
|
|
598
|
+
k.value = b;
|
|
599
|
+
let x = P.getEventPixel(e), C, O;
|
|
600
|
+
if (P.forEachFeatureAtPixel(x, (e, b) => (C = e, O = b, !0)), !C) {
|
|
601
|
+
R();
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
T.value = C;
|
|
605
|
+
let j = {
|
|
606
|
+
map: P,
|
|
607
|
+
position: {
|
|
608
|
+
x: e.clientX,
|
|
609
|
+
y: e.clientY
|
|
610
|
+
},
|
|
611
|
+
coordinate: b,
|
|
612
|
+
feature: C,
|
|
613
|
+
layer: O
|
|
614
|
+
}, M = I(j);
|
|
615
|
+
if (M) {
|
|
616
|
+
let { content: e, cursor: b, visible: x, fixedFeatureCenter: S, offset: C, priority: w,...T } = M;
|
|
617
|
+
A.value = { ...T };
|
|
618
|
+
}
|
|
619
|
+
if (!M) {
|
|
620
|
+
R();
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
D.value = {
|
|
624
|
+
x: M.offset?.x ?? 0,
|
|
625
|
+
y: M.offset?.y ?? 0
|
|
626
|
+
};
|
|
627
|
+
let N = M.fixedFeatureCenter ?? !0, L = C.getGeometry();
|
|
628
|
+
if (N && L) {
|
|
629
|
+
let e = getCenter(L.getExtent()), b = P.getPixelFromCoordinate(e), { top: x, left: S } = P.getViewport().getBoundingClientRect();
|
|
630
|
+
w.value.x = b[0] + S, w.value.y = b[1] + x;
|
|
631
|
+
} else w.value = {
|
|
632
|
+
x: e.clientX,
|
|
633
|
+
y: e.clientY
|
|
634
|
+
};
|
|
635
|
+
let z = M.content;
|
|
636
|
+
E.value = typeof z == "function" ? () => z(j) : z;
|
|
637
|
+
let B = M.cursor, V = typeof B == "function" ? B(j) : B;
|
|
638
|
+
if (V && P) {
|
|
639
|
+
let e = P.getViewport();
|
|
640
|
+
F ||= e.style.cursor, e.style.cursor = V;
|
|
641
|
+
}
|
|
642
|
+
S.value = !0;
|
|
643
|
+
}
|
|
644
|
+
function R() {
|
|
645
|
+
if (S.value = !1, T.value = void 0, P && F !== void 0) {
|
|
646
|
+
let e = P.getViewport();
|
|
647
|
+
e.style.cursor = F, F = "";
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
function z(e) {
|
|
651
|
+
if (!e) return;
|
|
652
|
+
let b = e.getViewport();
|
|
653
|
+
b.addEventListener("pointermove", L), b.addEventListener("pointerout", R);
|
|
654
|
+
}
|
|
655
|
+
function B(e) {
|
|
656
|
+
if (!e) return;
|
|
657
|
+
let b = e.getViewport();
|
|
658
|
+
b.removeEventListener("pointermove", L), b.removeEventListener("pointerout", R);
|
|
659
|
+
}
|
|
660
|
+
return watch(() => toValue(b), (e, b) => {
|
|
661
|
+
b !== e && (B(b), z(e), P = e);
|
|
662
|
+
}, { immediate: !0 }), onBeforeUnmount(() => {
|
|
663
|
+
B(P);
|
|
664
|
+
}), {
|
|
665
|
+
visible: computed(() => S.value),
|
|
666
|
+
position: computed(() => M.value),
|
|
667
|
+
originalPosition: computed(() => w.value),
|
|
668
|
+
feature: computed(() => T.value),
|
|
669
|
+
content: computed(() => E.value),
|
|
670
|
+
coordinate: computed(() => k.value),
|
|
671
|
+
option: computed(() => A.value),
|
|
672
|
+
hide: R
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
function useSwitchBaseLayer(e) {
|
|
676
|
+
let b = ref(e.defaultLayerName || Object.keys(e.layers)[0]);
|
|
677
|
+
return Object.values(e.layers).forEach((b) => {
|
|
678
|
+
b.forEach((b) => {
|
|
679
|
+
e.olMap.addLayer(b);
|
|
680
|
+
});
|
|
681
|
+
}), watch(b, () => {
|
|
682
|
+
Object.entries(e.layers).forEach(([e, x]) => {
|
|
683
|
+
let S = e === b.value;
|
|
684
|
+
x.forEach((e) => {
|
|
685
|
+
e.setVisible(S);
|
|
686
|
+
});
|
|
687
|
+
});
|
|
688
|
+
}, { immediate: !0 }), { visibleLayerName: b };
|
|
689
|
+
}
|
|
690
|
+
export { EPSG_3857, EPSG_3857ExtentToEPSG_4326, EPSG_3857ToEPSG_4326, EPSG_4326, EPSG_4326ExtentToEPSG_3857, EPSG_4326ToEPSG_3857, ONE_NM, ol_map_default as OlMap, WGS84Projection, WebMercatorProjection, createCircle, createCircleFeature, createCircleStyle, createFeature, createLineString, createLineStringFeature, createMultiLineString, createMultiLineStringFeature, createMultiPoint, createMultiPointFeature, createMultiPolygon, createMultiPolygonFeature, createPoint, createPointFeature, createPolygon, createPolygonFeature, createStyle, createTextStyle, createVectorLayer, getBingLayer, getOSMLayer, getTianDiTuLayer, getTianDiTuUrl, kmToNauticalMiles, mercatorExtentToWgs84, mercatorToWgs84, nauticalMilesToKm, olMapInjectionKey, useContextmenu, useDrawLineString, useDrawPolygon, useGraticule, useOlMap, usePointermove, useSwitchBaseLayer, wgs84ExtentToMercator, wgs84ToMercator };
|