ifcviewer: cache per-model georef in SceneLoader

Adds ModelGeoref { ModelUnits units; Eigen::Matrix4d stage2_meters; bool
has_stage2; } and computeModelGeoref(file*) in Federation.{h,cpp}.  The
helper reads the project length unit, IfcProjectedCRS.MapUnit, helmert
parameters and WCS, and reduces them to a metres-in/metres-out stage 2
matrix using the existing Geolocation + Unit primitives.  When the model
has no IfcMapConversion it returns an identity stage_2 with has_stage2
== false, so the upload pipeline can branch cheaply.

SceneLoader::Model gains a cached ModelGeoref; SceneLoader::modelGeoref
(uint32_t mid) computes lazily on first call (returns nullptr when the
IFC file isn't available yet — happens on the sidecar-hit path before
the data-source thread populates the streamer) and serves from cache
afterwards.

Not yet consumed by the upload pipeline; that's the next commit.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-05-01 17:31:08 +10:00
parent 5386c9ec69
commit bea4e38e65
5 changed files with 87 additions and 3 deletions
+6 -3
View File
@@ -58,10 +58,13 @@ find_package(Eigen3 REQUIRED)
add_executable(test_federation
test_federation.cpp
${IFCVIEWER_SRC}/Federation.cpp
# Federation pulls in Unit::convert for federation_unit_to_meters; compile
# Unit.cpp directly so the test doesn't have to link the whole IfcViewer
# library (which would drag in Qt6::OpenGL, OpenCASCADE, etc.).
# Federation pulls in Unit::convert for federationUnitToMeters and
# Geolocation helpers (helmertMetersFromParameters, getWcs, getMapUnit)
# for computeModelGeoref; compile both directly so the test doesn't
# have to link the whole IfcViewer library (which would drag in
# Qt6::OpenGL, OpenCASCADE, etc.).
${IFCVIEWER_SRC}/Unit.cpp
${IFCVIEWER_SRC}/Geolocation.cpp
)
set_target_properties(test_federation PROPERTIES AUTOMOC ON)
target_include_directories(test_federation PRIVATE ${IFCVIEWER_SRC})