@summeruse/ol 0.2.0-alpha.0 → 0.2.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/index.js +689 -816
  3. package/es/components/index.mjs +3 -0
  4. package/es/components/ol-map/index.mjs +3 -0
  5. package/es/components/ol-map/index.vue_vue_type_script_setup_true_lang.mjs +114 -0
  6. package/es/components/ol-map/index2.mjs +2 -0
  7. package/es/components/ol-map/props.mjs +5 -8
  8. package/es/composables/common/index.mjs +4 -6
  9. package/es/composables/index.mjs +6 -0
  10. package/es/composables/useContextmenu/index.mjs +70 -76
  11. package/es/composables/useDrawLineString/index.mjs +104 -112
  12. package/es/composables/useDrawPolygon/index.mjs +105 -115
  13. package/es/composables/useGraticule/index.mjs +22 -36
  14. package/es/composables/usePointermove/index.mjs +100 -99
  15. package/es/composables/useSwitchBaseLayer/index.mjs +16 -24
  16. package/es/constants/distance.mjs +2 -4
  17. package/es/constants/projection.mjs +2 -7
  18. package/es/index.mjs +19 -76
  19. package/es/utils/distance/index.mjs +6 -9
  20. package/es/utils/feature/index.mjs +66 -82
  21. package/es/utils/index.d.ts +0 -3
  22. package/es/utils/index.mjs +5 -0
  23. package/es/utils/layer/index.d.ts +1 -1
  24. package/es/utils/layer/index.mjs +47 -60
  25. package/es/utils/projection/index.mjs +15 -24
  26. package/es/utils/style/index.mjs +27 -31
  27. package/lib/_virtual/rolldown_runtime.js +1 -0
  28. package/lib/components/index.js +1 -0
  29. package/lib/components/ol-map/index.js +1 -0
  30. package/lib/components/ol-map/index.vue_vue_type_script_setup_true_lang.js +1 -0
  31. package/lib/components/ol-map/index2.js +1 -0
  32. package/lib/components/ol-map/props.js +1 -1
  33. package/lib/composables/common/index.js +1 -1
  34. package/lib/composables/index.js +1 -0
  35. package/lib/composables/useContextmenu/index.js +1 -1
  36. package/lib/composables/useDrawLineString/index.js +1 -1
  37. package/lib/composables/useDrawPolygon/index.js +1 -1
  38. package/lib/composables/useGraticule/index.js +1 -1
  39. package/lib/composables/usePointermove/index.js +1 -1
  40. package/lib/composables/useSwitchBaseLayer/index.js +1 -1
  41. package/lib/constants/distance.js +1 -1
  42. package/lib/constants/projection.js +1 -1
  43. package/lib/index.js +1 -1
  44. package/lib/utils/distance/index.js +1 -1
  45. package/lib/utils/feature/index.js +1 -1
  46. package/lib/utils/index.d.ts +0 -3
  47. package/lib/utils/index.js +1 -0
  48. package/lib/utils/layer/index.d.ts +1 -1
  49. package/lib/utils/layer/index.js +1 -1
  50. package/lib/utils/projection/index.js +1 -1
  51. package/lib/utils/style/index.js +1 -1
  52. package/package.json +4 -11
  53. package/es/components/ol-map/index.vue.mjs +0 -124
  54. package/es/components/ol-map/index.vue2.mjs +0 -4
  55. package/es/utils/calculate/index.d.ts +0 -24
  56. package/es/utils/calculate/index.mjs +0 -29
  57. package/es/utils/calculate/index.test.d.ts +0 -1
  58. package/es/utils/format/index.d.ts +0 -4
  59. package/es/utils/format/index.mjs +0 -10
  60. package/es/utils/realCircle/index.d.ts +0 -9
  61. package/es/utils/realCircle/index.mjs +0 -10
  62. package/lib/components/ol-map/index.vue.js +0 -1
  63. package/lib/components/ol-map/index.vue2.js +0 -1
  64. package/lib/utils/calculate/index.d.ts +0 -24
  65. package/lib/utils/calculate/index.js +0 -1
  66. package/lib/utils/calculate/index.test.d.ts +0 -1
  67. package/lib/utils/format/index.d.ts +0 -4
  68. package/lib/utils/format/index.js +0 -1
  69. package/lib/utils/realCircle/index.d.ts +0 -9
  70. package/lib/utils/realCircle/index.js +0 -1
