@summeruse/ol 0.0.1-beta.0 → 0.0.1-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/index.js +341 -30
  3. package/dist/ol.css +1 -0
  4. package/es/components/common/render-v-node.vue.d.ts +17 -0
  5. package/es/components/common/render-v-node.vue.mjs +22 -0
  6. package/es/components/common/render-v-node.vue2.mjs +4 -0
  7. package/es/components/index.d.ts +3 -3
  8. package/es/components/n-ol-contextmenu/index.d.ts +3 -0
  9. package/es/components/n-ol-contextmenu/index.vue.d.ts +3 -0
  10. package/es/components/n-ol-contextmenu/index.vue.mjs +47 -0
  11. package/es/components/n-ol-contextmenu/index.vue2.mjs +4 -0
  12. package/{lib/components/ol-contextmenu → es/components/n-ol-contextmenu}/props.d.ts +4 -4
  13. package/es/components/n-ol-pointermove/index.d.ts +3 -0
  14. package/es/components/n-ol-pointermove/index.vue.d.ts +3 -0
  15. package/es/components/n-ol-pointermove/index.vue.mjs +47 -0
  16. package/es/components/n-ol-pointermove/index.vue3.mjs +5 -0
  17. package/es/components/n-ol-pointermove/props.d.ts +20 -0
  18. package/es/components/ol-map/index.d.ts +4 -0
  19. package/es/components/ol-map/index.vue.d.ts +44 -0
  20. package/es/components/ol-map/index.vue.mjs +124 -0
  21. package/es/components/ol-map/index.vue2.mjs +4 -0
  22. package/es/components/ol-map/props.d.ts +27 -0
  23. package/es/components/ol-map/props.mjs +4 -0
  24. package/es/composables/index.d.ts +2 -0
  25. package/es/composables/useGraticule/index.d.ts +12 -0
  26. package/es/composables/useGraticule/index.mjs +44 -0
  27. package/es/composables/useSwitchBaseLayer/index.d.ts +11 -0
  28. package/es/composables/useSwitchBaseLayer/index.mjs +25 -0
  29. package/es/constants/distance.d.ts +1 -0
  30. package/es/constants/distance.mjs +4 -0
  31. package/es/constants/index.d.ts +2 -0
  32. package/es/constants/projection.d.ts +4 -0
  33. package/es/constants/projection.mjs +7 -0
  34. package/es/index.d.ts +3 -0
  35. package/es/index.mjs +45 -2
  36. package/es/ol.css +1 -0
  37. package/es/types/index.d.ts +2 -0
  38. package/es/utils/calculate/index.d.ts +22 -0
  39. package/es/utils/calculate/index.mjs +14 -0
  40. package/es/utils/distance/index.d.ts +4 -0
  41. package/es/utils/distance/index.mjs +6 -0
  42. package/es/utils/draw/index.d.ts +109 -0
  43. package/es/utils/format/index.d.ts +4 -0
  44. package/es/utils/format/index.mjs +5 -0
  45. package/es/utils/index.d.ts +6 -0
  46. package/es/utils/layer/index.d.ts +28 -0
  47. package/es/utils/layer/index.mjs +44 -0
  48. package/es/utils/projection/index.d.ts +10 -0
  49. package/es/utils/projection/index.mjs +9 -0
  50. package/es/utils/realCircle/index.d.ts +10 -0
  51. package/es/utils/realCircle/index.mjs +10 -0
  52. package/lib/components/common/render-v-node.vue.d.ts +17 -0
  53. package/lib/components/common/render-v-node.vue.js +1 -0
  54. package/lib/components/common/render-v-node.vue2.js +1 -0
  55. package/lib/components/index.d.ts +3 -3
  56. package/lib/components/n-ol-contextmenu/index.d.ts +3 -0
  57. package/lib/components/n-ol-contextmenu/index.vue.d.ts +3 -0
  58. package/lib/components/n-ol-contextmenu/index.vue.js +1 -0
  59. package/lib/components/n-ol-contextmenu/index.vue2.js +1 -0
  60. package/{es/components/ol-contextmenu → lib/components/n-ol-contextmenu}/props.d.ts +4 -4
  61. package/lib/components/n-ol-pointermove/index.d.ts +3 -0
  62. package/lib/components/n-ol-pointermove/index.vue.d.ts +3 -0
  63. package/lib/components/n-ol-pointermove/index.vue.js +1 -0
  64. package/lib/components/n-ol-pointermove/index.vue3.js +1 -0
  65. package/lib/components/n-ol-pointermove/props.d.ts +20 -0
  66. package/lib/components/ol-map/index.d.ts +4 -0
  67. package/lib/components/ol-map/index.vue.d.ts +44 -0
  68. package/lib/components/ol-map/index.vue.js +1 -0
  69. package/lib/components/ol-map/index.vue2.js +1 -0
  70. package/lib/components/ol-map/props.d.ts +27 -0
  71. package/lib/components/ol-map/props.js +1 -0
  72. package/lib/composables/index.d.ts +2 -0
  73. package/lib/composables/useGraticule/index.d.ts +12 -0
  74. package/lib/composables/useGraticule/index.js +1 -0
  75. package/lib/composables/useSwitchBaseLayer/index.d.ts +11 -0
  76. package/lib/composables/useSwitchBaseLayer/index.js +1 -0
  77. package/lib/constants/distance.d.ts +1 -0
  78. package/lib/constants/distance.js +1 -0
  79. package/lib/constants/index.d.ts +2 -0
  80. package/lib/constants/projection.d.ts +4 -0
  81. package/lib/constants/projection.js +1 -0
  82. package/lib/index.d.ts +3 -0
  83. package/lib/index.js +1 -1
  84. package/lib/ol.css +1 -0
  85. package/lib/types/index.d.ts +2 -0
  86. package/lib/utils/calculate/index.d.ts +22 -0
  87. package/lib/utils/calculate/index.js +1 -0
  88. package/lib/utils/distance/index.d.ts +4 -0
  89. package/lib/utils/distance/index.js +1 -0
  90. package/lib/utils/draw/index.d.ts +109 -0
  91. package/lib/utils/format/index.d.ts +4 -0
  92. package/lib/utils/format/index.js +1 -0
  93. package/lib/utils/index.d.ts +6 -0
  94. package/lib/utils/layer/index.d.ts +28 -0
  95. package/lib/utils/layer/index.js +1 -0
  96. package/lib/utils/projection/index.d.ts +10 -0
  97. package/lib/utils/projection/index.js +1 -0
  98. package/lib/utils/realCircle/index.d.ts +10 -0
  99. package/lib/utils/realCircle/index.js +1 -0
  100. package/package.json +7 -4
  101. package/es/components/ol-contextmenu/n-ol-contextmenu.vue.d.ts +0 -3
  102. package/es/components/ol-contextmenu/n-ol-contextmenu.vue.mjs +0 -44
  103. package/es/components/ol-contextmenu/n-ol-contextmenu.vue2.mjs +0 -4
  104. package/lib/components/ol-contextmenu/n-ol-contextmenu.vue.d.ts +0 -3
  105. package/lib/components/ol-contextmenu/n-ol-contextmenu.vue.js +0 -1
  106. package/lib/components/ol-contextmenu/n-ol-contextmenu.vue2.js +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
