@summeruse/ol 0.3.0 → 0.3.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 +13 -0
- package/dist/index.js +450 -432
- package/es/components/ol-map/index.vue_vue_type_script_setup_true_lang.mjs +1 -0
- package/es/composables/usePointermove/index.d.ts +5 -0
- package/es/composables/usePointermove/index.mjs +40 -38
- package/es/index.mjs +2 -2
- package/es/utils/index.mjs +1 -1
- package/es/utils/layer/index.d.ts +19 -4
- package/es/utils/layer/index.mjs +34 -19
- package/lib/components/ol-map/index.vue_vue_type_script_setup_true_lang.js +1 -1
- package/lib/composables/usePointermove/index.d.ts +5 -0
- package/lib/composables/usePointermove/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/utils/layer/index.d.ts +19 -4
- package/lib/utils/layer/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import VectorLayer from "ol/layer/Vector";
|
|
|
8
8
|
import VectorSource from "ol/source/Vector";
|
|
9
9
|
import { Circle as Circle$1, Fill, Icon, Stroke, Style, Text } from "ol/style";
|
|
10
10
|
import { Graticule, Tile } from "ol/layer";
|
|
11
|
+
import WebGLVectorLayer from "ol/layer/WebGLVector";
|
|
11
12
|
import { BingMaps, OSM, XYZ } from "ol/source";
|
|
12
13
|
import { transform, transformExtent } from "ol/proj";
|
|
13
14
|
const olMapInjectionKey = Symbol("olMapInjectionKey");
|
|
@@ -15,6 +16,7 @@ function useOlMap() {
|
|
|
15
16
|
return inject(olMapInjectionKey);
|
|
16
17
|
}
|
|
17
18
|
var ol_map_default = /* @__PURE__ */ defineComponent({
|
|
19
|
+
name: "OlMap",
|
|
18
20
|
__name: "index",
|
|
19
21
|
props: {
|
|
20
22
|
olMap: { default: () => new Map() },
|
|
@@ -76,314 +78,317 @@ var ol_map_default = /* @__PURE__ */ defineComponent({
|
|
|
76
78
|
"moveend",
|
|
77
79
|
"movestart"
|
|
78
80
|
],
|
|
79
|
-
setup(
|
|
80
|
-
let
|
|
81
|
-
projection:
|
|
82
|
-
extent:
|
|
81
|
+
setup(r, { expose: u, emit: d }) {
|
|
82
|
+
let f = r, v = d, b = ref(), C = f.olMap, w = new View({
|
|
83
|
+
projection: f.projection,
|
|
84
|
+
extent: f.extent
|
|
83
85
|
});
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}, { immediate: !0 }), watch(() =>
|
|
87
|
-
|
|
88
|
-
}, { immediate: !0 }), watch(() =>
|
|
89
|
-
|
|
90
|
-
}, { immediate: !0 }), watch(
|
|
91
|
-
|
|
92
|
-
}),
|
|
93
|
-
let
|
|
94
|
-
watch(() =>
|
|
95
|
-
F.setMap(
|
|
96
|
-
}, { immediate: !0 }), watch(() =>
|
|
97
|
-
I.setMap(
|
|
98
|
-
}, { immediate: !0 }), watch(() =>
|
|
99
|
-
L.setMap(
|
|
100
|
-
}, { immediate: !0 }), watch(() =>
|
|
101
|
-
R.setMap(
|
|
102
|
-
}, { immediate: !0 }), watch(() =>
|
|
103
|
-
z.setMap(
|
|
104
|
-
}, { immediate: !0 }), watch(() =>
|
|
105
|
-
B.setMap(
|
|
86
|
+
C.setView(w), w.setZoom(f.zoom), w.setCenter(f.center), watch(() => f.constrainResolution, (r) => {
|
|
87
|
+
w.setConstrainResolution(r);
|
|
88
|
+
}, { immediate: !0 }), watch(() => f.minZoom, (r) => {
|
|
89
|
+
r && w.setMinZoom(r);
|
|
90
|
+
}, { immediate: !0 }), watch(() => f.maxZoom, (r) => {
|
|
91
|
+
r && w.setMaxZoom(r);
|
|
92
|
+
}, { immediate: !0 }), watch(b, (r) => {
|
|
93
|
+
r && C.setTarget(r);
|
|
94
|
+
}), u({ olMap: C }), provide(olMapInjectionKey, C);
|
|
95
|
+
let T = C.getControls().getArray(), F = T.find((r) => r instanceof Zoom) || new Zoom(), I = T.find((r) => r instanceof Attribution) || new Attribution(), L = T.find((r) => r instanceof Rotate) || new Rotate(), R = T.find((r) => r instanceof FullScreen) || new FullScreen(), z = T.find((r) => r instanceof OverviewMap) || new OverviewMap(), B = T.find((r) => r instanceof ScaleLine) || new ScaleLine();
|
|
96
|
+
watch(() => f.showZoom, (r) => {
|
|
97
|
+
F.setMap(r ? C : null);
|
|
98
|
+
}, { immediate: !0 }), watch(() => f.showAttribution, (r) => {
|
|
99
|
+
I.setMap(r ? C : null);
|
|
100
|
+
}, { immediate: !0 }), watch(() => f.showRotate, (r) => {
|
|
101
|
+
L.setMap(r ? C : null);
|
|
102
|
+
}, { immediate: !0 }), watch(() => f.showFullScreen, (r) => {
|
|
103
|
+
R.setMap(r ? C : null);
|
|
104
|
+
}, { immediate: !0 }), watch(() => f.showOverview, (r) => {
|
|
105
|
+
z.setMap(r ? C : null);
|
|
106
|
+
}, { immediate: !0 }), watch(() => f.showScale, (r) => {
|
|
107
|
+
B.setMap(r ? C : null);
|
|
106
108
|
}, { immediate: !0 });
|
|
107
|
-
let V =
|
|
108
|
-
|
|
109
|
-
H.setActive(
|
|
110
|
-
}, { immediate: !0 }), watch(() =>
|
|
111
|
-
U.setActive(
|
|
112
|
-
}, { immediate: !0 }), watch(() =>
|
|
113
|
-
W.setActive(
|
|
114
|
-
}, { immediate: !0 }), watch(() =>
|
|
115
|
-
G.setActive(
|
|
116
|
-
}, { immediate: !0 }), watch(() =>
|
|
117
|
-
K.setActive(
|
|
118
|
-
}, { immediate: !0 }), watch(() =>
|
|
119
|
-
q.setActive(
|
|
109
|
+
let V = C.getInteractions().getArray(), H = V.find((r) => r instanceof DragPan) || new DragPan(), U = V.find((r) => r instanceof MouseWheelZoom) || new MouseWheelZoom(), W = V.find((r) => r instanceof DoubleClickZoom) || new DoubleClickZoom(), G = V.find((r) => r instanceof PinchRotate) || new PinchRotate(), K = V.find((r) => r instanceof PinchZoom) || new PinchZoom(), q = V.find((r) => r instanceof DragRotate) || new DragRotate(), J = V.find((r) => r instanceof KeyboardPan) || new KeyboardPan(), Y = V.find((r) => r instanceof KeyboardZoom) || new KeyboardZoom();
|
|
110
|
+
C.removeInteraction(H), C.addInteraction(H), C.removeInteraction(U), C.addInteraction(U), C.removeInteraction(W), C.addInteraction(W), C.removeInteraction(G), C.addInteraction(G), C.removeInteraction(K), C.addInteraction(K), C.removeInteraction(q), C.addInteraction(q), C.removeInteraction(J), C.removeInteraction(Y), watch(() => f.dragPan, (r) => {
|
|
111
|
+
H.setActive(r);
|
|
112
|
+
}, { immediate: !0 }), watch(() => f.mouseWheelZoom, (r) => {
|
|
113
|
+
U.setActive(r);
|
|
114
|
+
}, { immediate: !0 }), watch(() => f.doubleClickZoom, (r) => {
|
|
115
|
+
W.setActive(r);
|
|
116
|
+
}, { immediate: !0 }), watch(() => f.pinchRotate, (r) => {
|
|
117
|
+
G.setActive(r);
|
|
118
|
+
}, { immediate: !0 }), watch(() => f.pinchZoom, (r) => {
|
|
119
|
+
K.setActive(r);
|
|
120
|
+
}, { immediate: !0 }), watch(() => f.altShiftDragRotate, (r) => {
|
|
121
|
+
q.setActive(r);
|
|
120
122
|
}, { immediate: !0 });
|
|
121
|
-
function X(
|
|
122
|
-
|
|
123
|
+
function X(r) {
|
|
124
|
+
v("update:zoom", Math.floor(w.getZoom() || 0)), v("changeResolution", r);
|
|
123
125
|
}
|
|
124
126
|
onMounted(() => {
|
|
125
|
-
|
|
127
|
+
w.on("change:resolution", X);
|
|
126
128
|
}), onUnmounted(() => {
|
|
127
|
-
|
|
129
|
+
w.un("change:resolution", X);
|
|
128
130
|
});
|
|
129
|
-
function Z(
|
|
130
|
-
|
|
131
|
+
function Z(r) {
|
|
132
|
+
v("update:center", w.getCenter() || [0, 0]), v("changeCenter", r);
|
|
131
133
|
}
|
|
132
134
|
onMounted(() => {
|
|
133
|
-
|
|
135
|
+
w.on("change:center", Z);
|
|
134
136
|
}), onUnmounted(() => {
|
|
135
|
-
|
|
137
|
+
w.un("change:center", Z);
|
|
136
138
|
});
|
|
137
|
-
function Q(
|
|
138
|
-
|
|
139
|
+
function Q(r) {
|
|
140
|
+
v("movestart", r);
|
|
139
141
|
}
|
|
140
142
|
onMounted(() => {
|
|
141
|
-
|
|
143
|
+
C.on("movestart", Q);
|
|
142
144
|
}), onUnmounted(() => {
|
|
143
|
-
|
|
145
|
+
C.un("movestart", Q);
|
|
144
146
|
});
|
|
145
|
-
function $(
|
|
146
|
-
|
|
147
|
+
function $(r) {
|
|
148
|
+
v("moveend", r);
|
|
147
149
|
}
|
|
148
150
|
return onMounted(() => {
|
|
149
|
-
|
|
151
|
+
C.on("moveend", $);
|
|
150
152
|
}), onUnmounted(() => {
|
|
151
|
-
|
|
152
|
-
}), (
|
|
153
|
+
C.un("moveend", $);
|
|
154
|
+
}), (r, u) => (openBlock(), createElementBlock("div", {
|
|
153
155
|
ref_key: "mapRef",
|
|
154
|
-
ref:
|
|
155
|
-
}, [renderSlot(
|
|
156
|
-
olMap: unref(
|
|
157
|
-
mapRef:
|
|
156
|
+
ref: b
|
|
157
|
+
}, [renderSlot(r.$slots, "default", {
|
|
158
|
+
olMap: unref(C),
|
|
159
|
+
mapRef: b.value
|
|
158
160
|
})], 512));
|
|
159
161
|
}
|
|
160
162
|
});
|
|
161
|
-
function useContextmenu(
|
|
162
|
-
let
|
|
163
|
+
function useContextmenu(l, u) {
|
|
164
|
+
let d = ref(!1), p = ref({
|
|
163
165
|
x: 0,
|
|
164
166
|
y: 0
|
|
165
|
-
}),
|
|
166
|
-
function
|
|
167
|
-
let
|
|
168
|
-
return
|
|
169
|
-
let
|
|
170
|
-
return typeof
|
|
171
|
-
}).filter((
|
|
172
|
-
let
|
|
173
|
-
|
|
174
|
-
...
|
|
175
|
-
children:
|
|
167
|
+
}), m = ref(), h = ref([]), g = ref(), v;
|
|
168
|
+
function y(r, l) {
|
|
169
|
+
let u = [];
|
|
170
|
+
return r.filter((r) => {
|
|
171
|
+
let u = r.visible;
|
|
172
|
+
return typeof u == "function" ? u(l) : u ?? !0;
|
|
173
|
+
}).filter((r) => !r.children || r.children.length > 0).sort((r, l) => (r.order ?? 0) - (l.order ?? 0)).forEach((r) => {
|
|
174
|
+
let d = r.icon, f = r.label;
|
|
175
|
+
u.push({
|
|
176
|
+
...r,
|
|
177
|
+
children: r.children ? y(r.children, l) : void 0,
|
|
176
178
|
visible: !0,
|
|
177
179
|
action: () => {
|
|
178
|
-
|
|
180
|
+
r.action?.(l), C();
|
|
179
181
|
},
|
|
180
|
-
icon: typeof
|
|
181
|
-
label: typeof
|
|
182
|
-
disabled: typeof
|
|
182
|
+
icon: typeof d == "function" ? () => d(l) : d,
|
|
183
|
+
label: typeof f == "function" ? () => f(l) : f,
|
|
184
|
+
disabled: typeof r.disabled == "function" ? r.disabled(l) : r.disabled ?? !1
|
|
183
185
|
});
|
|
184
|
-
}),
|
|
186
|
+
}), u;
|
|
185
187
|
}
|
|
186
|
-
function
|
|
187
|
-
if (
|
|
188
|
-
let
|
|
189
|
-
|
|
190
|
-
let
|
|
191
|
-
|
|
192
|
-
let [
|
|
193
|
-
|
|
194
|
-
x:
|
|
195
|
-
y:
|
|
196
|
-
},
|
|
197
|
-
map:
|
|
198
|
-
position: { ...
|
|
199
|
-
coordinate:
|
|
200
|
-
feature:
|
|
201
|
-
layer:
|
|
202
|
-
}),
|
|
188
|
+
function x(r) {
|
|
189
|
+
if (r.preventDefault(), !v) return;
|
|
190
|
+
let l = v.getEventCoordinate(r);
|
|
191
|
+
g.value = l;
|
|
192
|
+
let f = v.getEventPixel(r), _, x;
|
|
193
|
+
v.forEachFeatureAtPixel(f, (r, l) => (_ = r, x = l, !0)), m.value = _;
|
|
194
|
+
let [S, C] = [r.clientX, r.clientY];
|
|
195
|
+
p.value = {
|
|
196
|
+
x: S,
|
|
197
|
+
y: C
|
|
198
|
+
}, h.value = y(toValue(u), {
|
|
199
|
+
map: v,
|
|
200
|
+
position: { ...p.value },
|
|
201
|
+
coordinate: l,
|
|
202
|
+
feature: _,
|
|
203
|
+
layer: x
|
|
204
|
+
}), d.value = !0;
|
|
203
205
|
}
|
|
204
|
-
function
|
|
205
|
-
|
|
206
|
+
function C() {
|
|
207
|
+
d.value = !1;
|
|
206
208
|
}
|
|
207
|
-
function
|
|
208
|
-
if (!
|
|
209
|
-
let
|
|
210
|
-
|
|
209
|
+
function w(r) {
|
|
210
|
+
if (!r) return;
|
|
211
|
+
let l = r.getViewport();
|
|
212
|
+
l.addEventListener("contextmenu", x), l.addEventListener("click", C);
|
|
211
213
|
}
|
|
212
|
-
function
|
|
213
|
-
if (!
|
|
214
|
-
let
|
|
215
|
-
|
|
214
|
+
function T(r) {
|
|
215
|
+
if (!r) return;
|
|
216
|
+
let l = r.getViewport();
|
|
217
|
+
l.removeEventListener("contextmenu", x), l.removeEventListener("click", C);
|
|
216
218
|
}
|
|
217
|
-
return watch(() => toValue(
|
|
218
|
-
|
|
219
|
+
return watch(() => toValue(l), (r, l) => {
|
|
220
|
+
l !== r && (T(l), w(r), v = r);
|
|
219
221
|
}, { immediate: !0 }), onBeforeUnmount(() => {
|
|
220
|
-
|
|
222
|
+
T(v);
|
|
221
223
|
}), {
|
|
222
|
-
visible: computed(() =>
|
|
223
|
-
position: computed(() =>
|
|
224
|
-
feature: computed(() =>
|
|
225
|
-
options: computed(() =>
|
|
226
|
-
coordinate: computed(() =>
|
|
227
|
-
hide:
|
|
224
|
+
visible: computed(() => d.value),
|
|
225
|
+
position: computed(() => p.value),
|
|
226
|
+
feature: computed(() => m.value),
|
|
227
|
+
options: computed(() => h.value),
|
|
228
|
+
coordinate: computed(() => g.value),
|
|
229
|
+
hide: C
|
|
228
230
|
};
|
|
229
231
|
}
|
|
230
232
|
const ONE_NM = 1852, EPSG_3857 = "EPSG:3857", EPSG_4326 = "EPSG:4326", WebMercatorProjection = EPSG_3857, WGS84Projection = EPSG_4326;
|
|
231
|
-
function kmToNauticalMiles(
|
|
232
|
-
return
|
|
233
|
+
function kmToNauticalMiles(r) {
|
|
234
|
+
return r * 1e3 / ONE_NM;
|
|
233
235
|
}
|
|
234
|
-
function nauticalMilesToKm(
|
|
235
|
-
return
|
|
236
|
+
function nauticalMilesToKm(r) {
|
|
237
|
+
return r * ONE_NM / 1e3;
|
|
236
238
|
}
|
|
237
|
-
function formatRotation(
|
|
238
|
-
return
|
|
239
|
+
function formatRotation(r) {
|
|
240
|
+
return r < 0 ? formatRotation(r + 2 * Math.PI) : r > 2 * Math.PI ? formatRotation(r - 2 * Math.PI) : r;
|
|
239
241
|
}
|
|
240
|
-
function formatAngle(
|
|
241
|
-
return
|
|
242
|
+
function formatAngle(r) {
|
|
243
|
+
return r < 0 ? formatAngle(r + 360) : r >= 360 ? formatAngle(r - 360) : r;
|
|
242
244
|
}
|
|
243
|
-
function createCircleStyle(
|
|
244
|
-
let { fillOptions:
|
|
245
|
+
function createCircleStyle(r) {
|
|
246
|
+
let { fillOptions: l, strokeOptions: u,...d } = r;
|
|
245
247
|
return new Circle$1({
|
|
246
|
-
...
|
|
247
|
-
fill:
|
|
248
|
-
stroke:
|
|
248
|
+
...d,
|
|
249
|
+
fill: l ? new Fill(l) : void 0,
|
|
250
|
+
stroke: u ? new Stroke(u) : void 0
|
|
249
251
|
});
|
|
250
252
|
}
|
|
251
|
-
function createTextStyle(
|
|
252
|
-
let { fillOptions:
|
|
253
|
+
function createTextStyle(r) {
|
|
254
|
+
let { fillOptions: l, strokeOptions: u, backgroundFillOptions: d, backgroundStrokeOptions: f,...p } = r;
|
|
253
255
|
return new Text({
|
|
254
|
-
...
|
|
255
|
-
fill:
|
|
256
|
-
stroke:
|
|
257
|
-
backgroundFill:
|
|
258
|
-
backgroundStroke:
|
|
256
|
+
...p,
|
|
257
|
+
fill: l ? new Fill(l) : void 0,
|
|
258
|
+
stroke: u ? new Stroke(u) : void 0,
|
|
259
|
+
backgroundFill: d ? new Fill(d) : void 0,
|
|
260
|
+
backgroundStroke: f ? new Stroke(f) : void 0
|
|
259
261
|
});
|
|
260
262
|
}
|
|
261
|
-
function createStyle(
|
|
262
|
-
let { fillOptions:
|
|
263
|
+
function createStyle(r) {
|
|
264
|
+
let { fillOptions: l, strokeOptions: u, iconOptions: d, circleOptions: f, textOptions: p,...m } = r, h = l ? new Fill(l) : void 0, g = u ? new Stroke(u) : void 0, _ = d ? new Icon(d) : void 0, v = f ? createCircleStyle(f) : void 0, y = p ? createTextStyle(p) : void 0;
|
|
263
265
|
return new Style({
|
|
264
|
-
...
|
|
265
|
-
fill:
|
|
266
|
-
stroke:
|
|
267
|
-
image:
|
|
268
|
-
text:
|
|
266
|
+
...m,
|
|
267
|
+
fill: h,
|
|
268
|
+
stroke: g,
|
|
269
|
+
image: _ || v,
|
|
270
|
+
text: y
|
|
269
271
|
});
|
|
270
272
|
}
|
|
271
|
-
function createPoint(
|
|
272
|
-
return new Point(
|
|
273
|
+
function createPoint(r) {
|
|
274
|
+
return new Point(r);
|
|
273
275
|
}
|
|
274
|
-
function createLineString(
|
|
275
|
-
return new LineString(
|
|
276
|
+
function createLineString(r) {
|
|
277
|
+
return new LineString(r);
|
|
276
278
|
}
|
|
277
|
-
function createPolygon(
|
|
278
|
-
return new Polygon(
|
|
279
|
+
function createPolygon(r) {
|
|
280
|
+
return new Polygon(r);
|
|
279
281
|
}
|
|
280
|
-
function createCircle(
|
|
281
|
-
return new Circle(
|
|
282
|
+
function createCircle(r, l) {
|
|
283
|
+
return new Circle(r, l);
|
|
282
284
|
}
|
|
283
|
-
function createMultiPoint(
|
|
284
|
-
return new MultiPoint(
|
|
285
|
+
function createMultiPoint(r) {
|
|
286
|
+
return new MultiPoint(r);
|
|
285
287
|
}
|
|
286
|
-
function createMultiLineString(
|
|
287
|
-
return new MultiLineString(
|
|
288
|
+
function createMultiLineString(r) {
|
|
289
|
+
return new MultiLineString(r);
|
|
288
290
|
}
|
|
289
|
-
function createMultiPolygon(
|
|
290
|
-
return new MultiPolygon(
|
|
291
|
+
function createMultiPolygon(r) {
|
|
292
|
+
return new MultiPolygon(r);
|
|
291
293
|
}
|
|
292
|
-
function createFeature(
|
|
293
|
-
let { styleOptions:
|
|
294
|
-
geometry:
|
|
295
|
-
...
|
|
294
|
+
function createFeature(r) {
|
|
295
|
+
let { styleOptions: l, style: u, geometry: d,...f } = r ?? {}, p = l ? createStyle(l) : u, m = new Feature({
|
|
296
|
+
geometry: d,
|
|
297
|
+
...f
|
|
296
298
|
});
|
|
297
|
-
return
|
|
299
|
+
return m.setStyle(p), m;
|
|
298
300
|
}
|
|
299
|
-
function createPointFeature(
|
|
300
|
-
let
|
|
301
|
+
function createPointFeature(r, l) {
|
|
302
|
+
let u = createPoint(r);
|
|
301
303
|
return createFeature({
|
|
302
|
-
...
|
|
303
|
-
geometry:
|
|
304
|
+
...l,
|
|
305
|
+
geometry: u
|
|
304
306
|
});
|
|
305
307
|
}
|
|
306
|
-
function createLineStringFeature(
|
|
307
|
-
let
|
|
308
|
+
function createLineStringFeature(r, l) {
|
|
309
|
+
let u = createLineString(r);
|
|
308
310
|
return createFeature({
|
|
309
|
-
...
|
|
310
|
-
geometry:
|
|
311
|
+
...l,
|
|
312
|
+
geometry: u
|
|
311
313
|
});
|
|
312
314
|
}
|
|
313
|
-
function createPolygonFeature(
|
|
314
|
-
let
|
|
315
|
+
function createPolygonFeature(r, l) {
|
|
316
|
+
let u = createPolygon(r);
|
|
315
317
|
return createFeature({
|
|
316
|
-
...
|
|
317
|
-
geometry:
|
|
318
|
+
...l,
|
|
319
|
+
geometry: u
|
|
318
320
|
});
|
|
319
321
|
}
|
|
320
|
-
function createCircleFeature(
|
|
321
|
-
let
|
|
322
|
+
function createCircleFeature(r, l, u) {
|
|
323
|
+
let d = createCircle(r, l);
|
|
322
324
|
return createFeature({
|
|
323
|
-
...
|
|
324
|
-
geometry:
|
|
325
|
+
...u,
|
|
326
|
+
geometry: d
|
|
325
327
|
});
|
|
326
328
|
}
|
|
327
|
-
function createMultiPointFeature(
|
|
328
|
-
let
|
|
329
|
+
function createMultiPointFeature(r, l) {
|
|
330
|
+
let u = createMultiPoint(r);
|
|
329
331
|
return createFeature({
|
|
330
|
-
...
|
|
331
|
-
geometry:
|
|
332
|
+
...l,
|
|
333
|
+
geometry: u
|
|
332
334
|
});
|
|
333
335
|
}
|
|
334
|
-
function createMultiLineStringFeature(
|
|
335
|
-
let
|
|
336
|
+
function createMultiLineStringFeature(r, l) {
|
|
337
|
+
let u = createMultiLineString(r);
|
|
336
338
|
return createFeature({
|
|
337
|
-
...
|
|
338
|
-
geometry:
|
|
339
|
+
...l,
|
|
340
|
+
geometry: u
|
|
339
341
|
});
|
|
340
342
|
}
|
|
341
|
-
function createMultiPolygonFeature(
|
|
342
|
-
let
|
|
343
|
+
function createMultiPolygonFeature(r, l) {
|
|
344
|
+
let u = createMultiPolygon(r);
|
|
343
345
|
return createFeature({
|
|
344
|
-
...
|
|
345
|
-
geometry:
|
|
346
|
+
...l,
|
|
347
|
+
geometry: u
|
|
346
348
|
});
|
|
347
349
|
}
|
|
348
|
-
function createTianDiTuUrl(
|
|
349
|
-
let { type:
|
|
350
|
-
return `${
|
|
350
|
+
function createTianDiTuUrl(r) {
|
|
351
|
+
let { type: l = "img", projection: u = WebMercatorProjection, key: d } = r, f = r.url || "https://t{0-4}.tianditu.gov.cn", p = `&tk=${d}&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}`;
|
|
352
|
+
return `${f}/${l}_${u === "EPSG:4326" ? "c" : u === "EPSG:3857" ? "w" : "c"}/wmts?LAYER=${l}${p}`;
|
|
351
353
|
}
|
|
352
|
-
function createTianDiTuLayer(
|
|
353
|
-
let { layerOptions:
|
|
354
|
+
function createTianDiTuLayer(r) {
|
|
355
|
+
let { layerOptions: l, sourceOptions: u,...d } = r;
|
|
354
356
|
return new Tile({
|
|
355
357
|
source: new XYZ({
|
|
356
|
-
url: createTianDiTuUrl(
|
|
357
|
-
projection:
|
|
358
|
+
url: createTianDiTuUrl(d),
|
|
359
|
+
projection: d.projection,
|
|
358
360
|
crossOrigin: "Anonymous",
|
|
359
|
-
...
|
|
361
|
+
...u
|
|
360
362
|
}),
|
|
361
|
-
...
|
|
363
|
+
...l
|
|
362
364
|
});
|
|
363
365
|
}
|
|
364
|
-
function createBingLayer({ name:
|
|
366
|
+
function createBingLayer({ name: r, key: l, layerOptions: u, sourceOptions: d }) {
|
|
365
367
|
return new Tile({
|
|
366
368
|
source: new BingMaps({
|
|
367
|
-
key:
|
|
368
|
-
imagerySet:
|
|
369
|
+
key: l,
|
|
370
|
+
imagerySet: r,
|
|
369
371
|
placeholderTiles: !1,
|
|
370
|
-
...
|
|
372
|
+
...d
|
|
371
373
|
}),
|
|
372
|
-
...
|
|
374
|
+
...u
|
|
373
375
|
});
|
|
374
376
|
}
|
|
375
|
-
function createOpenStreetMapLayer(
|
|
376
|
-
let { layerOptions:
|
|
377
|
+
function createOpenStreetMapLayer(r) {
|
|
378
|
+
let { layerOptions: l, sourceOptions: u } = r || {};
|
|
377
379
|
return new Tile({
|
|
378
380
|
source: new OSM({
|
|
379
381
|
crossOrigin: "Anonymous",
|
|
380
|
-
...
|
|
382
|
+
...u
|
|
381
383
|
}),
|
|
382
|
-
...
|
|
384
|
+
...l
|
|
383
385
|
});
|
|
384
386
|
}
|
|
385
|
-
function
|
|
386
|
-
|
|
387
|
+
function createVectorSource(r) {
|
|
388
|
+
return new VectorSource({ ...r });
|
|
389
|
+
}
|
|
390
|
+
function createVectorLayer(r) {
|
|
391
|
+
let { styleOptions: l, sourceOptions: u,...d } = r || {}, f = l ? createStyle(l) : void 0, p = createVectorSource(u);
|
|
387
392
|
return {
|
|
388
393
|
source: p,
|
|
389
394
|
layer: new VectorLayer({
|
|
@@ -393,331 +398,344 @@ function createVectorLayer(a) {
|
|
|
393
398
|
})
|
|
394
399
|
};
|
|
395
400
|
}
|
|
396
|
-
function
|
|
397
|
-
|
|
401
|
+
function createWebGLVectorLayer(r) {
|
|
402
|
+
let { style: l, sourceOptions: u,...d } = r, f = createVectorSource(u);
|
|
403
|
+
return {
|
|
404
|
+
source: f,
|
|
405
|
+
layer: new WebGLVectorLayer({
|
|
406
|
+
source: f,
|
|
407
|
+
...d,
|
|
408
|
+
style: l
|
|
409
|
+
})
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
function wgs84ToMercator(r) {
|
|
413
|
+
return transform(r, EPSG_4326, EPSG_3857);
|
|
398
414
|
}
|
|
399
415
|
const EPSG_4326ToEPSG_3857 = wgs84ToMercator;
|
|
400
|
-
function mercatorToWgs84(
|
|
401
|
-
return transform(
|
|
416
|
+
function mercatorToWgs84(r) {
|
|
417
|
+
return transform(r, EPSG_3857, EPSG_4326);
|
|
402
418
|
}
|
|
403
419
|
const EPSG_3857ToEPSG_4326 = mercatorToWgs84;
|
|
404
|
-
function wgs84ExtentToMercator(
|
|
405
|
-
return transformExtent(
|
|
420
|
+
function wgs84ExtentToMercator(r) {
|
|
421
|
+
return transformExtent(r, EPSG_4326, EPSG_3857);
|
|
406
422
|
}
|
|
407
423
|
const EPSG_4326ExtentToEPSG_3857 = wgs84ExtentToMercator;
|
|
408
|
-
function mercatorExtentToWgs84(
|
|
409
|
-
return transformExtent(
|
|
424
|
+
function mercatorExtentToWgs84(r) {
|
|
425
|
+
return transformExtent(r, EPSG_3857, EPSG_4326);
|
|
410
426
|
}
|
|
411
427
|
const EPSG_3857ExtentToEPSG_4326 = mercatorExtentToWgs84;
|
|
412
|
-
function createToolTipElement(
|
|
413
|
-
let
|
|
414
|
-
return
|
|
415
|
-
}
|
|
416
|
-
function useDrawLineString(
|
|
417
|
-
let
|
|
418
|
-
source:
|
|
419
|
-
style:
|
|
420
|
-
zIndex:
|
|
428
|
+
function createToolTipElement(r) {
|
|
429
|
+
let l = document.createElement("div");
|
|
430
|
+
return l.innerHTML = r, l.style.cursor = "pointer", l.style.userSelect = "none", l.style.backgroundColor = "red", l.style.color = "white", l.style.borderRadius = "5px", l.style.padding = "0 5px", l.style.fontSize = "12px", l.style.border = "2px solid white", l;
|
|
431
|
+
}
|
|
432
|
+
function useDrawLineString(l, u) {
|
|
433
|
+
let d = ref(!0), f = ref([]), h = computed(() => f.value.map((r) => r.getGeometry().getCoordinates())), g = new VectorSource(), y = u.styleOptions ? createStyle(u.styleOptions) : u?.style, b = new VectorLayer({
|
|
434
|
+
source: g,
|
|
435
|
+
style: y,
|
|
436
|
+
zIndex: u?.zIndex
|
|
421
437
|
});
|
|
422
|
-
|
|
423
|
-
let
|
|
424
|
-
source:
|
|
425
|
-
style: (
|
|
438
|
+
l.addLayer(b);
|
|
439
|
+
let x = new Draw({
|
|
440
|
+
source: g,
|
|
441
|
+
style: (u.drawStyleOptions ? createStyle(u.drawStyleOptions) : u?.drawStyle) || y,
|
|
426
442
|
type: "LineString"
|
|
427
443
|
});
|
|
428
|
-
|
|
429
|
-
let
|
|
430
|
-
source:
|
|
431
|
-
style: (
|
|
432
|
-
}),
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
}),
|
|
436
|
-
|
|
437
|
-
}),
|
|
438
|
-
|
|
444
|
+
x.setActive(!1);
|
|
445
|
+
let S = new Modify({
|
|
446
|
+
source: g,
|
|
447
|
+
style: (u.modifyStyleOptions ? createStyle(u.modifyStyleOptions) : u?.modifyStyle) || y
|
|
448
|
+
}), w = /* @__PURE__ */ new Set();
|
|
449
|
+
l.addInteraction(x), onMounted(() => {
|
|
450
|
+
l.addInteraction(S);
|
|
451
|
+
}), g.on("addfeature", () => {
|
|
452
|
+
u.size && g.getFeatures().length >= u.size && x.setActive(!1);
|
|
453
|
+
}), g.on("removefeature", () => {
|
|
454
|
+
u.size && g.getFeatures().length < u.size && x.setActive(!0);
|
|
439
455
|
});
|
|
440
|
-
let
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
}),
|
|
456
|
+
let E = () => {
|
|
457
|
+
w.forEach((r) => {
|
|
458
|
+
l.removeOverlay(r);
|
|
459
|
+
}), w.clear();
|
|
444
460
|
};
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
let
|
|
448
|
-
|
|
449
|
-
let
|
|
450
|
-
|
|
451
|
-
|
|
461
|
+
g.on("change", () => {
|
|
462
|
+
E(), g.getFeatures().forEach((r) => {
|
|
463
|
+
let d = r.getGeometry();
|
|
464
|
+
d.getCoordinates();
|
|
465
|
+
let f = getCenter(d.getExtent()), p = document.createElement("div");
|
|
466
|
+
u.deleteFeatureLabel ? render(u.deleteFeatureLabel, p) : p = createToolTipElement("删除线"), p.addEventListener("click", () => {
|
|
467
|
+
g.removeFeature(r);
|
|
452
468
|
});
|
|
453
|
-
let
|
|
454
|
-
position:
|
|
469
|
+
let m = new Overlay({
|
|
470
|
+
position: f,
|
|
455
471
|
positioning: "center-center",
|
|
456
|
-
element:
|
|
472
|
+
element: p
|
|
457
473
|
});
|
|
458
|
-
|
|
459
|
-
let
|
|
460
|
-
|
|
461
|
-
let
|
|
462
|
-
|
|
463
|
-
|
|
474
|
+
w.add(m), l.addOverlay(m);
|
|
475
|
+
let h = d.getCoordinates();
|
|
476
|
+
h.length < 3 || h.forEach((d, f) => {
|
|
477
|
+
let p = document.createElement("div");
|
|
478
|
+
u.deletePointLabel ? render(u.deletePointLabel, p) : p = createToolTipElement("删除点"), p.addEventListener("click", () => {
|
|
479
|
+
r.setGeometry(new LineString(h.filter((r, l) => l !== f)));
|
|
464
480
|
});
|
|
465
|
-
let
|
|
466
|
-
position:
|
|
481
|
+
let m = new Overlay({
|
|
482
|
+
position: d,
|
|
467
483
|
positioning: "top-center",
|
|
468
484
|
offset: [0, -30],
|
|
469
|
-
element:
|
|
485
|
+
element: p
|
|
470
486
|
});
|
|
471
|
-
|
|
487
|
+
w.add(m), l.addOverlay(m);
|
|
472
488
|
});
|
|
473
489
|
});
|
|
474
|
-
}),
|
|
475
|
-
|
|
476
|
-
}),
|
|
477
|
-
|
|
490
|
+
}), x.on("change:active", () => {
|
|
491
|
+
d.value = x.getActive();
|
|
492
|
+
}), g.on("change", () => {
|
|
493
|
+
f.value = g.getFeatures();
|
|
478
494
|
});
|
|
479
|
-
let
|
|
480
|
-
|
|
495
|
+
let D = () => {
|
|
496
|
+
E(), l.removeLayer(b), l.removeInteraction(x), l.removeInteraction(S);
|
|
497
|
+
}, O = () => {
|
|
498
|
+
u.size && f.value.length >= u.size || x.setActive(!0);
|
|
481
499
|
}, k = () => {
|
|
482
|
-
|
|
483
|
-
}, A = () => {
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
let u = new Feature({ geometry: new LineString(a) });
|
|
489
|
-
_.addFeature(u);
|
|
500
|
+
x.setActive(!1);
|
|
501
|
+
}, A = (r) => {
|
|
502
|
+
g.clear(), r.forEach((r) => {
|
|
503
|
+
if (r.length < 2) return;
|
|
504
|
+
let l = new Feature({ geometry: new LineString(r) });
|
|
505
|
+
g.addFeature(l);
|
|
490
506
|
});
|
|
491
|
-
},
|
|
492
|
-
|
|
507
|
+
}, j = () => {
|
|
508
|
+
A(u.defaultCoordinates || []);
|
|
493
509
|
};
|
|
494
|
-
return
|
|
495
|
-
|
|
510
|
+
return j(), onUnmounted(() => {
|
|
511
|
+
D();
|
|
496
512
|
}), {
|
|
497
|
-
inDraw:
|
|
498
|
-
start:
|
|
499
|
-
stop:
|
|
513
|
+
inDraw: d,
|
|
514
|
+
start: O,
|
|
515
|
+
stop: k,
|
|
500
516
|
clear: () => {
|
|
501
|
-
|
|
517
|
+
g.clear(), k();
|
|
502
518
|
},
|
|
503
|
-
setFeatures:
|
|
504
|
-
reset:
|
|
505
|
-
features:
|
|
506
|
-
coordinates:
|
|
507
|
-
destroy:
|
|
519
|
+
setFeatures: A,
|
|
520
|
+
reset: j,
|
|
521
|
+
features: f,
|
|
522
|
+
coordinates: h,
|
|
523
|
+
destroy: D
|
|
508
524
|
};
|
|
509
525
|
}
|
|
510
|
-
function useDrawPolygon(
|
|
511
|
-
let
|
|
512
|
-
source:
|
|
513
|
-
style:
|
|
514
|
-
zIndex:
|
|
526
|
+
function useDrawPolygon(l, u) {
|
|
527
|
+
let d = ref(!0), f = ref([]), h = computed(() => f.value.map((r) => r.getGeometry().getCoordinates())), g = u.styleOptions ? createStyle(u.styleOptions) : u?.style, y = new VectorSource(), b = new VectorLayer({
|
|
528
|
+
source: y,
|
|
529
|
+
style: g,
|
|
530
|
+
zIndex: u?.zIndex
|
|
515
531
|
});
|
|
516
|
-
|
|
517
|
-
let
|
|
518
|
-
source:
|
|
519
|
-
style: (
|
|
532
|
+
l.addLayer(b);
|
|
533
|
+
let x = new Draw({
|
|
534
|
+
source: y,
|
|
535
|
+
style: (u.drawStyleOptions ? createStyle(u.drawStyleOptions) : u?.drawStyle) || g,
|
|
520
536
|
type: "Polygon"
|
|
521
537
|
});
|
|
522
|
-
|
|
523
|
-
let
|
|
524
|
-
source:
|
|
525
|
-
style: (
|
|
526
|
-
}),
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
}),
|
|
530
|
-
|
|
531
|
-
}),
|
|
532
|
-
|
|
538
|
+
x.setActive(!1);
|
|
539
|
+
let S = new Modify({
|
|
540
|
+
source: y,
|
|
541
|
+
style: (u.modifyStyleOptions ? createStyle(u.modifyStyleOptions) : u?.modifyStyle) || g
|
|
542
|
+
}), w = /* @__PURE__ */ new Set();
|
|
543
|
+
l.addInteraction(x), onMounted(() => {
|
|
544
|
+
l.addInteraction(S);
|
|
545
|
+
}), y.on("addfeature", () => {
|
|
546
|
+
u.size && y.getFeatures().length >= u.size && x.setActive(!1);
|
|
547
|
+
}), y.on("removefeature", () => {
|
|
548
|
+
u.size && y.getFeatures().length < u.size && x.setActive(!0);
|
|
533
549
|
});
|
|
534
|
-
let
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
}),
|
|
550
|
+
let E = () => {
|
|
551
|
+
w.forEach((r) => {
|
|
552
|
+
l.removeOverlay(r);
|
|
553
|
+
}), w.clear();
|
|
538
554
|
};
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
let
|
|
542
|
-
|
|
543
|
-
|
|
555
|
+
y.on("change", () => {
|
|
556
|
+
E(), y.getFeatures().forEach((r) => {
|
|
557
|
+
let d = r.getGeometry(), f = getCenter(d.getExtent()), p = document.createElement("div");
|
|
558
|
+
u.deleteFeatureLabel ? render(u.deleteFeatureLabel, p) : p = createToolTipElement("删除区域"), p.addEventListener("click", () => {
|
|
559
|
+
y.removeFeature(r);
|
|
544
560
|
});
|
|
545
|
-
let
|
|
546
|
-
position:
|
|
561
|
+
let m = new Overlay({
|
|
562
|
+
position: f,
|
|
547
563
|
positioning: "center-center",
|
|
548
|
-
element:
|
|
564
|
+
element: p
|
|
549
565
|
});
|
|
550
|
-
|
|
551
|
-
let
|
|
552
|
-
|
|
553
|
-
let
|
|
554
|
-
|
|
555
|
-
|
|
566
|
+
w.add(m), l.addOverlay(m);
|
|
567
|
+
let h = d.getCoordinates()[0];
|
|
568
|
+
h.length < 3 || h.forEach((d, f) => {
|
|
569
|
+
let p = document.createElement("div");
|
|
570
|
+
u.deletePointLabel ? render(u.deletePointLabel, p) : p = createToolTipElement("删除点"), p.addEventListener("click", () => {
|
|
571
|
+
r.setGeometry(new Polygon([h.filter((r, l) => l !== f)]));
|
|
556
572
|
});
|
|
557
|
-
let
|
|
558
|
-
position:
|
|
573
|
+
let m = new Overlay({
|
|
574
|
+
position: d,
|
|
559
575
|
positioning: "top-center",
|
|
560
576
|
offset: [0, -30],
|
|
561
|
-
element:
|
|
577
|
+
element: p
|
|
562
578
|
});
|
|
563
|
-
|
|
579
|
+
w.add(m), l.addOverlay(m);
|
|
564
580
|
});
|
|
565
581
|
});
|
|
566
|
-
}),
|
|
567
|
-
|
|
568
|
-
}),
|
|
569
|
-
|
|
582
|
+
}), x.on("change:active", () => {
|
|
583
|
+
d.value = x.getActive();
|
|
584
|
+
}), y.on("change", () => {
|
|
585
|
+
f.value = y.getFeatures();
|
|
570
586
|
});
|
|
571
|
-
let
|
|
572
|
-
|
|
587
|
+
let D = () => {
|
|
588
|
+
E(), l.removeLayer(b), l.removeInteraction(x), l.removeInteraction(S);
|
|
589
|
+
}, O = () => {
|
|
590
|
+
u.size && f.value.length >= u.size || x.setActive(!0);
|
|
573
591
|
}, k = () => {
|
|
574
|
-
|
|
575
|
-
}, A = () => {
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
let u = new Feature({ geometry: new Polygon([a]) });
|
|
583
|
-
b.addFeature(u);
|
|
592
|
+
x.setActive(!1);
|
|
593
|
+
}, A = (r) => {
|
|
594
|
+
y.clear(), r?.forEach((r) => {
|
|
595
|
+
r.forEach((r) => {
|
|
596
|
+
if (r.length < 2) return;
|
|
597
|
+
r[0] !== r[r.length - 1] && r.push(r[0]);
|
|
598
|
+
let l = new Feature({ geometry: new Polygon([r]) });
|
|
599
|
+
y.addFeature(l);
|
|
584
600
|
});
|
|
585
601
|
});
|
|
586
|
-
},
|
|
587
|
-
|
|
602
|
+
}, j = () => {
|
|
603
|
+
A(u.defaultCoordinates);
|
|
588
604
|
};
|
|
589
|
-
return
|
|
590
|
-
|
|
605
|
+
return j(), onUnmounted(() => {
|
|
606
|
+
D();
|
|
591
607
|
}), {
|
|
592
|
-
inDraw:
|
|
593
|
-
start:
|
|
594
|
-
stop:
|
|
608
|
+
inDraw: d,
|
|
609
|
+
start: O,
|
|
610
|
+
stop: k,
|
|
595
611
|
clear: () => {
|
|
596
|
-
|
|
612
|
+
y.clear(), k();
|
|
597
613
|
},
|
|
598
|
-
setFeatures:
|
|
599
|
-
reset:
|
|
600
|
-
features:
|
|
601
|
-
coordinates:
|
|
602
|
-
destroy:
|
|
614
|
+
setFeatures: A,
|
|
615
|
+
reset: j,
|
|
616
|
+
features: f,
|
|
617
|
+
coordinates: h,
|
|
618
|
+
destroy: D
|
|
603
619
|
};
|
|
604
620
|
}
|
|
605
|
-
function useGraticule(
|
|
606
|
-
let
|
|
607
|
-
...
|
|
608
|
-
strokeStyle:
|
|
609
|
-
latLabelStyle:
|
|
610
|
-
lonLabelStyle:
|
|
621
|
+
function useGraticule(r) {
|
|
622
|
+
let l = ref(r.defaultShow || !1), { strokeStyleOption: u, strokeStyle: d, labelStyleOption: f, latLabelStyleOption: p, lonLabelStyleOption: m, latLabelStyle: h, lonLabelStyle: g,...v } = r.graticuleOptions || {}, y = u ? new Stroke(u) : d, x = f ? createTextStyle(f) : void 0, C = (p ? createTextStyle(p) : h) || x, w = (m ? createTextStyle(m) : g) || x, T = new Graticule({
|
|
623
|
+
...v,
|
|
624
|
+
strokeStyle: y,
|
|
625
|
+
latLabelStyle: C,
|
|
626
|
+
lonLabelStyle: w
|
|
611
627
|
});
|
|
612
|
-
return watch(
|
|
613
|
-
if (
|
|
614
|
-
let
|
|
615
|
-
|
|
628
|
+
return watch(l, (l) => {
|
|
629
|
+
if (T.setMap(null), l) {
|
|
630
|
+
let l = toValue(r.olMap);
|
|
631
|
+
l && T.setMap(l);
|
|
616
632
|
}
|
|
617
633
|
}, {
|
|
618
634
|
immediate: !0,
|
|
619
635
|
deep: !0
|
|
620
|
-
}), { showGraticule:
|
|
636
|
+
}), { showGraticule: l };
|
|
621
637
|
}
|
|
622
|
-
function usePointermove({ mapRef:
|
|
623
|
-
let
|
|
638
|
+
function usePointermove({ mapRef: l, items: u, forceUpdate: d = !1 }) {
|
|
639
|
+
let p = ref(!1), m = ref({
|
|
624
640
|
x: 0,
|
|
625
641
|
y: 0
|
|
626
|
-
}),
|
|
642
|
+
}), h = ref(), g = ref(), v = ref({
|
|
627
643
|
x: 0,
|
|
628
644
|
y: 0
|
|
629
|
-
}),
|
|
630
|
-
x:
|
|
631
|
-
y:
|
|
645
|
+
}), y = ref(), x = ref(), C = ref(), w = computed(() => ({
|
|
646
|
+
x: m.value.x + v.value.x,
|
|
647
|
+
y: m.value.y + v.value.y
|
|
632
648
|
})), T, E, D = "";
|
|
633
|
-
function O(
|
|
634
|
-
let
|
|
635
|
-
return
|
|
636
|
-
let
|
|
637
|
-
return typeof
|
|
649
|
+
function O(r) {
|
|
650
|
+
let l = toValue(u);
|
|
651
|
+
return l.sort((r, l) => (l.priority ?? 0) - (r.priority ?? 0)), l.find((l) => {
|
|
652
|
+
let u = l.visible;
|
|
653
|
+
return typeof u == "function" ? u(r) : u ?? !0;
|
|
638
654
|
});
|
|
639
655
|
}
|
|
640
|
-
function k(
|
|
641
|
-
if (
|
|
642
|
-
let
|
|
643
|
-
|
|
644
|
-
let
|
|
645
|
-
if (T.forEachFeatureAtPixel(
|
|
656
|
+
function k(r) {
|
|
657
|
+
if (r.dragging || !T || !E) return;
|
|
658
|
+
let l = r.coordinate;
|
|
659
|
+
y.value = l, x.value = l;
|
|
660
|
+
let u = r.pixel, f, _;
|
|
661
|
+
if (T.forEachFeatureAtPixel(u, (r, l) => (f = r, _ = l, !0)), !f) {
|
|
646
662
|
A();
|
|
647
663
|
return;
|
|
648
664
|
}
|
|
649
|
-
if (!
|
|
650
|
-
|
|
651
|
-
let { top:
|
|
665
|
+
if (!d && h.value && h.value.getId() === f.getId()) return;
|
|
666
|
+
h.value = f;
|
|
667
|
+
let { top: b, left: S } = E.getBoundingClientRect(), w = {
|
|
652
668
|
map: T,
|
|
653
669
|
position: {
|
|
654
|
-
x:
|
|
655
|
-
y:
|
|
670
|
+
x: u[0] + S,
|
|
671
|
+
y: u[1] + b
|
|
656
672
|
},
|
|
657
|
-
coordinate:
|
|
658
|
-
feature:
|
|
659
|
-
layer:
|
|
673
|
+
coordinate: l,
|
|
674
|
+
feature: f,
|
|
675
|
+
layer: _
|
|
660
676
|
}, D = O(w);
|
|
661
677
|
if (D) {
|
|
662
|
-
let { content:
|
|
663
|
-
|
|
678
|
+
let { content: r, cursor: l, visible: u, fixedFeatureCenter: d, offset: f, priority: p,...m } = D;
|
|
679
|
+
C.value = { ...m };
|
|
664
680
|
}
|
|
665
681
|
if (!D) {
|
|
666
682
|
A();
|
|
667
683
|
return;
|
|
668
684
|
}
|
|
669
|
-
|
|
685
|
+
v.value = {
|
|
670
686
|
x: D.offset?.x ?? 0,
|
|
671
687
|
y: D.offset?.y ?? 0
|
|
672
688
|
};
|
|
673
|
-
let k =
|
|
689
|
+
let k = d === !1 ? !0 : D.fixedFeatureCenter ?? !0, j = f.getGeometry();
|
|
674
690
|
if (k && j) {
|
|
675
|
-
let
|
|
676
|
-
|
|
691
|
+
let r = getCenter(j.getExtent());
|
|
692
|
+
x.value = r, u = T.getPixelFromCoordinate(r);
|
|
677
693
|
}
|
|
678
|
-
|
|
694
|
+
m.value.x = u[0] + S, m.value.y = u[1] + b;
|
|
679
695
|
let M = D.content;
|
|
680
|
-
|
|
696
|
+
g.value = typeof M == "function" ? () => M(w) : M;
|
|
681
697
|
let N = D.cursor, P = typeof N == "function" ? N(w) : N;
|
|
682
|
-
P !== void 0 && P !== E.style.cursor && (E.style.cursor = P),
|
|
698
|
+
P !== void 0 && P !== E.style.cursor && (E.style.cursor = P), p.value = !0;
|
|
683
699
|
}
|
|
684
700
|
function A() {
|
|
685
|
-
|
|
701
|
+
p.value = !1, h.value = void 0, E && E.style.cursor !== D && (E.style.cursor = D);
|
|
686
702
|
}
|
|
687
|
-
function j(
|
|
688
|
-
|
|
703
|
+
function j(r) {
|
|
704
|
+
r.on("pointermove", k);
|
|
689
705
|
}
|
|
690
|
-
function M(
|
|
691
|
-
|
|
706
|
+
function M(r) {
|
|
707
|
+
r.un("pointermove", k);
|
|
692
708
|
}
|
|
693
|
-
return watch(() => toValue(
|
|
694
|
-
|
|
709
|
+
return watch(() => toValue(l), (r, l) => {
|
|
710
|
+
l && M(l), l !== r && (T = r, r && (E = r.getViewport(), j(r), D = E.style.cursor));
|
|
695
711
|
}, { immediate: !0 }), onBeforeUnmount(() => {
|
|
696
712
|
T && M(T);
|
|
697
713
|
}), {
|
|
698
|
-
visible: computed(() =>
|
|
714
|
+
visible: computed(() => p.value),
|
|
699
715
|
position: computed(() => w.value),
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
716
|
+
offset: computed(() => v.value),
|
|
717
|
+
originalPosition: computed(() => m.value),
|
|
718
|
+
feature: computed(() => h.value),
|
|
719
|
+
content: computed(() => g.value),
|
|
720
|
+
originalCoordinate: computed(() => y.value),
|
|
721
|
+
coordinate: computed(() => x.value),
|
|
722
|
+
option: computed(() => C.value),
|
|
705
723
|
hide: A
|
|
706
724
|
};
|
|
707
725
|
}
|
|
708
|
-
function useSwitchBaseLayer(
|
|
709
|
-
let
|
|
710
|
-
return Object.values(
|
|
711
|
-
|
|
712
|
-
|
|
726
|
+
function useSwitchBaseLayer(r) {
|
|
727
|
+
let l = ref(r.defaultLayerName || Object.keys(r.layers)[0]);
|
|
728
|
+
return Object.values(r.layers).forEach((l) => {
|
|
729
|
+
l.forEach((l) => {
|
|
730
|
+
r.olMap.addLayer(l);
|
|
713
731
|
});
|
|
714
|
-
}), watch(
|
|
715
|
-
Object.entries(
|
|
716
|
-
let
|
|
717
|
-
|
|
718
|
-
|
|
732
|
+
}), watch(l, () => {
|
|
733
|
+
Object.entries(r.layers).forEach(([r, u]) => {
|
|
734
|
+
let d = r === l.value;
|
|
735
|
+
u.forEach((r) => {
|
|
736
|
+
r.setVisible(d);
|
|
719
737
|
});
|
|
720
738
|
});
|
|
721
|
-
}, { immediate: !0 }), { visibleLayerName:
|
|
739
|
+
}, { immediate: !0 }), { visibleLayerName: l };
|
|
722
740
|
}
|
|
723
|
-
export { EPSG_3857, EPSG_3857ExtentToEPSG_4326, EPSG_3857ToEPSG_4326, EPSG_4326, EPSG_4326ExtentToEPSG_3857, EPSG_4326ToEPSG_3857, ONE_NM, ol_map_default as OlMap, WGS84Projection, WebMercatorProjection, createBingLayer, createCircle, createCircleFeature, createCircleStyle, createFeature, createLineString, createLineStringFeature, createMultiLineString, createMultiLineStringFeature, createMultiPoint, createMultiPointFeature, createMultiPolygon, createMultiPolygonFeature, createOpenStreetMapLayer, createPoint, createPointFeature, createPolygon, createPolygonFeature, createStyle, createTextStyle, createTianDiTuLayer, createTianDiTuUrl, createVectorLayer, formatAngle, formatRotation, kmToNauticalMiles, mercatorExtentToWgs84, mercatorToWgs84, nauticalMilesToKm, olMapInjectionKey, useContextmenu, useDrawLineString, useDrawPolygon, useGraticule, useOlMap, usePointermove, useSwitchBaseLayer, wgs84ExtentToMercator, wgs84ToMercator };
|
|
741
|
+
export { EPSG_3857, EPSG_3857ExtentToEPSG_4326, EPSG_3857ToEPSG_4326, EPSG_4326, EPSG_4326ExtentToEPSG_3857, EPSG_4326ToEPSG_3857, ONE_NM, ol_map_default as OlMap, WGS84Projection, WebMercatorProjection, createBingLayer, createCircle, createCircleFeature, createCircleStyle, createFeature, createLineString, createLineStringFeature, createMultiLineString, createMultiLineStringFeature, createMultiPoint, createMultiPointFeature, createMultiPolygon, createMultiPolygonFeature, createOpenStreetMapLayer, createPoint, createPointFeature, createPolygon, createPolygonFeature, createStyle, createTextStyle, createTianDiTuLayer, createTianDiTuUrl, createVectorLayer, createVectorSource, createWebGLVectorLayer, formatAngle, formatRotation, kmToNauticalMiles, mercatorExtentToWgs84, mercatorToWgs84, nauticalMilesToKm, olMapInjectionKey, useContextmenu, useDrawLineString, useDrawPolygon, useGraticule, useOlMap, usePointermove, useSwitchBaseLayer, wgs84ExtentToMercator, wgs84ToMercator };
|