完善地图元素查询机制
This commit is contained in:
@@ -347,7 +347,7 @@ const Toolbar: React.FC<ToolbarProps> = ({ hiddenButtons, queryType }) => {
|
||||
// 从要素属性中提取属性面板需要的数据
|
||||
const getFeatureProperties = useCallback(() => {
|
||||
if (!highlightFeature) return {};
|
||||
|
||||
const layer = highlightFeature?.getId()?.toString().split(".")[0];
|
||||
const properties = highlightFeature.getProperties();
|
||||
// 计算属性字段,增加 key 字段
|
||||
const pipeComputedFields = [
|
||||
@@ -367,7 +367,7 @@ const Toolbar: React.FC<ToolbarProps> = ({ hiddenButtons, queryType }) => {
|
||||
{ key: "quality", label: "水质", unit: "mg/L" },
|
||||
];
|
||||
|
||||
if (properties.geometry.getType() === "LineString") {
|
||||
if (layer === "geo_pipes_mat" || layer === "geo_pipes") {
|
||||
let result = {
|
||||
id: properties.id,
|
||||
type: "管道",
|
||||
@@ -400,7 +400,7 @@ const Toolbar: React.FC<ToolbarProps> = ({ hiddenButtons, queryType }) => {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
if (properties.geometry.getType() === "Point") {
|
||||
if (layer === "geo_junctions_mat" || layer === "geo_junctions") {
|
||||
let result = {
|
||||
id: properties.id,
|
||||
type: "节点",
|
||||
@@ -432,6 +432,183 @@ const Toolbar: React.FC<ToolbarProps> = ({ hiddenButtons, queryType }) => {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
if (layer === "geo_tanks_mat" || layer === "geo_tanks") {
|
||||
return {
|
||||
id: properties.id,
|
||||
type: "水池",
|
||||
properties: [
|
||||
{
|
||||
label: "海拔",
|
||||
value: properties.elevation?.toFixed?.(1),
|
||||
unit: "m",
|
||||
},
|
||||
{
|
||||
label: "初始水位",
|
||||
value: properties.init_level?.toFixed?.(1),
|
||||
unit: "m",
|
||||
},
|
||||
{
|
||||
label: "最低水位",
|
||||
value: properties.min_level?.toFixed?.(1),
|
||||
unit: "m",
|
||||
},
|
||||
{
|
||||
label: "最高水位",
|
||||
value: properties.max_level?.toFixed?.(1),
|
||||
unit: "m",
|
||||
},
|
||||
{
|
||||
label: "直径",
|
||||
value: properties.diameter?.toFixed?.(1),
|
||||
unit: "m",
|
||||
},
|
||||
{
|
||||
label: "最小容积",
|
||||
value: properties.min_vol?.toFixed?.(1),
|
||||
unit: "m³",
|
||||
},
|
||||
// {
|
||||
// label: "容积曲线",
|
||||
// value: properties.vol_curve,
|
||||
// },
|
||||
{
|
||||
label: "溢出",
|
||||
value: properties.overflow ? "是" : "否",
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
if (layer === "geo_reservoirs_mat" || layer === "geo_reservoirs") {
|
||||
return {
|
||||
id: properties.id,
|
||||
type: "水库",
|
||||
properties: [
|
||||
{
|
||||
label: "水头",
|
||||
value: properties.head?.toFixed?.(1),
|
||||
unit: "m",
|
||||
},
|
||||
// {
|
||||
// label: "模式",
|
||||
// value: properties.pattern,
|
||||
// },
|
||||
],
|
||||
};
|
||||
}
|
||||
if (layer === "geo_pumps_mat" || layer === "geo_pumps") {
|
||||
return {
|
||||
id: properties.id,
|
||||
type: "水泵",
|
||||
properties: [
|
||||
{ label: "起始节点 ID", value: properties.node1 },
|
||||
{ label: "终点节点 ID", value: properties.node2 },
|
||||
{
|
||||
label: "功率",
|
||||
value: properties.power?.toFixed?.(1),
|
||||
unit: "kW",
|
||||
},
|
||||
{
|
||||
label: "扬程",
|
||||
value: properties.head?.toFixed?.(1),
|
||||
unit: "m",
|
||||
},
|
||||
{
|
||||
label: "转速",
|
||||
value: properties.speed?.toFixed?.(1),
|
||||
unit: "rpm",
|
||||
},
|
||||
{
|
||||
label: "模式",
|
||||
value: properties.pattern,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
if (layer === "geo_valves_mat" || layer === "geo_valves") {
|
||||
return {
|
||||
id: properties.id,
|
||||
type: "阀门",
|
||||
properties: [
|
||||
{ label: "起始节点 ID", value: properties.node1 },
|
||||
{ label: "终点节点 ID", value: properties.node2 },
|
||||
{
|
||||
label: "直径",
|
||||
value: properties.diameter?.toFixed?.(1),
|
||||
unit: "mm",
|
||||
},
|
||||
{
|
||||
label: "阀门类型",
|
||||
value: properties.v_type,
|
||||
},
|
||||
// {
|
||||
// label: "设置",
|
||||
// value: properties.setting?.toFixed?.(2),
|
||||
// },
|
||||
{
|
||||
label: "局部损失",
|
||||
value: properties.minor_loss?.toFixed?.(2),
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
// 传输频率文字对应
|
||||
const getTransmissionFrequency = (transmission_frequency: string) => {
|
||||
// 传输频率文本:00:01:00,00:05:00,00:10:00,00:30:00,01:00:00,转换为分钟数
|
||||
const parts = transmission_frequency.split(":");
|
||||
if (parts.length !== 3) return transmission_frequency;
|
||||
const hours = parseInt(parts[0], 10);
|
||||
const minutes = parseInt(parts[1], 10);
|
||||
const seconds = parseInt(parts[2], 10);
|
||||
const totalMinutes = hours * 60 + minutes + (seconds >= 30 ? 1 : 0);
|
||||
return totalMinutes;
|
||||
};
|
||||
// 可靠度文字映射
|
||||
const getReliability = (reliability: number) => {
|
||||
switch (reliability) {
|
||||
case 1:
|
||||
return "高";
|
||||
case 2:
|
||||
return "中";
|
||||
case 3:
|
||||
return "低";
|
||||
default:
|
||||
return "未知";
|
||||
}
|
||||
};
|
||||
if (layer === "geo_scada_mat" || layer === "geo_scada") {
|
||||
let result = {
|
||||
id: properties.id,
|
||||
type: "SCADA设备",
|
||||
properties: [
|
||||
{
|
||||
label: "类型",
|
||||
value:
|
||||
properties.type === "pipe_flow" ? "流量传感器" : "压力传感器",
|
||||
},
|
||||
{
|
||||
label: "关联节点 ID",
|
||||
value: properties.associated_element_id,
|
||||
},
|
||||
{
|
||||
label: "传输模式",
|
||||
value:
|
||||
properties.transmission_mode === "non_realtime"
|
||||
? "定时传输"
|
||||
: "实时传输",
|
||||
},
|
||||
{
|
||||
label: "传输频率",
|
||||
value: getTransmissionFrequency(properties.transmission_frequency),
|
||||
unit: "分钟",
|
||||
},
|
||||
{
|
||||
label: "可靠性",
|
||||
value: getReliability(properties.reliability),
|
||||
},
|
||||
],
|
||||
};
|
||||
return result;
|
||||
}
|
||||
return {};
|
||||
}, [highlightFeature, computedProperties]);
|
||||
|
||||
@@ -449,7 +626,7 @@ const Toolbar: React.FC<ToolbarProps> = ({ hiddenButtons, queryType }) => {
|
||||
{!hiddenButtons?.includes("draw") && (
|
||||
<ToolbarButton
|
||||
icon={<EditOutlinedIcon />}
|
||||
name="矢量编辑"
|
||||
name="标记绘制"
|
||||
isActive={activeTools.includes("draw")}
|
||||
onClick={() => handleToolClick("draw")}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user