@summeruse/ol 0.2.0-alpha.1 → 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,623 +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 createCircleStyle(e) {
202
- let { fillOptions: b, strokeOptions: x,...S } = e;
237
+ function formatRotation(a) {
238
+ return a < 0 ? formatRotation(a + 2 * Math.PI) : a > 2 * Math.PI ? formatRotation(a - 2 * Math.PI) : a;
239
+ }
240
+ function formatAngle(a) {
241
+ return a < 0 ? formatAngle(a + 360) : a >= 360 ? formatAngle(a - 360) : a;
242
+ }
243
+ function createCircleStyle(a) {
244
+ let { fillOptions: u, strokeOptions: d,...f } = a;
203
245
  return new Circle$1({
204
- ...S,
205
- fill: b ? new Fill(b) : void 0,
206
- 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
207
249
  });
208
250
  }
209
- function createTextStyle(e) {
210
- 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;
211
253
  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
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
217
259
  });
218
260
  }
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;
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;
221
263
  return new Style({
222
- ...T,
223
- fill: E,
224
- stroke: D,
225
- image: O || k,
226
- text: A
264
+ ...h,
265
+ fill: g,
266
+ stroke: _,
267
+ image: v || y,
268
+ text: b
227
269
  });
228
270
  }
229
- function createPoint(e) {
230
- return new Point(e);
271
+ function createPoint(a) {
272
+ return new Point(a);
231
273
  }
232
- function createLineString(e) {
233
- return new LineString(e);
274
+ function createLineString(a) {
275
+ return new LineString(a);
234
276
  }
235
- function createPolygon(e) {
236
- return new Polygon(e);
277
+ function createPolygon(a) {
278
+ return new Polygon(a);
237
279
  }
238
- function createCircle(e, b) {
239
- return new Circle(e, b);
280
+ function createCircle(a, u) {
281
+ return new Circle(a, u);
240
282
  }
241
- function createMultiPoint(e) {
242
- return new MultiPoint(e);
283
+ function createMultiPoint(a) {
284
+ return new MultiPoint(a);
243
285
  }
244
- function createMultiLineString(e) {
245
- return new MultiLineString(e);
286
+ function createMultiLineString(a) {
287
+ return new MultiLineString(a);
246
288
  }
247
- function createMultiPolygon(e) {
248
- return new MultiPolygon(e);
289
+ function createMultiPolygon(a) {
290
+ return new MultiPolygon(a);
249
291
  }
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
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
254
296
  });
255
- return T.setStyle(w), T;
297
+ return h.setStyle(m), h;
256
298
  }
257
- function createPointFeature(e, b) {
258
- let x = createPoint(e);
299
+ function createPointFeature(a, u) {
300
+ let d = createPoint(a);
259
301
  return createFeature({
260
- ...b,
261
- geometry: x
302
+ ...u,
303
+ geometry: d
262
304
  });
263
305
  }
264
- function createLineStringFeature(e, b) {
265
- let x = createLineString(e);
306
+ function createLineStringFeature(a, u) {
307
+ let d = createLineString(a);
266
308
  return createFeature({
267
- ...b,
268
- geometry: x
309
+ ...u,
310
+ geometry: d
269
311
  });
270
312
  }
271
- function createPolygonFeature(e, b) {
272
- let x = createPolygon(e);
313
+ function createPolygonFeature(a, u) {
314
+ let d = createPolygon(a);
273
315
  return createFeature({
274
- ...b,
275
- geometry: x
316
+ ...u,
317
+ geometry: d
276
318
  });
277
319
  }
278
- function createCircleFeature(e, b, x) {
279
- let S = createCircle(e, b);
320
+ function createCircleFeature(a, u, d) {
321
+ let f = createCircle(a, u);
280
322
  return createFeature({
281
- ...x,
282
- geometry: S
323
+ ...d,
324
+ geometry: f
283
325
  });
284
326
  }
285
- function createMultiPointFeature(e, b) {
286
- let x = createMultiPoint(e);
327
+ function createMultiPointFeature(a, u) {
328
+ let d = createMultiPoint(a);
287
329
  return createFeature({
288
- ...b,
289
- geometry: x
330
+ ...u,
331
+ geometry: d
290
332
  });
291
333
  }
292
- function createMultiLineStringFeature(e, b) {
293
- let x = createMultiLineString(e);
334
+ function createMultiLineStringFeature(a, u) {
335
+ let d = createMultiLineString(a);
294
336
  return createFeature({
295
- ...b,
296
- geometry: x
337
+ ...u,
338
+ geometry: d
297
339
  });
298
340
  }
299
- function createMultiPolygonFeature(e, b) {
300
- let x = createMultiPolygon(e);
341
+ function createMultiPolygonFeature(a, u) {
342
+ let d = createMultiPolygon(a);
301
343
  return createFeature({
302
- ...b,
303
- geometry: x
344
+ ...u,
345
+ geometry: d
304
346
  });
305
347
  }
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}`;
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}`;
309
351
  }
310
- function getTianDiTuLayer(e) {
311
- let { zIndex: b, projection: x, className: S } = e;
352
+ function createTianDiTuLayer(a) {
353
+ let { layerOptions: u, sourceOptions: d,...f } = a;
312
354
  return new Tile({
313
- className: S,
314
355
  source: new XYZ({
315
- url: getTianDiTuUrl(e),
316
- projection: x,
317
- crossOrigin: "Anonymous"
356
+ url: createTianDiTuUrl(f),
357
+ projection: f.projection,
358
+ crossOrigin: "Anonymous",
359
+ ...d
318
360
  }),
319
- zIndex: b
361
+ ...u
320
362
  });
321
363
  }
322
- function getBingLayer({ name: e, zIndex: b, key: x, className: S }) {
364
+ function createBingLayer({ name: a, key: u, layerOptions: d, sourceOptions: f }) {
323
365
  return new Tile({
324
- className: S,
325
366
  source: new BingMaps({
326
- key: x,
327
- imagerySet: e,
328
- placeholderTiles: !1
367
+ key: u,
368
+ imagerySet: a,
369
+ placeholderTiles: !1,
370
+ ...f
329
371
  }),
330
- zIndex: b
372
+ ...d
331
373
  });
332
374
  }
333
- function getOSMLayer(e) {
375
+ function createOpenStreetMapLayer(a) {
376
+ let { layerOptions: u, sourceOptions: d } = a || {};
334
377
  return new Tile({
335
- className: e?.className,
336
- source: new OSM({ crossOrigin: "Anonymous" }),
337
- zIndex: e?.zIndex
378
+ source: new OSM({
379
+ crossOrigin: "Anonymous",
380
+ ...d
381
+ }),
382
+ ...u
338
383
  });
339
384
  }
340
- function createVectorLayer(e) {
341
- 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();
342
387
  return {
343
- source: C,
388
+ source: p,
344
389
  layer: new VectorLayer({
345
- source: C,
346
- ...x,
347
- style: S || x.style
390
+ source: p,
391
+ ...d,
392
+ style: f || d.style
348
393
  })
349
394
  };
350
395
  }
351
- function wgs84ToMercator(e) {
352
- return transform(e, EPSG_4326, EPSG_3857);
396
+ function wgs84ToMercator(a) {
397
+ return transform(a, EPSG_4326, EPSG_3857);
353
398
  }
354
399
  const EPSG_4326ToEPSG_3857 = wgs84ToMercator;
355
- function mercatorToWgs84(e) {
356
- return transform(e, EPSG_3857, EPSG_4326);
400
+ function mercatorToWgs84(a) {
401
+ return transform(a, EPSG_3857, EPSG_4326);
357
402
  }
358
403
  const EPSG_3857ToEPSG_4326 = mercatorToWgs84;
359
- function wgs84ExtentToMercator(e) {
360
- return transformExtent(e, EPSG_4326, EPSG_3857);
404
+ function wgs84ExtentToMercator(a) {
405
+ return transformExtent(a, EPSG_4326, EPSG_3857);
361
406
  }
362
407
  const EPSG_4326ExtentToEPSG_3857 = wgs84ExtentToMercator;
363
- function mercatorExtentToWgs84(e) {
364
- return transformExtent(e, EPSG_3857, EPSG_4326);
408
+ function mercatorExtentToWgs84(a) {
409
+ return transformExtent(a, EPSG_3857, EPSG_4326);
365
410
  }
366
411
  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
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
376
421
  });
377
- b.addLayer(j);
378
- let M = new Draw({
379
- source: D,
380
- 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,
381
426
  type: "LineString"
382
427
  });
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);
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);
394
439
  });
395
- let L = () => {
396
- F.forEach((e) => {
397
- b.removeOverlay(e);
398
- }), F.clear();
440
+ let D = () => {
441
+ T.forEach((a) => {
442
+ u.removeOverlay(a);
443
+ }), T.clear();
399
444
  };
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);
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);
407
452
  });
408
- let T = new Overlay({
409
- position: C,
453
+ let h = new Overlay({
454
+ position: p,
410
455
  positioning: "center-center",
411
- element: w
456
+ element: m
412
457
  });
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)));
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)));
419
464
  });
420
- let T = new Overlay({
421
- position: S,
465
+ let h = new Overlay({
466
+ position: f,
422
467
  positioning: "top-center",
423
468
  offset: [0, -30],
424
- element: w
469
+ element: m
425
470
  });
426
- F.add(T), b.addOverlay(T);
471
+ T.add(h), u.addOverlay(h);
427
472
  });
428
473
  });
