@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,41 @@
|
|
|
1
|
+
import type { GeoJSONSourceSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
2
|
+
/** 帧动画图标层:雪碧图切帧后由 StyleImageInterface.render 逐帧驱动 symbol 循环播放,零解码依赖。 */
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/** 点要素数据(GeoJSON 或其 URL) */
|
|
5
|
+
data: GeoJSONSourceSpecification['data'];
|
|
6
|
+
/** 雪碧图 URL(所有帧拼一张图,行优先排布) */
|
|
7
|
+
image: string;
|
|
8
|
+
/** 总帧数 */
|
|
9
|
+
frames: number;
|
|
10
|
+
/** 列数;省略时等于 frames(单行) */
|
|
11
|
+
columns?: number;
|
|
12
|
+
/**
|
|
13
|
+
* 行数
|
|
14
|
+
* @defaultValue 1
|
|
15
|
+
*/
|
|
16
|
+
rows?: number;
|
|
17
|
+
/** 单帧宽(像素);省略由图宽/列数推算 */
|
|
18
|
+
frameWidth?: number;
|
|
19
|
+
/** 单帧高(像素);省略由图高/行数推算 */
|
|
20
|
+
frameHeight?: number;
|
|
21
|
+
/**
|
|
22
|
+
* 播放帧率(帧/秒)
|
|
23
|
+
* @defaultValue 12
|
|
24
|
+
*/
|
|
25
|
+
fps?: number;
|
|
26
|
+
/**
|
|
27
|
+
* 上图图标边长(像素)
|
|
28
|
+
* @defaultValue 64
|
|
29
|
+
*/
|
|
30
|
+
size?: number;
|
|
31
|
+
/** 图层 id;省略时自动生成 */
|
|
32
|
+
layerId?: string;
|
|
33
|
+
/** 插入到该图层之前 */
|
|
34
|
+
beforeId?: string;
|
|
35
|
+
};
|
|
36
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
37
|
+
size: number;
|
|
38
|
+
fps: number;
|
|
39
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
40
|
+
declare const _default: typeof __VLS_export;
|
|
41
|
+
export default _default;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref, useId, watch } from "vue";
|
|
3
|
+
import { spriteFrame, spriteFrameRect } from "../../utils/sprite";
|
|
4
|
+
import { useMap } from "../../composables/useMap";
|
|
5
|
+
import { useFrameIcon } from "../../composables/useFrameIcon";
|
|
6
|
+
import MaplibreSource from "../Source.vue";
|
|
7
|
+
import MaplibreLayer from "../Layer.vue";
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
data: { type: null, required: true },
|
|
10
|
+
image: { type: String, required: true },
|
|
11
|
+
frames: { type: Number, required: true },
|
|
12
|
+
columns: { type: Number, required: false },
|
|
13
|
+
rows: { type: Number, required: false },
|
|
14
|
+
frameWidth: { type: Number, required: false },
|
|
15
|
+
frameHeight: { type: Number, required: false },
|
|
16
|
+
fps: { type: Number, required: false, default: 12 },
|
|
17
|
+
size: { type: Number, required: false, default: 64 },
|
|
18
|
+
layerId: { type: String, required: false },
|
|
19
|
+
beforeId: { type: String, required: false }
|
|
20
|
+
});
|
|
21
|
+
const ctx = useMap();
|
|
22
|
+
const id = props.layerId ?? `movk-sprite-${useId()}`;
|
|
23
|
+
const imageName = `${id}-frames`;
|
|
24
|
+
const source = computed(() => ({ type: "geojson", data: props.data }));
|
|
25
|
+
const layout = computed(() => ({
|
|
26
|
+
"icon-image": imageName,
|
|
27
|
+
"icon-allow-overlap": true,
|
|
28
|
+
"icon-ignore-placement": true
|
|
29
|
+
}));
|
|
30
|
+
const sliced = ref([]);
|
|
31
|
+
useFrameIcon({ imageName, size: props.size, frames: () => sliced.value, fps: props.fps });
|
|
32
|
+
function prepareFrames() {
|
|
33
|
+
if (typeof Image === "undefined") return;
|
|
34
|
+
const img = new Image();
|
|
35
|
+
img.crossOrigin = "anonymous";
|
|
36
|
+
img.onload = () => {
|
|
37
|
+
const columns = props.columns ?? props.frames;
|
|
38
|
+
const rows = props.rows ?? 1;
|
|
39
|
+
const grid = {
|
|
40
|
+
columns,
|
|
41
|
+
rows,
|
|
42
|
+
frameWidth: props.frameWidth ?? img.width / columns,
|
|
43
|
+
frameHeight: props.frameHeight ?? img.height / rows,
|
|
44
|
+
frames: props.frames
|
|
45
|
+
};
|
|
46
|
+
const next = [];
|
|
47
|
+
for (let i = 0; i < props.frames; i++) {
|
|
48
|
+
const frame = spriteFrame(img, spriteFrameRect(i, grid), props.size);
|
|
49
|
+
if (frame) next.push(frame);
|
|
50
|
+
}
|
|
51
|
+
sliced.value = next;
|
|
52
|
+
ctx.map.value?.triggerRepaint();
|
|
53
|
+
};
|
|
54
|
+
img.src = props.image;
|
|
55
|
+
}
|
|
56
|
+
prepareFrames();
|
|
57
|
+
watch(() => props.image, () => {
|
|
58
|
+
sliced.value = [];
|
|
59
|
+
prepareFrames();
|
|
60
|
+
});
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<template>
|
|
64
|
+
<MaplibreSource :source-id="id" :source="source">
|
|
65
|
+
<MaplibreLayer :layer-id="id" type="symbol" :source="id" :layout="layout" :before-id="beforeId" />
|
|
66
|
+
</MaplibreSource>
|
|
67
|
+
</template>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { GeoJSONSourceSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
2
|
+
/** 帧动画图标层:雪碧图切帧后由 StyleImageInterface.render 逐帧驱动 symbol 循环播放,零解码依赖。 */
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/** 点要素数据(GeoJSON 或其 URL) */
|
|
5
|
+
data: GeoJSONSourceSpecification['data'];
|
|
6
|
+
/** 雪碧图 URL(所有帧拼一张图,行优先排布) */
|
|
7
|
+
image: string;
|
|
8
|
+
/** 总帧数 */
|
|
9
|
+
frames: number;
|
|
10
|
+
/** 列数;省略时等于 frames(单行) */
|
|
11
|
+
columns?: number;
|
|
12
|
+
/**
|
|
13
|
+
* 行数
|
|
14
|
+
* @defaultValue 1
|
|
15
|
+
*/
|
|
16
|
+
rows?: number;
|
|
17
|
+
/** 单帧宽(像素);省略由图宽/列数推算 */
|
|
18
|
+
frameWidth?: number;
|
|
19
|
+
/** 单帧高(像素);省略由图高/行数推算 */
|
|
20
|
+
frameHeight?: number;
|
|
21
|
+
/**
|
|
22
|
+
* 播放帧率(帧/秒)
|
|
23
|
+
* @defaultValue 12
|
|
24
|
+
*/
|
|
25
|
+
fps?: number;
|
|
26
|
+
/**
|
|
27
|
+
* 上图图标边长(像素)
|
|
28
|
+
* @defaultValue 64
|
|
29
|
+
*/
|
|
30
|
+
size?: number;
|
|
31
|
+
/** 图层 id;省略时自动生成 */
|
|
32
|
+
layerId?: string;
|
|
33
|
+
/** 插入到该图层之前 */
|
|
34
|
+
beforeId?: string;
|
|
35
|
+
};
|
|
36
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
37
|
+
size: number;
|
|
38
|
+
fps: number;
|
|
39
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
40
|
+
declare const _default: typeof __VLS_export;
|
|
41
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { BuildingSourceOptions } from '../../utils/building';
|
|
2
|
+
/** 纹理建筑:用户贴图 url 作 fill-extrusion-pattern。 */
|
|
3
|
+
type __VLS_Props = BuildingSourceOptions & {
|
|
4
|
+
/** 贴图地址 */
|
|
5
|
+
url: string;
|
|
6
|
+
/** 图层 id;省略时自动生成 */
|
|
7
|
+
layerId?: string;
|
|
8
|
+
/**
|
|
9
|
+
* 整体透明度
|
|
10
|
+
* @defaultValue 1
|
|
11
|
+
*/
|
|
12
|
+
opacity?: number;
|
|
13
|
+
/**
|
|
14
|
+
* 最小缩放级别
|
|
15
|
+
* @defaultValue 15
|
|
16
|
+
*/
|
|
17
|
+
minzoom?: number;
|
|
18
|
+
/** 插入到该图层之前 */
|
|
19
|
+
beforeId?: string;
|
|
20
|
+
};
|
|
21
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
22
|
+
minzoom: number;
|
|
23
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
declare const _default: typeof __VLS_export;
|
|
25
|
+
export default _default;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, useId } from "vue";
|
|
3
|
+
import { useMaplibreImage } from "../../composables/useMaplibreImage";
|
|
4
|
+
import { buildingExtrusionPaint } from "../../utils/building";
|
|
5
|
+
import MaplibreBuildingLayer from "../layers/BuildingLayer.vue";
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
source: { type: String, required: true },
|
|
8
|
+
sourceLayer: { type: String, required: false },
|
|
9
|
+
heightProperty: { type: String, required: false },
|
|
10
|
+
baseProperty: { type: String, required: false },
|
|
11
|
+
url: { type: String, required: true },
|
|
12
|
+
layerId: { type: String, required: false },
|
|
13
|
+
opacity: { type: Number, required: false },
|
|
14
|
+
minzoom: { type: Number, required: false, default: 15 },
|
|
15
|
+
beforeId: { type: String, required: false }
|
|
16
|
+
});
|
|
17
|
+
const id = props.layerId ?? `movk-texture-building-${useId()}`;
|
|
18
|
+
const imageName = `${id}-texture`;
|
|
19
|
+
const { loaded } = useMaplibreImage(imageName, props.url);
|
|
20
|
+
const paint = computed(() => ({
|
|
21
|
+
"fill-extrusion-pattern": imageName,
|
|
22
|
+
...buildingExtrusionPaint({ minzoom: props.minzoom, heightProperty: props.heightProperty, baseProperty: props.baseProperty }),
|
|
23
|
+
"fill-extrusion-opacity": props.opacity ?? 1
|
|
24
|
+
}));
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<MaplibreBuildingLayer
|
|
29
|
+
v-if="loaded"
|
|
30
|
+
:layer-id="id"
|
|
31
|
+
:source="source"
|
|
32
|
+
:source-layer="sourceLayer"
|
|
33
|
+
:height-property="heightProperty"
|
|
34
|
+
:base-property="baseProperty"
|
|
35
|
+
:minzoom="minzoom"
|
|
36
|
+
:paint="paint"
|
|
37
|
+
:before-id="beforeId"
|
|
38
|
+
/>
|
|
39
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { BuildingSourceOptions } from '../../utils/building';
|
|
2
|
+
/** 纹理建筑:用户贴图 url 作 fill-extrusion-pattern。 */
|
|
3
|
+
type __VLS_Props = BuildingSourceOptions & {
|
|
4
|
+
/** 贴图地址 */
|
|
5
|
+
url: string;
|
|
6
|
+
/** 图层 id;省略时自动生成 */
|
|
7
|
+
layerId?: string;
|
|
8
|
+
/**
|
|
9
|
+
* 整体透明度
|
|
10
|
+
* @defaultValue 1
|
|
11
|
+
*/
|
|
12
|
+
opacity?: number;
|
|
13
|
+
/**
|
|
14
|
+
* 最小缩放级别
|
|
15
|
+
* @defaultValue 15
|
|
16
|
+
*/
|
|
17
|
+
minzoom?: number;
|
|
18
|
+
/** 插入到该图层之前 */
|
|
19
|
+
beforeId?: string;
|
|
20
|
+
};
|
|
21
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
22
|
+
minzoom: number;
|
|
23
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
declare const _default: typeof __VLS_export;
|
|
25
|
+
export default _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { GeoJSONSourceSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
2
|
+
/** 动态轨迹:line-gradient 彗尾窗口沿线循环平移(source 需 lineMetrics)。 */
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/** 线要素数据(GeoJSON 或其 URL) */
|
|
5
|
+
data: GeoJSONSourceSpecification['data'];
|
|
6
|
+
/** 图层 id 前缀;省略时自动生成 */
|
|
7
|
+
layerId?: string;
|
|
8
|
+
/**
|
|
9
|
+
* 主色
|
|
10
|
+
* @defaultValue '#8b5cf6'
|
|
11
|
+
*/
|
|
12
|
+
color?: string;
|
|
13
|
+
/**
|
|
14
|
+
* 线宽(像素)
|
|
15
|
+
* @defaultValue 4
|
|
16
|
+
*/
|
|
17
|
+
lineWidth?: number;
|
|
18
|
+
/**
|
|
19
|
+
* 彗尾长度(line-progress 占比 0-1)
|
|
20
|
+
* @defaultValue 0.25
|
|
21
|
+
*/
|
|
22
|
+
trailLength?: number;
|
|
23
|
+
/**
|
|
24
|
+
* 跑完全程的周期(毫秒)
|
|
25
|
+
* @defaultValue 3000
|
|
26
|
+
*/
|
|
27
|
+
duration?: number;
|
|
28
|
+
/**
|
|
29
|
+
* 是否同时绘制半透明底线
|
|
30
|
+
* @defaultValue true
|
|
31
|
+
*/
|
|
32
|
+
baseLine?: boolean;
|
|
33
|
+
/** 插入到该图层之前 */
|
|
34
|
+
beforeId?: string;
|
|
35
|
+
};
|
|
36
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
37
|
+
color: string;
|
|
38
|
+
duration: number;
|
|
39
|
+
lineWidth: number;
|
|
40
|
+
trailLength: number;
|
|
41
|
+
baseLine: boolean;
|
|
42
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
43
|
+
declare const _default: typeof __VLS_export;
|
|
44
|
+
export default _default;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, useId } from "vue";
|
|
3
|
+
import { trailGradient } from "../../utils/effects";
|
|
4
|
+
import { useMapAnimation } from "../../composables/useMapAnimation";
|
|
5
|
+
import MaplibreSource from "../Source.vue";
|
|
6
|
+
import MaplibreLayer from "../Layer.vue";
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
data: { type: null, required: true },
|
|
9
|
+
layerId: { type: String, required: false },
|
|
10
|
+
color: { type: String, required: false, default: "#8b5cf6" },
|
|
11
|
+
lineWidth: { type: Number, required: false, default: 4 },
|
|
12
|
+
trailLength: { type: Number, required: false, default: 0.25 },
|
|
13
|
+
duration: { type: Number, required: false, default: 3e3 },
|
|
14
|
+
baseLine: { type: Boolean, required: false, default: true },
|
|
15
|
+
beforeId: { type: String, required: false }
|
|
16
|
+
});
|
|
17
|
+
const id = props.layerId ?? `movk-trail-${useId()}`;
|
|
18
|
+
const source = computed(() => ({
|
|
19
|
+
type: "geojson",
|
|
20
|
+
data: props.data,
|
|
21
|
+
lineMetrics: true
|
|
22
|
+
}));
|
|
23
|
+
const basePaint = computed(() => ({
|
|
24
|
+
"line-color": props.color,
|
|
25
|
+
"line-width": Math.max(1, props.lineWidth / 2),
|
|
26
|
+
"line-opacity": 0.25
|
|
27
|
+
}));
|
|
28
|
+
const trailPaint = computed(() => ({
|
|
29
|
+
"line-width": props.lineWidth,
|
|
30
|
+
"line-gradient": trailGradient(0, props.trailLength, props.color)
|
|
31
|
+
}));
|
|
32
|
+
const layout = { "line-cap": "round", "line-join": "round" };
|
|
33
|
+
useMapAnimation((map, elapsed) => {
|
|
34
|
+
if (!map.getLayer(id)) return;
|
|
35
|
+
const span = 1 + props.trailLength;
|
|
36
|
+
const head = elapsed % props.duration / props.duration * span;
|
|
37
|
+
map.setPaintProperty(id, "line-gradient", trailGradient(head, props.trailLength, props.color));
|
|
38
|
+
});
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<template>
|
|
42
|
+
<MaplibreSource :source-id="id" :source="source">
|
|
43
|
+
<MaplibreLayer
|
|
44
|
+
v-if="baseLine"
|
|
45
|
+
:layer-id="`${id}-base`"
|
|
46
|
+
type="line"
|
|
47
|
+
:source="id"
|
|
48
|
+
:layout="layout"
|
|
49
|
+
:paint="basePaint"
|
|
50
|
+
:before-id="beforeId"
|
|
51
|
+
/>
|
|
52
|
+
<MaplibreLayer
|
|
53
|
+
:layer-id="id"
|
|
54
|
+
type="line"
|
|
55
|
+
:source="id"
|
|
56
|
+
:layout="layout"
|
|
57
|
+
:paint="trailPaint"
|
|
58
|
+
:before-id="beforeId"
|
|
59
|
+
/>
|
|
60
|
+
</MaplibreSource>
|
|
61
|
+
</template>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { GeoJSONSourceSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
2
|
+
/** 动态轨迹:line-gradient 彗尾窗口沿线循环平移(source 需 lineMetrics)。 */
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/** 线要素数据(GeoJSON 或其 URL) */
|
|
5
|
+
data: GeoJSONSourceSpecification['data'];
|
|
6
|
+
/** 图层 id 前缀;省略时自动生成 */
|
|
7
|
+
layerId?: string;
|
|
8
|
+
/**
|
|
9
|
+
* 主色
|
|
10
|
+
* @defaultValue '#8b5cf6'
|
|
11
|
+
*/
|
|
12
|
+
color?: string;
|
|
13
|
+
/**
|
|
14
|
+
* 线宽(像素)
|
|
15
|
+
* @defaultValue 4
|
|
16
|
+
*/
|
|
17
|
+
lineWidth?: number;
|
|
18
|
+
/**
|
|
19
|
+
* 彗尾长度(line-progress 占比 0-1)
|
|
20
|
+
* @defaultValue 0.25
|
|
21
|
+
*/
|
|
22
|
+
trailLength?: number;
|
|
23
|
+
/**
|
|
24
|
+
* 跑完全程的周期(毫秒)
|
|
25
|
+
* @defaultValue 3000
|
|
26
|
+
*/
|
|
27
|
+
duration?: number;
|
|
28
|
+
/**
|
|
29
|
+
* 是否同时绘制半透明底线
|
|
30
|
+
* @defaultValue true
|
|
31
|
+
*/
|
|
32
|
+
baseLine?: boolean;
|
|
33
|
+
/** 插入到该图层之前 */
|
|
34
|
+
beforeId?: string;
|
|
35
|
+
};
|
|
36
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
37
|
+
color: string;
|
|
38
|
+
duration: number;
|
|
39
|
+
lineWidth: number;
|
|
40
|
+
trailLength: number;
|
|
41
|
+
baseLine: boolean;
|
|
42
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
43
|
+
declare const _default: typeof __VLS_export;
|
|
44
|
+
export default _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { GeoJSONSourceSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
2
|
+
/** 波浪圆:常驻实心底圆 + 周期向外扩张的描边波纹。 */
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/** 点要素数据(GeoJSON 或其 URL) */
|
|
5
|
+
data: GeoJSONSourceSpecification['data'];
|
|
6
|
+
/** 图层 id 前缀;省略时自动生成 */
|
|
7
|
+
layerId?: string;
|
|
8
|
+
/**
|
|
9
|
+
* 主色
|
|
10
|
+
* @defaultValue '#10b981'
|
|
11
|
+
*/
|
|
12
|
+
color?: string;
|
|
13
|
+
/**
|
|
14
|
+
* 底圆半径(像素)
|
|
15
|
+
* @defaultValue 6
|
|
16
|
+
*/
|
|
17
|
+
baseRadius?: number;
|
|
18
|
+
/**
|
|
19
|
+
* 波纹最大半径(像素)
|
|
20
|
+
* @defaultValue 36
|
|
21
|
+
*/
|
|
22
|
+
maxRadius?: number;
|
|
23
|
+
/**
|
|
24
|
+
* 波纹周期(毫秒)
|
|
25
|
+
* @defaultValue 2000
|
|
26
|
+
*/
|
|
27
|
+
duration?: number;
|
|
28
|
+
/**
|
|
29
|
+
* 波纹圈数
|
|
30
|
+
* @defaultValue 2
|
|
31
|
+
*/
|
|
32
|
+
rings?: number;
|
|
33
|
+
/** 插入到该图层之前 */
|
|
34
|
+
beforeId?: string;
|
|
35
|
+
};
|
|
36
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
37
|
+
color: string;
|
|
38
|
+
maxRadius: number;
|
|
39
|
+
duration: number;
|
|
40
|
+
rings: number;
|
|
41
|
+
baseRadius: number;
|
|
42
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
43
|
+
declare const _default: typeof __VLS_export;
|
|
44
|
+
export default _default;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, useId } from "vue";
|
|
3
|
+
import { ringFade, ringProgress } from "../../utils/effects";
|
|
4
|
+
import { useMapAnimation } from "../../composables/useMapAnimation";
|
|
5
|
+
import MaplibreSource from "../Source.vue";
|
|
6
|
+
import MaplibreLayer from "../Layer.vue";
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
data: { type: null, required: true },
|
|
9
|
+
layerId: { type: String, required: false },
|
|
10
|
+
color: { type: String, required: false, default: "#10b981" },
|
|
11
|
+
baseRadius: { type: Number, required: false, default: 6 },
|
|
12
|
+
maxRadius: { type: Number, required: false, default: 36 },
|
|
13
|
+
duration: { type: Number, required: false, default: 2e3 },
|
|
14
|
+
rings: { type: Number, required: false, default: 2 },
|
|
15
|
+
beforeId: { type: String, required: false }
|
|
16
|
+
});
|
|
17
|
+
const id = props.layerId ?? `movk-wave-${useId()}`;
|
|
18
|
+
const source = computed(() => ({ type: "geojson", data: props.data }));
|
|
19
|
+
const basePaint = computed(() => ({
|
|
20
|
+
"circle-color": props.color,
|
|
21
|
+
"circle-radius": props.baseRadius
|
|
22
|
+
}));
|
|
23
|
+
const wavePaint = computed(() => ({
|
|
24
|
+
"circle-color": props.color,
|
|
25
|
+
"circle-opacity": 0,
|
|
26
|
+
"circle-radius": props.baseRadius,
|
|
27
|
+
"circle-stroke-color": props.color,
|
|
28
|
+
"circle-stroke-width": 2,
|
|
29
|
+
"circle-stroke-opacity": 0
|
|
30
|
+
}));
|
|
31
|
+
useMapAnimation((map, elapsed) => {
|
|
32
|
+
for (let ring = 0; ring < props.rings; ring++) {
|
|
33
|
+
const layerId = `${id}-wave-${ring}`;
|
|
34
|
+
if (!map.getLayer(layerId)) continue;
|
|
35
|
+
const progress = ringProgress(ring, props.rings, elapsed, props.duration);
|
|
36
|
+
map.setPaintProperty(layerId, "circle-radius", props.baseRadius + progress * (props.maxRadius - props.baseRadius));
|
|
37
|
+
map.setPaintProperty(layerId, "circle-stroke-opacity", ringFade(progress));
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<MaplibreSource :source-id="id" :source="source">
|
|
44
|
+
<MaplibreLayer
|
|
45
|
+
v-for="ring in rings"
|
|
46
|
+
:key="ring"
|
|
47
|
+
:layer-id="`${id}-wave-${ring - 1}`"
|
|
48
|
+
type="circle"
|
|
49
|
+
:source="id"
|
|
50
|
+
:paint="wavePaint"
|
|
51
|
+
:before-id="beforeId"
|
|
52
|
+
/>
|
|
53
|
+
<MaplibreLayer :layer-id="`${id}-base`" type="circle" :source="id" :paint="basePaint" :before-id="beforeId" />
|
|
54
|
+
</MaplibreSource>
|
|
55
|
+
</template>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { GeoJSONSourceSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
2
|
+
/** 波浪圆:常驻实心底圆 + 周期向外扩张的描边波纹。 */
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/** 点要素数据(GeoJSON 或其 URL) */
|
|
5
|
+
data: GeoJSONSourceSpecification['data'];
|
|
6
|
+
/** 图层 id 前缀;省略时自动生成 */
|
|
7
|
+
layerId?: string;
|
|
8
|
+
/**
|
|
9
|
+
* 主色
|
|
10
|
+
* @defaultValue '#10b981'
|
|
11
|
+
*/
|
|
12
|
+
color?: string;
|
|
13
|
+
/**
|
|
14
|
+
* 底圆半径(像素)
|
|
15
|
+
* @defaultValue 6
|
|
16
|
+
*/
|
|
17
|
+
baseRadius?: number;
|
|
18
|
+
/**
|
|
19
|
+
* 波纹最大半径(像素)
|
|
20
|
+
* @defaultValue 36
|
|
21
|
+
*/
|
|
22
|
+
maxRadius?: number;
|
|
23
|
+
/**
|
|
24
|
+
* 波纹周期(毫秒)
|
|
25
|
+
* @defaultValue 2000
|
|
26
|
+
*/
|
|
27
|
+
duration?: number;
|
|
28
|
+
/**
|
|
29
|
+
* 波纹圈数
|
|
30
|
+
* @defaultValue 2
|
|
31
|
+
*/
|
|
32
|
+
rings?: number;
|
|
33
|
+
/** 插入到该图层之前 */
|
|
34
|
+
beforeId?: string;
|
|
35
|
+
};
|
|
36
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
37
|
+
color: string;
|
|
38
|
+
maxRadius: number;
|
|
39
|
+
duration: number;
|
|
40
|
+
rings: number;
|
|
41
|
+
baseRadius: number;
|
|
42
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
43
|
+
declare const _default: typeof __VLS_export;
|
|
44
|
+
export default _default;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { BuildingSourceOptions } from '../../utils/building';
|
|
2
|
+
/** 窗户建筑:程序生成窗户点阵贴图 fill-extrusion-pattern。 */
|
|
3
|
+
type __VLS_Props = BuildingSourceOptions & {
|
|
4
|
+
/** 图层 id;省略时自动生成 */
|
|
5
|
+
layerId?: string;
|
|
6
|
+
/**
|
|
7
|
+
* 窗户行数
|
|
8
|
+
* @defaultValue 8
|
|
9
|
+
*/
|
|
10
|
+
rows?: number;
|
|
11
|
+
/**
|
|
12
|
+
* 窗户列数
|
|
13
|
+
* @defaultValue 6
|
|
14
|
+
*/
|
|
15
|
+
cols?: number;
|
|
16
|
+
/**
|
|
17
|
+
* 亮窗颜色
|
|
18
|
+
* @defaultValue '#fde68a'
|
|
19
|
+
*/
|
|
20
|
+
litColor?: string;
|
|
21
|
+
/**
|
|
22
|
+
* 暗窗/墙体颜色
|
|
23
|
+
* @defaultValue '#1f2937'
|
|
24
|
+
*/
|
|
25
|
+
darkColor?: string;
|
|
26
|
+
/**
|
|
27
|
+
* 亮窗比例
|
|
28
|
+
* @defaultValue 0.45
|
|
29
|
+
*/
|
|
30
|
+
litRatio?: number;
|
|
31
|
+
/**
|
|
32
|
+
* 随机种子
|
|
33
|
+
* @defaultValue 1
|
|
34
|
+
*/
|
|
35
|
+
seed?: number;
|
|
36
|
+
/**
|
|
37
|
+
* 整体透明度
|
|
38
|
+
* @defaultValue 1
|
|
39
|
+
*/
|
|
40
|
+
opacity?: number;
|
|
41
|
+
/**
|
|
42
|
+
* 最小缩放级别
|
|
43
|
+
* @defaultValue 15
|
|
44
|
+
*/
|
|
45
|
+
minzoom?: number;
|
|
46
|
+
/** 插入到该图层之前 */
|
|
47
|
+
beforeId?: string;
|
|
48
|
+
};
|
|
49
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
50
|
+
minzoom: number;
|
|
51
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
52
|
+
declare const _default: typeof __VLS_export;
|
|
53
|
+
export default _default;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, onUnmounted, useId } from "vue";
|
|
3
|
+
import { windowTextureImage } from "../../utils/building-effects";
|
|
4
|
+
import { useMap } from "../../composables/useMap";
|
|
5
|
+
import { buildingExtrusionPaint } from "../../utils/building";
|
|
6
|
+
import MaplibreBuildingLayer from "../layers/BuildingLayer.vue";
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
source: { type: String, required: true },
|
|
9
|
+
sourceLayer: { type: String, required: false },
|
|
10
|
+
heightProperty: { type: String, required: false },
|
|
11
|
+
baseProperty: { type: String, required: false },
|
|
12
|
+
layerId: { type: String, required: false },
|
|
13
|
+
rows: { type: Number, required: false },
|
|
14
|
+
cols: { type: Number, required: false },
|
|
15
|
+
litColor: { type: String, required: false },
|
|
16
|
+
darkColor: { type: String, required: false },
|
|
17
|
+
litRatio: { type: Number, required: false },
|
|
18
|
+
seed: { type: Number, required: false },
|
|
19
|
+
opacity: { type: Number, required: false },
|
|
20
|
+
minzoom: { type: Number, required: false, default: 15 },
|
|
21
|
+
beforeId: { type: String, required: false }
|
|
22
|
+
});
|
|
23
|
+
const ctx = useMap();
|
|
24
|
+
const id = props.layerId ?? `movk-window-building-${useId()}`;
|
|
25
|
+
const imageName = `${id}-pattern`;
|
|
26
|
+
const paint = computed(() => ({
|
|
27
|
+
"fill-extrusion-pattern": imageName,
|
|
28
|
+
...buildingExtrusionPaint({ minzoom: props.minzoom, heightProperty: props.heightProperty, baseProperty: props.baseProperty }),
|
|
29
|
+
"fill-extrusion-opacity": props.opacity ?? 1
|
|
30
|
+
}));
|
|
31
|
+
const stopReady = ctx.onReady((map) => {
|
|
32
|
+
if (map.hasImage(imageName)) return;
|
|
33
|
+
const image = windowTextureImage({
|
|
34
|
+
rows: props.rows,
|
|
35
|
+
cols: props.cols,
|
|
36
|
+
litColor: props.litColor,
|
|
37
|
+
darkColor: props.darkColor,
|
|
38
|
+
litRatio: props.litRatio,
|
|
39
|
+
seed: props.seed
|
|
40
|
+
});
|
|
41
|
+
if (image) map.addImage(imageName, image);
|
|
42
|
+
});
|
|
43
|
+
onUnmounted(() => {
|
|
44
|
+
stopReady();
|
|
45
|
+
const map = ctx.map.value;
|
|
46
|
+
if (map?.hasImage(imageName)) map.removeImage(imageName);
|
|
47
|
+
});
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<MaplibreBuildingLayer
|
|
52
|
+
:layer-id="id"
|
|
53
|
+
:source="source"
|
|
54
|
+
:source-layer="sourceLayer"
|
|
55
|
+
:height-property="heightProperty"
|
|
56
|
+
:base-property="baseProperty"
|
|
57
|
+
:minzoom="minzoom"
|
|
58
|
+
:paint="paint"
|
|
59
|
+
:before-id="beforeId"
|
|
60
|
+
/>
|
|
61
|
+
</template>
|