ifcviewer: F to frame selection from tree, debug coord dump

Tree -> viewport selection was already wired (onTreeSelectionChanged
calls setSelectedObjectId), but pressing F afterwards routed to the
focused tree widget rather than the viewport, so framing didn't fire.
Add a window-level View > Frame Selected QAction with Qt::Key_F that
delegates to ViewportWindow::focusOnSelectedObject — works regardless
of which child widget has focus.  The viewport's own F handler stays
in place for when the viewport itself owns focus.

For debugging coordinate problems, add View > Print Selected Coords
(Ctrl+Shift+P) -> ViewportWindow::printSelectedObjectCoords, which
qInfo's:
  - a sample vertex (first vertex of the selected mesh, decoded on
    demand from the quantised VBO so no extra CPU storage is needed);
  - placement_transformation (the per-instance matrix that maps the
    sample vertex from mesh-local into the model's pre-georef frame);
  - global = CoordinateOperation . placement_transformation (where
    the IFC's own IfcCoordinateOperation has been folded in);
  - the sample vertex transformed through both matrices.

The print is a no-op when nothing is selected or GL hasn't initialised.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-05-02 19:01:50 +10:00
parent 8f3eaa35d7
commit e0e143bab5
3 changed files with 100 additions and 0 deletions
+6
View File
@@ -177,6 +177,12 @@ public:
void showModel(uint32_t model_id);
void removeModel(uint32_t model_id);
// Debug helper: walk to the currently selected object's instance and
// qInfo a sample vertex (decoded from the VBO), the placement
// transformation matrix, and the global matrix
// (CoordinateOperation · placement_transformation), in metres.
void printSelectedObjectCoords();
// Federation pipeline: composed instance transform =
// FederatedFalseOrigin · ModelTransformation · CoordinateOperation
// · placement_transformation