ifcviewer-full: console-print accumulating coplanar-patch area tool

Adds a click-to-measure area mode triggered by Ctrl+Shift+A.  Each LMB
click expands the picked triangle into its connected coplanar patch
(BFS over shared edges, dot(normal, seed) > 0.9999); re-clicking
removes that patch; Alt+LMB skips expansion for a single triangle.
Picks across different meshes accumulate as separate patches.

ViewportWindow gains pickMeshLocalAt (screen pick → mesh-local hit
via inverse composed transform) and a tool-mode pattern mirroring
the section tool (toggleAreaTool, surfacePickedInTool signal,
areaToolToggled signal, Esc to exit).  Per-mesh adjacency is built
lazily on first pick of each mesh and dropped on tool toggle.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-05-07 12:03:22 +10:00
parent f2b655fcf6
commit 016c278748
6 changed files with 391 additions and 4 deletions
+13
View File
@@ -206,6 +206,16 @@ void MainWindow::setupUi() {
setCentralWidget(viewport_container_);
connect(viewport_, &ViewportWindow::objectPicked, this, &MainWindow::onObjectPicked);
connect(viewport_, &ViewportWindow::surfacePickedInTool, this,
[this](int x, int y, int modifiers) {
const bool alt = (modifiers & Qt::AltModifier) != 0;
area_measurement_.onPick(*viewport_, x, y, alt);
});
connect(viewport_, &ViewportWindow::areaToolToggled, this,
[this](bool active) {
area_measurement_.clear();
qInfo("Area tool %s", active ? "on (LMB to add patch, Alt+LMB single tri, click again to remove, Esc exits)" : "off");
});
auto* tree_dock = new QDockWidget("Elements", this);
tree_dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
@@ -283,6 +293,9 @@ void MainWindow::setupMenus() {
view_menu->addAction("Print Selected &Coords", this, [this]() {
viewport_->printSelectedObjectCoords();
}, QKeySequence("Ctrl+Shift+P"));
view_menu->addAction("&Measure Area", this, [this]() {
viewport_->toggleAreaTool();
}, QKeySequence("Ctrl+Shift+A"));
view_menu->addSeparator();
view_menu->addAction("Set &Home View", this, &MainWindow::onSetHomeView);
view_menu->addAction("&Go to Home View", this, &MainWindow::onGoHomeView);