人口网格
This commit is contained in:
+6
-1
@@ -1,5 +1,10 @@
|
|||||||
NEW_FILE_CODE
|
NEW_FILE_CODE
|
||||||
|
|
||||||
|
# 后端地址
|
||||||
VITE_BACKEND_BASE_URL=http://localhost:8081
|
VITE_BACKEND_BASE_URL=http://localhost:8081
|
||||||
|
|
||||||
START_PORT=81
|
# 启动端口
|
||||||
|
START_PORT=81
|
||||||
|
|
||||||
|
# geoserver地址
|
||||||
|
VITE_GEOSERVER_BASE_URL=http://47.92.216.173:4019/geoserver/xian
|
||||||
+7
-1
@@ -1,4 +1,10 @@
|
|||||||
NEW_FILE_CODE
|
NEW_FILE_CODE
|
||||||
|
|
||||||
|
# 后端地址
|
||||||
VITE_BACKEND_BASE_URL=http://localhost:8080
|
VITE_BACKEND_BASE_URL=http://localhost:8080
|
||||||
|
|
||||||
START_PORT=80
|
# 启动端口
|
||||||
|
START_PORT=80
|
||||||
|
|
||||||
|
# geoserver地址
|
||||||
|
VITE_GEOSERVER_BASE_URL=http://10.22.245.246/geoserver/xian
|
||||||
@@ -1,60 +1,61 @@
|
|||||||
NEW_FILE_CODE
|
NEW_FILE_CODE;
|
||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
|
|
||||||
declare module '*.vue' {
|
declare module '*.vue' {
|
||||||
import type { DefineComponent } from 'vue'
|
import type { DefineComponent } from 'vue';
|
||||||
const component: DefineComponent<{}, {}, any>
|
const component: DefineComponent<{}, {}, any>;
|
||||||
export default component
|
export default component;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 声明环境变量类型
|
// 声明环境变量类型
|
||||||
interface ImportMetaEnv {
|
interface ImportMetaEnv {
|
||||||
readonly VITE_BACKEND_BASE_URL: string
|
readonly VITE_BACKEND_BASE_URL: string;
|
||||||
readonly START_PORT: number
|
readonly START_PORT: number;
|
||||||
readonly MODE: string
|
readonly VITE_GEOSERVER_BASE_URL: string;
|
||||||
readonly DEV: boolean
|
readonly MODE: string;
|
||||||
readonly PROD: boolean
|
readonly DEV: boolean;
|
||||||
readonly SSR: boolean
|
readonly PROD: boolean;
|
||||||
|
readonly SSR: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ImportMeta {
|
interface ImportMeta {
|
||||||
readonly env: ImportMetaEnv,
|
readonly env: ImportMetaEnv;
|
||||||
readonly glob
|
readonly glob;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 声明 CSS 模块类型
|
// 声明 CSS 模块类型
|
||||||
declare module '*.css' {
|
declare module '*.css' {
|
||||||
const content: Record<string, string>
|
const content: Record<string, string>;
|
||||||
export default content
|
export default content;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 声明静态资源类型
|
// 声明静态资源类型
|
||||||
declare module '*.svg' {
|
declare module '*.svg' {
|
||||||
const content: string
|
const content: string;
|
||||||
export default content
|
export default content;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '*.png' {
|
declare module '*.png' {
|
||||||
const content: string
|
const content: string;
|
||||||
export default content
|
export default content;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '*.jpg' {
|
declare module '*.jpg' {
|
||||||
const content: string
|
const content: string;
|
||||||
export default content
|
export default content;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '*.jpeg' {
|
declare module '*.jpeg' {
|
||||||
const content: string
|
const content: string;
|
||||||
export default content
|
export default content;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '*.gif' {
|
declare module '*.gif' {
|
||||||
const content: string
|
const content: string;
|
||||||
export default content
|
export default content;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '*.webp' {
|
declare module '*.webp' {
|
||||||
const content: string
|
const content: string;
|
||||||
export default content
|
export default content;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils';
|
import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils';
|
||||||
import { xiAn } from '@/assets';
|
import { xiAn } from '@/assets';
|
||||||
import { Color, UrlTemplateImageryProvider } from 'cesium';
|
import { Color } from 'cesium';
|
||||||
import type { GeoJsonFileType } from '@/types/cesium/GeoJsonFileType';
|
import type { GeoJsonFileType } from '@/types/cesium/GeoJsonFileType';
|
||||||
import config from '@/config/config.json';
|
import config from '@/config/config.json';
|
||||||
import { useMap } from '@/hooks/map/useMap';
|
import { useMap } from '@/hooks/map/useMap';
|
||||||
@@ -65,13 +65,6 @@
|
|||||||
CesiumUtilsSingleton.viewToTarget(
|
CesiumUtilsSingleton.viewToTarget(
|
||||||
config.defaultPosition as [number, number, number]
|
config.defaultPosition as [number, number, number]
|
||||||
);
|
);
|
||||||
|
|
||||||
const mvtProvider = new UrlTemplateImageryProvider({
|
|
||||||
url: 'http://localhost:8081/people/{z}/{x}/{y}.mvt',
|
|
||||||
});
|
|
||||||
CesiumUtilsSingleton.getViewer()!.imageryLayers.addImageryProvider(
|
|
||||||
mvtProvider
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,14 @@
|
|||||||
useStatusStore().poiLayers.showReservePoint.loading
|
useStatusStore().poiLayers.showReservePoint.loading
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<!-- 人口网格 -->
|
||||||
|
<PopulationGridComponent
|
||||||
|
v-if="
|
||||||
|
useStatusStore().appLoadingCompleted &&
|
||||||
|
useStatusStore().poiLayers.showPopulationGrid.loading
|
||||||
|
"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
@@ -47,6 +55,7 @@
|
|||||||
import EmergencyShelterComponent from './EmergencyShelterComponent.vue';
|
import EmergencyShelterComponent from './EmergencyShelterComponent.vue';
|
||||||
import FireStationComponent from './FireStationComponent.vue';
|
import FireStationComponent from './FireStationComponent.vue';
|
||||||
import StorePointsComponent from './StorePointsComponent.vue';
|
import StorePointsComponent from './StorePointsComponent.vue';
|
||||||
|
import PopulationGridComponent from './PopulationGridComponent.vue';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less"></style>
|
<style scoped lang="less"></style>
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<!-- 加载geoserver图层 -->
|
||||||
|
<template>
|
||||||
|
<div></div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils';
|
||||||
|
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,38 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 加载人口网格 -->
|
||||||
|
<LoadingGeoserverLayer
|
||||||
|
:id="`people`"
|
||||||
|
:layers="`xian:xian_people`"
|
||||||
|
@provide-layers="provideLayers"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { useStatusStore } from '@/stores/useStatusStore';
|
||||||
|
import type { ImageryLayer } from 'cesium';
|
||||||
|
import { onMounted, watch } from 'vue';
|
||||||
|
import LoadingGeoserverLayer from './LoadingGeoserverLayer.vue';
|
||||||
|
|
||||||
|
// 保存图层引用
|
||||||
|
let populationLayer: ImageryLayer | null = null;
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
// 监听显示隐藏风险点
|
||||||
|
watch(
|
||||||
|
() => useStatusStore().poiLayers.showPopulationGrid.show,
|
||||||
|
(newValue: boolean) => {
|
||||||
|
populationLayer!.show = newValue;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提供图层
|
||||||
|
* @param layer 图层
|
||||||
|
*/
|
||||||
|
function provideLayers(layer: ImageryLayer) {
|
||||||
|
populationLayer = layer;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
@@ -225,9 +225,7 @@ export const useEarthquakeDisasterChain = () => {
|
|||||||
name: '显示人口网格',
|
name: '显示人口网格',
|
||||||
statusStore: statusStore.poiLayers,
|
statusStore: statusStore.poiLayers,
|
||||||
statusKey: 'showPopulationGrid' as const,
|
statusKey: 'showPopulationGrid' as const,
|
||||||
callback: (status: unknown) => {
|
callback: layerControl.clickPopulationGrid,
|
||||||
console.log('显示人口网格', status);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '显示管网系统',
|
name: '显示管网系统',
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ export const useMap = () => {
|
|||||||
useLoadingInformationStore().resetStatue();
|
useLoadingInformationStore().resetStatue();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
console.log(pickedObject);
|
||||||
// 重置状态
|
// 重置状态
|
||||||
useLoadingInformationStore().resetStatue();
|
useLoadingInformationStore().resetStatue();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -255,9 +255,7 @@ export const useRainDisasterChain = () => {
|
|||||||
name: '显示人口网格',
|
name: '显示人口网格',
|
||||||
statusStore: statusStore.poiLayers,
|
statusStore: statusStore.poiLayers,
|
||||||
statusKey: 'showPopulationGrid' as const,
|
statusKey: 'showPopulationGrid' as const,
|
||||||
callback: (status: unknown) => {
|
callback: layerControl.clickPopulationGrid,
|
||||||
console.log('显示人口网格', status);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '显示管网系统',
|
name: '显示管网系统',
|
||||||
|
|||||||
@@ -53,6 +53,14 @@ export const useLayerControl = () => {
|
|||||||
useStatusStore().poiLayers.showReservePoint.loading = true;
|
useStatusStore().poiLayers.showReservePoint.loading = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击显示人口网格
|
||||||
|
*/
|
||||||
|
const clickPopulationGrid = () => {
|
||||||
|
// 加载状态为true
|
||||||
|
useStatusStore().poiLayers.showPopulationGrid.loading = true;
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
clickHiddenDangerPoint,
|
clickHiddenDangerPoint,
|
||||||
clickHospital,
|
clickHospital,
|
||||||
@@ -60,5 +68,6 @@ export const useLayerControl = () => {
|
|||||||
clickEmergencyShelter,
|
clickEmergencyShelter,
|
||||||
clickFireStation,
|
clickFireStation,
|
||||||
clickStorePoints,
|
clickStorePoints,
|
||||||
|
clickPopulationGrid,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -27,5 +27,5 @@ export interface LayerConfig {
|
|||||||
credit?: string;
|
credit?: string;
|
||||||
|
|
||||||
/** 图层参数 */
|
/** 图层参数 */
|
||||||
parameters?: Record<string, string>;
|
parameters?: Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user