429
- }), M.on("change:active", () => {
430
- S.value = M.getActive();
431
- }), D.on("change", () => {
432
- C.value = D.getFeatures();
474
+ }), S.on("change:active", () => {
475
+ f.value = S.getActive();
476
+ }), _.on("change", () => {
477
+ p.value = _.getFeatures();
433
478
  });
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);
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);
445
490
  });
446
- }, H = () => {
447
- V(x.defaultCoordinates || []);
491
+ }, M = () => {
492
+ j(d.defaultCoordinates || []);
448
493
  };
449
- return H(), onUnmounted(() => {
450
- R();
494
+ return M(), onUnmounted(() => {
495
+ O();
451
496
  }), {
452
- inDraw: S,
453
- start: z,
454
- stop: B,
497
+ inDraw: f,
498
+ start: k,
499
+ stop: A,
455
500
  clear: () => {
456
- D.clear(), B();
501
+ _.clear(), A();
457
502
  },
458
- setFeatures: V,
459
- reset: H,
460
- features: C,
461
- coordinates: E,
462
- destroy: R
503
+ setFeatures: j,
504
+ reset: M,
505
+ features: p,
506
+ coordinates: g,
507
+ destroy: O
463
508
  };
464
509
  }
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
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
470
515
  });
471
- b.addLayer(j);
472
- let M = new Draw({
473
- source: A,
474
- 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) || _,
475
520
  type: "Polygon"
476
521
  });
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);
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);
488
533
  });
