添加爆管定位功能及相关组件
This commit is contained in:
@@ -11,7 +11,7 @@ export const AREA_COLORS = [
|
||||
"#be123c",
|
||||
];
|
||||
|
||||
export const DMA_FLOW_DISPLAY_UNIT = "m3/h";
|
||||
export const DMA_FLOW_DISPLAY_UNIT = "m³/h";
|
||||
const M3H_FACTOR = 3600;
|
||||
|
||||
export const getAreaColor = (areaId: string | number | undefined) => {
|
||||
@@ -23,16 +23,16 @@ export const getAreaColor = (areaId: string | number | undefined) => {
|
||||
return AREA_COLORS[hash % AREA_COLORS.length];
|
||||
};
|
||||
|
||||
export const toM3h = (value: number, sourceUnit: string = "m3/s") => {
|
||||
export const toM3h = (value: number, sourceUnit: string = "m³/s") => {
|
||||
if (!Number.isFinite(value)) return Number.NaN;
|
||||
const normalizedUnit = sourceUnit.trim().toLowerCase();
|
||||
if (normalizedUnit === "m3/h") return value;
|
||||
if (normalizedUnit === "m³/h") return value;
|
||||
return value * M3H_FACTOR;
|
||||
};
|
||||
|
||||
export const toM3s = (value: number, sourceUnit: string = "m3/h") => {
|
||||
export const toM3s = (value: number, sourceUnit: string = "m³/h") => {
|
||||
if (!Number.isFinite(value)) return Number.NaN;
|
||||
const normalizedUnit = sourceUnit.trim().toLowerCase();
|
||||
if (normalizedUnit === "m3/s") return value;
|
||||
if (normalizedUnit === "m³/s") return value;
|
||||
return value / M3H_FACTOR;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user