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