重构组件结构,添加周边分析组件结构(但无具体实现)
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<!-- 加载geoserver图层 -->
|
||||
<template>
|
||||
<div></div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils.ts';
|
||||
import type { ImageryLayer } from 'cesium';
|
||||
import { onMounted } from 'vue';
|
||||
|
||||
const props = defineProps<{
|
||||
id: string;
|
||||
layers: string;
|
||||
}>();
|
||||
|
||||
const emits = defineEmits<{
|
||||
(e: 'provideLayers', layer: ImageryLayer): void;
|
||||
}>();
|
||||
|
||||
onMounted(() => {
|
||||
// 从环境变量获取 GeoServer 地址
|
||||
const geoserverBaseUrl = import.meta.env.VITE_GEOSERVER_BASE_URL;
|
||||
const wmsUrl = `${geoserverBaseUrl}/wms`;
|
||||
|
||||
// 创建 WMS 图层并保存引用
|
||||
const layers = CesiumUtilsSingleton.createLayersBatch([
|
||||
{
|
||||
id: props.id,
|
||||
type: 'wms',
|
||||
provider: 'xian',
|
||||
url: wmsUrl,
|
||||
layers: props.layers,
|
||||
parameters: {
|
||||
service: 'WMS',
|
||||
version: '1.1.0',
|
||||
request: 'GetMap',
|
||||
transparent: true,
|
||||
format: 'image/png',
|
||||
srs: 'EPSG:4326',
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
emits('provideLayers', layers[0]!);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
@@ -0,0 +1,42 @@
|
||||
<!-- 加载点的组件 -->
|
||||
<template>
|
||||
<div></div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted } from 'vue';
|
||||
import { usePointsHandle } from '@/hooks/usePointsHandle.ts';
|
||||
import type { Point } from '@/types/base/Point.ts';
|
||||
import type { LoadingResource } from '@/types/common/LoadingResourceType.ts';
|
||||
import { useLoadingResourceStore } from '@/stores/useLoadingResourceStore.ts';
|
||||
|
||||
// 属性
|
||||
const props = defineProps<{
|
||||
basePoints: Point[];
|
||||
getDisasterIcon: (disasterType?: string) => string;
|
||||
prefix: string;
|
||||
isDefault?: boolean;
|
||||
loadingResourceField?: LoadingResource;
|
||||
}>();
|
||||
|
||||
// 点处理钩子
|
||||
const pointsHandle = usePointsHandle();
|
||||
|
||||
onMounted(() => {
|
||||
// 加载点
|
||||
const ids: string[] = pointsHandle.addPoints(
|
||||
props.basePoints,
|
||||
props.getDisasterIcon,
|
||||
props.prefix,
|
||||
props.isDefault
|
||||
);
|
||||
|
||||
// 记录id
|
||||
useLoadingResourceStore().addLoadingResource(
|
||||
props.loadingResourceField!,
|
||||
ids
|
||||
);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
Reference in New Issue
Block a user