@summeruse/ol 0.2.0-alpha.2 → 0.2.0-alpha.3

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/dist/index.js CHANGED
@@ -68,632 +68,662 @@ var ol_map_default = /* @__PURE__ */ defineComponent({
68
68
  pinchZoom: { type: Boolean },
69
69
  altShiftDragRotate: { type: Boolean }
70
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
71
+ emits: [
72
+ "update:zoom",
73
+ "update:center",
74
+ "changeResolution",
75
+ "changeCenter",
76
+ "moveend",
77
+ "movestart"
78
+ ],
79
+ setup(a, { expose: d, emit: f }) {
80
+ let p = a, y = f, x = ref(), w = p.olMap, T = new View({
81
+ projection: p.projection,
82
+ extent: p.extent
75
83
  });
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);
84
+ w.setView(T), T.setZoom(p.zoom), T.setCenter(p.center), watch(() => p.constrainResolution, (a) => {
85
+ T.setConstrainResolution(a);
86
+ }, { immediate: !0 }), watch(() => p.minZoom, (a) => {
87
+ a && T.setMinZoom(a);
88
+ }, { immediate: !0 }), watch(() => p.maxZoom, (a) => {
89
+ a && T.setMaxZoom(a);
90
+ }, { immediate: !0 }), watch(x, (a) => {
91
+ a && w.setTarget(a);
92
+ }), d({ olMap: w }), provide(olMapInjectionKey, w);
93
+ let E = w.getControls().getArray(), F = E.find((a) => a instanceof Zoom) || new Zoom(), I = E.find((a) => a instanceof Attribution) || new Attribution(), L = E.find((a) => a instanceof Rotate) || new Rotate(), R = E.find((a) => a instanceof FullScreen) || new FullScreen(), z = E.find((a) => a instanceof OverviewMap) || new OverviewMap(), B = E.find((a) => a instanceof ScaleLine) || new ScaleLine();
94
+ watch(() => p.showZoom, (a) => {
95
+ F.setMap(a ? w : null);
96
+ }, { immediate: !0 }), watch(() => p.showAttribution, (a) => {
97
+ I.setMap(a ? w : null);
98
+ }, { immediate: !0 }), watch(() => p.showRotate, (a) => {
99
+ L.setMap(a ? w : null);
100
+ }, { immediate: !0 }), watch(() => p.showFullScreen, (a) => {
101
+ R.setMap(a ? w : null);
102
+ }, { immediate: !0 }), watch(() => p.showOverview, (a) => {
103
+ z.setMap(a ? w : null);
104
+ }, { immediate: !0 }), watch(() => p.showScale, (a) => {
105
+ B.setMap(a ? w : null);
102
106
  }, { 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", {
107
+ let V = w.getInteractions().getArray(), H = V.find((a) => a instanceof DragPan) || new DragPan(), U = V.find((a) => a instanceof MouseWheelZoom) || new MouseWheelZoom(), W = V.find((a) => a instanceof DoubleClickZoom) || new DoubleClickZoom(), G = V.find((a) => a instanceof PinchRotate) || new PinchRotate(), K = V.find((a) => a instanceof PinchZoom) || new PinchZoom(), q = V.find((a) => a instanceof DragRotate) || new DragRotate(), J = V.find((a) => a instanceof KeyboardPan) || new KeyboardPan(), Y = V.find((a) => a instanceof KeyboardZoom) || new KeyboardZoom();
108
+ w.removeInteraction(H), w.addInteraction(H), w.removeInteraction(U), w.addInteraction(U), w.removeInteraction(W), w.addInteraction(W), w.removeInteraction(G), w.addInteraction(G), w.removeInteraction(K), w.addInteraction(K), w.removeInteraction(q), w.addInteraction(q), w.removeInteraction(J), w.removeInteraction(Y), watch(() => p.dragPan, (a) => {
109
+ H.setActive(a);
110
+ }, { immediate: !0 }), watch(() => p.mouseWheelZoom, (a) => {
111
+ U.setActive(a);
112
+ }, { immediate: !0 }), watch(() => p.doubleClickZoom, (a) => {
113
+ W.setActive(a);
114
+ }, { immediate: !0 }), watch(() => p.pinchRotate, (a) => {
115
+ G.setActive(a);
116
+ }, { immediate: !0 }), watch(() => p.pinchZoom, (a) => {
117
+ K.setActive(a);
118
+ }, { immediate: !0 }), watch(() => p.altShiftDragRotate, (a) => {
119
+ q.setActive(a);
120
+ }, { immediate: !0 });
121
+ function X(a) {
122
+ y("update:zoom", Math.floor(T.getZoom() || 0)), y("changeResolution", a);
123
+ }
124
+ onMounted(() => {
125
+ T.on("change:resolution", X);
126
+ }), onUnmounted(() => {
127
+ T.un("change:resolution", X);
128
+ });
129
+ function Z(a) {
130
+ y("update:center", T.getCenter() || [0, 0]), y("changeCenter", a);
131
+ }
132
+ onMounted(() => {
133
+ T.on("change:center", Z);
134
+ }), onUnmounted(() => {
135
+ T.un("change:center", Z);
136
+ });
137
+ function Q(a) {
138
+ y("movestart", a);
139
+ }
140
+ onMounted(() => {
141
+ w.on("movestart", Q);
142
+ }), onUnmounted(() => {
143
+ w.un("movestart", Q);
144
+ });
145
+ function $(a) {
146
+ y("moveend", a);
147
+ }
148
+ return onMounted(() => {
149
+ w.on("moveend", $);
150
+ }), onUnmounted(() => {
151
+ w.un("moveend", $);
152
+ }), (a, d) => (openBlock(), createElementBlock("div", {
117
153
  ref_key: "mapRef",
118
- ref: C
119
- }, [renderSlot(e.$slots, "default", {
154
+ ref: x
155
+ }, [renderSlot(a.$slots, "default", {
120
156
  olMap: unref(w),
121
- mapRef: C.value
157
+ mapRef: x.value
122
158
  })], 512));
123
159
  }
124
160
  });
125
- function useContextmenu(b, x) {
126
- let S = ref(!1), w = ref({
161
+ function useContextmenu(u, d) {
162
+ let f = ref(!1), m = ref({
127
163
  x: 0,
128
164
  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,
165
+ }), h = ref(), g = ref([]), _ = ref(), y;
166
+ function b(a, u) {
167
+ let d = [];
168
+ return a.filter((a) => {
169
+ let d = a.visible;
170
+ return typeof d == "function" ? d(u) : d ?? !0;
171
+ }).filter((a) => !a.children || a.children.length > 0).sort((a, u) => (a.order ?? 0) - (u.order ?? 0)).forEach((a) => {
172
+ let f = a.icon, p = a.label;
173
+ d.push({
174
+ ...a,
175
+ children: a.children ? b(a.children, u) : void 0,
140
176
  visible: !0,
141
177
  action: () => {
142
- e.action?.(b), P();
178
+ a.action?.(u), w();
143
179
  },
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
180
+ icon: typeof f == "function" ? () => f(u) : f,
181
+ label: typeof p == "function" ? () => p(u) : p,
182
+ disabled: typeof a.disabled == "function" ? a.disabled(u) : a.disabled ?? !1
147
183
  });
148
- }), x;
184
+ }), d;
149
185
  }
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;
186
+ function S(a) {
187
+ if (a.preventDefault(), !y) return;
188
+ let u = y.getEventCoordinate(a);
189
+ _.value = u;
190
+ let p = y.getEventPixel(a), v, S;
191
+ y.forEachFeatureAtPixel(p, (a, u) => (v = a, S = u, !0)), h.value = v;
192
+ let [C, w] = [a.clientX, a.clientY];
193
+ m.value = {
194
+ x: C,
195
+ y: w
196
+ }, g.value = b(toValue(d), {
197
+ map: y,
198
+ position: { ...m.value },
199
+ coordinate: u,
200
+ feature: v,
201
+ layer: S
202
+ }), f.value = !0;
167
203
  }
168
- function P() {
169
- S.value = !1;
204
+ function w() {
205
+ f.value = !1;
170
206
  }
171
- function F(e) {
172
- if (!e) return;
173
- let b = e.getViewport();
174
- b.addEventListener("contextmenu", M), b.addEventListener("click", P);
207
+ function T(a) {
208
+ if (!a) return;
209
+ let u = a.getViewport();
210
+ u.addEventListener("contextmenu", S), u.addEventListener("click", w);
175
211
  }
176
- function I(e) {
177
- if (!e) return;
178
- let b = e.getViewport();
179
- b.removeEventListener("contextmenu", M), b.removeEventListener("click", P);
212
+ function E(a) {
213
+ if (!a) return;
214
+ let u = a.getViewport();
215
+ u.removeEventListener("contextmenu", S), u.removeEventListener("click", w);
180
216
  }
181
- return watch(() => toValue(b), (e, b) => {
182
- b !== e && (I(b), F(e), k = e);
217
+ return watch(() => toValue(u), (a, u) => {
218
+ u !== a && (E(u), T(a), y = a);
183
219
  }, { immediate: !0 }), onBeforeUnmount(() => {
184
- I(k);
220
+ E(y);
185
221
  }), {
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
222
+ visible: computed(() => f.value),
223
+ position: computed(() => m.value),
224
+ feature: computed(() => h.value),
225
+ options: computed(() => g.value),
226
+ coordinate: computed(() => _.value),
227
+ hide: w
192
228
  };
193
229
  }
194
230
  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;
231
+ function kmToNauticalMiles(a) {
232
+ return a * 1e3 / ONE_NM;
197
233
  }
198
- function nauticalMilesToKm(e) {
199
- return e * ONE_NM / 1e3;
234
+ function nauticalMilesToKm(a) {
235
+ return a * ONE_NM / 1e3;
200
236
  }
201
- function formatRotation(e) {
202
- return e < 0 ? formatRotation(e + 2 * Math.PI) : e > 2 * Math.PI ? formatRotation(e - 2 * Math.PI) : e;
237
+ function formatRotation(a) {
238
+ return a < 0 ? formatRotation(a + 2 * Math.PI) : a > 2 * Math.PI ? formatRotation(a - 2 * Math.PI) : a;
203
239
  }
204
- function formatAngle(e) {
205
- return e < 0 ? formatAngle(e + 360) : e >= 360 ? formatAngle(e - 360) : e;
240
+ function formatAngle(a) {
241
+ return a < 0 ? formatAngle(a + 360) : a >= 360 ? formatAngle(a - 360) : a;
206
242
  }
207
- function createCircleStyle(e) {
208
- let { fillOptions: b, strokeOptions: x,...S } = e;
243
+ function createCircleStyle(a) {
244
+ let { fillOptions: u, strokeOptions: d,...f } = a;
209
245
  return new Circle$1({
210
- ...S,
211
- fill: b ? new Fill(b) : void 0,
212
- stroke: x ? new Stroke(x) : void 0
246
+ ...f,
247
+ fill: u ? new Fill(u) : void 0,
248
+ stroke: d ? new Stroke(d) : void 0
213
249
  });
214
250
  }
215
- function createTextStyle(e) {
216
- let { fillOptions: b, strokeOptions: x, backgroundFillOptions: S, backgroundStrokeOptions: C,...w } = e;
251
+ function createTextStyle(a) {
252
+ let { fillOptions: u, strokeOptions: d, backgroundFillOptions: f, backgroundStrokeOptions: p,...m } = a;
217
253
  return new Text({
218
- ...w,
219
- fill: b ? new Fill(b) : void 0,
220
- stroke: x ? new Stroke(x) : void 0,
221
- backgroundFill: S ? new Fill(S) : void 0,
222
- backgroundStroke: C ? new Stroke(C) : void 0
254
+ ...m,
255
+ fill: u ? new Fill(u) : void 0,
256
+ stroke: d ? new Stroke(d) : void 0,
257
+ backgroundFill: f ? new Fill(f) : void 0,
258
+ backgroundStroke: p ? new Stroke(p) : void 0
223
259
  });
224
260
  }
225
- function createStyle(e) {
226
- 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;
261
+ function createStyle(a) {
262
+ let { fillOptions: u, strokeOptions: d, iconOptions: f, circleOptions: p, textOptions: m,...h } = a, g = u ? new Fill(u) : void 0, _ = d ? new Stroke(d) : void 0, v = f ? new Icon(f) : void 0, y = p ? createCircleStyle(p) : void 0, b = m ? createTextStyle(m) : void 0;
227
263
  return new Style({
228
- ...T,
229
- fill: E,
230
- stroke: D,
231
- image: O || k,
232
- text: A
264
+ ...h,
265
+ fill: g,
266
+ stroke: _,
267
+ image: v || y,
268
+ text: b
233
269
  });
234
270
  }
235
- function createPoint(e) {
236
- return new Point(e);
271
+ function createPoint(a) {
272
+ return new Point(a);
237
273
  }
238
- function createLineString(e) {
239
- return new LineString(e);
274
+ function createLineString(a) {
275
+ return new LineString(a);
240
276
  }
241
- function createPolygon(e) {
242
- return new Polygon(e);
277
+ function createPolygon(a) {
278
+ return new Polygon(a);
243
279
  }
244
- function createCircle(e, b) {
245
- return new Circle(e, b);
280
+ function createCircle(a, u) {
281
+ return new Circle(a, u);
246
282
  }
247
- function createMultiPoint(e) {
248
- return new MultiPoint(e);
283
+ function createMultiPoint(a) {
284
+ return new MultiPoint(a);
249
285
  }
250
- function createMultiLineString(e) {
251
- return new MultiLineString(e);
286
+ function createMultiLineString(a) {
287
+ return new MultiLineString(a);
252
288
  }
253
- function createMultiPolygon(e) {
254
- return new MultiPolygon(e);
289
+ function createMultiPolygon(a) {
290
+ return new MultiPolygon(a);
255
291
  }
256
- function createFeature(e) {
257
- let { styleOptions: b, style: x, geometry: S,...C } = e ?? {}, w = b ? createStyle(b) : x, T = new Feature({
258
- geometry: S,
259
- ...C
292
+ function createFeature(a) {
293
+ let { styleOptions: u, style: d, geometry: f,...p } = a ?? {}, m = u ? createStyle(u) : d, h = new Feature({
294
+ geometry: f,
295
+ ...p
260
296
  });
261
- return T.setStyle(w), T;
297
+ return h.setStyle(m), h;
262
298
  }
263
- function createPointFeature(e, b) {
264
- let x = createPoint(e);
299
+ function createPointFeature(a, u) {
300
+ let d = createPoint(a);
265
301
  return createFeature({
266
- ...b,
267
- geometry: x
302
+ ...u,
303
+ geometry: d
268
304
  });
269
305
  }
270
- function createLineStringFeature(e, b) {
271
- let x = createLineString(e);
306
+ function createLineStringFeature(a, u) {
307
+ let d = createLineString(a);
272
308
  return createFeature({
273
- ...b,
274
- geometry: x
309
+ ...u,
310
+ geometry: d
275
311
  });
276
312
  }
277
- function createPolygonFeature(e, b) {
278
- let x = createPolygon(e);
313
+ function createPolygonFeature(a, u) {
314
+ let d = createPolygon(a);
279
315
  return createFeature({
280
- ...b,
281
- geometry: x
316
+ ...u,
317
+ geometry: d
282
318
  });
283
319
  }
284
- function createCircleFeature(e, b, x) {
285
- let S = createCircle(e, b);
320
+ function createCircleFeature(a, u, d) {
321
+ let f = createCircle(a, u);
286
322
  return createFeature({
287
- ...x,
288
- geometry: S
323
+ ...d,
324
+ geometry: f
289
325
  });
290
326
  }
291
- function createMultiPointFeature(e, b) {
292
- let x = createMultiPoint(e);
327
+ function createMultiPointFeature(a, u) {
328
+ let d = createMultiPoint(a);
293
329
  return createFeature({
294
- ...b,
295
- geometry: x
330
+ ...u,
331
+ geometry: d
296
332
  });
297
333
  }
298
- function createMultiLineStringFeature(e, b) {
299
- let x = createMultiLineString(e);
334
+ function createMultiLineStringFeature(a, u) {
335
+ let d = createMultiLineString(a);
300
336
  return createFeature({
301
- ...b,
302
- geometry: x
337
+ ...u,
338
+ geometry: d
303
339
  });
304
340
  }
305
- function createMultiPolygonFeature(e, b) {
306
- let x = createMultiPolygon(e);
341
+ function createMultiPolygonFeature(a, u) {
342
+ let d = createMultiPolygon(a);
307
343
  return createFeature({
308
- ...b,
309
- geometry: x
344
+ ...u,
345
+ geometry: d
310
346
  });
311
347
  }
312
- function createTianDiTuUrl(e) {
313
- 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}`;
314
- return `${C}/${b}_${x === "EPSG:4326" ? "c" : x === "EPSG:3857" ? "w" : "c"}/wmts?LAYER=${b}${w}`;
348
+ function createTianDiTuUrl(a) {
349
+ let { type: u = "img", projection: d = WebMercatorProjection, key: f } = a, p = a.url || "https://t{0-4}.tianditu.gov.cn", m = `&tk=${f}&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}`;
350
+ return `${p}/${u}_${d === "EPSG:4326" ? "c" : d === "EPSG:3857" ? "w" : "c"}/wmts?LAYER=${u}${m}`;
315
351
  }
316
- function createTianDiTuLayer(e) {
317
- let { layerOptions: b, sourceOptions: x,...S } = e;
352
+ function createTianDiTuLayer(a) {
353
+ let { layerOptions: u, sourceOptions: d,...f } = a;
318
354
  return new Tile({
319
355
  source: new XYZ({
320
- url: createTianDiTuUrl(S),
321
- projection: S.projection,
356
+ url: createTianDiTuUrl(f),
357
+ projection: f.projection,
322
358
  crossOrigin: "Anonymous",
323
- ...x
359
+ ...d
324
360
  }),
325
- ...b
361
+ ...u
326
362
  });
327
363
  }
328
- function createBingLayer({ name: e, key: b, layerOptions: x, sourceOptions: S }) {
364
+ function createBingLayer({ name: a, key: u, layerOptions: d, sourceOptions: f }) {
329
365
  return new Tile({
330
366
  source: new BingMaps({
331
- key: b,
332
- imagerySet: e,
367
+ key: u,
368
+ imagerySet: a,
333
369
  placeholderTiles: !1,
334
- ...S
370
+ ...f
335
371
  }),
336
- ...x
372
+ ...d
337
373
  });
338
374
  }
339
- function createOpenStreetMapLayer(e) {
340
- let { layerOptions: b, sourceOptions: x } = e || {};
375
+ function createOpenStreetMapLayer(a) {
376
+ let { layerOptions: u, sourceOptions: d } = a || {};
341
377
  return new Tile({
342
378
  source: new OSM({
343
379
  crossOrigin: "Anonymous",
344
- ...x
380
+ ...d
345
381
  }),
346
- ...b
382
+ ...u
347
383
  });
348
384
  }
349
- function createVectorLayer(e) {
350
- let { styleOptions: b,...x } = e || {}, S = b ? createStyle(b) : void 0, C = new VectorSource();
385
+ function createVectorLayer(a) {
386
+ let { styleOptions: u,...d } = a || {}, f = u ? createStyle(u) : void 0, p = new VectorSource();
351
387
  return {
352
- source: C,
388
+ source: p,
353
389
  layer: new VectorLayer({
354
- source: C,
355
- ...x,
356
- style: S || x.style
390
+ source: p,
391
+ ...d,
392
+ style: f || d.style
357
393
  })
358
394
  };
359
395
  }
360
- function wgs84ToMercator(e) {
361
- return transform(e, EPSG_4326, EPSG_3857);
396
+ function wgs84ToMercator(a) {
397
+ return transform(a, EPSG_4326, EPSG_3857);
362
398
  }
363
399
  const EPSG_4326ToEPSG_3857 = wgs84ToMercator;
364
- function mercatorToWgs84(e) {
365
- return transform(e, EPSG_3857, EPSG_4326);
400
+ function mercatorToWgs84(a) {
401
+ return transform(a, EPSG_3857, EPSG_4326);
366
402
  }
367
403
  const EPSG_3857ToEPSG_4326 = mercatorToWgs84;
368
- function wgs84ExtentToMercator(e) {
369
- return transformExtent(e, EPSG_4326, EPSG_3857);
404
+ function wgs84ExtentToMercator(a) {
405
+ return transformExtent(a, EPSG_4326, EPSG_3857);
370
406
  }
371
407
  const EPSG_4326ExtentToEPSG_3857 = wgs84ExtentToMercator;
372
- function mercatorExtentToWgs84(e) {
373
- return transformExtent(e, EPSG_3857, EPSG_4326);
408
+ function mercatorExtentToWgs84(a) {
409
+ return transformExtent(a, EPSG_3857, EPSG_4326);
374
410
  }
375
411
  const EPSG_3857ExtentToEPSG_4326 = mercatorExtentToWgs84;
376
- function createToolTipElement(e) {
377
- let b = document.createElement("div");
378
- 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;
379
- }
380
- function useDrawLineString(b, x) {
381
- 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({
382
- source: D,
383
- style: A,
384
- zIndex: x?.zIndex
412
+ function createToolTipElement(a) {
413
+ let u = document.createElement("div");
414
+ return u.innerHTML = a, u.style.cursor = "pointer", u.style.userSelect = "none", u.style.backgroundColor = "red", u.style.color = "white", u.style.borderRadius = "5px", u.style.padding = "0 5px", u.style.fontSize = "12px", u.style.border = "2px solid white", u;
415
+ }
416
+ function useDrawLineString(u, d) {
417
+ let f = ref(!0), p = ref([]), g = computed(() => p.value.map((a) => a.getGeometry().getCoordinates())), _ = new VectorSource(), b = d.styleOptions ? createStyle(d.styleOptions) : d?.style, x = new VectorLayer({
418
+ source: _,
419
+ style: b,
420
+ zIndex: d?.zIndex
385
421
  });
386
- b.addLayer(j);
387
- let M = new Draw({
388
- source: D,
389
- style: (x.drawStyleOptions ? createStyle(x.drawStyleOptions) : x?.drawStyle) || A,
422
+ u.addLayer(x);
423
+ let S = new Draw({
424
+ source: _,
425
+ style: (d.drawStyleOptions ? createStyle(d.drawStyleOptions) : d?.drawStyle) || b,
390
426
  type: "LineString"
391
427
  });
392
- M.setActive(!1);
393
- let N = new Modify({
394
- source: D,
395
- style: (x.modifyStyleOptions ? createStyle(x.modifyStyleOptions) : x?.modifyStyle) || A
396
- }), F = /* @__PURE__ */ new Set();
397
- b.addInteraction(M), onMounted(() => {
398
- b.addInteraction(N);
399
- }), D.on("addfeature", () => {
400
- x.size && D.getFeatures().length >= x.size && M.setActive(!1);
401
- }), D.on("removefeature", () => {
402
- x.size && D.getFeatures().length < x.size && M.setActive(!0);
428
+ S.setActive(!1);
429
+ let C = new Modify({
430
+ source: _,
431
+ style: (d.modifyStyleOptions ? createStyle(d.modifyStyleOptions) : d?.modifyStyle) || b
432
+ }), T = /* @__PURE__ */ new Set();
433
+ u.addInteraction(S), onMounted(() => {
434
+ u.addInteraction(C);
435
+ }), _.on("addfeature", () => {
436
+ d.size && _.getFeatures().length >= d.size && S.setActive(!1);
437
+ }), _.on("removefeature", () => {
438
+ d.size && _.getFeatures().length < d.size && S.setActive(!0);
403
439
  });
404
- let L = () => {
405
- F.forEach((e) => {
406
- b.removeOverlay(e);
407
- }), F.clear();
440
+ let D = () => {
441
+ T.forEach((a) => {
442
+ u.removeOverlay(a);
443
+ }), T.clear();
408
444
  };
409
- D.on("change", () => {
410
- L(), D.getFeatures().forEach((e) => {
411
- let S = e.getGeometry();
412
- S.getCoordinates();
413
- let C = getCenter(S.getExtent()), w = document.createElement("div");
414
- x.deleteFeatureLabel ? render(x.deleteFeatureLabel, w) : w = createToolTipElement("删除线"), w.addEventListener("click", () => {
415
- D.removeFeature(e);
445
+ _.on("change", () => {
446
+ D(), _.getFeatures().forEach((a) => {
447
+ let f = a.getGeometry();
448
+ f.getCoordinates();
449
+ let p = getCenter(f.getExtent()), m = document.createElement("div");
450
+ d.deleteFeatureLabel ? render(d.deleteFeatureLabel, m) : m = createToolTipElement("删除线"), m.addEventListener("click", () => {
451
+ _.removeFeature(a);
416
452
  });
417
- let T = new Overlay({
418
- position: C,
453
+ let h = new Overlay({
454
+ position: p,
419
455
  positioning: "center-center",
420
- element: w
456
+ element: m
421
457
  });
422
- F.add(T), b.addOverlay(T);
423
- let E = S.getCoordinates();
424
- E.length < 3 || E.forEach((S, C) => {
425
- let w = document.createElement("div");
426
- x.deletePointLabel ? render(x.deletePointLabel, w) : w = createToolTipElement("删除点"), w.addEventListener("click", () => {
427
- e.setGeometry(new LineString(E.filter((e, b) => b !== C)));
458
+ T.add(h), u.addOverlay(h);
459
+ let g = f.getCoordinates();
460
+ g.length < 3 || g.forEach((f, p) => {
461
+ let m = document.createElement("div");
462
+ d.deletePointLabel ? render(d.deletePointLabel, m) : m = createToolTipElement("删除点"), m.addEventListener("click", () => {
463
+ a.setGeometry(new LineString(g.filter((a, u) => u !== p)));
428
464
  });
429
- let T = new Overlay({
430
- position: S,
465
+ let h = new Overlay({
466
+ position: f,
431
467
  positioning: "top-center",
432
468
  offset: [0, -30],
433
- element: w
469
+ element: m
434
470
  });
435
- F.add(T), b.addOverlay(T);
471
+ T.add(h), u.addOverlay(h);
436
472
  });
437
473
  });
438
- }), M.on("change:active", () => {
439
- S.value = M.getActive();
440
- }), D.on("change", () => {
441
- C.value = D.getFeatures();
474
+ }), S.on("change:active", () => {
475
+ f.value = S.getActive();
476
+ }), _.on("change", () => {
477
+ p.value = _.getFeatures();
442
478
  });
443
- let R = () => {
444
- L(), b.removeLayer(j), b.removeInteraction(M), b.removeInteraction(N);
445
- }, z = () => {
446
- x.size && C.value.length >= x.size || M.setActive(!0);
447
- }, B = () => {
448
- M.setActive(!1);
449
- }, V = (e) => {
450
- D.clear(), e.forEach((e) => {
451
- if (e.length < 2) return;
452
- let b = new Feature({ geometry: new LineString(e) });
453
- D.addFeature(b);
479
+ let O = () => {
480
+ D(), u.removeLayer(x), u.removeInteraction(S), u.removeInteraction(C);
481
+ }, k = () => {
482
+ d.size && p.value.length >= d.size || S.setActive(!0);
483
+ }, A = () => {
484
+ S.setActive(!1);
485
+ }, j = (a) => {
486
+ _.clear(), a.forEach((a) => {
487
+ if (a.length < 2) return;
488
+ let u = new Feature({ geometry: new LineString(a) });
489
+ _.addFeature(u);
454
490
  });
455
- }, H = () => {
456
- V(x.defaultCoordinates || []);
491
+ }, M = () => {
492
+ j(d.defaultCoordinates || []);
457
493
  };
458
- return H(), onUnmounted(() => {
459
- R();
494
+ return M(), onUnmounted(() => {
495
+ O();
460
496
  }), {
461
- inDraw: S,
462
- start: z,
463
- stop: B,
497
+ inDraw: f,
498
+ start: k,
499
+ stop: A,
464
500
  clear: () => {
465
- D.clear(), B();
501
+ _.clear(), A();
466
502
  },
467
- setFeatures: V,
468
- reset: H,
469
- features: C,
470
- coordinates: E,
471
- destroy: R
503
+ setFeatures: j,
504
+ reset: M,
505
+ features: p,
506
+ coordinates: g,
507
+ destroy: O
472
508
  };
473
509
  }
474
- function useDrawPolygon(b, x) {
475
- 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({
476
- source: A,
477
- style: D,
478
- zIndex: x?.zIndex
510
+ function useDrawPolygon(u, d) {
511
+ let f = ref(!0), p = ref([]), g = computed(() => p.value.map((a) => a.getGeometry().getCoordinates())), _ = d.styleOptions ? createStyle(d.styleOptions) : d?.style, b = new VectorSource(), x = new VectorLayer({
512
+ source: b,
513
+ style: _,
514
+ zIndex: d?.zIndex
479
515
  });
480
- b.addLayer(j);
481
- let M = new Draw({
482
- source: A,
483
- style: (x.drawStyleOptions ? createStyle(x.drawStyleOptions) : x?.drawStyle) || D,
516
+ u.addLayer(x);
517
+ let S = new Draw({
518
+ source: b,
519
+ style: (d.drawStyleOptions ? createStyle(d.drawStyleOptions) : d?.drawStyle) || _,
484
520
  type: "Polygon"
485
521
  });
486
- M.setActive(!1);
487
- let N = new Modify({
488
- source: A,
489
- style: (x.modifyStyleOptions ? createStyle(x.modifyStyleOptions) : x?.modifyStyle) || D
490
- }), F = /* @__PURE__ */ new Set();
491
- b.addInteraction(M), onMounted(() => {
492
- b.addInteraction(N);
493
- }), A.on("addfeature", () => {
494
- x.size && A.getFeatures().length >= x.size && M.setActive(!1);
495
- }), A.on("removefeature", () => {
496
- x.size && A.getFeatures().length < x.size && M.setActive(!0);
522
+ S.setActive(!1);
523
+ let C = new Modify({
524
+ source: b,
525
+ style: (d.modifyStyleOptions ? createStyle(d.modifyStyleOptions) : d?.modifyStyle) || _
526
+ }), T = /* @__PURE__ */ new Set();
527
+ u.addInteraction(S), onMounted(() => {
528
+ u.addInteraction(C);
529
+ }), b.on("addfeature", () => {
530
+ d.size && b.getFeatures().length >= d.size && S.setActive(!1);
531
+ }), b.on("removefeature", () => {
532
+ d.size && b.getFeatures().length < d.size && S.setActive(!0);
497
533
  });
498
- let L = () => {
499
- F.forEach((e) => {
500
- b.removeOverlay(e);
501
- }), F.clear();
534
+ let D = () => {
535
+ T.forEach((a) => {
536
+ u.removeOverlay(a);
537
+ }), T.clear();
502
538
  };
503
- A.on("change", () => {
504
- L(), A.getFeatures().forEach((e) => {
505
- let S = e.getGeometry(), C = getCenter(S.getExtent()), w = document.createElement("div");
506
- x.deleteFeatureLabel ? render(x.deleteFeatureLabel, w) : w = createToolTipElement("删除区域"), w.addEventListener("click", () => {
507
- A.removeFeature(e);
539
+ b.on("change", () => {
540
+ D(), b.getFeatures().forEach((a) => {
541
+ let f = a.getGeometry(), p = getCenter(f.getExtent()), m = document.createElement("div");
542
+ d.deleteFeatureLabel ? render(d.deleteFeatureLabel, m) : m = createToolTipElement("删除区域"), m.addEventListener("click", () => {
543
+ b.removeFeature(a);
508
544
  });
509
- let T = new Overlay({
510
- position: C,
545
+ let h = new Overlay({
546
+ position: p,
511
547
  positioning: "center-center",
512
- element: w
548
+ element: m
513
549
  });
514
- F.add(T), b.addOverlay(T);
515
- let E = S.getCoordinates()[0];
516
- E.length < 3 || E.forEach((S, C) => {
517
- let w = document.createElement("div");
518
- x.deletePointLabel ? render(x.deletePointLabel, w) : w = createToolTipElement("删除点"), w.addEventListener("click", () => {
519
- e.setGeometry(new Polygon([E.filter((e, b) => b !== C)]));
550
+ T.add(h), u.addOverlay(h);
551
+ let g = f.getCoordinates()[0];
552
+ g.length < 3 || g.forEach((f, p) => {
553
+ let m = document.createElement("div");
554
+ d.deletePointLabel ? render(d.deletePointLabel, m) : m = createToolTipElement("删除点"), m.addEventListener("click", () => {
555
+ a.setGeometry(new Polygon([g.filter((a, u) => u !== p)]));
520
556
  });
521
- let T = new Overlay({
522
- position: S,
557
+ let h = new Overlay({
558
+ position: f,
523
559
  positioning: "top-center",
524
560
  offset: [0, -30],
525
- element: w
561
+ element: m
526
562
  });
527
- F.add(T), b.addOverlay(T);
563
+ T.add(h), u.addOverlay(h);
528
564
  });
529
565
  });
530
- }), M.on("change:active", () => {
531
- S.value = M.getActive();
532
- }), A.on("change", () => {
533
- C.value = A.getFeatures();
566
+ }), S.on("change:active", () => {
567
+ f.value = S.getActive();
568
+ }), b.on("change", () => {
569
+ p.value = b.getFeatures();
534
570
  });
535
- let R = () => {
536
- L(), b.removeLayer(j), b.removeInteraction(M), b.removeInteraction(N);
537
- }, z = () => {
538
- x.size && C.value.length >= x.size || M.setActive(!0);
539
- }, B = () => {
540
- M.setActive(!1);
541
- }, V = (e) => {
542
- A.clear(), e?.forEach((e) => {
543
- e.forEach((e) => {
544
- if (e.length < 2) return;
545
- e[0] !== e[e.length - 1] && e.push(e[0]);
546
- let b = new Feature({ geometry: new Polygon([e]) });
547
- A.addFeature(b);
571
+ let O = () => {
572
+ D(), u.removeLayer(x), u.removeInteraction(S), u.removeInteraction(C);
573
+ }, k = () => {
574
+ d.size && p.value.length >= d.size || S.setActive(!0);
575
+ }, A = () => {
576
+ S.setActive(!1);
577
+ }, j = (a) => {
578
+ b.clear(), a?.forEach((a) => {
579
+ a.forEach((a) => {
580
+ if (a.length < 2) return;
581
+ a[0] !== a[a.length - 1] && a.push(a[0]);
582
+ let u = new Feature({ geometry: new Polygon([a]) });
583
+ b.addFeature(u);
548
584
  });
549
585
  });
550
- }, H = () => {
551
- V(x.defaultCoordinates);
586
+ }, M = () => {
587
+ j(d.defaultCoordinates);
552
588
  };
553
- return H(), onUnmounted(() => {
554
- R();
589
+ return M(), onUnmounted(() => {
590
+ O();
555
591
  }), {
556
- inDraw: S,
557
- start: z,
558
- stop: B,
592
+ inDraw: f,
593
+ start: k,
594
+ stop: A,
559
595
  clear: () => {
560
- A.clear(), B();
596
+ b.clear(), A();
561
597
  },
562
- setFeatures: V,
563
- reset: H,
564
- features: C,
565
- coordinates: E,
566
- destroy: R
598
+ setFeatures: j,
599
+ reset: M,
600
+ features: p,
601
+ coordinates: g,
602
+ destroy: O
567
603
  };
568
604
  }
569
- function useGraticule(e) {
570
- 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({
571
- ...k,
572
- strokeStyle: A,
573
- latLabelStyle: P,
574
- lonLabelStyle: F
605
+ function useGraticule(a) {
606
+ let u = ref(a.defaultShow || !1), { strokeStyleOption: d, strokeStyle: f, labelStyleOption: p, latLabelStyleOption: m, lonLabelStyleOption: h, latLabelStyle: g, lonLabelStyle: _,...y } = a.graticuleOptions || {}, b = d ? new Stroke(d) : f, S = p ? createTextStyle(p) : void 0, w = (m ? createTextStyle(m) : g) || S, T = (h ? createTextStyle(h) : _) || S, E = new Graticule({
607
+ ...y,
608
+ strokeStyle: b,
609
+ latLabelStyle: w,
610
+ lonLabelStyle: T
575
611
  });
576
- return watch(b, (b) => {
577
- if (I.setMap(null), b) {
578
- let b = toValue(e.olMap);
579
- b && I.setMap(b);
612
+ return watch(u, (u) => {
613
+ if (E.setMap(null), u) {
614
+ let u = toValue(a.olMap);
615
+ u && E.setMap(u);
580
616
  }
581
617
  }, {
582
618
  immediate: !0,
583
619
  deep: !0
584
- }), { showGraticule: b };
620
+ }), { showGraticule: u };
585
621
  }
586
- function usePointermove(b, x) {
587
- let S = ref(!1), w = ref({
622
+ function usePointermove({ mapRef: u, items: d, enabled: f = !0, forceUpdate: m = !1 }) {
623
+ let h = ref(!1), g = ref({
588
624
  x: 0,
589
625
  y: 0
590
- }), T = ref(), E = ref(), D = ref({
626
+ }), _ = ref(), y = ref(), b = ref({
591
627
  x: 0,
592
628
  y: 0
593
- }), k = ref(), A = ref(), M = computed(() => ({
594
- x: w.value.x + D.value.x,
595
- y: w.value.y + D.value.y
596
- })), P, F = "";
597
- function I(e) {
598
- let b = toValue(x).filter((b) => {
599
- let x = b.visible;
600
- return typeof x == "function" ? x(e) : x ?? !0;
629
+ }), S = ref(), w = ref(), T = computed(() => ({
630
+ x: g.value.x + b.value.x,
631
+ y: g.value.y + b.value.y
632
+ })), E = () => typeof f == "function" ? f() : f, D, O, k = "";
633
+ function A(a) {
634
+ let u = toValue(d);
635
+ return u.sort((a, u) => (u.priority ?? 0) - (a.priority ?? 0)), u.find((u) => {
636
+ let d = u.visible;
637
+ return typeof d == "function" ? d(a) : d ?? !0;
601
638
  });
602
- return b.length === 0 ? null : b.sort((e, b) => (b.priority ?? 0) - (e.priority ?? 0))[0];
603
639
  }
604
- function L(e) {
605
- if (!P) return;
606
- let b = P.getEventCoordinate(e);
607
- k.value = b;
608
- let x = P.getEventPixel(e), C, O;
609
- if (P.forEachFeatureAtPixel(x, (e, b) => (C = e, O = b, !0)), !C) {
610
- R();
640
+ function j(a) {
641
+ if (!E()) {
642
+ M();
643
+ return;
644
+ }
645
+ if (!D || !O) return;
646
+ let u = D.getEventCoordinate(a);
647
+ S.value = u;
648
+ let d = D.getEventPixel(a), f, p;
649
+ if (D.forEachFeatureAtPixel(d, (a, u) => (f = a, p = u, !0)), !f) {
650
+ M();
611
651
  return;
612
652
  }
613
- T.value = C;
614
- let j = {
615
- map: P,
653
+ if (!m && _.value && _.value.getId() === f.getId()) return;
654
+ _.value = f;
655
+ let v = {
656
+ map: D,
616
657
  position: {
617
- x: e.clientX,
618
- y: e.clientY
658
+ x: a.clientX,
659
+ y: a.clientY
619
660
  },
620
- coordinate: b,
621
- feature: C,
622
- layer: O
623
- }, M = I(j);
624
- if (M) {
625
- let { content: e, cursor: b, visible: x, fixedFeatureCenter: S, offset: C, priority: w,...T } = M;
626
- A.value = { ...T };
661
+ coordinate: u,
662
+ feature: f,
663
+ layer: p
664
+ }, x = A(v);
665
+ if (x) {
666
+ let { content: a, cursor: u, visible: d, fixedFeatureCenter: f, offset: p, priority: m,...h } = x;
667
+ w.value = { ...h };
627
668
  }
628
- if (!M) {
629
- R();
669
+ if (!x) {
670
+ M();
630
671
  return;
631
672
  }
632
- D.value = {
633
- x: M.offset?.x ?? 0,
634
- y: M.offset?.y ?? 0
673
+ b.value = {
674
+ x: x.offset?.x ?? 0,
675
+ y: x.offset?.y ?? 0
635
676
  };
636
- let N = M.fixedFeatureCenter ?? !0, L = C.getGeometry();
637
- if (N && L) {
638
- let e = getCenter(L.getExtent()), b = P.getPixelFromCoordinate(e), { top: x, left: S } = P.getViewport().getBoundingClientRect();
639
- w.value.x = b[0] + S, w.value.y = b[1] + x;
640
- } else w.value = {
641
- x: e.clientX,
642
- y: e.clientY
677
+ let C = m === !1 ? !0 : x.fixedFeatureCenter ?? !0, T = f.getGeometry();
678
+ if (C && T) {
679
+ let a = getCenter(T.getExtent()), u = D.getPixelFromCoordinate(a), { top: d, left: f } = O.getBoundingClientRect();
680
+ g.value.x = u[0] + f, g.value.y = u[1] + d;
681
+ } else g.value = {
682
+ x: a.clientX,
683
+ y: a.clientY
643
684
  };
644
- let z = M.content;
645
- E.value = typeof z == "function" ? () => z(j) : z;
646
- let B = M.cursor, V = typeof B == "function" ? B(j) : B;
647
- if (V && P) {
648
- let e = P.getViewport();
649
- F ||= e.style.cursor, e.style.cursor = V;
650
- }
651
- S.value = !0;
685
+ let k = x.content;
686
+ y.value = typeof k == "function" ? () => k(v) : k;
687
+ let j = x.cursor, N = typeof j == "function" ? j(v) : j;
688
+ N !== void 0 && N !== O.style.cursor && (O.style.cursor = N), h.value = !0;
652
689
  }
653
- function R() {
654
- if (S.value = !1, T.value = void 0, P && F !== void 0) {
655
- let e = P.getViewport();
656
- e.style.cursor = F, F = "";
657
- }
690
+ function M() {
691
+ h.value = !1, _.value = void 0, O && O.style.cursor !== k && (O.style.cursor = k);
658
692
  }
659
- function z(e) {
660
- if (!e) return;
661
- let b = e.getViewport();
662
- b.addEventListener("pointermove", L), b.addEventListener("pointerout", R);
693
+ function N(a) {
694
+ a.addEventListener("pointermove", j);
663
695
  }
664
- function B(e) {
665
- if (!e) return;
666
- let b = e.getViewport();
667
- b.removeEventListener("pointermove", L), b.removeEventListener("pointerout", R);
696
+ function P(a) {
697
+ a.removeEventListener("pointermove", j);
668
698
  }
669
- return watch(() => toValue(b), (e, b) => {
670
- b !== e && (B(b), z(e), P = e);
699
+ return watch(() => toValue(u), (a, u) => {
700
+ u !== a && (D = a, a && (O = a.getViewport(), P(O), N(O), k = O.style.cursor));
671
701
  }, { immediate: !0 }), onBeforeUnmount(() => {
672
- B(P);
702
+ O && P(O);
673
703
  }), {
674
- visible: computed(() => S.value),
675
- position: computed(() => M.value),
676
- originalPosition: computed(() => w.value),
677
- feature: computed(() => T.value),
678
- content: computed(() => E.value),
679
- coordinate: computed(() => k.value),
680
- option: computed(() => A.value),
681
- hide: R
704
+ visible: computed(() => h.value),
705
+ position: computed(() => T.value),
706
+ originalPosition: computed(() => g.value),
707
+ feature: computed(() => _.value),
708
+ content: computed(() => y.value),
709
+ coordinate: computed(() => S.value),
710
+ option: computed(() => w.value),
711
+ hide: M
682
712
  };
683
713
  }
684
- function useSwitchBaseLayer(e) {
685
- let b = ref(e.defaultLayerName || Object.keys(e.layers)[0]);
686
- return Object.values(e.layers).forEach((b) => {
687
- b.forEach((b) => {
688
- e.olMap.addLayer(b);
714
+ function useSwitchBaseLayer(a) {
715
+ let u = ref(a.defaultLayerName || Object.keys(a.layers)[0]);
716
+ return Object.values(a.layers).forEach((u) => {
717
+ u.forEach((u) => {
718
+ a.olMap.addLayer(u);
689
719
  });
690
- }), watch(b, () => {
691
- Object.entries(e.layers).forEach(([e, x]) => {
692
- let S = e === b.value;
693
- x.forEach((e) => {
694
- e.setVisible(S);
720
+ }), watch(u, () => {
721
+ Object.entries(a.layers).forEach(([a, d]) => {
722
+ let f = a === u.value;
723
+ d.forEach((a) => {
724
+ a.setVisible(f);
695
725
  });
696
726
  });
697
- }, { immediate: !0 }), { visibleLayerName: b };
727
+ }, { immediate: !0 }), { visibleLayerName: u };
698
728
  }
699
729
  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, createBingLayer, createCircle, createCircleFeature, createCircleStyle, createFeature, createLineString, createLineStringFeature, createMultiLineString, createMultiLineStringFeature, createMultiPoint, createMultiPointFeature, createMultiPolygon, createMultiPolygonFeature, createOpenStreetMapLayer, createPoint, createPointFeature, createPolygon, createPolygonFeature, createStyle, createTextStyle, createTianDiTuLayer, createTianDiTuUrl, createVectorLayer, formatAngle, formatRotation, kmToNauticalMiles, mercatorExtentToWgs84, mercatorToWgs84, nauticalMilesToKm, olMapInjectionKey, useContextmenu, useDrawLineString, useDrawPolygon, useGraticule, useOlMap, usePointermove, useSwitchBaseLayer, wgs84ExtentToMercator, wgs84ToMercator };