@summeruse/ol 0.3.0 → 0.3.2

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