489
- let L = () => {
490
- F.forEach((e) => {
491
- b.removeOverlay(e);
492
- }), F.clear();
534
+ let D = () => {
535
+ T.forEach((a) => {
536
+ u.removeOverlay(a);
537
+ }), T.clear();
493
538
  };
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);
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);
499
544
  });
500
- let T = new Overlay({
501
- position: C,
545
+ let h = new Overlay({
546
+ position: p,
502
547
  positioning: "center-center",
503
- element: w
548
+ element: m
504
549
  });
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)]));
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)]));
511
556
  });
512
- let T = new Overlay({
513
- position: S,
557
+ let h = new Overlay({
558
+ position: f,
514
559
  positioning: "top-center",
515
560
  offset: [0, -30],
516
- element: w
561
+ element: m
517
562
  });
518
- F.add(T), b.addOverlay(T);
563
+ T.add(h), u.addOverlay(h);
519
564
  });
520
565
  });
521
- }), M.on("change:active", () => {
522
- S.value = M.getActive();
523
- }), A.on("change", () => {
524
- C.value = A.getFeatures();
566
+ }), S.on("change:active", () => {
567
+ f.value = S.getActive();
568
+ }), b.on("change", () => {
569
+ p.value = b.getFeatures();
525
570
  });
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);
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);
539
584
  });
