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