@summeruse/ol 0.1.0 → 0.1.1-beta.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.
package/CHANGELOG.md CHANGED
@@ -1,15 +1,21 @@
1
1
  # @summeruse/ol
2
2
 
3
- ## 0.1.0
3
+ ## 0.1.1-beta.1
4
4
 
5
- ### Minor Changes
5
+ ### Patch Changes
6
6
 
7
- - 更新 0.1.0 正式版
7
+ - e651b52: 添加经纬度标签样式支持
8
8
 
9
- ## 0.0.1
9
+ ## 0.1.1-beta.0
10
10
 
11
11
  ### Patch Changes
12
12
 
13
+ - c26ae5a: 重构 useGraticule 以支持更灵活的样式配置
14
+
15
+ ## 0.1.0
16
+
17
+ ### Minor Changes
18
+
13
19
  - 8e34a3f: 添加 useDrawLineString useDrawPolygon
14
20
  - b6b95dc: 添加创建几何要素的实用函数
15
21
  - 58c1e99: 添加坐标系相关函数的注释
package/dist/index.js CHANGED
@@ -1,88 +1,88 @@
1
- import { defineComponent as Y, ref as v, onMounted as D, createBlock as he, openBlock as U, unref as R, shallowRef as Ce, withCtx as ke, createVNode as Fe, watch as f, provide as Me, createElementBlock as Ae, renderSlot as Te, computed as pe, render as z, onUnmounted as Se, toValue as _e } from "vue";
2
- import { NDropdown as Re, NPopover as ze } from "naive-ui";
3
- import { RenderVNode as Ze } from "@summeruse/common";
4
- import { Map as Ge, View as Be, Feature as H, Overlay as Z } from "ol";
5
- import { Zoom as ne, Attribution as re, Rotate as oe, FullScreen as ie, OverviewMap as ae, ScaleLine as ce } from "ol/control";
6
- import { DragPan as le, MouseWheelZoom as se, DoubleClickZoom as ue, PinchRotate as fe, PinchZoom as de, DragRotate as me, KeyboardPan as ye, KeyboardZoom as we, Draw as Ee, Modify as Oe } from "ol/interaction";
7
- import { Point as De, LineString as W, Polygon as $, Circle as Ne, MultiPoint as je, MultiLineString as Ve, MultiPolygon as We } from "ol/geom";
8
- import Q from "ol/layer/Vector";
9
- import q from "ol/source/Vector";
10
- import { destination as $e, lineString as Xe, length as Ke, area as Ye, polygon as Ue, bearing as He, midpoint as Qe } from "@turf/turf";
11
- import { Circle as qe, Stroke as F, Fill as G, Text as Je, Icon as et, Style as tt } from "ol/style";
12
- import { Tile as J, Graticule as ve } from "ol/layer";
13
- import { XYZ as nt, BingMaps as rt, OSM as ot } from "ol/source";
14
- import { transform as xe, transformExtent as be } from "ol/proj";
15
- const Rt = /* @__PURE__ */ Y({
1
+ import { defineComponent as U, ref as g, onMounted as N, createBlock as pe, openBlock as H, unref as Z, shallowRef as Ce, withCtx as ke, createVNode as Fe, watch as d, provide as Me, createElementBlock as Te, renderSlot as Ae, computed as Se, render as z, onUnmounted as he, toValue as _e } from "vue";
2
+ import { NDropdown as Re, NPopover as Ze } from "naive-ui";
3
+ import { RenderVNode as ze } from "@summeruse/common";
4
+ import { Map as Ge, View as Be, Feature as Q, Overlay as G } from "ol";
5
+ import { Zoom as oe, Attribution as re, Rotate as ie, FullScreen as ae, OverviewMap as ce, ScaleLine as le } from "ol/control";
6
+ import { DragPan as se, MouseWheelZoom as ue, DoubleClickZoom as fe, PinchRotate as de, PinchZoom as me, DragRotate as ye, KeyboardPan as ve, KeyboardZoom as we, Draw as Oe, Modify as Ee } from "ol/interaction";
7
+ import { Point as De, LineString as $, Polygon as K, Circle as Ne, MultiPoint as je, MultiLineString as Ve, MultiPolygon as We } from "ol/geom";
8
+ import q from "ol/layer/Vector";
9
+ import J from "ol/source/Vector";
10
+ import { destination as $e, lineString as Ke, length as Xe, area as Ye, polygon as Ue, bearing as He, midpoint as Qe } from "@turf/turf";
11
+ import { Circle as qe, Stroke as T, Fill as B, Text as Je, Icon as et, Style as tt } from "ol/style";
12
+ import { Tile as ee, Graticule as nt } from "ol/layer";
13
+ import { XYZ as ot, BingMaps as rt, OSM as it } from "ol/source";
14
+ import { transform as be, transformExtent as xe } from "ol/proj";
15
+ const Rt = /* @__PURE__ */ U({
16
16
  __name: "index",
17
17
  props: {
18
18
  olMap: {},
19
19
  createOptions: { type: Function }
20
20
  },
21
21
  setup(t) {
22
- const e = t, { olMap: n } = e, i = v({
22
+ const e = t, { olMap: n } = e, a = g({
23
23
  visible: !1,
24
24
  x: 0,
25
25
  y: 0
26
26
  });
27
- function o() {
28
- i.value.visible = !1;
27
+ function r() {
28
+ a.value.visible = !1;
29
29
  }
30
- const a = v();
31
- D(() => {
32
- const d = n.getViewport();
33
- d && (d.oncontextmenu = (s) => {
30
+ const i = g();
31
+ N(() => {
32
+ const f = n.getViewport();
33
+ f && (f.oncontextmenu = (s) => {
34
34
  s.preventDefault();
35
- const l = n.getEventPixel(s), p = n.getEventCoordinate(s), w = n.getFeaturesAtPixel(l);
36
- a.value = e.createOptions({ event: s, pixel: l, coordinate: p, features: w }), i.value = {
35
+ const l = n.getEventPixel(s), w = n.getEventCoordinate(s), y = n.getFeaturesAtPixel(l);
36
+ i.value = e.createOptions({ event: s, pixel: l, coordinate: w, features: y }), a.value = {
37
37
  visible: !0,
38
38
  x: s.clientX,
39
39
  y: s.clientY
40
40
  };
41
41
  });
42
42
  });
43
- function c(d, s) {
43
+ function c(f, s) {
44
44
  const { onClick: l } = s;
45
- l && l(), i.value.visible = !1;
45
+ l && l(), a.value.visible = !1;
46
46
  }
47
- return (d, s) => (U(), he(R(Re), {
47
+ return (f, s) => (H(), pe(Z(Re), {
48
48
  placement: "bottom-start",
49
49
  trigger: "manual",
50
- show: a.value && a.value.length > 0 && i.value.visible,
51
- x: i.value.x,
52
- y: i.value.y,
53
- options: a.value,
54
- "on-clickoutside": o,
50
+ show: i.value && i.value.length > 0 && a.value.visible,
51
+ x: a.value.x,
52
+ y: a.value.y,
53
+ options: i.value,
54
+ "on-clickoutside": r,
55
55
  onSelect: c
56
56
  }, null, 8, ["show", "x", "y", "options"]));
57
57
  }
58
- }), zt = /* @__PURE__ */ Y({
58
+ }), Zt = /* @__PURE__ */ U({
59
59
  __name: "index",
60
60
  props: {
61
61
  olMap: {},
62
62
  createOptions: { type: Function }
63
63
  },
64
64
  setup(t) {
65
- const e = t, n = v({
65
+ const e = t, n = g({
66
66
  visible: !1,
67
67
  x: 0,
68
68
  y: 0
69
- }), i = Ce(), o = v("bottom-start"), a = v(!1), c = v(!1);
70
- return D(() => {
71
- var d;
72
- (d = e.olMap) == null || d.on("pointermove", (s) => {
73
- const l = e.olMap.getFeaturesAtPixel(s.pixel), { clientX: p, clientY: w } = s.originalEvent;
69
+ }), a = Ce(), r = g("bottom-start"), i = g(!1), c = g(!1);
70
+ return N(() => {
71
+ var f;
72
+ (f = e.olMap) == null || f.on("pointermove", (s) => {
73
+ const l = e.olMap.getFeaturesAtPixel(s.pixel), { clientX: w, clientY: y } = s.originalEvent;
74
74
  n.value.visible = !1;
75
75
  const m = e.createOptions({
76
76
  pixel: s.pixel,
77
77
  coordinate: s.coordinate,
78
78
  features: l
79
79
  });
80
- m && (i.value = m.content, o.value = m.placement || "bottom-start", c.value = m.showArrow || !1, a.value = m.raw || !1, n.value.visible = !0, n.value.x = p, n.value.y = w);
80
+ m && (a.value = m.content, r.value = m.placement || "bottom-start", c.value = m.showArrow || !1, i.value = m.raw || !1, n.value.visible = !0, n.value.x = w, n.value.y = y);
81
81
  });
82
- }), (d, s) => (U(), he(R(ze), {
82
+ }), (f, s) => (H(), pe(Z(Ze), {
83
83
  "show-arrow": c.value,
84
- raw: a.value,
85
- placement: o.value,
84
+ raw: i.value,
85
+ placement: r.value,
86
86
  show: n.value.visible,
87
87
  x: n.value.x,
88
88
  y: n.value.y,
@@ -93,12 +93,12 @@ const Rt = /* @__PURE__ */ Y({
93
93
  }
94
94
  }, {
95
95
  default: ke(() => [
96
- Fe(R(Ze), { "dynamic-v-node": i.value }, null, 8, ["dynamic-v-node"])
96
+ Fe(Z(ze), { "dynamic-v-node": a.value }, null, 8, ["dynamic-v-node"])
97
97
  ]),
98
98
  _: 1
99
99
  }, 8, ["show-arrow", "raw", "placement", "show", "x", "y"]));
100
100
  }
101
- }), it = Symbol("olMapInjectionKey"), Zt = /* @__PURE__ */ Y({
101
+ }), at = Symbol("olMapInjectionKey"), zt = /* @__PURE__ */ U({
102
102
  __name: "index",
103
103
  props: {
104
104
  olMap: { default: () => new Ge() },
@@ -123,93 +123,93 @@ const Rt = /* @__PURE__ */ Y({
123
123
  altShiftDragRotate: { type: Boolean }
124
124
  },
125
125
  setup(t, { expose: e }) {
126
- const n = t, i = v(), o = n.olMap, a = new Be({
126
+ const n = t, a = g(), r = n.olMap, i = new Be({
127
127
  projection: n.projection,
128
128
  extent: n.extent
129
129
  });
130
- o.setView(a), f(() => n.zoom, (r) => {
131
- a.setZoom(r);
130
+ r.setView(i), d(() => n.zoom, (o) => {
131
+ i.setZoom(o);
132
132
  }, {
133
133
  immediate: !0
134
- }), f(() => n.center, (r) => {
135
- a.setCenter(r);
134
+ }), d(() => n.center, (o) => {
135
+ i.setCenter(o);
136
136
  }, {
137
137
  immediate: !0
138
- }), f(() => n.constrainResolution, (r) => {
139
- a.setConstrainResolution(r);
138
+ }), d(() => n.constrainResolution, (o) => {
139
+ i.setConstrainResolution(o);
140
140
  }, {
141
141
  immediate: !0
142
- }), f(() => n.minZoom, (r) => {
143
- r && a.setMinZoom(r);
142
+ }), d(() => n.minZoom, (o) => {
143
+ o && i.setMinZoom(o);
144
144
  }, {
145
145
  immediate: !0
146
- }), f(() => n.maxZoom, (r) => {
147
- r && a.setMaxZoom(r);
146
+ }), d(() => n.maxZoom, (o) => {
147
+ o && i.setMaxZoom(o);
148
148
  }, {
149
149
  immediate: !0
150
- }), f(i, (r) => {
151
- r && o.setTarget(r);
150
+ }), d(a, (o) => {
151
+ o && r.setTarget(o);
152
152
  }), e({
153
- olMap: o
154
- }), Me(it, o);
155
- const c = o.getControls().getArray(), d = c.find((r) => r instanceof ne) || new ne(), s = c.find((r) => r instanceof re) || new re(), l = c.find((r) => r instanceof oe) || new oe(), p = c.find((r) => r instanceof ie) || new ie(), w = c.find((r) => r instanceof ae) || new ae(), m = c.find((r) => r instanceof ce) || new ce();
156
- f(() => n.showZoom, (r) => {
157
- d.setMap(r ? o : null);
153
+ olMap: r
154
+ }), Me(at, r);
155
+ 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(), w = c.find((o) => o instanceof ae) || new ae(), y = c.find((o) => o instanceof ce) || new ce(), m = c.find((o) => o instanceof le) || new le();
156
+ d(() => n.showZoom, (o) => {
157
+ f.setMap(o ? r : null);
158
158
  }, {
159
159
  immediate: !0
160
- }), f(() => n.showAttribution, (r) => {
161
- s.setMap(r ? o : null);
160
+ }), d(() => n.showAttribution, (o) => {
161
+ s.setMap(o ? r : null);
162
162
  }, {
163
163
  immediate: !0
164
- }), f(() => n.showRotate, (r) => {
165
- l.setMap(r ? o : null);
164
+ }), d(() => n.showRotate, (o) => {
165
+ l.setMap(o ? r : null);
166
166
  }, {
167
167
  immediate: !0
168
- }), f(() => n.showFullScreen, (r) => {
169
- p.setMap(r ? o : null);
168
+ }), d(() => n.showFullScreen, (o) => {
169
+ w.setMap(o ? r : null);
170
170
  }, {
171
171
  immediate: !0
172
- }), f(() => n.showOverview, (r) => {
173
- w.setMap(r ? o : null);
172
+ }), d(() => n.showOverview, (o) => {
173
+ y.setMap(o ? r : null);
174
174
  }, {
175
175
  immediate: !0
176
- }), f(() => n.showScale, (r) => {
177
- m.setMap(r ? o : null);
176
+ }), d(() => n.showScale, (o) => {
177
+ m.setMap(o ? r : null);
178
178
  }, {
179
179
  immediate: !0
180
180
  });
181
- const y = o.getInteractions().getArray(), S = y.find((r) => r instanceof le) || new le(), P = y.find((r) => r instanceof se) || new se(), E = y.find((r) => r instanceof ue) || new ue(), O = y.find((r) => r instanceof fe) || new fe(), x = y.find((r) => r instanceof de) || new de(), I = y.find((r) => r instanceof me) || new me(), u = y.find((r) => r instanceof ye) || new ye(), g = y.find((r) => r instanceof we) || new we();
182
- return o.removeInteraction(S), o.addInteraction(S), o.removeInteraction(P), o.addInteraction(P), o.removeInteraction(E), o.addInteraction(E), o.removeInteraction(O), o.addInteraction(O), o.removeInteraction(x), o.addInteraction(x), o.removeInteraction(I), o.addInteraction(I), o.removeInteraction(u), o.removeInteraction(g), f(() => n.dragPan, (r) => {
183
- S.setActive(r);
181
+ const v = r.getInteractions().getArray(), p = v.find((o) => o instanceof se) || new se(), E = v.find((o) => o instanceof ue) || new ue(), S = v.find((o) => o instanceof fe) || new fe(), b = v.find((o) => o instanceof de) || new de(), x = v.find((o) => o instanceof me) || new me(), I = v.find((o) => o instanceof ye) || new ye(), u = v.find((o) => o instanceof ve) || new ve(), h = v.find((o) => o instanceof we) || new we();
182
+ return r.removeInteraction(p), r.addInteraction(p), r.removeInteraction(E), r.addInteraction(E), r.removeInteraction(S), r.addInteraction(S), r.removeInteraction(b), r.addInteraction(b), r.removeInteraction(x), r.addInteraction(x), r.removeInteraction(I), r.addInteraction(I), r.removeInteraction(u), r.removeInteraction(h), d(() => n.dragPan, (o) => {
183
+ p.setActive(o);
184
184
  }, {
185
185
  immediate: !0
186
- }), f(() => n.mouseWheelZoom, (r) => {
187
- P.setActive(r);
186
+ }), d(() => n.mouseWheelZoom, (o) => {
187
+ E.setActive(o);
188
188
  }, {
189
189
  immediate: !0
190
- }), f(() => n.doubleClickZoom, (r) => {
191
- E.setActive(r);
190
+ }), d(() => n.doubleClickZoom, (o) => {
191
+ S.setActive(o);
192
192
  }, {
193
193
  immediate: !0
194
- }), f(() => n.pinchRotate, (r) => {
195
- O.setActive(r);
194
+ }), d(() => n.pinchRotate, (o) => {
195
+ b.setActive(o);
196
196
  }, {
197
197
  immediate: !0
198
- }), f(() => n.pinchZoom, (r) => {
199
- x.setActive(r);
198
+ }), d(() => n.pinchZoom, (o) => {
199
+ x.setActive(o);
200
200
  }, {
201
201
  immediate: !0
202
- }), f(() => n.altShiftDragRotate, (r) => {
203
- I.setActive(r);
202
+ }), d(() => n.altShiftDragRotate, (o) => {
203
+ I.setActive(o);
204
204
  }, {
205
205
  immediate: !0
206
- }), (r, h) => (U(), Ae("div", {
206
+ }), (o, O) => (H(), Te("div", {
207
207
  ref_key: "mapRef",
208
- ref: i
208
+ ref: a
209
209
  }, [
210
- Te(r.$slots, "default", {
211
- olMap: R(o),
212
- mapRef: i.value
210
+ Ae(o.$slots, "default", {
211
+ olMap: Z(r),
212
+ mapRef: a.value
213
213
  })
214
214
  ], 512));
215
215
  }
@@ -217,15 +217,15 @@ const Rt = /* @__PURE__ */ Y({
217
217
  function X(t) {
218
218
  return t < 0 ? X(t + 360) : t > 360 ? X(t - 360) : t;
219
219
  }
220
- function K(t) {
221
- return t < -180 ? K(t + 360) : t > 180 ? K(t - 360) : t;
220
+ function Y(t) {
221
+ return t < -180 ? Y(t + 360) : t > 180 ? Y(t - 360) : t;
222
222
  }
223
- function at(t, e, n) {
224
- return $e(t, e, K(n), { units: "meters" }).geometry.coordinates;
223
+ function ct(t, e, n) {
224
+ return $e(t, e, Y(n), { units: "meters" }).geometry.coordinates;
225
225
  }
226
226
  function Gt(t) {
227
- const e = Xe(t);
228
- return Ke(e, { units: "meters" });
227
+ const e = Ke(t);
228
+ return Xe(e, { units: "meters" });
229
229
  }
230
230
  function Bt(t) {
231
231
  return Ye(Ue(t));
@@ -233,73 +233,73 @@ function Bt(t) {
233
233
  function Dt(t, e) {
234
234
  return X(He(t, e));
235
235
  }
236
- function ct(t, e) {
236
+ function lt(t, e) {
237
237
  return Qe(t, e).geometry.coordinates;
238
238
  }
239
239
  function Le(t) {
240
- return ct([t[0], t[1]], [t[2], t[3]]);
240
+ return lt([t[0], t[1]], [t[2], t[3]]);
241
241
  }
242
- const Pe = 1852, T = "EPSG:3857", _ = "EPSG:4326", ge = T, lt = _;
242
+ const Pe = 1852, A = "EPSG:3857", _ = "EPSG:4326", ge = A, st = _;
243
243
  function Nt(t) {
244
244
  return t * 1e3 / Pe;
245
245
  }
246
246
  function jt(t) {
247
247
  return t * Pe / 1e3;
248
248
  }
249
- function st(t) {
250
- const { fillOptions: e, strokeOptions: n, ...i } = t;
249
+ function ut(t) {
250
+ const { fillOptions: e, strokeOptions: n, ...a } = t;
251
251
  return new qe({
252
- ...i,
253
- fill: e ? new G(e) : void 0,
254
- stroke: n ? new F(n) : void 0
252
+ ...a,
253
+ fill: e ? new B(e) : void 0,
254
+ stroke: n ? new T(n) : void 0
255
255
  });
256
256
  }
257
- function ut(t) {
258
- const { fillOptions: e, strokeOptions: n, backgroundFillOptions: i, backgroundStrokeOptions: o, ...a } = t;
257
+ function R(t) {
258
+ const { fillOptions: e, strokeOptions: n, backgroundFillOptions: a, backgroundStrokeOptions: r, ...i } = t;
259
259
  return new Je({
260
- ...a,
261
- fill: e ? new G(e) : void 0,
262
- stroke: n ? new F(n) : void 0,
263
- backgroundFill: i ? new G(i) : void 0,
264
- backgroundStroke: o ? new F(o) : void 0
260
+ ...i,
261
+ fill: e ? new B(e) : void 0,
262
+ stroke: n ? new T(n) : void 0,
263
+ backgroundFill: a ? new B(a) : void 0,
264
+ backgroundStroke: r ? new T(r) : void 0
265
265
  });
266
266
  }
267
- function L(t) {
268
- const { fillOptions: e, strokeOptions: n, iconOptions: i, circleOptions: o, textOptions: a, ...c } = t, d = e ? new G(e) : void 0, s = n ? new F(n) : void 0, l = i ? new et(i) : void 0, p = o ? st(o) : void 0, w = a ? ut(a) : void 0;
267
+ function P(t) {
268
+ const { fillOptions: e, strokeOptions: n, iconOptions: a, circleOptions: r, textOptions: i, ...c } = t, f = e ? new B(e) : void 0, s = n ? new T(n) : void 0, l = a ? new et(a) : void 0, w = r ? ut(r) : void 0, y = i ? R(i) : void 0;
269
269
  return new tt({
270
270
  ...c,
271
- fill: d,
271
+ fill: f,
272
272
  stroke: s,
273
- image: l || p,
274
- text: w
273
+ image: l || w,
274
+ text: y
275
275
  });
276
276
  }
277
277
  function ft(t) {
278
278
  return new De(t);
279
279
  }
280
280
  function dt(t) {
281
- return new W(t);
281
+ return new $(t);
282
282
  }
283
283
  function mt(t) {
284
- return new $(t);
284
+ return new K(t);
285
285
  }
286
286
  function yt(t, e) {
287
287
  return new Ne(t, e);
288
288
  }
289
- function wt(t) {
289
+ function vt(t) {
290
290
  return new je(t);
291
291
  }
292
- function vt(t) {
292
+ function wt(t) {
293
293
  return new Ve(t);
294
294
  }
295
295
  function gt(t) {
296
296
  return new We(t);
297
297
  }
298
298
  function k(t) {
299
- const { styleOptions: e, ...n } = t ?? {}, i = e ? L(e) : n.style;
300
- return new H({
299
+ const { styleOptions: e, ...n } = t ?? {}, a = e ? P(e) : n.style;
300
+ return new Q({
301
301
  ...n,
302
- style: i
302
+ style: a
303
303
  });
304
304
  }
305
305
  function Vt(t, e) {
@@ -323,22 +323,22 @@ function $t(t, e) {
323
323
  geometry: n
324
324
  });
325
325
  }
326
- function Xt(t, e, n) {
327
- const i = yt(t, e);
326
+ function Kt(t, e, n) {
327
+ const a = yt(t, e);
328
328
  return k({
329
329
  ...n,
330
- geometry: i
330
+ geometry: a
331
331
  });
332
332
  }
333
- function Kt(t, e) {
334
- const n = wt(t);
333
+ function Xt(t, e) {
334
+ const n = vt(t);
335
335
  return k({
336
336
  ...e,
337
337
  geometry: n
338
338
  });
339
339
  }
340
340
  function Yt(t, e) {
341
- const n = vt(t);
341
+ const n = wt(t);
342
342
  return k({
343
343
  ...e,
344
344
  geometry: n
@@ -351,16 +351,16 @@ function Ut(t, e) {
351
351
  geometry: n
352
352
  });
353
353
  }
354
- function ht(t) {
355
- const { type: e = "img", projection: n = ge, key: i } = t, o = t.url || "https://t{0-4}.tianditu.gov.cn", a = `&tk=${i}&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}`;
356
- return `${o}/${e}_${n === lt ? "c" : n === ge ? "w" : "c"}/wmts?LAYER=${e}${a}`;
354
+ function pt(t) {
355
+ const { type: e = "img", projection: n = ge, 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}`;
356
+ return `${r}/${e}_${n === st ? "c" : n === ge ? "w" : "c"}/wmts?LAYER=${e}${i}`;
357
357
  }
358
358
  function Ht(t) {
359
- const { zIndex: e, projection: n, className: i } = t;
360
- return new J({
361
- className: i,
362
- source: new nt({
363
- url: ht(t),
359
+ const { zIndex: e, projection: n, className: a } = t;
360
+ return new ee({
361
+ className: a,
362
+ source: new ot({
363
+ url: pt(t),
364
364
  projection: n,
365
365
  crossOrigin: "Anonymous"
366
366
  }),
@@ -371,10 +371,10 @@ function Qt({
371
371
  name: t,
372
372
  zIndex: e,
373
373
  key: n,
374
- className: i
374
+ className: a
375
375
  }) {
376
- return new J({
377
- className: i,
376
+ return new ee({
377
+ className: a,
378
378
  source: new rt({
379
379
  key: n,
380
380
  imagerySet: t,
@@ -384,278 +384,263 @@ function Qt({
384
384
  });
385
385
  }
386
386
  function qt(t) {
387
- return new J({
387
+ return new ee({
388
388
  className: t == null ? void 0 : t.className,
389
- source: new ot({
389
+ source: new it({
390
390
  crossOrigin: "Anonymous"
391
391
  }),
392
392
  zIndex: t == null ? void 0 : t.zIndex
393
393
  });
394
394
  }
395
395
  function Jt(t) {
396
- const { styleOptions: e, ...n } = t || {}, i = e ? L(e) : void 0, o = new q(), a = new Q({
397
- source: o,
396
+ const { styleOptions: e, ...n } = t || {}, a = e ? P(e) : void 0, r = new J(), i = new q({
397
+ source: r,
398
398
  ...n,
399
- style: i || n.style
399
+ style: a || n.style
400
400
  });
401
401
  return {
402
- source: o,
403
- layer: a
402
+ source: r,
403
+ layer: i
404
404
  };
405
405
  }
406
- function ee(t) {
407
- return xe(t, _, T);
408
- }
409
- const en = ee;
410
- function pt(t) {
411
- return xe(t, T, _);
406
+ function te(t) {
407
+ return be(t, _, A);
412
408
  }
413
- const tn = pt;
409
+ const en = te;
414
410
  function St(t) {
415
- return be(t, _, T);
411
+ return be(t, A, _);
416
412
  }
417
- const nn = St;
418
- function te(t) {
419
- return be(t, T, _);
413
+ const tn = St;
414
+ function ht(t) {
415
+ return xe(t, _, A);
420
416
  }
421
- const rn = te;
422
- function on(t, e, n = 60) {
423
- const i = [], o = 360 / n;
424
- for (let a = -180; a < 180; a = a + o)
425
- i.push(at(t, e, a));
426
- return [i];
417
+ const nn = ht;
418
+ function ne(t) {
419
+ return xe(t, A, _);
427
420
  }
428
- function B(t) {
421
+ const on = ne;
422
+ function rn(t, e, n = 60) {
423
+ const a = [], r = 360 / n;
424
+ for (let i = -180; i < 180; i = i + r)
425
+ a.push(ct(t, e, i));
426
+ return [a];
427
+ }
428
+ function D(t) {
429
429
  const e = document.createElement("div");
430
430
  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;
431
431
  }
432
432
  function an(t, e) {
433
- const n = v(!0), i = v([]), o = pe(() => i.value.map((u) => u.getGeometry().getCoordinates())), a = new q(), c = e.styleOptions ? L(e.styleOptions) : e == null ? void 0 : e.style, d = new Q({
434
- source: a,
433
+ const n = g(!0), a = g([]), r = Se(() => a.value.map((u) => u.getGeometry().getCoordinates())), i = new J(), c = e.styleOptions ? P(e.styleOptions) : e == null ? void 0 : e.style, f = new q({
434
+ source: i,
435
435
  style: c,
436
436
  zIndex: e == null ? void 0 : e.zIndex
437
437
  });
438
- t.addLayer(d);
439
- const s = e.drawStyleOptions ? L(e.drawStyleOptions) : e == null ? void 0 : e.drawStyle, l = new Ee({
440
- source: a,
438
+ t.addLayer(f);
439
+ const s = e.drawStyleOptions ? P(e.drawStyleOptions) : e == null ? void 0 : e.drawStyle, l = new Oe({
440
+ source: i,
441
441
  style: s || c,
442
442
  type: "LineString"
443
443
  });
444
444
  l.setActive(!1);
445
- const p = e.modifyStyleOptions ? L(e.modifyStyleOptions) : e == null ? void 0 : e.modifyStyle, w = new Oe({
446
- source: a,
447
- style: p || c
445
+ const w = e.modifyStyleOptions ? P(e.modifyStyleOptions) : e == null ? void 0 : e.modifyStyle, y = new Ee({
446
+ source: i,
447
+ style: w || c
448
448
  }), m = /* @__PURE__ */ new Set();
449
- t.addInteraction(l), D(() => {
450
- t.addInteraction(w);
451
- }), a.on("addfeature", () => {
452
- e.size && a.getFeatures().length >= e.size && l.setActive(!1);
453
- }), a.on("removefeature", () => {
454
- e.size && a.getFeatures().length < e.size && l.setActive(!0);
449
+ t.addInteraction(l), N(() => {
450
+ t.addInteraction(y);
451
+ }), i.on("addfeature", () => {
452
+ e.size && i.getFeatures().length >= e.size && l.setActive(!1);
453
+ }), i.on("removefeature", () => {
454
+ e.size && i.getFeatures().length < e.size && l.setActive(!0);
455
455
  });
456
- const y = () => {
456
+ const v = () => {
457
457
  m.forEach((u) => {
458
458
  t.removeOverlay(u);
459
459
  }), m.clear();
460
460
  };
461
- a.on("change", () => {
462
- y(), a.getFeatures().forEach((u) => {
463
- const g = u.getGeometry(), r = Le(te(g.getExtent()));
464
- let h = document.createElement("div");
465
- e.deleteFeatureLabel ? z(e.deleteFeatureLabel, h) : h = B("删除线"), h.addEventListener("click", () => {
466
- a.removeFeature(u);
461
+ i.on("change", () => {
462
+ v(), i.getFeatures().forEach((u) => {
463
+ const h = u.getGeometry(), o = Le(ne(h.getExtent()));
464
+ let O = document.createElement("div");
465
+ e.deleteFeatureLabel ? z(e.deleteFeatureLabel, O) : O = D("删除线"), O.addEventListener("click", () => {
466
+ i.removeFeature(u);
467
467
  });
468
- const M = new Z({
469
- position: ee(r),
468
+ const F = new G({
469
+ position: te(o),
470
470
  positioning: "center-center",
471
- element: h
471
+ element: O
472
472
  });
473
- m.add(M), t.addOverlay(M);
474
- const C = g.getCoordinates();
475
- C.length < 3 || C.forEach((N, j) => {
476
- let b = document.createElement("div");
477
- e.deletePointLabel ? z(e.deletePointLabel, b) : b = B("删除点"), b.addEventListener("click", () => {
478
- u.setGeometry(new W(C.filter((Ie, V) => V !== j)));
473
+ m.add(F), t.addOverlay(F);
474
+ const C = h.getCoordinates();
475
+ C.length < 3 || C.forEach((j, V) => {
476
+ let L = document.createElement("div");
477
+ e.deletePointLabel ? z(e.deletePointLabel, L) : L = D("删除点"), L.addEventListener("click", () => {
478
+ u.setGeometry(new $(C.filter((Ie, W) => W !== V)));
479
479
  });
480
- const A = new Z({
481
- position: N,
480
+ const M = new G({
481
+ position: j,
482
482
  positioning: "top-center",
483
483
  offset: [0, -30],
484
- element: b
484
+ element: L
485
485
  });
486
- m.add(A), t.addOverlay(A);
486
+ m.add(M), t.addOverlay(M);
487
487
  });
488
488
  });
489
489
  }), l.on("change:active", () => {
490
490
  n.value = l.getActive();
491
- }), a.on("change", () => {
492
- i.value = a.getFeatures();
491
+ }), i.on("change", () => {
492
+ a.value = i.getFeatures();
493
493
  });
494
- const S = () => {
495
- y(), t.removeLayer(d), t.removeInteraction(l), t.removeInteraction(w);
496
- }, P = () => {
497
- e.size && i.value.length >= e.size || l.setActive(!0);
494
+ const p = () => {
495
+ v(), t.removeLayer(f), t.removeInteraction(l), t.removeInteraction(y);
498
496
  }, E = () => {
497
+ e.size && a.value.length >= e.size || l.setActive(!0);
498
+ }, S = () => {
499
499
  l.setActive(!1);
500
- }, O = (u) => {
501
- a.clear(), u.forEach((g) => {
502
- if (g.length < 2)
500
+ }, b = (u) => {
501
+ i.clear(), u.forEach((h) => {
502
+ if (h.length < 2)
503
503
  return;
504
- const r = new H({
505
- geometry: new W(g)
504
+ const o = new Q({
505
+ geometry: new $(h)
506
506
  });
507
- a.addFeature(r);
507
+ i.addFeature(o);
508
508
  });
509
509
  }, x = () => {
510
- O(e.defaultCoordinates || []);
510
+ b(e.defaultCoordinates || []);
511
511
  };
512
512
  x();
513
513
  const I = () => {
514
- a.clear(), E();
514
+ i.clear(), S();
515
515
  };
516
- return Se(() => {
517
- S();
516
+ return he(() => {
517
+ p();
518
518
  }), {
519
519
  inDraw: n,
520
- start: P,
521
- stop: E,
520
+ start: E,
521
+ stop: S,
522
522
  clear: I,
523
- setFeatures: O,
523
+ setFeatures: b,
524
524
  reset: x,
525
- features: i,
526
- coordinates: o,
527
- destroy: S
525
+ features: a,
526
+ coordinates: r,
527
+ destroy: p
528
528
  };
529
529
  }
530
530
  function cn(t, e) {
531
- const n = v(!0), i = v([]), o = pe(() => i.value.map((u) => u.getGeometry().getCoordinates())), a = e.styleOptions ? L(e.styleOptions) : e == null ? void 0 : e.style, c = new q(), d = new Q({
531
+ const n = g(!0), a = g([]), r = Se(() => a.value.map((u) => u.getGeometry().getCoordinates())), i = e.styleOptions ? P(e.styleOptions) : e == null ? void 0 : e.style, c = new J(), f = new q({
532
532
  source: c,
533
- style: a,
533
+ style: i,
534
534
  zIndex: e == null ? void 0 : e.zIndex
535
535
  });
536
- t.addLayer(d);
537
- const s = e.drawStyleOptions ? L(e.drawStyleOptions) : e == null ? void 0 : e.drawStyle, l = new Ee({
536
+ t.addLayer(f);
537
+ const s = e.drawStyleOptions ? P(e.drawStyleOptions) : e == null ? void 0 : e.drawStyle, l = new Oe({
538
538
  source: c,
539
- style: s || a,
539
+ style: s || i,
540
540
  type: "Polygon"
541
541
  });
542
542
  l.setActive(!1);
543
- const p = e.modifyStyleOptions ? L(e.modifyStyleOptions) : e == null ? void 0 : e.modifyStyle, w = new Oe({
543
+ const w = e.modifyStyleOptions ? P(e.modifyStyleOptions) : e == null ? void 0 : e.modifyStyle, y = new Ee({
544
544
  source: c,
545
- style: p || a
545
+ style: w || i
546
546
  }), m = /* @__PURE__ */ new Set();
547
- t.addInteraction(l), D(() => {
548
- t.addInteraction(w);
547
+ t.addInteraction(l), N(() => {
548
+ t.addInteraction(y);
549
549
  }), c.on("addfeature", () => {
550
550
  e.size && c.getFeatures().length >= e.size && l.setActive(!1);
551
551
  }), c.on("removefeature", () => {
552
552
  e.size && c.getFeatures().length < e.size && l.setActive(!0);
553
553
  });
554
- const y = () => {
554
+ const v = () => {
555
555
  m.forEach((u) => {
556
556
  t.removeOverlay(u);
557
557
  }), m.clear();
558
558
  };
559
559
  c.on("change", () => {
560
- y(), c.getFeatures().forEach((u) => {
561
- const g = u.getGeometry(), r = Le(te(g.getExtent()));
562
- let h = document.createElement("div");
563
- e.deleteFeatureLabel ? z(e.deleteFeatureLabel, h) : h = B("删除区域"), h.addEventListener("click", () => {
560
+ v(), c.getFeatures().forEach((u) => {
561
+ const h = u.getGeometry(), o = Le(ne(h.getExtent()));
562
+ let O = document.createElement("div");
563
+ e.deleteFeatureLabel ? z(e.deleteFeatureLabel, O) : O = D("删除区域"), O.addEventListener("click", () => {
564
564
  c.removeFeature(u);
565
565
  });
566
- const M = new Z({
567
- position: ee(r),
566
+ const F = new G({
567
+ position: te(o),
568
568
  positioning: "center-center",
569
- element: h
569
+ element: O
570
570
  });
571
- m.add(M), t.addOverlay(M);
572
- const C = g.getCoordinates()[0];
573
- C.length < 3 || C.forEach((N, j) => {
574
- let b = document.createElement("div");
575
- e.deletePointLabel ? z(e.deletePointLabel, b) : b = B("删除点"), b.addEventListener("click", () => {
576
- u.setGeometry(new $([C.filter((Ie, V) => V !== j)]));
571
+ m.add(F), t.addOverlay(F);
572
+ const C = h.getCoordinates()[0];
573
+ C.length < 3 || C.forEach((j, V) => {
574
+ let L = document.createElement("div");
575
+ e.deletePointLabel ? z(e.deletePointLabel, L) : L = D("删除点"), L.addEventListener("click", () => {
576
+ u.setGeometry(new K([C.filter((Ie, W) => W !== V)]));
577
577
  });
578
- const A = new Z({
579
- position: N,
578
+ const M = new G({
579
+ position: j,
580
580
  positioning: "top-center",
581
581
  offset: [0, -30],
582
- element: b
582
+ element: L
583
583
  });
584
- m.add(A), t.addOverlay(A);
584
+ m.add(M), t.addOverlay(M);
585
585
  });
586
586
  });
587
587
  }), l.on("change:active", () => {
588
588
  n.value = l.getActive();
589
589
  }), c.on("change", () => {
590
- i.value = c.getFeatures();
590
+ a.value = c.getFeatures();
591
591
  });
592
- const S = () => {
593
- y(), t.removeLayer(d), t.removeInteraction(l), t.removeInteraction(w);
594
- }, P = () => {
595
- e.size && i.value.length >= e.size || l.setActive(!0);
592
+ const p = () => {
593
+ v(), t.removeLayer(f), t.removeInteraction(l), t.removeInteraction(y);
596
594
  }, E = () => {
595
+ e.size && a.value.length >= e.size || l.setActive(!0);
596
+ }, S = () => {
597
597
  l.setActive(!1);
598
- }, O = (u) => {
599
- c.clear(), u == null || u.forEach((g) => {
600
- g.forEach((r) => {
601
- if (r.length < 2)
598
+ }, b = (u) => {
599
+ c.clear(), u == null || u.forEach((h) => {
600
+ h.forEach((o) => {
601
+ if (o.length < 2)
602
602
  return;
603
- r[0] !== r[r.length - 1] && r.push(r[0]);
604
- const h = new H({
605
- geometry: new $([r])
603
+ o[0] !== o[o.length - 1] && o.push(o[0]);
604
+ const O = new Q({
605
+ geometry: new K([o])
606
606
  });
607
- c.addFeature(h);
607
+ c.addFeature(O);
608
608
  });
609
609
  });
610
610
  }, x = () => {
611
- O(e.defaultCoordinates);
611
+ b(e.defaultCoordinates);
612
612
  };
613
613
  x();
614
614
  const I = () => {
615
- c.clear(), E();
615
+ c.clear(), S();
616
616
  };
617
- return Se(() => {
618
- S();
617
+ return he(() => {
618
+ p();
619
619
  }), {
620
620
  inDraw: n,
621
- start: P,
622
- stop: E,
621
+ start: E,
622
+ stop: S,
623
623
  clear: I,
624
- setFeatures: O,
624
+ setFeatures: b,
625
625
  reset: x,
626
- features: i,
627
- coordinates: o,
628
- destroy: S
626
+ features: a,
627
+ coordinates: r,
628
+ destroy: p
629
629
  };
630
630
  }
631
631
  function ln(t) {
632
- const e = v(t.defaultShow || !1);
633
- let n = new ve({
634
- strokeStyle: t.strokeStyle || new F({
635
- color: "#000",
636
- width: 1.5,
637
- lineDash: [4, 4]
638
- }),
639
- showLabels: !0,
640
- wrapX: !1,
641
- zIndex: 1
632
+ const e = g(t.defaultShow || !1), { strokeStyleOption: n, strokeStyle: a, labelStyleOption: r, latLabelStyleOption: i, lonLabelStyleOption: c, latLabelStyle: f, lonLabelStyle: s, ...l } = t.graticuleOptions || {}, w = n ? new T(n) : a, y = r ? R(r) : void 0, m = (i ? R(i) : f) || y, v = (c ? R(c) : s) || y, p = new nt({
633
+ ...l,
634
+ strokeStyle: w,
635
+ latLabelStyle: m,
636
+ lonLabelStyle: v
642
637
  });
643
- return f(
638
+ return d(
644
639
  e,
645
- (i) => {
646
- if (n.setMap(null), i) {
647
- n = new ve({
648
- strokeStyle: new F({
649
- color: "#555",
650
- width: 1.5,
651
- lineDash: [4, 4]
652
- }),
653
- showLabels: !0,
654
- wrapX: !1,
655
- zIndex: 1
656
- });
657
- const o = _e(t.olMap);
658
- o && n.setMap(o);
640
+ (E) => {
641
+ if (p.setMap(null), E) {
642
+ const S = _e(t.olMap);
643
+ S && p.setMap(S);
659
644
  }
660
645
  },
661
646
  {
@@ -667,18 +652,18 @@ function ln(t) {
667
652
  };
668
653
  }
669
654
  function sn(t) {
670
- const e = v(t.defaultLayerName || Object.keys(t.layers)[0]);
655
+ const e = g(t.defaultLayerName || Object.keys(t.layers)[0]);
671
656
  return Object.values(t.layers).forEach((n) => {
672
- n.forEach((i) => {
673
- t.olMap.addLayer(i);
657
+ n.forEach((a) => {
658
+ t.olMap.addLayer(a);
674
659
  });
675
- }), f(
660
+ }), d(
676
661
  e,
677
662
  () => {
678
- Object.entries(t.layers).forEach(([n, i]) => {
679
- const o = n === e.value;
680
- i.forEach((a) => {
681
- a.setVisible(o);
663
+ Object.entries(t.layers).forEach(([n, a]) => {
664
+ const r = n === e.value;
665
+ a.forEach((i) => {
666
+ i.setVisible(r);
682
667
  });
683
668
  });
684
669
  },
@@ -688,59 +673,59 @@ function sn(t) {
688
673
  ), { visibleLayerName: e };
689
674
  }
690
675
  export {
691
- T as EPSG_3857,
692
- rn as EPSG_3857ExtentToEPSG_4326,
676
+ A as EPSG_3857,
677
+ on as EPSG_3857ExtentToEPSG_4326,
693
678
  tn as EPSG_3857ToEPSG_4326,
694
679
  _ as EPSG_4326,
695
680
  nn as EPSG_4326ExtentToEPSG_3857,
696
681
  en as EPSG_4326ToEPSG_3857,
697
682
  Rt as NOlContextmenu,
698
- zt as NOlPointermove,
683
+ Zt as NOlPointermove,
699
684
  Pe as ONE_NM,
700
- Zt as OlMap,
701
- lt as WGS84Projection,
685
+ zt as OlMap,
686
+ st as WGS84Projection,
702
687
  ge as WebMercatorProjection,
703
688
  yt as createCircle,
704
- Xt as createCircleFeature,
705
- st as createCircleStyle,
689
+ Kt as createCircleFeature,
690
+ ut as createCircleStyle,
706
691
  k as createFeature,
707
692
  dt as createLineString,
708
693
  Wt as createLineStringFeature,
709
- vt as createMultiLineString,
694
+ wt as createMultiLineString,
710
695
  Yt as createMultiLineStringFeature,
711
- wt as createMultiPoint,
712
- Kt as createMultiPointFeature,
696
+ vt as createMultiPoint,
697
+ Xt as createMultiPointFeature,
713
698
  gt as createMultiPolygon,
714
699
  Ut as createMultiPolygonFeature,
715
700
  ft as createPoint,
716
701
  Vt as createPointFeature,
717
702
  mt as createPolygon,
718
703
  $t as createPolygonFeature,
719
- L as createStyle,
720
- ut as createTextStyle,
704
+ P as createStyle,
705
+ R as createTextStyle,
721
706
  Jt as createVectorLayer,
722
707
  Dt as getAngle,
723
708
  Bt as getArea,
724
709
  Qt as getBingLayer,
725
- ct as getCenter,
726
- at as getDestinationPoint,
710
+ lt as getCenter,
711
+ ct as getDestinationPoint,
727
712
  Le as getExtentCenter,
728
713
  Gt as getLineLength,
729
714
  qt as getOSMLayer,
730
- on as getRealCircleCoordinates,
715
+ rn as getRealCircleCoordinates,
731
716
  Ht as getTianDiTuLayer,
732
- ht as getTianDiTuUrl,
717
+ pt as getTianDiTuUrl,
733
718
  Nt as kmToNauticalMiles,
734
- te as mercatorExtentToWgs84,
735
- pt as mercatorToWgs84,
719
+ ne as mercatorExtentToWgs84,
720
+ St as mercatorToWgs84,
736
721
  jt as nauticalMilesToKm,
737
- it as olMapInjectionKey,
722
+ at as olMapInjectionKey,
738
723
  X as toOlAngle,
739
- K as toTurfAngle,
724
+ Y as toTurfAngle,
740
725
  an as useDrawLineString,
741
726
  cn as useDrawPolygon,
742
727
  ln as useGraticule,
743
728
  sn as useSwitchBaseLayer,
744
- St as wgs84ExtentToMercator,
745
- ee as wgs84ToMercator
729
+ ht as wgs84ExtentToMercator,
730
+ te as wgs84ToMercator
746
731
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,9 +1,17 @@
1
1
  import { Map as OLMap } from 'ol';
2
2
  import { MaybeRef, Ref } from 'vue';
3
- import { Stroke } from 'ol/style';
3
+ import { StrokeOptions, TextOptions } from '../../utils';
4
+ import { Graticule } from 'ol/layer';
5
+ export type _GraticuleOptions = ConstructorParameters<typeof Graticule>[0];
6
+ export type GraticuleOptions = _GraticuleOptions & {
7
+ strokeStyleOption?: StrokeOptions;
8
+ labelStyleOption?: TextOptions;
9
+ latLabelStyleOption?: TextOptions;
10
+ lonLabelStyleOption?: TextOptions;
11
+ };
4
12
  export interface UseGraticuleOptions {
5
13
  olMap: MaybeRef<OLMap | null | undefined>;
6
- strokeStyle?: Stroke;
14
+ graticuleOptions?: GraticuleOptions;
7
15
  defaultShow?: boolean;
8
16
  }
9
17
  export declare function useGraticule(options: UseGraticuleOptions): {
@@ -1,34 +1,27 @@
1
- import { Graticule as a } from "ol/layer";
2
- import { Stroke as o } from "ol/style";
3
- import { ref as i, watch as u, toValue as w } from "vue";
4
- function h(e) {
5
- const r = i(e.defaultShow || !1);
6
- let t = new a({
7
- strokeStyle: e.strokeStyle || new o({
8
- color: "#000",
9
- width: 1.5,
10
- lineDash: [4, 4]
11
- }),
12
- showLabels: !0,
13
- wrapX: !1,
14
- zIndex: 1
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
15
18
  });
16
- return u(
17
- r,
18
- (s) => {
19
- if (t.setMap(null), s) {
20
- t = new a({
21
- strokeStyle: new o({
22
- color: "#555",
23
- width: 1.5,
24
- lineDash: [4, 4]
25
- }),
26
- showLabels: !0,
27
- wrapX: !1,
28
- zIndex: 1
29
- });
30
- const l = w(e.olMap);
31
- l && t.setMap(l);
19
+ return d(
20
+ l,
21
+ (L) => {
22
+ if (p.setMap(null), L) {
23
+ const c = k(t.olMap);
24
+ c && p.setMap(c);
32
25
  }
33
26
  },
34
27
  {
@@ -36,9 +29,9 @@ function h(e) {
36
29
  deep: !0
37
30
  }
38
31
  ), {
39
- showGraticule: r
32
+ showGraticule: l
40
33
  };
41
34
  }
42
35
  export {
43
- h as useGraticule
36
+ B as useGraticule
44
37
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,9 +1,17 @@
1
1
  import { Map as OLMap } from 'ol';
2
2
  import { MaybeRef, Ref } from 'vue';
3
- import { Stroke } from 'ol/style';
3
+ import { StrokeOptions, TextOptions } from '../../utils';
4
+ import { Graticule } from 'ol/layer';
5
+ export type _GraticuleOptions = ConstructorParameters<typeof Graticule>[0];
6
+ export type GraticuleOptions = _GraticuleOptions & {
7
+ strokeStyleOption?: StrokeOptions;
8
+ labelStyleOption?: TextOptions;
9
+ latLabelStyleOption?: TextOptions;
10
+ lonLabelStyleOption?: TextOptions;
11
+ };
4
12
  export interface UseGraticuleOptions {
5
13
  olMap: MaybeRef<OLMap | null | undefined>;
6
- strokeStyle?: Stroke;
14
+ graticuleOptions?: GraticuleOptions;
7
15
  defaultShow?: boolean;
8
16
  }
9
17
  export declare function useGraticule(options: UseGraticuleOptions): {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("ol/layer"),s=require("ol/style"),r=require("vue");function i(e){const l=r.ref(e.defaultShow||!1);let t=new u.Graticule({strokeStyle:e.strokeStyle||new s.Stroke({color:"#000",width:1.5,lineDash:[4,4]}),showLabels:!0,wrapX:!1,zIndex:1});return r.watch(l,o=>{if(t.setMap(null),o){t=new u.Graticule({strokeStyle:new s.Stroke({color:"#555",width:1.5,lineDash:[4,4]}),showLabels:!0,wrapX:!1,zIndex:1});const a=r.toValue(e.olMap);a&&t.setMap(a)}},{immediate:!0,deep:!0}),{showGraticule:l}}exports.useGraticule=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("ol/layer"),O=require("ol/style"),t=require("vue");require("@turf/turf");require("ol");require("ol/geom");const l=require("../../utils/style/index.js");require("ol/layer/Vector");require("ol/source");require("ol/source/Vector");require("ol/proj");function T(e){const r=t.ref(e.defaultShow||!1),{strokeStyleOption:a,strokeStyle:y,labelStyleOption:o,latLabelStyleOption:i,lonLabelStyleOption:u,latLabelStyle:S,lonLabelStyle:b,...q}=e.graticuleOptions||{},p=a?new O.Stroke(a):y,n=o?l.createTextStyle(o):void 0,L=(i?l.createTextStyle(i):S)||n,d=(u?l.createTextStyle(u):b)||n,c=new x.Graticule({...q,strokeStyle:p,latLabelStyle:L,lonLabelStyle:d});return t.watch(r,f=>{if(c.setMap(null),f){const s=t.toValue(e.olMap);s&&c.setMap(s)}},{immediate:!0,deep:!0}),{showGraticule:r}}exports.useGraticule=T;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@summeruse/ol",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.1.1-beta.1",
5
5
  "description": "",
6
6
  "author": "finalsummer",
7
7
  "license": "ISC",