1
+ # @summeruse/ol
2
+
3
+ ## 0.0.1-beta.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 添加常数模块
8
+ - 添加工具函数模块
9
+
10
+ ## 0.0.1-beta.2
11
+
12
+ ### Patch Changes
13
+
14
+ - 添加 ol-map 组件
15
+ - 添加 useGraticule
16
+ - 添加 useSwitchBaseLayer
17
+ - 添加 n-ol-pointermove
18
+
19
+ ## 0.0.1-beta.0
20
+
21
+ ### Patch Changes
22
+
23
+ - 更新 ol-contextmenu Props 类型
package/dist/index.js CHANGED
@@ -1,44 +1,355 @@
1
- import { defineComponent as d, ref as c, createBlock as f, openBlock as m, unref as v } from "vue";
2
- import { NDropdown as x } from "naive-ui";
3
- const _ = /* @__PURE__ */ d({
4
- __name: "n-ol-contextmenu",
1
+ import { defineComponent as g, ref as f, onMounted as U, createBlock as Q, openBlock as _, unref as A, watch as s, provide as oe, createElementBlock as ne, renderSlot as re, h as ie, isVNode as O, shallowRef as ae, withCtx as se, createVNode as ce, toValue as le } from "vue";
2
+ import { NDropdown as ue, NPopover as me } from "naive-ui";
3
+ import { Map as fe, View as de } from "ol";
4
+ import { Zoom as Z, Attribution as N, Rotate as k, FullScreen as L, OverviewMap as P, ScaleLine as B } from "ol/control";
5
+ import { DragPan as V, MouseWheelZoom as j, DoubleClickZoom as D, PinchRotate as W, PinchZoom as z, DragRotate as F, KeyboardPan as G, KeyboardZoom as X } from "ol/interaction";
6
+ import { Graticule as Y, Tile as E } from "ol/layer";
7
+ import { Stroke as K } from "ol/style";
8
+ import { XYZ as pe, BingMaps as we, OSM as ye } from "ol/source";
9
+ import { destination as ve, lineString as he, length as ge, area as Me, polygon as xe, bearing as Se, midpoint as be } from "@turf/turf";
10
+ import { transform as q, transformExtent as H } from "ol/proj";
11
+ const We = /* @__PURE__ */ g({
12
+ __name: "index",
5
13
  props: {
6
14
  olMap: {},
7
- createDropdownOptions: { type: Function }
15
+ createOptions: { type: Function }
8
16
  },
9
- setup(a) {
10
- const s = a, { olMap: n } = s, o = c({
17
+ setup(e) {
18
+ const r = e, { olMap: o } = r, i = f({
11
19
  visible: !1,
12
20
  x: 0,
13
21
  y: 0
14
- }), r = () => {
15
- o.value.visible = !1;
16
- }, l = c();
17
- n.getViewport().oncontextmenu = (e) => {
18
- e.preventDefault();
19
- const t = n.getEventPixel(e), i = n.getEventCoordinate(e), u = n.getFeaturesAtPixel(t);
20
- l.value = s.createDropdownOptions({ event: e, pixel: t, coordinate: i, features: u }), o.value = {
21
- visible: !0,
22
- x: e.clientX,
23
- y: e.clientY
24
- };
22
+ }), n = () => {
23
+ i.value.visible = !1;
24
+ }, a = f();
25
+ U(() => {
26
+ const u = o.getViewport();
27
+ u && (u.oncontextmenu = (c) => {
28
+ c.preventDefault();
29
+ const m = o.getEventPixel(c), w = o.getEventCoordinate(c), y = o.getFeaturesAtPixel(m);
30
+ a.value = r.createOptions({ event: c, pixel: m, coordinate: w, features: y }), i.value = {
31
+ visible: !0,
32
+ x: c.clientX,
33
+ y: c.clientY
34
+ };
35
+ });
36
+ });
37
+ const l = (u, c) => {
38
+ const { onClick: m } = c;
39
+ m && m(), i.value.visible = !1;
25
40
  };
26
- const p = (e, t) => {
27
- const { onClick: i } = t;
28
- i && i(), o.value.visible = !1;
29
- };
30
- return (e, t) => (m(), f(v(x), {
41
+ return (u, c) => (_(), Q(A(ue), {
31
42
  placement: "bottom-start",
32
43
  trigger: "manual",
33
- show: l.value && l.value.length > 0 && o.value.visible,
44
+ show: a.value && a.value.length > 0 && i.value.visible,
45
+ x: i.value.x,
46
+ y: i.value.y,
47
+ options: a.value,
48
+ "on-clickoutside": n,
49
+ onSelect: l
50
+ }, null, 8, ["show", "x", "y", "options"]));
51
+ }
52
+ }), Ie = Symbol(), ze = /* @__PURE__ */ g({
53
+ __name: "index",
54
+ props: {
55
+ olMap: { default: () => new fe() },
56
+ center: { default: () => [0, 0] },
57
+ zoom: { default: 2 },
58
+ minZoom: { default: 2 },
59
+ maxZoom: { default: 18 },
60
+ constrainResolution: { type: Boolean, default: !0 },
61
+ projection: {},
62
+ extent: {},
63
+ showZoom: { type: Boolean, default: !1 },
64
+ showAttribution: { type: Boolean, default: !1 },
65
+ showRotate: { type: Boolean, default: !1 },
66
+ showFullScreen: { type: Boolean, default: !1 },
67
+ showOverview: { type: Boolean, default: !1 },
68
+ showScale: { type: Boolean, default: !1 },
69
+ dragPan: { type: Boolean, default: !0 },
70
+ mouseWheelZoom: { type: Boolean, default: !0 },
71
+ doubleClickZoom: { type: Boolean, default: !1 },
72
+ pinchRotate: { type: Boolean },
73
+ pinchZoom: { type: Boolean },
74
+ altShiftDragRotate: { type: Boolean }
75
+ },
76
+ setup(e, { expose: r }) {
77
+ const o = e, i = f(), n = o.olMap, a = new de({
78
+ projection: o.projection,
79
+ extent: o.extent
80
+ });
81
+ n.setView(a), s(() => o.zoom, (t) => {
82
+ a.setZoom(t);
83
+ }, {
84
+ immediate: !0
85
+ }), s(() => o.center, (t) => {
86
+ a.setCenter(t);
87
+ }, {
88
+ immediate: !0
89
+ }), s(() => o.constrainResolution, (t) => {
90
+ a.setConstrainResolution(t);
91
+ }, {
92
+ immediate: !0
93
+ }), s(() => o.minZoom, (t) => {
94
+ t && a.setMinZoom(t);
95
+ }, {
96
+ immediate: !0
97
+ }), s(() => o.maxZoom, (t) => {
98
+ t && a.setMaxZoom(t);
99
+ }, {
100
+ immediate: !0
101
+ }), s(i, (t) => {
102
+ t && n.setTarget(t);
103
+ }), r({
104
+ olMap: n
105
+ }), oe(Ie, n);
106
+ const l = n.getControls().getArray(), u = l.find((t) => t instanceof Z) || new Z(), c = l.find((t) => t instanceof N) || new N(), m = l.find((t) => t instanceof k) || new k(), w = l.find((t) => t instanceof L) || new L(), y = l.find((t) => t instanceof P) || new P(), p = l.find((t) => t instanceof B) || new B();
107
+ s(() => o.showZoom, (t) => {
108
+ u.setMap(t ? n : null);
109
+ }, {
110
+ immediate: !0
111
+ }), s(() => o.showAttribution, (t) => {
112
+ c.setMap(t ? n : null);
113
+ }, {
114
+ immediate: !0
115
+ }), s(() => o.showRotate, (t) => {
116
+ m.setMap(t ? n : null);
117
+ }, {
118
+ immediate: !0
119
+ }), s(() => o.showFullScreen, (t) => {
120
+ w.setMap(t ? n : null);
121
+ }, {
122
+ immediate: !0
123
+ }), s(() => o.showOverview, (t) => {
124
+ y.setMap(t ? n : null);
125
+ }, {
126
+ immediate: !0
127
+ }), s(() => o.showScale, (t) => {
128
+ p.setMap(t ? n : null);
129
+ }, {
130
+ immediate: !0
131
+ });
132
+ const d = n.getInteractions().getArray(), M = d.find((t) => t instanceof V) || new V(), x = d.find((t) => t instanceof j) || new j(), S = d.find((t) => t instanceof D) || new D(), b = d.find((t) => t instanceof W) || new W(), I = d.find((t) => t instanceof z) || new z(), C = d.find((t) => t instanceof F) || new F(), ee = d.find((t) => t instanceof G) || new G(), te = d.find((t) => t instanceof X) || new X();
133
+ return n.removeInteraction(M), n.addInteraction(M), n.removeInteraction(x), n.addInteraction(x), n.removeInteraction(S), n.addInteraction(S), n.removeInteraction(b), n.addInteraction(b), n.removeInteraction(I), n.addInteraction(I), n.removeInteraction(C), n.addInteraction(C), n.removeInteraction(ee), n.removeInteraction(te), s(() => o.dragPan, (t) => {
134
+ M.setActive(t);
135
+ }, {
136
+ immediate: !0
137
+ }), s(() => o.mouseWheelZoom, (t) => {
138
+ x.setActive(t);
139
+ }, {
140
+ immediate: !0
141
+ }), s(() => o.doubleClickZoom, (t) => {
142
+ S.setActive(t);
143
+ }, {
144
+ immediate: !0
145
+ }), s(() => o.pinchRotate, (t) => {
146
+ b.setActive(t);
147
+ }, {
148
+ immediate: !0
149
+ }), s(() => o.pinchZoom, (t) => {
150
+ I.setActive(t);
151
+ }, {
152
+ immediate: !0
153
+ }), s(() => o.altShiftDragRotate, (t) => {
154
+ C.setActive(t);
155
+ }, {
156
+ immediate: !0
157
+ }), (t, Ee) => (_(), ne("div", {
158
+ ref_key: "mapRef",
159
+ ref: i
160
+ }, [
161
+ re(t.$slots, "default", {
162
+ olMap: A(n),
163
+ mapRef: i.value
164
+ })
165
+ ], 512));
166
+ }
167
+ }), Ce = g({
168
+ props: {
169
+ dynamicVNode: {
170
+ type: [Function, String, Object],
171
+ default: void 0
172
+ }
173
+ },
174
+ setup(e) {
175
+ return () => {
176
+ if (!e.dynamicVNode) return ie("span");
177
+ if (typeof e.dynamicVNode == "string" || O(e.dynamicVNode)) return e.dynamicVNode;
178
+ if (typeof e.dynamicVNode == "function") {
179
+ const r = e.dynamicVNode();
180
+ return O(r), r;
181
+ }
182
+ };
183
+ }
184
+ }), Fe = /* @__PURE__ */ g({
185
+ __name: "index",
186
+ props: {
187
+ olMap: {},
188
+ createOptions: { type: Function }
189
+ },
190
+ setup(e) {
191
+ const r = e, o = f({
192
+ visible: !1,
193
+ x: 0,
194
+ y: 0
195
+ }), i = ae(), n = f("bottom-start"), a = f(!1), l = f(!1);
196
+ return U(() => {
197
+ var u;
198
+ (u = r.olMap) == null || u.on("pointermove", (c) => {
199
+ const m = r.olMap.getFeaturesAtPixel(c.pixel), { clientX: w, clientY: y } = c.originalEvent;
200
+ o.value.visible = !1;
201
+ const p = r.createOptions({
202
+ pixel: c.pixel,
203
+ coordinate: c.coordinate,
204
+ features: m
205
+ });
206
+ p && (i.value = p.content, n.value = p.placement || "bottom-start", l.value = p.showArrow || !1, a.value = p.raw || !1, o.value.visible = !0, o.value.x = w, o.value.y = y);
207
+ });
208
+ }), (u, c) => (_(), Q(A(me), {
209
+ "show-arrow": l.value,
210
+ raw: a.value,
211
+ placement: n.value,
212
+ show: o.value.visible,
34
213
  x: o.value.x,
35
214
  y: o.value.y,
36
- options: l.value,
37
- "on-clickoutside": r,
38
- onSelect: p
39
- }, null, 8, ["show", "x", "y", "options"]));
215
+ trigger: "manual",
216
+ class: "n-ol-pointermove"
217
+ }, {
218
+ default: se(() => [
219
+ ce(Ce, { "dynamic-v-node": i.value }, null, 8, ["dynamic-v-node"])
220
+ ]),
221
+ _: 1
222
+ }, 8, ["show-arrow", "raw", "placement", "show", "x", "y"]));
40
223
  }
41
- });
224
+ }), Ge = (e) => {
225
+ const r = f(e.defaultShow || !1);
226
+ let o = new Y({
227
+ strokeStyle: e.strokeStyle || new K({
228
+ color: "#000",
229
+ width: 1.5,
230
+ lineDash: [4, 4]
231
+ }),
232
+ showLabels: !0,
233
+ wrapX: !1,
234
+ zIndex: 1
235
+ });
236
+ return s(
237
+ r,
238
+ (i) => {
239
+ if (o.setMap(null), i) {
240
+ o = new Y({
241
+ strokeStyle: new K({
242
+ color: "#555",
243
+ width: 1.5,
244
+ lineDash: [4, 4]
245
+ }),
246
+ showLabels: !0,
247
+ wrapX: !1,
248
+ zIndex: 1
249
+ });
250
+ const n = le(e.olMap);
251
+ n && o.setMap(n);
252
+ }
253
+ },
254
+ {
255
+ immediate: !0,
256
+ deep: !0
257
+ }
258
+ ), {
259
+ showGraticule: r
260
+ };
261
+ }, Xe = (e) => {
262
+ const r = f(e.defaultLayerName || Object.keys(e.layers)[0]);
263
+ return Object.values(e.layers).map((o) => {
264
+ o.map((i) => {
265
+ e.olMap.addLayer(i);
266
+ });
267
+ }), s(
268
+ r,
269
+ () => {
270
+ Object.entries(e.layers).map(([o, i]) => {
271
+ const n = o === r.value;
272
+ i.map((a) => {
273
+ a.setVisible(n);
274
+ });
275
+ });
276
+ },
277
+ {
278
+ immediate: !0
279
+ }
280
+ ), { visibleLayerName: r };
281
+ }, J = 1852, v = "EPSG:3857", h = "EPSG:4326", $ = v, Re = h, Te = (e) => {
282
+ const { type: r = "img", projection: o = $, key: i } = e, n = e.url || "https://t{0-4}.tianditu.gov.cn", a = "&tk=" + i + // cSpell:disable-next-line
283
+ "&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}", l = o === Re ? "c" : o === $ ? "w" : "c";
284
+ return n + "/" + r + "_" + l + "/wmts?LAYER=" + r + a;
285
+ }, Ye = (e) => {
286
+ const { zIndex: r, projection: o, className: i } = e;
287
+ return new E({
288
+ className: i,
289
+ source: new pe({
290
+ url: Te(e),
291
+ projection: o,
292
+ crossOrigin: "Anonymous"
293
+ }),
294
+ zIndex: r
295
+ });
296
+ }, Ke = ({
297
+ name: e,
298
+ zIndex: r,
299
+ key: o,
300
+ className: i
301
+ }) => new E({
302
+ className: i,
303
+ source: new we({
304
+ key: o,
305
+ imagerySet: e,
306
+ placeholderTiles: !1
307
+ }),
308
+ zIndex: r
309
+ }), $e = (e) => new E({
310
+ className: e == null ? void 0 : e.className,
311
+ source: new ye({
312
+ crossOrigin: "Anonymous"
313
+ }),
314
+ zIndex: e == null ? void 0 : e.zIndex
315
+ }), R = (e) => e < 0 ? R(e + 360) : e > 360 ? R(e - 360) : e, T = (e) => e < -180 ? T(e + 360) : e > 180 ? T(e - 360) : e, _e = (e, r, o) => ve(e, r, T(o), { units: "meters" }).geometry.coordinates, Ue = (e) => {
316
+ const r = he(e);
317
+ return ge(r, { units: "meters" });
318
+ }, Qe = (e) => Me(xe(e)), qe = (e, r) => R(Se(e, r)), Ae = (e, r) => be(e, r).geometry.coordinates, He = (e) => Ae([e[0], e[1]], [e[2], e[3]]), Je = (e) => e * 1e3 / J, et = (e) => e * J / 1e3, tt = (e) => q(e, h, v), ot = (e) => q(e, v, h), nt = (e) => H(e, h, v), rt = (e) => H(e, v, h), it = (e, r, o = 60) => {
319
+ const i = [], n = 360 / o;
320
+ for (let a = -180; a < 180; a = a + n)
321
+ i.push(_e(e, r, a));
322
+ return [i];
323
+ };
42
324
  export {
43
- _ as NOlContextmenu
325
+ v as EPSG_3857,
326
+ h as EPSG_4326,
327
+ We as NOlContextmenu,
328
+ Fe as NOlPointermove,
329
+ J as ONE_NM,
330
+ ze as OlMap,
331
+ Re as WGS84Projection,
332
+ $ as WebMercatorProjection,
333
+ qe as getAngle,
334
+ Qe as getArea,
335
+ Ke as getBingLayer,
336
+ Ae as getCenter,
337
+ _e as getDestinationPoint,
338
+ He as getExtentCenter,
339
+ Ue as getLineLength,
340
+ $e as getOSMLayer,
341
+ it as getRealCircleCoordinates,
342
+ Ye as getTianDiTuLayer,
343
+ Te as getTianDiTuUrl,
344
+ Je as kmToNauticalMiles,
345
+ rt as mercatorExtentToWgs84,
346
+ ot as mercatorToWgs84,
347
+ et as nauticalMilesToKm,
348
+ Ie as olMapInjectionKey,
349
+ R as toOlAngle,
350
+ T as toTurfAngle,
351
+ Ge as useGraticule,
352
+ Xe as useSwitchBaseLayer,
353
+ nt as wgs84ExtentToMercator,
354
+ tt as wgs84ToMercator
44
355
  };
package/dist/ol.css ADDED
@@ -0,0 +1 @@
1
+ .n-ol-pointermove.n-popover{box-shadow:none!important}
@@ -0,0 +1,17 @@
1
+ import { PropType, VNodeChild } from 'vue';
2
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
3
+ dynamicVNode: {
4
+ type: PropType<(() => VNodeChild) | VNodeChild | string>;
5
+ default: undefined;
6
+ };
7
+ }>, () => string | number | boolean | void | import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
8
+ [key: string]: any;
9
+ }> | import('vue').VNodeArrayChildren | null, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
10
+ dynamicVNode: {
11
+ type: PropType<(() => VNodeChild) | VNodeChild | string>;
12
+ default: undefined;
13
+ };
14
+ }>> & Readonly<{}>, {
15
+ dynamicVNode: VNodeChild | (() => VNodeChild);
16
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
17
+ export default _default;
@@ -0,0 +1,22 @@
1
+ import { defineComponent as i, h as t, isVNode as d } from "vue";
2
+ const c = i({
3
+ props: {
4
+ dynamicVNode: {
5
+ type: [Function, String, Object],
6
+ default: void 0
7
+ }
8
+ },
9
+ setup(e) {
10
+ return () => {
11
+ if (!e.dynamicVNode) return t("span");
12
+ if (typeof e.dynamicVNode == "string" || d(e.dynamicVNode)) return e.dynamicVNode;
13
+ if (typeof e.dynamicVNode == "function") {
14
+ const n = e.dynamicVNode();
15
+ return d(n), n;
16
+ }
17
+ };
18
+ }
19
+ });
20
+ export {
21
+ c as default
22
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./render-v-node.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -1,3 +1,3 @@
1
- import { default as NOlContextmenu } from './ol-contextmenu/n-ol-contextmenu.vue';
2
- export { NOlContextmenu };
3
- export * from './ol-contextmenu/props';
1
+ export * from './n-ol-contextmenu';
2
+ export * from './ol-map';
3
+ export * from './n-ol-pointermove';
@@ -0,0 +1,3 @@
1
+ import { default as NOlContextmenu } from './index.vue';
2
+ export { NOlContextmenu };
3
+ export * from './props';
@@ -0,0 +1,3 @@
1
+ import { NOlContextmenuProps } from './props';
2
+ declare const _default: import('vue').DefineComponent<NOlContextmenuProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<NOlContextmenuProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
3
+ export default _default;
@@ -0,0 +1,47 @@
1
+ import { defineComponent as d, ref as a, onMounted as v, createBlock as x, openBlock as m, unref as g } from "vue";
2
+ import { NDropdown as w } from "naive-ui";
3
+ const y = /* @__PURE__ */ d({
4
+ __name: "index",
5
+ props: {
6
+ olMap: {},
7
+ createOptions: { type: Function }
8
+ },
9
+ setup(c) {
10
+ const s = c, { olMap: n } = s, o = a({
11
+ visible: !1,
12
+ x: 0,
13
+ y: 0
14
+ }), r = () => {
15
+ o.value.visible = !1;
16
+ }, l = a();
17
+ v(() => {
18
+ const i = n.getViewport();
19
+ i && (i.oncontextmenu = (e) => {
20
+ e.preventDefault();
21
+ const t = n.getEventPixel(e), u = n.getEventCoordinate(e), f = n.getFeaturesAtPixel(t);
22
+ l.value = s.createOptions({ event: e, pixel: t, coordinate: u, features: f }), o.value = {
23
+ visible: !0,
24
+ x: e.clientX,
25
+ y: e.clientY
26
+ };
27
+ });
28
+ });
29
+ const p = (i, e) => {
30
+ const { onClick: t } = e;
31
+ t && t(), o.value.visible = !1;
32
+ };
33
+ return (i, e) => (m(), x(g(w), {
34
+ placement: "bottom-start",
35
+ trigger: "manual",
36
+ show: l.value && l.value.length > 0 && o.value.visible,
37
+ x: o.value.x,
38
+ y: o.value.y,
39
+ options: l.value,
40
+ "on-clickoutside": r,
41
+ onSelect: p
42
+ }, null, 8, ["show", "x", "y", "options"]));
43
+ }
44
+ });
45
+ export {
46
+ y as default
47
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -3,15 +3,15 @@ import { DropdownMixedOption } from 'naive-ui/es/dropdown/src/interface';
3
3
  import { Pixel } from 'ol/pixel';
4
4
  import { Coordinate } from 'ol/coordinate';
5
5
  import { FeatureLike } from 'ol/Feature';
6
- export interface Options {
6
+ export interface NOlContextmenuOptions {
7
7
  event: MouseEvent;
8
8
  pixel: Pixel;
9
9
  coordinate: Coordinate;
10
10
  features: FeatureLike[];
11
11
  }
12
- export interface Props {
12
+ export interface NOlContextmenuProps {
13
13
  olMap: OLMap;
14
- createDropdownOptions: (options: Options) => (DropdownMixedOption & {
15
- onClick: (options: Options) => void;
14
+ createOptions: (options: NOlContextmenuOptions) => (DropdownMixedOption & {
15
+ onClick?: (options: NOlContextmenuOptions) => void;
16
16
  })[];
17
17
  }
@@ -0,0 +1,3 @@
1
+ import { default as NOlPointermove } from './index.vue';
2
+ export { NOlPointermove };
3
+ export * from './props';
@@ -0,0 +1,3 @@
1
+ import { NOlPointermoveProps } from './props';
2
+ declare const _default: import('vue').DefineComponent<NOlPointermoveProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<NOlPointermoveProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
3
+ export default _default;
@@ -0,0 +1,47 @@
1
+ import { defineComponent as f, ref as t, shallowRef as w, onMounted as d, createBlock as x, openBlock as h, unref as _, withCtx as y, createVNode as b } from "vue";
2
+ import { NPopover as g } from "naive-ui";
3
+ import M from "../common/render-v-node.vue.mjs";
4
+ const B = /* @__PURE__ */ f({
5
+ __name: "index",
6
+ props: {
7
+ olMap: {},
8
+ createOptions: { type: Function }
9
+ },
10
+ setup(p) {
11
+ const l = p, e = t({
12
+ visible: !1,
13
+ x: 0,
14
+ y: 0
15
+ }), r = w(), s = t("bottom-start"), i = t(!1), c = t(!1);
16
+ return d(() => {
17
+ var n;
18
+ (n = l.olMap) == null || n.on("pointermove", (o) => {
19
+ const u = l.olMap.getFeaturesAtPixel(o.pixel), { clientX: v, clientY: m } = o.originalEvent;
20
+ e.value.visible = !1;
21
+ const a = l.createOptions({
22
+ pixel: o.pixel,
23
+ coordinate: o.coordinate,
24
+ features: u
25
+ });
26
+ a && (r.value = a.content, s.value = a.placement || "bottom-start", c.value = a.showArrow || !1, i.value = a.raw || !1, e.value.visible = !0, e.value.x = v, e.value.y = m);
27
+ });
28
+ }), (n, o) => (h(), x(_(g), {
29
+ "show-arrow": c.value,
30
+ raw: i.value,
31
+ placement: s.value,
32
+ show: e.value.visible,
33
+ x: e.value.x,
34
+ y: e.value.y,
35
+ trigger: "manual",
36
+ class: "n-ol-pointermove"
37
+ }, {
38
+ default: y(() => [
39
+ b(M, { "dynamic-v-node": r.value }, null, 8, ["dynamic-v-node"])
40
+ ]),
41
+ _: 1
42
+ }, 8, ["show-arrow", "raw", "placement", "show", "x", "y"]));
43
+ }
44
+ });
45
+ export {
46
+ B as default
47
+ };
@@ -0,0 +1,5 @@
1
+ import o from "./index.vue.mjs";
2
+ /* empty css */
3
+ export {
4
+ o as default
5
+ };
@@ -0,0 +1,20 @@
1
+ import { PopoverPlacement } from 'naive-ui';
2
+ import { Map as OLMap } from 'ol';
3
+ import { Coordinate } from 'ol/coordinate';
4
+ import { FeatureLike } from 'ol/Feature';
5
+ import { Pixel } from 'ol/pixel';
6
+ import { VNodeChild } from 'vue';
7
+ export interface NOlPointermoveOptions {
8
+ pixel: Pixel;
9
+ coordinate: Coordinate;
10
+ features: FeatureLike[];
11
+ }
12
+ export interface NOlPointermoveProps {
13
+ olMap: OLMap;
14
+ createOptions: (data: NOlPointermoveOptions) => {
15
+ content: (() => VNodeChild) | VNodeChild | string;
16
+ raw?: boolean;
17
+ showArrow?: boolean;
18
+ placement?: PopoverPlacement;
19
+ } | undefined;
20
+ }
@@ -0,0 +1,4 @@
1
+ import { default as OlMap } from './index.vue';
2
+ export { OlMap };
3
+ export * from './props';
4
+ export type OlMapInst = InstanceType<typeof OlMap>;