@summeruse/ol 0.1.7 → 0.2.0-alpha.0

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