540
585
  });
541
- }, H = () => {
542
- V(x.defaultCoordinates);
586
+ }, M = () => {
587
+ j(d.defaultCoordinates);
543
588
  };
544
- return H(), onUnmounted(() => {
545
- R();
589
+ return M(), onUnmounted(() => {
590
+ O();
546
591
  }), {
547
- inDraw: S,
548
- start: z,
549
- stop: B,
592
+ inDraw: f,
593
+ start: k,
594
+ stop: A,
550
595
  clear: () => {
551
- A.clear(), B();
596
+ b.clear(), A();
552
597
  },
553
- setFeatures: V,
554
- reset: H,
555
- features: C,
556
- coordinates: E,
557
- destroy: R
598
+ setFeatures: j,
599
+ reset: M,
600
+ features: p,
601
+ coordinates: g,
602
+ destroy: O
558
603
  };
559
604
  }
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
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
566
611
  });
567
- return watch(b, (b) => {
568
- if (I.setMap(null), b) {
569
- let b = toValue(e.olMap);
570
- 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);
571
616
  }
572
617
  }, {
573
618
  immediate: !0,
574
619
  deep: !0
575
- }), { showGraticule: b };
620
+ }), { showGraticule: u };
576
621
  }
577
- function usePointermove(b, x) {
578
- 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({
579
624
  x: 0,
580
625
  y: 0
581
- }), T = ref(), E = ref(), D = ref({
626
+ }), _ = ref(), y = ref(), b = ref({
582
627
  x: 0,
583
628
  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;
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;
592
638
  });
593
- return b.length === 0 ? null : b.sort((e, b) => (b.priority ?? 0) - (e.priority ?? 0))[0];
594
639
  }
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();
640
+ function j(a) {
641
+ if (!E()) {
642
+ M();
602
643
  return;
603
644
  }
604
- T.value = C;
605
- let j = {
606
- map: P,
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();
651
+ return;
652
+ }
653
+ if (!m && _.value && _.value.getId() === f.getId()) return;
654
+ _.value = f;
655
+ let v = {
656
+ map: D,
607
657
  position: {
608
- x: e.clientX,
609
- y: e.clientY
658
+ x: a.clientX,
659
+ y: a.clientY
610
660
  },
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 };
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 };
618
668
  }
619
- if (!M) {
620
- R();
669
+ if (!x) {
670
+ M();
621
671
  return;
622
672
  }
623
- D.value = {
624
- x: M.offset?.x ?? 0,
625
- y: M.offset?.y ?? 0
673
+ b.value = {
674
+ x: x.offset?.x ?? 0,
675
+ y: x.offset?.y ?? 0
626
676
  };
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
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
634
684
  };
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;
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;
643
689
  }
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
- }
690
+ function M() {
691
+ h.value = !1, _.value = void 0, O && O.style.cursor !== k && (O.style.cursor = k);
649
692
  }
650
- function z(e) {
651
- if (!e) return;
652
- let b = e.getViewport();
653
- b.addEventListener("pointermove", L), b.addEventListener("pointerout", R);
693
+ function N(a) {
694
+ a.addEventListener("pointermove", j);
654
695
  }
655
- function B(e) {
656
- if (!e) return;
657
- let b = e.getViewport();
658
- b.removeEventListener("pointermove", L), b.removeEventListener("pointerout", R);
696
+ function P(a) {
697
+ a.removeEventListener("pointermove", j);
659
698
  }
660
- return watch(() => toValue(b), (e, b) => {
661
- 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));
662
701
  }, { immediate: !0 }), onBeforeUnmount(() => {
663
- B(P);
702
+ O && P(O);
664
703
  }), {
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
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
673
712
  };
674
713
  }
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);
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);
680
719
  });
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);
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);
686
725
  });
687
726
  });
688
- }, { immediate: !0 }), { visibleLayerName: b };
727
+ }, { immediate: !0 }), { visibleLayerName: u };
689
728
  }
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 };
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 };