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