@@ -672,6 +672,13 @@ const categoryForSgsSpace = (space: SgsSpacePayload): MuseumCategory => {
|
||||
return spaceCategory
|
||||
}
|
||||
|
||||
const createCanonicalSpacePoiId = (space: SgsSpacePayload) => {
|
||||
const spaceId = stringifyId(space.id)
|
||||
if (!spaceId) return ''
|
||||
|
||||
return `${isExhibitionHallSpace(space) ? 'hall' : 'space'}-${spaceId}`
|
||||
}
|
||||
|
||||
export const toMuseumSpacePointFromSgs = (
|
||||
space: SgsSpacePayload,
|
||||
floors: SgsSdkFloorSummaryPayload[],
|
||||
@@ -686,9 +693,11 @@ export const toMuseumSpacePointFromSgs = (
|
||||
if (!spaceId || !name || !spacePosition) return null
|
||||
|
||||
const category = categoryForSgsSpace(space)
|
||||
const poiId = createCanonicalSpacePoiId(space)
|
||||
|
||||
return {
|
||||
id: `space-${spaceId}`,
|
||||
// 可生成展厅类 marker 的空间统一使用 hall ID,确保弱网回退结果仍可直接定位。
|
||||
id: poiId,
|
||||
name,
|
||||
floorId,
|
||||
floorLabel: floorLabelForSgs(floorId, floors),
|
||||
@@ -734,8 +743,8 @@ const createHallEntrance = (
|
||||
const createHallPoiId = (
|
||||
space: SgsSpacePayload
|
||||
) => {
|
||||
const spaceId = stringifyId(space.id)
|
||||
if (spaceId) return `hall-${spaceId}`
|
||||
const canonicalId = createCanonicalSpacePoiId(space)
|
||||
if (canonicalId) return canonicalId
|
||||
|
||||
const ownerName = normalizedHallName(space.name)
|
||||
const floorIdentity = normalizedHallName(stringifyId(space.floorId) || 'unknown-floor')
|
||||
@@ -755,16 +764,17 @@ const createSpaceFallbackHallPoi = (
|
||||
const position = spacePosition?.position
|
||||
const hallId = stringifyId(space.id)
|
||||
|
||||
if (!hallId || !normalizedText(space.name) || !position) return null
|
||||
|
||||
return {
|
||||
if (!hallId || !normalizedText(space.name) || !position) return null
|
||||
const category = categoryForSgsSpace(space)
|
||||
|
||||
return {
|
||||
id: `hall-${hallId}`,
|
||||
name: normalizedText(space.name),
|
||||
floorId,
|
||||
floorLabel: floorLabelForSgs(floorId, floors),
|
||||
primaryCategory: hallCategory,
|
||||
categories: [
|
||||
hallCategory
|
||||
primaryCategory: category,
|
||||
categories: [
|
||||
category
|
||||
],
|
||||
positionGltf: position,
|
||||
sourceObjectName: space.sourceNodeName || undefined,
|
||||
@@ -807,7 +817,8 @@ export const toMuseumHallPoisFromSgs = (
|
||||
const hallId = stringifyId(matchedSpace?.id) || undefined
|
||||
const poiId = createHallPoiId(matchedSpace)
|
||||
const hallName = normalizedText(matchedSpace?.name) || placeHallName(place) || entrance.name
|
||||
const existing = halls.get(poiId)
|
||||
const category = categoryForSgsSpace(matchedSpace)
|
||||
const existing = halls.get(poiId)
|
||||
|
||||
if (existing) {
|
||||
existing.entrances = [
|
||||
@@ -843,10 +854,10 @@ export const toMuseumHallPoisFromSgs = (
|
||||
name: hallName,
|
||||
floorId: usesSpaceCenter ? fallbackFloorIdForPoi : entrance.floorId,
|
||||
floorLabel: usesSpaceCenter ? fallbackFloorLabel : entrance.floorLabel,
|
||||
primaryCategory: hallCategory,
|
||||
primaryCategory: category,
|
||||
categories: [
|
||||
hallCategory,
|
||||
hallEntranceCategory
|
||||
category,
|
||||
...(category.id === hallCategory.id ? [hallEntranceCategory] : [])
|
||||
],
|
||||
positionGltf,
|
||||
sourceObjectName: usesSpaceCenter
|
||||
|
||||
Reference in New Issue
Block a user