обновление бизнес логики

This commit is contained in:
2026-02-05 18:53:25 +03:00
parent f275db88c9
commit 44473a8d9d
24 changed files with 712 additions and 5397 deletions

View File

@@ -236,7 +236,7 @@ const ModelViewer: React.FC<ModelViewerProps> = ({
// Find the mesh for this sensor
const allMeshes = importedMeshesRef.current || []
const sensorMeshes = collectSensorMeshes(allMeshes)
const sensorMeshes = collectSensorMeshes(allMeshes, sensorStatusMap)
const targetMesh = sensorMeshes.find(m => getSensorIdFromMesh(m) === sensorId)
if (!targetMesh) {
@@ -571,7 +571,7 @@ const ModelViewer: React.FC<ModelViewerProps> = ({
}
const allMeshes = importedMeshesRef.current || []
const sensorMeshes = collectSensorMeshes(allMeshes)
const sensorMeshes = collectSensorMeshes(allMeshes, sensorStatusMap)
if (sensorMeshes.length === 0) {
setAllSensorsOverlayCircles([])
return
@@ -609,14 +609,26 @@ const ModelViewer: React.FC<ModelViewerProps> = ({
return
}
const sensorMeshes = collectSensorMeshes(allMeshes)
// Сначала найдём ВСЕ датчики в 3D модели (без фильтра)
const allSensorMeshesInModel = collectSensorMeshes(allMeshes, null)
const allSensorIdsInModel = allSensorMeshesInModel.map(m => getSensorIdFromMesh(m)).filter(Boolean)
// Теперь применим фильтр по sensorStatusMap
const sensorMeshes = collectSensorMeshes(allMeshes, sensorStatusMap)
const filteredSensorIds = sensorMeshes.map(m => getSensorIdFromMesh(m)).filter(Boolean)
console.log('[ModelViewer] Total meshes in model:', allMeshes.length)
console.log('[ModelViewer] Sensor meshes found:', sensorMeshes.length)
console.log('[ModelViewer] ALL sensor meshes in 3D model (unfiltered):', allSensorIdsInModel.length, allSensorIdsInModel)
console.log('[ModelViewer] sensorStatusMap keys count:', sensorStatusMap ? Object.keys(sensorStatusMap).length : 0)
console.log('[ModelViewer] Sensor meshes found (filtered by sensorStatusMap):', sensorMeshes.length, filteredSensorIds)
// Log first 5 sensor IDs found in meshes
const sensorIds = sensorMeshes.map(m => getSensorIdFromMesh(m)).filter(Boolean).slice(0, 5)
console.log('[ModelViewer] Sample sensor IDs from meshes:', sensorIds)
// Найдём датчики которые есть в sensorStatusMap но НЕТ в 3D модели
if (sensorStatusMap) {
const missingInModel = Object.keys(sensorStatusMap).filter(id => !allSensorIdsInModel.includes(id))
if (missingInModel.length > 0) {
console.warn('[ModelViewer] Sensors in sensorStatusMap but MISSING in 3D model:', missingInModel.length, missingInModel.slice(0, 10))
}
}
if (sensorMeshes.length === 0) {
console.warn('[ModelViewer] No sensor meshes found in 3D model!')
@@ -670,7 +682,7 @@ const ModelViewer: React.FC<ModelViewerProps> = ({
return
}
const sensorMeshes = collectSensorMeshes(allMeshes)
const sensorMeshes = collectSensorMeshes(allMeshes, sensorStatusMap)
const allSensorIds = sensorMeshes.map(m => getSensorIdFromMesh(m))
const chosen = sensorMeshes.find(m => getSensorIdFromMesh(m) === sensorId)