@movk/maplibre 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.en.md +192 -0
- package/README.md +191 -0
- package/dist/module.d.mts +20 -0
- package/dist/module.d.ts +20 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +63 -0
- package/dist/runtime/components/CustomLayer.d.vue.ts +24 -0
- package/dist/runtime/components/CustomLayer.vue +23 -0
- package/dist/runtime/components/CustomLayer.vue.d.ts +24 -0
- package/dist/runtime/components/Layer.d.vue.ts +75 -0
- package/dist/runtime/components/Layer.vue +112 -0
- package/dist/runtime/components/Layer.vue.d.ts +75 -0
- package/dist/runtime/components/LayerGroup.d.vue.ts +25 -0
- package/dist/runtime/components/LayerGroup.vue +16 -0
- package/dist/runtime/components/LayerGroup.vue.d.ts +25 -0
- package/dist/runtime/components/LottieMarker.d.vue.ts +50 -0
- package/dist/runtime/components/LottieMarker.vue +31 -0
- package/dist/runtime/components/LottieMarker.vue.d.ts +50 -0
- package/dist/runtime/components/Map.d.vue.ts +84 -0
- package/dist/runtime/components/Map.vue +134 -0
- package/dist/runtime/components/Map.vue.d.ts +84 -0
- package/dist/runtime/components/Marker.d.vue.ts +54 -0
- package/dist/runtime/components/Marker.vue +86 -0
- package/dist/runtime/components/Marker.vue.d.ts +54 -0
- package/dist/runtime/components/Popup.d.vue.ts +30 -0
- package/dist/runtime/components/Popup.vue +33 -0
- package/dist/runtime/components/Popup.vue.d.ts +30 -0
- package/dist/runtime/components/Source.d.vue.ts +23 -0
- package/dist/runtime/components/Source.vue +44 -0
- package/dist/runtime/components/Source.vue.d.ts +23 -0
- package/dist/runtime/components/Tooltip.d.vue.ts +45 -0
- package/dist/runtime/components/Tooltip.vue +106 -0
- package/dist/runtime/components/Tooltip.vue.d.ts +45 -0
- package/dist/runtime/components/buffers/BufferCircle.d.vue.ts +27 -0
- package/dist/runtime/components/buffers/BufferCircle.vue +30 -0
- package/dist/runtime/components/buffers/BufferCircle.vue.d.ts +27 -0
- package/dist/runtime/components/buffers/BufferEllipse.d.vue.ts +35 -0
- package/dist/runtime/components/buffers/BufferEllipse.vue +36 -0
- package/dist/runtime/components/buffers/BufferEllipse.vue.d.ts +35 -0
- package/dist/runtime/components/buffers/BufferLine.d.vue.ts +21 -0
- package/dist/runtime/components/buffers/BufferLine.vue +40 -0
- package/dist/runtime/components/buffers/BufferLine.vue.d.ts +21 -0
- package/dist/runtime/components/buffers/BufferPolygon.d.vue.ts +21 -0
- package/dist/runtime/components/buffers/BufferPolygon.vue +40 -0
- package/dist/runtime/components/buffers/BufferPolygon.vue.d.ts +21 -0
- package/dist/runtime/components/buffers/BufferSector.d.vue.ts +31 -0
- package/dist/runtime/components/buffers/BufferSector.vue +35 -0
- package/dist/runtime/components/buffers/BufferSector.vue.d.ts +31 -0
- package/dist/runtime/components/controls/AttributionControl.d.vue.ts +24 -0
- package/dist/runtime/components/controls/AttributionControl.vue +18 -0
- package/dist/runtime/components/controls/AttributionControl.vue.d.ts +24 -0
- package/dist/runtime/components/controls/FullscreenControl.d.vue.ts +24 -0
- package/dist/runtime/components/controls/FullscreenControl.vue +18 -0
- package/dist/runtime/components/controls/FullscreenControl.vue.d.ts +24 -0
- package/dist/runtime/components/controls/GeolocateControl.d.vue.ts +24 -0
- package/dist/runtime/components/controls/GeolocateControl.vue +18 -0
- package/dist/runtime/components/controls/GeolocateControl.vue.d.ts +24 -0
- package/dist/runtime/components/controls/NavigationControl.d.vue.ts +24 -0
- package/dist/runtime/components/controls/NavigationControl.vue +18 -0
- package/dist/runtime/components/controls/NavigationControl.vue.d.ts +24 -0
- package/dist/runtime/components/controls/ScaleControl.d.vue.ts +24 -0
- package/dist/runtime/components/controls/ScaleControl.vue +18 -0
- package/dist/runtime/components/controls/ScaleControl.vue.d.ts +24 -0
- package/dist/runtime/components/effects/AnimatedImage.d.vue.ts +28 -0
- package/dist/runtime/components/effects/AnimatedImage.vue +50 -0
- package/dist/runtime/components/effects/AnimatedImage.vue.d.ts +28 -0
- package/dist/runtime/components/effects/DiffusionCircle.d.vue.ts +44 -0
- package/dist/runtime/components/effects/DiffusionCircle.vue +47 -0
- package/dist/runtime/components/effects/DiffusionCircle.vue.d.ts +44 -0
- package/dist/runtime/components/effects/FlowBuilding.d.vue.ts +53 -0
- package/dist/runtime/components/effects/FlowBuilding.vue +64 -0
- package/dist/runtime/components/effects/FlowBuilding.vue.d.ts +53 -0
- package/dist/runtime/components/effects/GlowCircle.d.vue.ts +44 -0
- package/dist/runtime/components/effects/GlowCircle.vue +42 -0
- package/dist/runtime/components/effects/GlowCircle.vue.d.ts +44 -0
- package/dist/runtime/components/effects/GradientBuilding.d.vue.ts +25 -0
- package/dist/runtime/components/effects/GradientBuilding.vue +37 -0
- package/dist/runtime/components/effects/GradientBuilding.vue.d.ts +25 -0
- package/dist/runtime/components/effects/Migration.d.vue.ts +50 -0
- package/dist/runtime/components/effects/Migration.vue +90 -0
- package/dist/runtime/components/effects/Migration.vue.d.ts +50 -0
- package/dist/runtime/components/effects/Radar.d.vue.ts +32 -0
- package/dist/runtime/components/effects/Radar.vue +49 -0
- package/dist/runtime/components/effects/Radar.vue.d.ts +32 -0
- package/dist/runtime/components/effects/SpriteImage.d.vue.ts +41 -0
- package/dist/runtime/components/effects/SpriteImage.vue +67 -0
- package/dist/runtime/components/effects/SpriteImage.vue.d.ts +41 -0
- package/dist/runtime/components/effects/TextureBuilding.d.vue.ts +25 -0
- package/dist/runtime/components/effects/TextureBuilding.vue +39 -0
- package/dist/runtime/components/effects/TextureBuilding.vue.d.ts +25 -0
- package/dist/runtime/components/effects/Trail.d.vue.ts +44 -0
- package/dist/runtime/components/effects/Trail.vue +61 -0
- package/dist/runtime/components/effects/Trail.vue.d.ts +44 -0
- package/dist/runtime/components/effects/WaveCircle.d.vue.ts +44 -0
- package/dist/runtime/components/effects/WaveCircle.vue +55 -0
- package/dist/runtime/components/effects/WaveCircle.vue.d.ts +44 -0
- package/dist/runtime/components/effects/WindowBuilding.d.vue.ts +53 -0
- package/dist/runtime/components/effects/WindowBuilding.vue +61 -0
- package/dist/runtime/components/effects/WindowBuilding.vue.d.ts +53 -0
- package/dist/runtime/components/environment/Sky.d.vue.ts +21 -0
- package/dist/runtime/components/environment/Sky.vue +15 -0
- package/dist/runtime/components/environment/Sky.vue.d.ts +21 -0
- package/dist/runtime/components/environment/Temperature.d.vue.ts +47 -0
- package/dist/runtime/components/environment/Temperature.vue +41 -0
- package/dist/runtime/components/environment/Temperature.vue.d.ts +47 -0
- package/dist/runtime/components/environment/Terrain.d.vue.ts +34 -0
- package/dist/runtime/components/environment/Terrain.vue +47 -0
- package/dist/runtime/components/environment/Terrain.vue.d.ts +34 -0
- package/dist/runtime/components/extensions/DrawControl.d.vue.ts +0 -0
- package/dist/runtime/components/extensions/DrawControl.vue +168 -0
- package/dist/runtime/components/extensions/DrawControl.vue.d.ts +0 -0
- package/dist/runtime/components/extensions/TiandituLayer.d.vue.ts +20 -0
- package/dist/runtime/components/extensions/TiandituLayer.vue +26 -0
- package/dist/runtime/components/extensions/TiandituLayer.vue.d.ts +20 -0
- package/dist/runtime/components/extensions/WmsLayer.d.vue.ts +50 -0
- package/dist/runtime/components/extensions/WmsLayer.vue +39 -0
- package/dist/runtime/components/extensions/WmsLayer.vue.d.ts +50 -0
- package/dist/runtime/components/extensions/WmtsLayer.d.vue.ts +42 -0
- package/dist/runtime/components/extensions/WmtsLayer.vue +37 -0
- package/dist/runtime/components/extensions/WmtsLayer.vue.d.ts +42 -0
- package/dist/runtime/components/layers/BuildingLayer.d.vue.ts +28 -0
- package/dist/runtime/components/layers/BuildingLayer.vue +41 -0
- package/dist/runtime/components/layers/BuildingLayer.vue.d.ts +28 -0
- package/dist/runtime/components/layers/ClusterLayer.d.vue.ts +55 -0
- package/dist/runtime/components/layers/ClusterLayer.vue +86 -0
- package/dist/runtime/components/layers/ClusterLayer.vue.d.ts +55 -0
- package/dist/runtime/components/layers/ImageLayer.d.vue.ts +21 -0
- package/dist/runtime/components/layers/ImageLayer.vue +25 -0
- package/dist/runtime/components/layers/ImageLayer.vue.d.ts +21 -0
- package/dist/runtime/components/layers/RasterLayer.d.vue.ts +35 -0
- package/dist/runtime/components/layers/RasterLayer.vue +34 -0
- package/dist/runtime/components/layers/RasterLayer.vue.d.ts +35 -0
- package/dist/runtime/components/layers/VideoLayer.d.vue.ts +28 -0
- package/dist/runtime/components/layers/VideoLayer.vue +38 -0
- package/dist/runtime/components/layers/VideoLayer.vue.d.ts +28 -0
- package/dist/runtime/composables/defineMaplibreControl.d.ts +3 -0
- package/dist/runtime/composables/defineMaplibreControl.js +6 -0
- package/dist/runtime/composables/useFeatureState.d.ts +35 -0
- package/dist/runtime/composables/useFeatureState.js +76 -0
- package/dist/runtime/composables/useFrameIcon.d.ts +17 -0
- package/dist/runtime/composables/useFrameIcon.js +36 -0
- package/dist/runtime/composables/useMap.d.ts +3 -0
- package/dist/runtime/composables/useMap.js +9 -0
- package/dist/runtime/composables/useMapAnimation.d.ts +21 -0
- package/dist/runtime/composables/useMapAnimation.js +13 -0
- package/dist/runtime/composables/useMapExport.d.ts +34 -0
- package/dist/runtime/composables/useMapExport.js +35 -0
- package/dist/runtime/composables/useMaplibre.d.ts +6 -0
- package/dist/runtime/composables/useMaplibre.js +4 -0
- package/dist/runtime/composables/useMaplibreCamera.d.ts +15 -0
- package/dist/runtime/composables/useMaplibreCamera.js +32 -0
- package/dist/runtime/composables/useMaplibreDraw.d.ts +10 -0
- package/dist/runtime/composables/useMaplibreDraw.js +34 -0
- package/dist/runtime/composables/useMaplibreImage.d.ts +19 -0
- package/dist/runtime/composables/useMaplibreImage.js +33 -0
- package/dist/runtime/composables/useMeasure.d.ts +25 -0
- package/dist/runtime/composables/useMeasure.js +173 -0
- package/dist/runtime/domains/map/config.d.ts +7 -0
- package/dist/runtime/domains/map/config.js +13 -0
- package/dist/runtime/domains/map/context.d.ts +13 -0
- package/dist/runtime/domains/map/context.js +51 -0
- package/dist/runtime/domains/map/control.d.ts +4 -0
- package/dist/runtime/domains/map/control.js +28 -0
- package/dist/runtime/domains/map/create-map.d.ts +3 -0
- package/dist/runtime/domains/map/create-map.js +21 -0
- package/dist/runtime/domains/map/draw-context.d.ts +26 -0
- package/dist/runtime/domains/map/draw-context.js +73 -0
- package/dist/runtime/domains/map/draw-registry.d.ts +5 -0
- package/dist/runtime/domains/map/draw-registry.js +15 -0
- package/dist/runtime/domains/map/draw-toolbar.d.ts +15 -0
- package/dist/runtime/domains/map/draw-toolbar.js +52 -0
- package/dist/runtime/domains/map/draw.d.ts +4 -0
- package/dist/runtime/domains/map/draw.js +1 -0
- package/dist/runtime/domains/map/layer-group.d.ts +9 -0
- package/dist/runtime/domains/map/layer-group.js +1 -0
- package/dist/runtime/domains/map/registry.d.ts +4 -0
- package/dist/runtime/domains/map/registry.js +10 -0
- package/dist/runtime/domains/map/resolve.d.ts +7 -0
- package/dist/runtime/domains/map/resolve.js +7 -0
- package/dist/runtime/domains/map/style-effect.d.ts +6 -0
- package/dist/runtime/domains/map/style-effect.js +21 -0
- package/dist/runtime/draw-modes/index.d.ts +16 -0
- package/dist/runtime/draw-modes/index.js +32 -0
- package/dist/runtime/index.css +1 -0
- package/dist/runtime/plugins/config.d.ts +2 -0
- package/dist/runtime/plugins/config.js +6 -0
- package/dist/runtime/types/draw.d.ts +30 -0
- package/dist/runtime/types/draw.js +0 -0
- package/dist/runtime/types/index.d.ts +3 -0
- package/dist/runtime/types/index.js +0 -0
- package/dist/runtime/types/map.d.ts +45 -0
- package/dist/runtime/types/map.js +0 -0
- package/dist/runtime/types/tianditu.d.ts +247 -0
- package/dist/runtime/types/tianditu.js +0 -0
- package/dist/runtime/utils/animated-image.d.ts +13 -0
- package/dist/runtime/utils/animated-image.js +47 -0
- package/dist/runtime/utils/buffer.d.ts +24 -0
- package/dist/runtime/utils/buffer.js +13 -0
- package/dist/runtime/utils/building-effects.d.ts +73 -0
- package/dist/runtime/utils/building-effects.js +50 -0
- package/dist/runtime/utils/building.d.ts +53 -0
- package/dist/runtime/utils/building.js +26 -0
- package/dist/runtime/utils/cluster.d.ts +24 -0
- package/dist/runtime/utils/cluster.js +42 -0
- package/dist/runtime/utils/coordinate.d.ts +12 -0
- package/dist/runtime/utils/coordinate.js +44 -0
- package/dist/runtime/utils/draw-theme.d.ts +47 -0
- package/dist/runtime/utils/draw-theme.js +39 -0
- package/dist/runtime/utils/effects.d.ts +34 -0
- package/dist/runtime/utils/effects.js +78 -0
- package/dist/runtime/utils/events.d.ts +6 -0
- package/dist/runtime/utils/events.js +20 -0
- package/dist/runtime/utils/frame-icon.d.ts +27 -0
- package/dist/runtime/utils/frame-icon.js +45 -0
- package/dist/runtime/utils/geometry.d.ts +5 -0
- package/dist/runtime/utils/geometry.js +41 -0
- package/dist/runtime/utils/heatmap.d.ts +36 -0
- package/dist/runtime/utils/heatmap.js +30 -0
- package/dist/runtime/utils/layer.d.ts +13 -0
- package/dist/runtime/utils/layer.js +17 -0
- package/dist/runtime/utils/logger.d.ts +2 -0
- package/dist/runtime/utils/logger.js +2 -0
- package/dist/runtime/utils/measure.d.ts +4 -0
- package/dist/runtime/utils/measure.js +8 -0
- package/dist/runtime/utils/sprite.d.ts +31 -0
- package/dist/runtime/utils/sprite.js +23 -0
- package/dist/runtime/utils/tianditu-administrative.d.ts +3 -0
- package/dist/runtime/utils/tianditu-administrative.js +48 -0
- package/dist/runtime/utils/tianditu-client.d.ts +30 -0
- package/dist/runtime/utils/tianditu-client.js +17 -0
- package/dist/runtime/utils/tianditu-geocoder.d.ts +5 -0
- package/dist/runtime/utils/tianditu-geocoder.js +37 -0
- package/dist/runtime/utils/tianditu-request.d.ts +20 -0
- package/dist/runtime/utils/tianditu-request.js +42 -0
- package/dist/runtime/utils/tianditu-route.d.ts +3 -0
- package/dist/runtime/utils/tianditu-route.js +40 -0
- package/dist/runtime/utils/tianditu-search.d.ts +15 -0
- package/dist/runtime/utils/tianditu-search.js +183 -0
- package/dist/runtime/utils/tianditu.d.ts +21 -0
- package/dist/runtime/utils/tianditu.js +26 -0
- package/dist/runtime/utils/wms.d.ts +43 -0
- package/dist/runtime/utils/wms.js +30 -0
- package/dist/runtime/utils/wmts.d.ts +35 -0
- package/dist/runtime/utils/wmts.js +29 -0
- package/dist/types.d.mts +5 -0
- package/dist/unplugin.d.mts +30 -0
- package/dist/unplugin.d.ts +30 -0
- package/dist/unplugin.mjs +53 -0
- package/dist/vite.d.mts +7 -0
- package/dist/vite.d.ts +7 -0
- package/dist/vite.mjs +11 -0
- package/dist/vue-plugin.d.mts +9 -0
- package/dist/vue-plugin.d.ts +9 -0
- package/dist/vue-plugin.mjs +9 -0
- package/package.json +174 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { onMounted, onUnmounted, shallowRef, useTemplateRef, watch } from "vue";
|
|
3
|
+
import { Popup } from "maplibre-gl";
|
|
4
|
+
import { useMap } from "../composables/useMap";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
layerId: { type: String, required: true },
|
|
7
|
+
options: { type: Object, required: false },
|
|
8
|
+
cursor: { type: String, required: false, default: "pointer" },
|
|
9
|
+
trigger: { type: String, required: false, default: "hover" }
|
|
10
|
+
});
|
|
11
|
+
const ctx = useMap();
|
|
12
|
+
const el = useTemplateRef("el");
|
|
13
|
+
const hovered = shallowRef();
|
|
14
|
+
let popup;
|
|
15
|
+
let unbind;
|
|
16
|
+
function setCursor(value) {
|
|
17
|
+
const map = ctx.map.value;
|
|
18
|
+
if (map) map.getCanvas().style.cursor = value;
|
|
19
|
+
}
|
|
20
|
+
function show(event) {
|
|
21
|
+
const map = ctx.map.value;
|
|
22
|
+
if (!map || !popup || !el.value) return;
|
|
23
|
+
hovered.value = event.features?.[0];
|
|
24
|
+
popup.setLngLat(event.lngLat).setDOMContent(el.value);
|
|
25
|
+
if (!popup.isOpen()) popup.addTo(map);
|
|
26
|
+
}
|
|
27
|
+
function close() {
|
|
28
|
+
hovered.value = void 0;
|
|
29
|
+
popup?.remove();
|
|
30
|
+
}
|
|
31
|
+
function onMove(event) {
|
|
32
|
+
setCursor(props.cursor);
|
|
33
|
+
show(event);
|
|
34
|
+
}
|
|
35
|
+
function onLeave() {
|
|
36
|
+
setCursor("");
|
|
37
|
+
close();
|
|
38
|
+
}
|
|
39
|
+
function onClick(event) {
|
|
40
|
+
show(event);
|
|
41
|
+
}
|
|
42
|
+
function onEnter() {
|
|
43
|
+
setCursor(props.cursor);
|
|
44
|
+
}
|
|
45
|
+
function onLeaveCursor() {
|
|
46
|
+
setCursor("");
|
|
47
|
+
}
|
|
48
|
+
function popupOptions() {
|
|
49
|
+
return props.trigger === "hover" ? { ...props.options, closeButton: false, closeOnClick: false } : { closeButton: true, closeOnClick: false, ...props.options };
|
|
50
|
+
}
|
|
51
|
+
function bind(map) {
|
|
52
|
+
if (props.trigger === "none") return;
|
|
53
|
+
if (props.trigger === "hover") {
|
|
54
|
+
map.on("mousemove", props.layerId, onMove);
|
|
55
|
+
map.on("mouseleave", props.layerId, onLeave);
|
|
56
|
+
unbind = () => {
|
|
57
|
+
map.off("mousemove", props.layerId, onMove);
|
|
58
|
+
map.off("mouseleave", props.layerId, onLeave);
|
|
59
|
+
};
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
map.on("click", props.layerId, onClick);
|
|
63
|
+
map.on("mouseenter", props.layerId, onEnter);
|
|
64
|
+
map.on("mouseleave", props.layerId, onLeaveCursor);
|
|
65
|
+
unbind = () => {
|
|
66
|
+
map.off("click", props.layerId, onClick);
|
|
67
|
+
map.off("mouseenter", props.layerId, onEnter);
|
|
68
|
+
map.off("mouseleave", props.layerId, onLeaveCursor);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function teardown() {
|
|
72
|
+
unbind?.();
|
|
73
|
+
unbind = void 0;
|
|
74
|
+
setCursor("");
|
|
75
|
+
popup?.remove();
|
|
76
|
+
popup = void 0;
|
|
77
|
+
}
|
|
78
|
+
function setup(map) {
|
|
79
|
+
popup = new Popup(popupOptions());
|
|
80
|
+
popup.on("close", () => hovered.value = void 0);
|
|
81
|
+
bind(map);
|
|
82
|
+
}
|
|
83
|
+
onMounted(async () => {
|
|
84
|
+
const map = await ctx.whenLoaded();
|
|
85
|
+
setup(map);
|
|
86
|
+
});
|
|
87
|
+
watch(() => props.trigger, () => {
|
|
88
|
+
const map = ctx.map.value;
|
|
89
|
+
if (!map) return;
|
|
90
|
+
teardown();
|
|
91
|
+
setup(map);
|
|
92
|
+
});
|
|
93
|
+
onUnmounted(teardown);
|
|
94
|
+
defineExpose({
|
|
95
|
+
/** 当前激活要素 */
|
|
96
|
+
hovered: () => hovered.value
|
|
97
|
+
});
|
|
98
|
+
</script>
|
|
99
|
+
|
|
100
|
+
<template>
|
|
101
|
+
<div style="display: none">
|
|
102
|
+
<div ref="el">
|
|
103
|
+
<slot :feature="hovered" :close="close" />
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
</template>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { GeoJSONFeature, PopupOptions } from 'maplibre-gl';
|
|
2
|
+
import type { PopupTrigger } from '../types';
|
|
3
|
+
/** 目标图层要素的弹窗:按 trigger 以悬浮或点击触发,作用域插槽拿到当前要素。 */
|
|
4
|
+
type __VLS_Props = {
|
|
5
|
+
/** 目标图层 id */
|
|
6
|
+
layerId: string;
|
|
7
|
+
/**
|
|
8
|
+
* Popup 选项(hover 模式下 closeButton/closeOnClick 由组件接管)
|
|
9
|
+
* @see https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/PopupOptions/
|
|
10
|
+
*/
|
|
11
|
+
options?: PopupOptions;
|
|
12
|
+
/**
|
|
13
|
+
* 悬浮时鼠标指针样式
|
|
14
|
+
* @defaultValue 'pointer'
|
|
15
|
+
*/
|
|
16
|
+
cursor?: string;
|
|
17
|
+
/**
|
|
18
|
+
* 触发时机;'none' 表示不绑定任何监听,可用于临时停用
|
|
19
|
+
* @defaultValue 'hover'
|
|
20
|
+
*/
|
|
21
|
+
trigger?: PopupTrigger;
|
|
22
|
+
};
|
|
23
|
+
declare function close(): void;
|
|
24
|
+
declare var __VLS_1: {
|
|
25
|
+
feature: GeoJSONFeature | undefined;
|
|
26
|
+
close: typeof close;
|
|
27
|
+
};
|
|
28
|
+
type __VLS_Slots = {} & {
|
|
29
|
+
default?: (props: typeof __VLS_1) => any;
|
|
30
|
+
};
|
|
31
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
32
|
+
/** 当前激活要素 */
|
|
33
|
+
hovered: () => GeoJSONFeature | undefined;
|
|
34
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
35
|
+
trigger: PopupTrigger;
|
|
36
|
+
cursor: string;
|
|
37
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
38
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
39
|
+
declare const _default: typeof __VLS_export;
|
|
40
|
+
export default _default;
|
|
41
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
42
|
+
new (): {
|
|
43
|
+
$slots: S;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** 圆形缓冲区:turf 测地圆,半径单位米。 */
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** 圆心经纬度 */
|
|
4
|
+
center: [number, number];
|
|
5
|
+
/** 半径(米) */
|
|
6
|
+
radius: number;
|
|
7
|
+
/**
|
|
8
|
+
* 圆周采样段数
|
|
9
|
+
* @defaultValue 64
|
|
10
|
+
*/
|
|
11
|
+
steps?: number;
|
|
12
|
+
/** 图层 id 前缀;省略时自动生成 */
|
|
13
|
+
layerId?: string;
|
|
14
|
+
/** 主色(快捷样式) */
|
|
15
|
+
color?: string;
|
|
16
|
+
/** 整体覆盖填充 paint */
|
|
17
|
+
fillPaint?: Record<string, unknown>;
|
|
18
|
+
/** 整体覆盖描边 paint */
|
|
19
|
+
linePaint?: Record<string, unknown>;
|
|
20
|
+
/** 插入到该图层之前 */
|
|
21
|
+
beforeId?: string;
|
|
22
|
+
};
|
|
23
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
24
|
+
steps: number;
|
|
25
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
26
|
+
declare const _default: typeof __VLS_export;
|
|
27
|
+
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, useId } from "vue";
|
|
3
|
+
import { circle } from "@turf/circle";
|
|
4
|
+
import { bufferPaints } from "../../utils/buffer";
|
|
5
|
+
import MaplibreSource from "../Source.vue";
|
|
6
|
+
import MaplibreLayer from "../Layer.vue";
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
center: { type: Array, required: true },
|
|
9
|
+
radius: { type: Number, required: true },
|
|
10
|
+
steps: { type: Number, required: false, default: 64 },
|
|
11
|
+
layerId: { type: String, required: false },
|
|
12
|
+
color: { type: String, required: false },
|
|
13
|
+
fillPaint: { type: Object, required: false },
|
|
14
|
+
linePaint: { type: Object, required: false },
|
|
15
|
+
beforeId: { type: String, required: false }
|
|
16
|
+
});
|
|
17
|
+
const id = props.layerId ?? `movk-buffer-circle-${useId()}`;
|
|
18
|
+
const source = computed(() => ({
|
|
19
|
+
type: "geojson",
|
|
20
|
+
data: circle(props.center, props.radius, { steps: props.steps, units: "meters" })
|
|
21
|
+
}));
|
|
22
|
+
const paints = computed(() => bufferPaints({ color: props.color }));
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<MaplibreSource :source-id="id" :source="source">
|
|
27
|
+
<MaplibreLayer :layer-id="`${id}-fill`" type="fill" :source="id" :paint="fillPaint ?? paints.fill" :before-id="beforeId" />
|
|
28
|
+
<MaplibreLayer :layer-id="`${id}-line`" type="line" :source="id" :paint="linePaint ?? paints.line" :before-id="beforeId" />
|
|
29
|
+
</MaplibreSource>
|
|
30
|
+
</template>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** 圆形缓冲区:turf 测地圆,半径单位米。 */
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** 圆心经纬度 */
|
|
4
|
+
center: [number, number];
|
|
5
|
+
/** 半径(米) */
|
|
6
|
+
radius: number;
|
|
7
|
+
/**
|
|
8
|
+
* 圆周采样段数
|
|
9
|
+
* @defaultValue 64
|
|
10
|
+
*/
|
|
11
|
+
steps?: number;
|
|
12
|
+
/** 图层 id 前缀;省略时自动生成 */
|
|
13
|
+
layerId?: string;
|
|
14
|
+
/** 主色(快捷样式) */
|
|
15
|
+
color?: string;
|
|
16
|
+
/** 整体覆盖填充 paint */
|
|
17
|
+
fillPaint?: Record<string, unknown>;
|
|
18
|
+
/** 整体覆盖描边 paint */
|
|
19
|
+
linePaint?: Record<string, unknown>;
|
|
20
|
+
/** 插入到该图层之前 */
|
|
21
|
+
beforeId?: string;
|
|
22
|
+
};
|
|
23
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
24
|
+
steps: number;
|
|
25
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
26
|
+
declare const _default: typeof __VLS_export;
|
|
27
|
+
export default _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** 椭圆缓冲区:半轴单位米,angle 为长轴方位角。 */
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** 中心经纬度 */
|
|
4
|
+
center: [number, number];
|
|
5
|
+
/** x 半轴(米) */
|
|
6
|
+
xSemiAxis: number;
|
|
7
|
+
/** y 半轴(米) */
|
|
8
|
+
ySemiAxis: number;
|
|
9
|
+
/**
|
|
10
|
+
* 旋转角(度,正北顺时针)
|
|
11
|
+
* @defaultValue 0
|
|
12
|
+
*/
|
|
13
|
+
angle?: number;
|
|
14
|
+
/**
|
|
15
|
+
* 周长采样段数
|
|
16
|
+
* @defaultValue 64
|
|
17
|
+
*/
|
|
18
|
+
steps?: number;
|
|
19
|
+
/** 图层 id 前缀;省略时自动生成 */
|
|
20
|
+
layerId?: string;
|
|
21
|
+
/** 主色(快捷样式) */
|
|
22
|
+
color?: string;
|
|
23
|
+
/** 整体覆盖填充 paint */
|
|
24
|
+
fillPaint?: Record<string, unknown>;
|
|
25
|
+
/** 整体覆盖描边 paint */
|
|
26
|
+
linePaint?: Record<string, unknown>;
|
|
27
|
+
/** 插入到该图层之前 */
|
|
28
|
+
beforeId?: string;
|
|
29
|
+
};
|
|
30
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
31
|
+
steps: number;
|
|
32
|
+
angle: number;
|
|
33
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
34
|
+
declare const _default: typeof __VLS_export;
|
|
35
|
+
export default _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, useId } from "vue";
|
|
3
|
+
import { ellipse } from "@turf/ellipse";
|
|
4
|
+
import { bufferPaints } from "../../utils/buffer";
|
|
5
|
+
import MaplibreSource from "../Source.vue";
|
|
6
|
+
import MaplibreLayer from "../Layer.vue";
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
center: { type: Array, required: true },
|
|
9
|
+
xSemiAxis: { type: Number, required: true },
|
|
10
|
+
ySemiAxis: { type: Number, required: true },
|
|
11
|
+
angle: { type: Number, required: false, default: 0 },
|
|
12
|
+
steps: { type: Number, required: false, default: 64 },
|
|
13
|
+
layerId: { type: String, required: false },
|
|
14
|
+
color: { type: String, required: false },
|
|
15
|
+
fillPaint: { type: Object, required: false },
|
|
16
|
+
linePaint: { type: Object, required: false },
|
|
17
|
+
beforeId: { type: String, required: false }
|
|
18
|
+
});
|
|
19
|
+
const id = props.layerId ?? `movk-buffer-ellipse-${useId()}`;
|
|
20
|
+
const source = computed(() => ({
|
|
21
|
+
type: "geojson",
|
|
22
|
+
data: ellipse(props.center, props.xSemiAxis, props.ySemiAxis, {
|
|
23
|
+
angle: props.angle,
|
|
24
|
+
steps: props.steps,
|
|
25
|
+
units: "meters"
|
|
26
|
+
})
|
|
27
|
+
}));
|
|
28
|
+
const paints = computed(() => bufferPaints({ color: props.color }));
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<MaplibreSource :source-id="id" :source="source">
|
|
33
|
+
<MaplibreLayer :layer-id="`${id}-fill`" type="fill" :source="id" :paint="fillPaint ?? paints.fill" :before-id="beforeId" />
|
|
34
|
+
<MaplibreLayer :layer-id="`${id}-line`" type="line" :source="id" :paint="linePaint ?? paints.line" :before-id="beforeId" />
|
|
35
|
+
</MaplibreSource>
|
|
36
|
+
</template>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** 椭圆缓冲区:半轴单位米,angle 为长轴方位角。 */
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** 中心经纬度 */
|
|
4
|
+
center: [number, number];
|
|
5
|
+
/** x 半轴(米) */
|
|
6
|
+
xSemiAxis: number;
|
|
7
|
+
/** y 半轴(米) */
|
|
8
|
+
ySemiAxis: number;
|
|
9
|
+
/**
|
|
10
|
+
* 旋转角(度,正北顺时针)
|
|
11
|
+
* @defaultValue 0
|
|
12
|
+
*/
|
|
13
|
+
angle?: number;
|
|
14
|
+
/**
|
|
15
|
+
* 周长采样段数
|
|
16
|
+
* @defaultValue 64
|
|
17
|
+
*/
|
|
18
|
+
steps?: number;
|
|
19
|
+
/** 图层 id 前缀;省略时自动生成 */
|
|
20
|
+
layerId?: string;
|
|
21
|
+
/** 主色(快捷样式) */
|
|
22
|
+
color?: string;
|
|
23
|
+
/** 整体覆盖填充 paint */
|
|
24
|
+
fillPaint?: Record<string, unknown>;
|
|
25
|
+
/** 整体覆盖描边 paint */
|
|
26
|
+
linePaint?: Record<string, unknown>;
|
|
27
|
+
/** 插入到该图层之前 */
|
|
28
|
+
beforeId?: string;
|
|
29
|
+
};
|
|
30
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
31
|
+
steps: number;
|
|
32
|
+
angle: number;
|
|
33
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
34
|
+
declare const _default: typeof __VLS_export;
|
|
35
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Feature, LineString } from 'geojson';
|
|
2
|
+
/** 线缓冲区:沿线两侧扩展 width 米的走廊面。 */
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/** 线要素、几何或坐标数组 */
|
|
5
|
+
line: Feature<LineString> | LineString | [number, number][];
|
|
6
|
+
/** 缓冲宽度(米) */
|
|
7
|
+
width: number;
|
|
8
|
+
/** 图层 id 前缀;省略时自动生成 */
|
|
9
|
+
layerId?: string;
|
|
10
|
+
/** 主色(快捷样式) */
|
|
11
|
+
color?: string;
|
|
12
|
+
/** 整体覆盖填充 paint */
|
|
13
|
+
fillPaint?: Record<string, unknown>;
|
|
14
|
+
/** 整体覆盖描边 paint */
|
|
15
|
+
linePaint?: Record<string, unknown>;
|
|
16
|
+
/** 插入到该图层之前 */
|
|
17
|
+
beforeId?: string;
|
|
18
|
+
};
|
|
19
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, useId } from "vue";
|
|
3
|
+
import { buffer } from "@turf/buffer";
|
|
4
|
+
import { bufferPaints } from "../../utils/buffer";
|
|
5
|
+
import MaplibreSource from "../Source.vue";
|
|
6
|
+
import MaplibreLayer from "../Layer.vue";
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
line: { type: [Object, Array], required: true },
|
|
9
|
+
width: { type: Number, required: true },
|
|
10
|
+
layerId: { type: String, required: false },
|
|
11
|
+
color: { type: String, required: false },
|
|
12
|
+
fillPaint: { type: Object, required: false },
|
|
13
|
+
linePaint: { type: Object, required: false },
|
|
14
|
+
beforeId: { type: String, required: false }
|
|
15
|
+
});
|
|
16
|
+
const id = props.layerId ?? `movk-buffer-line-${useId()}`;
|
|
17
|
+
function toFeature(line) {
|
|
18
|
+
if (Array.isArray(line)) {
|
|
19
|
+
return { type: "Feature", properties: {}, geometry: { type: "LineString", coordinates: line } };
|
|
20
|
+
}
|
|
21
|
+
if (line.type === "LineString") {
|
|
22
|
+
return { type: "Feature", properties: {}, geometry: line };
|
|
23
|
+
}
|
|
24
|
+
return line;
|
|
25
|
+
}
|
|
26
|
+
const EMPTY = { type: "FeatureCollection", features: [] };
|
|
27
|
+
const source = computed(() => ({
|
|
28
|
+
type: "geojson",
|
|
29
|
+
// buffer 在退化输入下可能返回 undefined,回退空集合
|
|
30
|
+
data: buffer(toFeature(props.line), props.width, { units: "meters" }) ?? EMPTY
|
|
31
|
+
}));
|
|
32
|
+
const paints = computed(() => bufferPaints({ color: props.color }));
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<MaplibreSource :source-id="id" :source="source">
|
|
37
|
+
<MaplibreLayer :layer-id="`${id}-fill`" type="fill" :source="id" :paint="fillPaint ?? paints.fill" :before-id="beforeId" />
|
|
38
|
+
<MaplibreLayer :layer-id="`${id}-line`" type="line" :source="id" :paint="linePaint ?? paints.line" :before-id="beforeId" />
|
|
39
|
+
</MaplibreSource>
|
|
40
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Feature, LineString } from 'geojson';
|
|
2
|
+
/** 线缓冲区:沿线两侧扩展 width 米的走廊面。 */
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/** 线要素、几何或坐标数组 */
|
|
5
|
+
line: Feature<LineString> | LineString | [number, number][];
|
|
6
|
+
/** 缓冲宽度(米) */
|
|
7
|
+
width: number;
|
|
8
|
+
/** 图层 id 前缀;省略时自动生成 */
|
|
9
|
+
layerId?: string;
|
|
10
|
+
/** 主色(快捷样式) */
|
|
11
|
+
color?: string;
|
|
12
|
+
/** 整体覆盖填充 paint */
|
|
13
|
+
fillPaint?: Record<string, unknown>;
|
|
14
|
+
/** 整体覆盖描边 paint */
|
|
15
|
+
linePaint?: Record<string, unknown>;
|
|
16
|
+
/** 插入到该图层之前 */
|
|
17
|
+
beforeId?: string;
|
|
18
|
+
};
|
|
19
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Feature, Polygon } from 'geojson';
|
|
2
|
+
/** 多边形缓冲区:向外扩展(或负值收缩)width 米。 */
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/** 面要素、几何或外环坐标数组 */
|
|
5
|
+
polygon: Feature<Polygon> | Polygon | [number, number][];
|
|
6
|
+
/** 缓冲宽度(米),负值向内收缩 */
|
|
7
|
+
width: number;
|
|
8
|
+
/** 图层 id 前缀;省略时自动生成 */
|
|
9
|
+
layerId?: string;
|
|
10
|
+
/** 主色(快捷样式) */
|
|
11
|
+
color?: string;
|
|
12
|
+
/** 整体覆盖填充 paint */
|
|
13
|
+
fillPaint?: Record<string, unknown>;
|
|
14
|
+
/** 整体覆盖描边 paint */
|
|
15
|
+
linePaint?: Record<string, unknown>;
|
|
16
|
+
/** 插入到该图层之前 */
|
|
17
|
+
beforeId?: string;
|
|
18
|
+
};
|
|
19
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, useId } from "vue";
|
|
3
|
+
import { buffer } from "@turf/buffer";
|
|
4
|
+
import { bufferPaints } from "../../utils/buffer";
|
|
5
|
+
import MaplibreSource from "../Source.vue";
|
|
6
|
+
import MaplibreLayer from "../Layer.vue";
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
polygon: { type: [Object, Array], required: true },
|
|
9
|
+
width: { type: Number, required: true },
|
|
10
|
+
layerId: { type: String, required: false },
|
|
11
|
+
color: { type: String, required: false },
|
|
12
|
+
fillPaint: { type: Object, required: false },
|
|
13
|
+
linePaint: { type: Object, required: false },
|
|
14
|
+
beforeId: { type: String, required: false }
|
|
15
|
+
});
|
|
16
|
+
const id = props.layerId ?? `movk-buffer-polygon-${useId()}`;
|
|
17
|
+
function toFeature(polygon) {
|
|
18
|
+
if (Array.isArray(polygon)) {
|
|
19
|
+
return { type: "Feature", properties: {}, geometry: { type: "Polygon", coordinates: [polygon] } };
|
|
20
|
+
}
|
|
21
|
+
if (polygon.type === "Polygon") {
|
|
22
|
+
return { type: "Feature", properties: {}, geometry: polygon };
|
|
23
|
+
}
|
|
24
|
+
return polygon;
|
|
25
|
+
}
|
|
26
|
+
const EMPTY = { type: "FeatureCollection", features: [] };
|
|
27
|
+
const source = computed(() => ({
|
|
28
|
+
type: "geojson",
|
|
29
|
+
// 负宽度收缩塌缩为空时 buffer 返回 undefined,回退空集合
|
|
30
|
+
data: buffer(toFeature(props.polygon), props.width, { units: "meters" }) ?? EMPTY
|
|
31
|
+
}));
|
|
32
|
+
const paints = computed(() => bufferPaints({ color: props.color }));
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<MaplibreSource :source-id="id" :source="source">
|
|
37
|
+
<MaplibreLayer :layer-id="`${id}-fill`" type="fill" :source="id" :paint="fillPaint ?? paints.fill" :before-id="beforeId" />
|
|
38
|
+
<MaplibreLayer :layer-id="`${id}-line`" type="line" :source="id" :paint="linePaint ?? paints.line" :before-id="beforeId" />
|
|
39
|
+
</MaplibreSource>
|
|
40
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Feature, Polygon } from 'geojson';
|
|
2
|
+
/** 多边形缓冲区:向外扩展(或负值收缩)width 米。 */
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/** 面要素、几何或外环坐标数组 */
|
|
5
|
+
polygon: Feature<Polygon> | Polygon | [number, number][];
|
|
6
|
+
/** 缓冲宽度(米),负值向内收缩 */
|
|
7
|
+
width: number;
|
|
8
|
+
/** 图层 id 前缀;省略时自动生成 */
|
|
9
|
+
layerId?: string;
|
|
10
|
+
/** 主色(快捷样式) */
|
|
11
|
+
color?: string;
|
|
12
|
+
/** 整体覆盖填充 paint */
|
|
13
|
+
fillPaint?: Record<string, unknown>;
|
|
14
|
+
/** 整体覆盖描边 paint */
|
|
15
|
+
linePaint?: Record<string, unknown>;
|
|
16
|
+
/** 插入到该图层之前 */
|
|
17
|
+
beforeId?: string;
|
|
18
|
+
};
|
|
19
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** 扇形缓冲区:bearing1 → bearing2(度,正北顺时针),半径单位米。 */
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** 圆心经纬度 */
|
|
4
|
+
center: [number, number];
|
|
5
|
+
/** 半径(米) */
|
|
6
|
+
radius: number;
|
|
7
|
+
/** 起始方位角(度) */
|
|
8
|
+
bearing1: number;
|
|
9
|
+
/** 结束方位角(度) */
|
|
10
|
+
bearing2: number;
|
|
11
|
+
/**
|
|
12
|
+
* 弧线采样段数
|
|
13
|
+
* @defaultValue 64
|
|
14
|
+
*/
|
|
15
|
+
steps?: number;
|
|
16
|
+
/** 图层 id 前缀;省略时自动生成 */
|
|
17
|
+
layerId?: string;
|
|
18
|
+
/** 主色(快捷样式) */
|
|
19
|
+
color?: string;
|
|
20
|
+
/** 整体覆盖填充 paint */
|
|
21
|
+
fillPaint?: Record<string, unknown>;
|
|
22
|
+
/** 整体覆盖描边 paint */
|
|
23
|
+
linePaint?: Record<string, unknown>;
|
|
24
|
+
/** 插入到该图层之前 */
|
|
25
|
+
beforeId?: string;
|
|
26
|
+
};
|
|
27
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
28
|
+
steps: number;
|
|
29
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
|
+
declare const _default: typeof __VLS_export;
|
|
31
|
+
export default _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, useId } from "vue";
|
|
3
|
+
import { sector } from "@turf/sector";
|
|
4
|
+
import { bufferPaints } from "../../utils/buffer";
|
|
5
|
+
import MaplibreSource from "../Source.vue";
|
|
6
|
+
import MaplibreLayer from "../Layer.vue";
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
center: { type: Array, required: true },
|
|
9
|
+
radius: { type: Number, required: true },
|
|
10
|
+
bearing1: { type: Number, required: true },
|
|
11
|
+
bearing2: { type: Number, required: true },
|
|
12
|
+
steps: { type: Number, required: false, default: 64 },
|
|
13
|
+
layerId: { type: String, required: false },
|
|
14
|
+
color: { type: String, required: false },
|
|
15
|
+
fillPaint: { type: Object, required: false },
|
|
16
|
+
linePaint: { type: Object, required: false },
|
|
17
|
+
beforeId: { type: String, required: false }
|
|
18
|
+
});
|
|
19
|
+
const id = props.layerId ?? `movk-buffer-sector-${useId()}`;
|
|
20
|
+
const source = computed(() => ({
|
|
21
|
+
type: "geojson",
|
|
22
|
+
data: sector(props.center, props.radius, props.bearing1, props.bearing2, {
|
|
23
|
+
steps: props.steps,
|
|
24
|
+
units: "meters"
|
|
25
|
+
})
|
|
26
|
+
}));
|
|
27
|
+
const paints = computed(() => bufferPaints({ color: props.color }));
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<MaplibreSource :source-id="id" :source="source">
|
|
32
|
+
<MaplibreLayer :layer-id="`${id}-fill`" type="fill" :source="id" :paint="fillPaint ?? paints.fill" :before-id="beforeId" />
|
|
33
|
+
<MaplibreLayer :layer-id="`${id}-line`" type="line" :source="id" :paint="linePaint ?? paints.line" :before-id="beforeId" />
|
|
34
|
+
</MaplibreSource>
|
|
35
|
+
</template>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** 扇形缓冲区:bearing1 → bearing2(度,正北顺时针),半径单位米。 */
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** 圆心经纬度 */
|
|
4
|
+
center: [number, number];
|
|
5
|
+
/** 半径(米) */
|
|
6
|
+
radius: number;
|
|
7
|
+
/** 起始方位角(度) */
|
|
8
|
+
bearing1: number;
|
|
9
|
+
/** 结束方位角(度) */
|
|
10
|
+
bearing2: number;
|
|
11
|
+
/**
|
|
12
|
+
* 弧线采样段数
|
|
13
|
+
* @defaultValue 64
|
|
14
|
+
*/
|
|
15
|
+
steps?: number;
|
|
16
|
+
/** 图层 id 前缀;省略时自动生成 */
|
|
17
|
+
layerId?: string;
|
|
18
|
+
/** 主色(快捷样式) */
|
|
19
|
+
color?: string;
|
|
20
|
+
/** 整体覆盖填充 paint */
|
|
21
|
+
fillPaint?: Record<string, unknown>;
|
|
22
|
+
/** 整体覆盖描边 paint */
|
|
23
|
+
linePaint?: Record<string, unknown>;
|
|
24
|
+
/** 插入到该图层之前 */
|
|
25
|
+
beforeId?: string;
|
|
26
|
+
};
|
|
27
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
28
|
+
steps: number;
|
|
29
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
|
+
declare const _default: typeof __VLS_export;
|
|
31
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AttributionControl } from 'maplibre-gl';
|
|
2
|
+
import type { ControlPosition } from 'maplibre-gl';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/** 控件停靠位置;省略用地图默认位置 */
|
|
5
|
+
position?: ControlPosition;
|
|
6
|
+
/**
|
|
7
|
+
* AttributionControl 构造选项
|
|
8
|
+
* @see https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/AttributionControlOptions/
|
|
9
|
+
*/
|
|
10
|
+
options?: ConstructorParameters<typeof AttributionControl>[0];
|
|
11
|
+
};
|
|
12
|
+
declare var __VLS_1: {};
|
|
13
|
+
type __VLS_Slots = {} & {
|
|
14
|
+
default?: (props: typeof __VLS_1) => any;
|
|
15
|
+
};
|
|
16
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
21
|
+
new (): {
|
|
22
|
+
$slots: S;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { omitUndefined } from "@movk/core";
|
|
3
|
+
import { AttributionControl } from "maplibre-gl";
|
|
4
|
+
import { useControl } from "../../domains/map/control";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
position: { type: String, required: false },
|
|
7
|
+
options: { type: null, required: false }
|
|
8
|
+
});
|
|
9
|
+
useControl(
|
|
10
|
+
() => new AttributionControl(omitUndefined(props.options ?? {})),
|
|
11
|
+
() => props.position,
|
|
12
|
+
() => props.options
|
|
13
|
+
);
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<slot />
|
|
18
|
+
</template>
|