@@ -19,11 +19,13 @@ export const formatNavFloorLabel = (floorId: string) => {
|
||||
const value = Number(match[1])
|
||||
if (Number.isNaN(value)) return floorId
|
||||
|
||||
if (value === 1.5) return 'MF'
|
||||
return value < 0 ? `B${Math.abs(value)}` : `${value}F`
|
||||
}
|
||||
|
||||
export const navFloorIdFromLabel = (labelOrId: string) => {
|
||||
if (floorIdPattern.test(labelOrId)) return labelOrId
|
||||
if (labelOrId.trim().toUpperCase() === 'MF') return 'L1.5'
|
||||
|
||||
const basementMatch = labelOrId.match(/^B(\d+(?:\.\d+)?)$/i)
|
||||
if (basementMatch) return `L-${basementMatch[1]}`
|
||||
|
||||
@@ -225,8 +225,8 @@ export const formatSgsFloorLabel = (floorCode?: string | null, floorName?: strin
|
||||
const basementMatch = floorCode?.match(/^L-(\d+(?:\.\d+)?)$/)
|
||||
if (basementMatch) return `B${basementMatch[1]}`
|
||||
|
||||
const floorMatch = floorCode?.match(/^L(\d+(?:\.\d+)?)$/)
|
||||
if (floorMatch) return `${floorMatch[1]}F`
|
||||
const floorMatch = floorCode?.match(/^L(\d+(?:\.\d+)?)$/)
|
||||
if (floorMatch) return floorMatch[1] === '1.5' ? 'MF' : `${floorMatch[1]}F`
|
||||
|
||||
return floorName || floorCode || '未知楼层'
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ interface FloorLike {
|
||||
}
|
||||
|
||||
const indoorFloorCodePattern = /^L-?\d+(?:\.\d+)?$/i
|
||||
const indoorFloorLabelPattern = /^(?:B\d+(?:\.\d+)?|\d+(?:\.\d+)?F)$/i
|
||||
const indoorFloorLabelPattern = /^(?:B\d+(?:\.\d+)?|\d+(?:\.\d+)?F|MF)$/i
|
||||
const rawNumericIdPattern = /^\d{6,}$/
|
||||
const nonNavigableFloorPattern = /(EXTERIOR|OUTDOOR|BUILDING|FACADE|EXTERNAL|外立面|建筑外观|建筑外立面|馆外模型|馆外场景|馆外底图|馆外建筑|馆外外观|馆外)$/i
|
||||
|
||||
@@ -37,6 +37,8 @@ const parseFloorLevelFromToken = (value: unknown) => {
|
||||
const labelMatch = normalized.match(/^(\d+(?:\.\d+)?)F$/)
|
||||
if (labelMatch) return Number(labelMatch[1])
|
||||
|
||||
if (normalized === 'MF') return 1.5
|
||||
|
||||
const codeMatch = normalized.match(/^L(-?\d+(?:\.\d+)?)$/)
|
||||
if (codeMatch) return Number(codeMatch[1])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user