细化隐患点显示逻辑
This commit is contained in:
@@ -178,10 +178,22 @@ export const useEarthquakeDisasterChain = () => {
|
||||
|
||||
return [
|
||||
{
|
||||
name: '显示隐患点',
|
||||
name: '显示滑坡隐患点',
|
||||
statusStore: statusStore.poiLayers,
|
||||
statusKey: 'showLandslideHiddenPoint' as const,
|
||||
callback: layerControl.clickLandslideHiddenPoint,
|
||||
},
|
||||
{
|
||||
name: '显示泥石流隐患点',
|
||||
statusStore: statusStore.poiLayers,
|
||||
statusKey: 'showDebrisFlowHiddenPoint' as const,
|
||||
callback: layerControl.clickDebrisFlowHiddenPoint,
|
||||
},
|
||||
{
|
||||
name: '显示风险点',
|
||||
statusStore: statusStore.mapLayers,
|
||||
statusKey: 'hiddenDangerPointShow' as const,
|
||||
callback: layerControl.clickHiddenDangerPoint,
|
||||
statusKey: 'riskPointShow' as const,
|
||||
callback: layerControl.clickRiskPoint,
|
||||
},
|
||||
{
|
||||
name: '显示医院',
|
||||
|
||||
+22
-4
@@ -23,7 +23,10 @@ export const useMap = () => {
|
||||
|
||||
// 当id改变时候,重置状态
|
||||
if (
|
||||
useLoadingInformationStore().hiddenPoint.id !== id &&
|
||||
useLoadingInformationStore().landslideHiddenPoint.id !== id &&
|
||||
useLoadingInformationStore().debrisFlowHiddenPoint.id !== id &&
|
||||
useLoadingInformationStore().waterLoggingHiddenPoint.id !== id &&
|
||||
useLoadingInformationStore().flashFloodHiddenPoint.id !== id &&
|
||||
useLoadingInformationStore().riskPoint.id !== id &&
|
||||
useLoadingInformationStore().hospital.id !== id
|
||||
) {
|
||||
@@ -35,9 +38,24 @@ export const useMap = () => {
|
||||
useLoadingInformationStore().clickObject.primitive =
|
||||
pickedObject.primitive;
|
||||
|
||||
// 隐患点
|
||||
if (pickedObject.id.startsWith(config.prefix.hiddenDangerPointId)) {
|
||||
useLoadingInformationStore().hiddenPoint.id = id;
|
||||
// 滑坡隐患点
|
||||
if (pickedObject.id.startsWith(config.prefix.landslideHiddenPointId)) {
|
||||
useLoadingInformationStore().landslideHiddenPoint.id = id;
|
||||
}
|
||||
|
||||
// 泥石流隐患点
|
||||
else if (pickedObject.id.startsWith(config.prefix.debrisFlowHiddenPointId)) {
|
||||
useLoadingInformationStore().debrisFlowHiddenPoint.id = id;
|
||||
}
|
||||
|
||||
// 内涝隐患点
|
||||
else if (pickedObject.id.startsWith(config.prefix.waterLoggingHiddenPointId)) {
|
||||
useLoadingInformationStore().waterLoggingHiddenPoint.id = id;
|
||||
}
|
||||
|
||||
// 山洪隐患点
|
||||
else if (pickedObject.id.startsWith(config.prefix.flashFloodHiddenPointId)) {
|
||||
useLoadingInformationStore().flashFloodHiddenPoint.id = id;
|
||||
}
|
||||
|
||||
// 风险点
|
||||
|
||||
@@ -24,17 +24,22 @@ export const useHiddenPoint = () => {
|
||||
|
||||
/**
|
||||
* 根据灾害类型获取对应图标
|
||||
* @param disasterType - 灾害类型
|
||||
* @param disasterType - 灾害类型(支持中英文)
|
||||
* @returns 图标路径
|
||||
*/
|
||||
function getDisasterIcon(disasterType?: string): string {
|
||||
// 支持英文和中文两种格式
|
||||
switch (disasterType) {
|
||||
case 'landslide':
|
||||
case '滑坡':
|
||||
return landslideIcon;
|
||||
case 'debris_flow':
|
||||
case '泥石流':
|
||||
return debrisFlowIcon;
|
||||
case 'water_logging':
|
||||
case '内涝':
|
||||
return waterLoggingIcon;
|
||||
case 'flash_flood':
|
||||
case '山洪':
|
||||
return flashFloodIcon;
|
||||
default:
|
||||
|
||||
@@ -4,15 +4,6 @@ import { useStatusStore } from '@/stores/useStatusStore.ts';
|
||||
* 控制面板显示隐藏逻辑
|
||||
*/
|
||||
export const useLayerControl = () => {
|
||||
/**
|
||||
* 点击显示隐藏隐患点
|
||||
* @param status - 显示隐藏状态
|
||||
*/
|
||||
const clickHiddenDangerPoint = (status: unknown) => {
|
||||
// 改变风险点显示状态
|
||||
useStatusStore().mapLayers.riskPointShow.show = status as boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* 点击显示医院
|
||||
*/
|
||||
@@ -116,8 +107,43 @@ export const useLayerControl = () => {
|
||||
useStatusStore().poiLayers.showSubwayStation.loading = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 显示滑坡隐患点
|
||||
*/
|
||||
const clickLandslideHiddenPoint = () => {
|
||||
useStatusStore().poiLayers.showLandslideHiddenPoint.loading = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 显示泥石流隐患点
|
||||
*/
|
||||
const clickDebrisFlowHiddenPoint = () => {
|
||||
useStatusStore().poiLayers.showDebrisFlowHiddenPoint.loading = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 显示内涝隐患点
|
||||
*/
|
||||
const clickWaterLoggingHiddenPoint = () => {
|
||||
useStatusStore().poiLayers.showWaterLoggingHiddenPoint.loading = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 显示山洪隐患点
|
||||
*/
|
||||
const clickFlashFloodHiddenPoint = () => {
|
||||
useStatusStore().poiLayers.showFlashFloodHiddenPoint.loading = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 显示风险点
|
||||
*/
|
||||
const clickRiskPoint = () => {
|
||||
useStatusStore().mapLayers.riskPointShow.loading = true;
|
||||
};
|
||||
|
||||
return {
|
||||
clickHiddenDangerPoint,
|
||||
clickRiskPoint,
|
||||
clickHospital,
|
||||
clickDangerousSource,
|
||||
clickEmergencyShelter,
|
||||
@@ -132,5 +158,9 @@ export const useLayerControl = () => {
|
||||
clickBridge,
|
||||
clickReservoir,
|
||||
clickSubwayStation,
|
||||
clickLandslideHiddenPoint,
|
||||
clickDebrisFlowHiddenPoint,
|
||||
clickWaterLoggingHiddenPoint,
|
||||
clickFlashFloodHiddenPoint,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -206,6 +206,36 @@ export const useRainDisasterChain = () => {
|
||||
const layerControl = useLayerControl();
|
||||
|
||||
return [
|
||||
{
|
||||
name: '显示滑坡隐患点',
|
||||
statusStore: statusStore.poiLayers,
|
||||
statusKey: 'showLandslideHiddenPoint' as const,
|
||||
callback: layerControl.clickLandslideHiddenPoint,
|
||||
},
|
||||
{
|
||||
name: '显示泥石流隐患点',
|
||||
statusStore: statusStore.poiLayers,
|
||||
statusKey: 'showDebrisFlowHiddenPoint' as const,
|
||||
callback: layerControl.clickDebrisFlowHiddenPoint,
|
||||
},
|
||||
{
|
||||
name: '显示内涝隐患点',
|
||||
statusStore: statusStore.poiLayers,
|
||||
statusKey: 'showWaterLoggingHiddenPoint' as const,
|
||||
callback: layerControl.clickWaterLoggingHiddenPoint,
|
||||
},
|
||||
{
|
||||
name: '显示山洪隐患点',
|
||||
statusStore: statusStore.poiLayers,
|
||||
statusKey: 'showFlashFloodHiddenPoint' as const,
|
||||
callback: layerControl.clickFlashFloodHiddenPoint,
|
||||
},
|
||||
{
|
||||
name: '显示风险点',
|
||||
statusStore: statusStore.mapLayers,
|
||||
statusKey: 'riskPointShow' as const,
|
||||
callback: layerControl.clickRiskPoint,
|
||||
},
|
||||
{
|
||||
name: '显示医院',
|
||||
statusStore: statusStore.poiLayers,
|
||||
|
||||
Reference in New Issue
Block a user