@@ -1,116 +1,106 @@
1
- import { Overlay as z, Feature as W } from "ol";
2
- import { Polygon as x } from "ol/geom";
3
- import { Draw as _, Modify as j } from "ol/interaction";
4
- import q from "ol/layer/Vector";
5
- import B from "ol/source/Vector";
6
- import { ref as A, computed as H, onMounted as J, render as I, onUnmounted as K } from "vue";
7
- import { getExtentCenter as N } from "../../utils/calculate/index.mjs";
8
- import { createStyle as o } from "../../utils/style/index.mjs";
9
- import "ol/layer";
10
- import "ol/source";
11
- import { mercatorExtentToWgs84 as Q, wgs84ToMercator as R } from "../../utils/projection/index.mjs";
12
- import { createToolTipElement as P } from "../common/index.mjs";
13
- function me(n, e) {
14
- const i = A(!0), m = A([]), b = H(() => m.value.map((r) => r.getGeometry().getCoordinates())), s = e.styleOptions ? o(e.styleOptions) : e == null ? void 0 : e.style, t = new B(), g = new q({
15
- source: t,
16
- style: s,
17
- zIndex: e == null ? void 0 : e.zIndex
18
- });
19
- n.addLayer(g);
20
- const C = e.drawStyleOptions ? o(e.drawStyleOptions) : e == null ? void 0 : e.drawStyle, a = new _({
21
- source: t,
22
- style: C || s,
23
- type: "Polygon"
24
- });
25
- a.setActive(!1);
26
- const T = e.modifyStyleOptions ? o(e.modifyStyleOptions) : e == null ? void 0 : e.modifyStyle, v = new j({
27
- source: t,
28
- style: T || s
29
- }), d = /* @__PURE__ */ new Set();
30
- n.addInteraction(a), J(() => {
31
- n.addInteraction(v);
32
- }), t.on("addfeature", () => {
33
- e.size && t.getFeatures().length >= e.size && a.setActive(!1);
34
- }), t.on("removefeature", () => {
35
- e.size && t.getFeatures().length < e.size && a.setActive(!0);
36
- });
37
- const w = () => {
38
- d.forEach((r) => {
39
- n.removeOverlay(r);
40
- }), d.clear();
41
- };
42
- t.on("change", () => {
43
- w(), t.getFeatures().forEach((r) => {
44
- const y = r.getGeometry(), c = N(Q(y.getExtent()));
45
- let l = document.createElement("div");
46
- e.deleteFeatureLabel ? I(e.deleteFeatureLabel, l) : l = P("删除区域"), l.addEventListener("click", () => {
47
- t.removeFeature(r);
48
- });
49
- const F = new z({
50
- position: R(c),
51
- positioning: "center-center",
52
- element: l
53
- });
54
- d.add(F), n.addOverlay(F);
55
- const u = y.getCoordinates()[0];
56
- u.length < 3 || u.forEach((k, V) => {
57
- let f = document.createElement("div");
58
- e.deletePointLabel ? I(e.deletePointLabel, f) : f = P("删除点"), f.addEventListener("click", () => {
59
- r.setGeometry(new x([u.filter((X, U) => U !== V)]));
60
- });
61
- const L = new z({
62
- position: k,
63
- positioning: "top-center",
64
- offset: [0, -30],
65
- element: f
66
- });
67
- d.add(L), n.addOverlay(L);
68
- });
69
- });
70
- }), a.on("change:active", () => {
71
- i.value = a.getActive();
72
- }), t.on("change", () => {
73
- m.value = t.getFeatures();
74
- });
75
- const h = () => {
76
- w(), n.removeLayer(g), n.removeInteraction(a), n.removeInteraction(v);
77
- }, D = () => {
78
- e.size && m.value.length >= e.size || a.setActive(!0);
79
- }, E = () => {
80
- a.setActive(!1);
81
- }, S = (r) => {
82
- t.clear(), r == null || r.forEach((y) => {
83
- y.forEach((c) => {
84
- if (c.length < 2)
85
- return;
86
- c[0] !== c[c.length - 1] && c.push(c[0]);
87
- const l = new W({
88
- geometry: new x([c])
89
- });
90
- t.addFeature(l);
91
- });
92
- });
93
- }, O = () => {
94
- S(e.defaultCoordinates);
95
- };
96
- O();
97
- const G = () => {
98
- t.clear(), E();
99
- };
100
- return K(() => {
101
- h();
102
- }), {
103
- inDraw: i,
104
- start: D,
105
- stop: E,
106
- clear: G,
107
- setFeatures: S,
108
- reset: O,
109
- features: m,
110
- coordinates: b,
111
- destroy: h
112
- };
1
+ import { createStyle } from "../../utils/style/index.mjs";
2
+ import "../../utils/index.mjs";
3
+ import { createToolTipElement } from "../common/index.mjs";
4
+ import { computed, onMounted, onUnmounted, ref, render } from "vue";
5
+ import { Feature, Overlay } from "ol";
6
+ import { Draw, Modify } from "ol/interaction";
7
+ import { getCenter } from "ol/extent";
8
+ import { Polygon } from "ol/geom";
9
+ import VectorLayer from "ol/layer/Vector";
10
+ import VectorSource from "ol/source/Vector";
11
+ function useDrawPolygon(h, g) {
12
+ let _ = ref(!0), v = ref([]), y = computed(() => v.value.map((e) => e.getGeometry().getCoordinates())), b = g.styleOptions ? createStyle(g.styleOptions) : g?.style, x = new VectorSource(), S = new VectorLayer({
13
+ source: x,
14
+ style: b,
15
+ zIndex: g?.zIndex
16
+ });
17
+ h.addLayer(S);
18
+ let C = new Draw({
19
+ source: x,
20
+ style: (g.drawStyleOptions ? createStyle(g.drawStyleOptions) : g?.drawStyle) || b,
21
+ type: "Polygon"
22
+ });
23
+ C.setActive(!1);
24
+ let w = new Modify({
25
+ source: x,
26
+ style: (g.modifyStyleOptions ? createStyle(g.modifyStyleOptions) : g?.modifyStyle) || b
27
+ }), T = /* @__PURE__ */ new Set();
28
+ h.addInteraction(C), onMounted(() => {
29
+ h.addInteraction(w);
30
+ }), x.on("addfeature", () => {
31
+ g.size && x.getFeatures().length >= g.size && C.setActive(!1);
32
+ }), x.on("removefeature", () => {
33
+ g.size && x.getFeatures().length < g.size && C.setActive(!0);
34
+ });
35
+ let E = () => {
36
+ T.forEach((e) => {
37
+ h.removeOverlay(e);
38
+ }), T.clear();
39
+ };
40
+ x.on("change", () => {
41
+ E(), x.getFeatures().forEach((e) => {
42
+ let u = e.getGeometry(), d = getCenter(u.getExtent()), f = document.createElement("div");
43
+ g.deleteFeatureLabel ? render(g.deleteFeatureLabel, f) : f = createToolTipElement("删除区域"), f.addEventListener("click", () => {
44
+ x.removeFeature(e);
45
+ });
46
+ let p = new Overlay({
47
+ position: d,
48
+ positioning: "center-center",
49
+ element: f
50
+ });
51
+ T.add(p), h.addOverlay(p);
52
+ let m = u.getCoordinates()[0];
53
+ m.length < 3 || m.forEach((u, d) => {
54
+ let f = document.createElement("div");
55
+ g.deletePointLabel ? render(g.deletePointLabel, f) : f = createToolTipElement("删除点"), f.addEventListener("click", () => {
56
+ e.setGeometry(new Polygon([m.filter((e, l) => l !== d)]));
57
+ });
58
+ let p = new Overlay({
59
+ position: u,
60
+ positioning: "top-center",
61
+ offset: [0, -30],
62
+ element: f
63
+ });
64
+ T.add(p), h.addOverlay(p);
65
+ });
66
+ });
67
+ }), C.on("change:active", () => {
68
+ _.value = C.getActive();
69
+ }), x.on("change", () => {
70
+ v.value = x.getFeatures();
71
+ });
72
+ let D = () => {
73
+ E(), h.removeLayer(S), h.removeInteraction(C), h.removeInteraction(w);
74
+ }, O = () => {
75
+ g.size && v.value.length >= g.size || C.setActive(!0);
76
+ }, k = () => {
77
+ C.setActive(!1);
78
+ }, A = (e) => {
79
+ x.clear(), e?.forEach((e) => {
80
+ e.forEach((e) => {
81
+ if (e.length < 2) return;
82
+ e[0] !== e[e.length - 1] && e.push(e[0]);
83
+ let l = new Feature({ geometry: new Polygon([e]) });
84
+ x.addFeature(l);
85
+ });
86
+ });
87
+ }, j = () => {
88
+ A(g.defaultCoordinates);
89
+ };
90
+ return j(), onUnmounted(() => {
91
+ D();
92
+ }), {
93
+ inDraw: _,
94
+ start: O,
95
+ stop: k,
96
+ clear: () => {
97
+ x.clear(), k();
98
+ },
99
+ setFeatures: A,
100
+ reset: j,
101
+ features: v,
102
+ coordinates: y,
103
+ destroy: D
104
+ };
113
105
  }
114
- export {
115
- me as useDrawPolygon
116
- };
106
+ export { useDrawPolygon };
@@ -1,37 +1,23 @@
1
- import { Graticule as O } from "ol/layer";
2
- import { Stroke as w } from "ol/style";
3
- import { ref as x, watch as d, toValue as k } from "vue";
4
- import "@turf/turf";
5
- import "ol";
6
- import "ol/geom";
7
- import { createTextStyle as e } from "../../utils/style/index.mjs";
8
- import "ol/layer/Vector";
9
- import "ol/source";
10
- import "ol/source/Vector";
11
- import "ol/proj";
12
- function B(t) {
13
- const l = x(t.defaultShow || !1), { strokeStyleOption: o, strokeStyle: m, labelStyleOption: r, latLabelStyleOption: a, lonLabelStyleOption: i, latLabelStyle: s, lonLabelStyle: u, ...S } = t.graticuleOptions || {}, y = o ? new w(o) : m, n = r ? e(r) : void 0, b = (a ? e(a) : s) || n, f = (i ? e(i) : u) || n, p = new O({
14
- ...S,
15
- strokeStyle: y,
16
- latLabelStyle: b,
17
- lonLabelStyle: f
18
- });
19
- return d(
20
- l,
21
- (L) => {
22
- if (p.setMap(null), L) {
23
- const c = k(t.olMap);
24
- c && p.setMap(c);
25
- }
26
- },
27
- {
28
- immediate: !0,
29
- deep: !0
30
- }
31
- ), {
32
- showGraticule: l
33
- };
1
+ import { createTextStyle } from "../../utils/style/index.mjs";
2
+ import "../../utils/index.mjs";
3
+ import { ref, toValue, watch } from "vue";
4
+ import { Stroke } from "ol/style";
5
+ import { Graticule } from "ol/layer";
6
+ function useGraticule(o) {
7
+ let s = ref(o.defaultShow || !1), { strokeStyleOption: c, strokeStyle: l, labelStyleOption: u, latLabelStyleOption: d, lonLabelStyleOption: f, latLabelStyle: p, lonLabelStyle: m,...h } = o.graticuleOptions || {}, g = c ? new Stroke(c) : l, _ = u ? createTextStyle(u) : void 0, v = (d ? createTextStyle(d) : p) || _, y = (f ? createTextStyle(f) : m) || _, b = new Graticule({
8
+ ...h,
9
+ strokeStyle: g,
10
+ latLabelStyle: v,
11
+ lonLabelStyle: y
12
+ });
13
+ return watch(s, (e) => {
14
+ if (b.setMap(null), e) {
15
+ let e = toValue(o.olMap);
16
+ e && b.setMap(e);
17
+ }
18
+ }, {
19
+ immediate: !0,
20
+ deep: !0
21
+ }), { showGraticule: s };
34
22
  }
35
- export {
36
- B as useGraticule
37
- };
23
+ export { useGraticule };
@@ -1,100 +1,101 @@
1
- import { getCenter as D } from "ol/extent";
2
- import { ref as c, computed as s, watch as H, toValue as A, onBeforeUnmount as I } from "vue";
3
- function O(G, M) {
4
- const d = c(!1), l = c({ x: 0, y: 0 }), y = c(), h = c(), x = c({ x: 0, y: 0 }), w = c(), P = c(), R = s(() => ({
5
- x: l.value.x + x.value.x,
6
- y: l.value.y + x.value.y
7
- }));
8
- let t, f = "";
9
- function U(e) {
10
- const v = A(M).filter((n) => {
11
- const r = n.visible;
12
- return typeof r == "function" ? r(e) : r ?? !0;
13
- });
14
- return v.length === 0 ? null : v.sort((n, r) => (r.priority ?? 0) - (n.priority ?? 0))[0];
15
- }
16
- function b(e) {
17
- var X, Y;
18
- if (!t)
19
- return;
20
- const o = t.getEventCoordinate(e);
21
- w.value = o;
22
- const v = t.getEventPixel(e);
23
- let n, r;
24
- if (t.forEachFeatureAtPixel(v, (u, p) => (n = u, r = p, !0)), !n) {
25
- a();
26
- return;
27
- }
28
- y.value = n;
29
- const g = {
30
- map: t,
31
- position: { x: e.clientX, y: e.clientY },
32
- coordinate: o,
33
- feature: n,
34
- layer: r
35
- }, i = U(g);
36
- if (i) {
37
- const { content: u, cursor: p, visible: E, fixedFeatureCenter: B, offset: S, priority: J, ...z } = i;
38
- P.value = { ...z };
39
- }
40
- if (!i) {
41
- a();
42
- return;
43
- }
44
- const j = ((X = i.offset) == null ? void 0 : X.x) ?? 0, k = ((Y = i.offset) == null ? void 0 : Y.y) ?? 0;
45
- x.value = { x: j, y: k };
46
- const q = i.fixedFeatureCenter ?? !0, V = n.getGeometry();
47
- if (q && V) {
48
- const u = V.getExtent(), p = D(u), E = t.getPixelFromCoordinate(p), { top: B, left: S } = t.getViewport().getBoundingClientRect();
49
- l.value.x = E[0] + S, l.value.y = E[1] + B;
50
- } else
51
- l.value = { x: e.clientX, y: e.clientY };
52
- const m = i.content;
53
- h.value = typeof m == "function" ? () => m(g) : m;
54
- const C = i.cursor, L = typeof C == "function" ? C(g) : C;
55
- if (L && t) {
56
- const u = t.getViewport();
57
- f || (f = u.style.cursor), u.style.cursor = L;
58
- }
59
- d.value = !0;
60
- }
61
- function a() {
62
- if (d.value = !1, y.value = void 0, t && f !== void 0) {
63
- const e = t.getViewport();
64
- e.style.cursor = f, f = "";
65
- }
66
- }
67
- function _(e) {
68
- if (!e)
69
- return;
70
- const o = e.getViewport();
71
- o.addEventListener("pointermove", b), o.addEventListener("pointerout", a);
72
- }
73
- function F(e) {
74
- if (!e)
75
- return;
76
- const o = e.getViewport();
77
- o.removeEventListener("pointermove", b), o.removeEventListener("pointerout", a);
78
- }
79
- return H(
80
- () => A(G),
81
- (e, o) => {
82
- o !== e && (F(o), _(e), t = e);
83
- },
84
- { immediate: !0 }
85
- ), I(() => {
86
- F(t);
87
- }), {
88
- visible: s(() => d.value),
89
- position: s(() => R.value),
90
- originalPosition: s(() => l.value),
91
- feature: s(() => y.value),
92
- content: s(() => h.value),
93
- coordinate: s(() => w.value),
94
- option: s(() => P.value),
95
- hide: a
96
- };
1
+ import { computed, onBeforeUnmount, ref, toValue, watch } from "vue";
2
+ import { getCenter } from "ol/extent";
3
+ function usePointermove(o, s) {
4
+ let c = ref(!1), l = ref({
5
+ x: 0,
6
+ y: 0
7
+ }), u = ref(), d = ref(), f = ref({
8
+ x: 0,
9
+ y: 0
10
+ }), p = ref(), m = ref(), h = computed(() => ({
11
+ x: l.value.x + f.value.x,
12
+ y: l.value.y + f.value.y
13
+ })), g, _ = "";
14
+ function v(e) {
15
+ let t = toValue(s).filter((t) => {
16
+ let n = t.visible;
17
+ return typeof n == "function" ? n(e) : n ?? !0;
18
+ });
19
+ return t.length === 0 ? null : t.sort((e, t) => (t.priority ?? 0) - (e.priority ?? 0))[0];
20
+ }
21
+ function y(e) {
22
+ if (!g) return;
23
+ let t = g.getEventCoordinate(e);
24
+ p.value = t;
25
+ let n = g.getEventPixel(e), r, i;
26
+ if (g.forEachFeatureAtPixel(n, (e, t) => (r = e, i = t, !0)), !r) {
27
+ b();
28
+ return;
29
+ }
30
+ u.value = r;
31
+ let o = {
32
+ map: g,
33
+ position: {
34
+ x: e.clientX,
35
+ y: e.clientY
36
+ },
37
+ coordinate: t,
38
+ feature: r,
39
+ layer: i
40
+ }, s = v(o);
41
+ if (s) {
42
+ let { content: e, cursor: t, visible: n, fixedFeatureCenter: r, offset: i, priority: a,...o } = s;
43
+ m.value = { ...o };
44
+ }
45
+ if (!s) {
46
+ b();
47
+ return;
48
+ }
49
+ f.value = {
50
+ x: s.offset?.x ?? 0,
51
+ y: s.offset?.y ?? 0
52
+ };
53
+ let h = s.fixedFeatureCenter ?? !0, y = r.getGeometry();
54
+ if (h && y) {
55
+ let e = getCenter(y.getExtent()), t = g.getPixelFromCoordinate(e), { top: n, left: r } = g.getViewport().getBoundingClientRect();
56
+ l.value.x = t[0] + r, l.value.y = t[1] + n;
57
+ } else l.value = {
58
+ x: e.clientX,
59
+ y: e.clientY
60
+ };
61
+ let x = s.content;
62
+ d.value = typeof x == "function" ? () => x(o) : x;
63
+ let S = s.cursor, C = typeof S == "function" ? S(o) : S;
64
+ if (C && g) {
65
+ let e = g.getViewport();
66
+ _ ||= e.style.cursor, e.style.cursor = C;
67
+ }
68
+ c.value = !0;
69
+ }
70
+ function b() {
71
+ if (c.value = !1, u.value = void 0, g && _ !== void 0) {
72
+ let e = g.getViewport();
73
+ e.style.cursor = _, _ = "";
74
+ }
75
+ }
76
+ function x(e) {
77
+ if (!e) return;
78
+ let t = e.getViewport();
79
+ t.addEventListener("pointermove", y), t.addEventListener("pointerout", b);
80
+ }
81
+ function S(e) {
82
+ if (!e) return;
83
+ let t = e.getViewport();
84
+ t.removeEventListener("pointermove", y), t.removeEventListener("pointerout", b);
85
+ }
86
+ return watch(() => toValue(o), (e, t) => {
87
+ t !== e && (S(t), x(e), g = e);
88
+ }, { immediate: !0 }), onBeforeUnmount(() => {
89
+ S(g);
90
+ }), {
91
+ visible: computed(() => c.value),
92
+ position: computed(() => h.value),
93
+ originalPosition: computed(() => l.value),
94
+ feature: computed(() => u.value),
95
+ content: computed(() => d.value),
96
+ coordinate: computed(() => p.value),
97
+ option: computed(() => m.value),
98
+ hide: b
99
+ };
97
100
  }
98
- export {
99
- O as usePointermove
100
- };
101
+ export { usePointermove };
@@ -1,25 +1,17 @@
1
- import { ref as t, watch as o } from "vue";
2
- function f(e) {
3
- const r = t(e.defaultLayerName || Object.keys(e.layers)[0]);
4
- return Object.values(e.layers).forEach((s) => {
5
- s.forEach((a) => {
6
- e.olMap.addLayer(a);
7
- });
8
- }), o(
9
- r,
10
- () => {
11
- Object.entries(e.layers).forEach(([s, a]) => {
12
- const c = s === r.value;
13
- a.forEach((i) => {
14
- i.setVisible(c);
15
- });
16
- });
17
- },
18
- {
19
- immediate: !0
20
- }
21
- ), { visibleLayerName: r };
1
+ import { ref, watch } from "vue";
2
+ function useSwitchBaseLayer(n) {
3
+ let r = ref(n.defaultLayerName || Object.keys(n.layers)[0]);
4
+ return Object.values(n.layers).forEach((e) => {
5
+ e.forEach((e) => {
6
+ n.olMap.addLayer(e);
7
+ });
8
+ }), watch(r, () => {
9
+ Object.entries(n.layers).forEach(([e, t]) => {
10
+ let n = e === r.value;
11
+ t.forEach((e) => {
12
+ e.setVisible(n);
13
+ });
14
+ });
15
+ }, { immediate: !0 }), { visibleLayerName: r };
22
16
  }
23
- export {
24
- f as useSwitchBaseLayer
25
- };
17
+ export { useSwitchBaseLayer };
@@ -1,4 +1,2 @@
1
- const o = 1852;
2
- export {
3
- o as ONE_NM
4
- };
1
+ const ONE_NM = 1852;
2
+ export { ONE_NM };
@@ -1,7 +1,2 @@
1
- const o = "EPSG:3857", t = "EPSG:4326", c = o, n = t;
2
- export {
3
- o as EPSG_3857,
4
- t as EPSG_4326,
5
- n as WGS84Projection,
6
- c as WebMercatorProjection
7
- };
1
+ const EPSG_3857 = "EPSG:3857", EPSG_4326 = "EPSG:4326", WebMercatorProjection = EPSG_3857, WGS84Projection = EPSG_4326;
2
+ export { EPSG_3857, EPSG_4326, WGS84Projection, WebMercatorProjection };