修复导览楼层切换点位错层

This commit is contained in:
lyf
2026-06-30 20:10:18 +08:00
parent e3682ed3ec
commit 2376923915
4 changed files with 457 additions and 35 deletions

View File

@@ -12,6 +12,7 @@ import {
isIndoorNavigableFloor
} from '@/domain/guideFloor'
import {
buildSgsFloorAliases,
createSgsHallPoiDiagnostics,
formatSgsFloorLabel,
toMuseumHallPoisFromSgs,
@@ -193,6 +194,16 @@ export class SgsSdkGuideModelRepository implements GuideModelRepository {
const floorModelItems = floors
.map((floor, index) => {
const bundle = bundles[index]
const bundleFloor = bundle.floor
if (bundleFloor && String(bundleFloor.floorId) !== String(floor.floorId)) {
warnSgsGuideModelDiagnostics('floor bundle metadata does not match requested floor', {
requestedFloorId: String(floor.floorId),
requestedFloorCode: floor.floorCode,
bundleFloorId: String(bundleFloor.floorId),
bundleFloorCode: bundleFloor.floorCode
})
}
const modelUrl = resolveSgsAssetUrl(bundle.model?.modelUrl || bundle.model?.fallbackModelUrl)
const label = formatSgsFloorLabel(floor.floorCode, floor.floorName)
@@ -228,12 +239,28 @@ export class SgsSdkGuideModelRepository implements GuideModelRepository {
async loadFloorPois(floorId: string) {
const manifest = await this.provider.getManifest()
this.floorsCache = sortSgsFloors(manifest.floors).filter(isIndoorNavigableFloor)
const aliases = buildSgsFloorAliases(this.floorsCache)
const requestedFloorId = floorId.trim()
const normalizedFloorId = aliases.get(requestedFloorId)
|| aliases.get(requestedFloorId.toLowerCase())
|| requestedFloorId
const matchedFloor = this.floorsCache.find((floor) => (
String(floor.floorId) === floorId
|| floor.floorCode === floorId
|| formatSgsFloorLabel(floor.floorCode, floor.floorName) === floorId
String(floor.floorId) === normalizedFloorId
|| floor.floorCode === normalizedFloorId
|| formatSgsFloorLabel(floor.floorCode, floor.floorName) === normalizedFloorId
))
if (!matchedFloor) return []
if (!matchedFloor) {
warnSgsGuideModelDiagnostics('unable to resolve floor for render POI request', {
requestedFloorId: floorId,
normalizedFloorId,
knownFloors: this.floorsCache.map((floor) => ({
floorId: String(floor.floorId),
floorCode: floor.floorCode,
label: formatSgsFloorLabel(floor.floorCode, floor.floorName)
}))
})
return []
}
const resolvedFloorId = String(matchedFloor.floorId)
const loadFloorData = async <T>(