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