ifcviewer-full: hide and remove model actions

Right-click a model root in the Elements tree to get Hide/Show and
Remove.  Hide flips the federation's per-model visible flag (already
round-tripped to .ifcfed), pushes ViewportWindow::hideModel/showModel,
and italicises + greys the tree root as a visual cue.  Remove drops
the model from the viewport, the SceneLoader (streamer + caches), the
MainWindow UI maps and tree, and the Federation — disabled while the
model is the active load.

Visibility is reapplied on each model's load completion (sidecar or
stream), so a federation saved with hidden models opens with them
hidden.  clearScene() now also drops SceneLoader state so streamers
no longer leak across federation transitions.

API additions:
- Federation::setModelVisible + modelVisibilityChanged signal
- SceneLoader::removeModel + isLoadingModel

Tests cover the setter (dirty + signal + idempotence + unknown id);
extends the existing round-trip test to actually exercise the
visibility load/save it always claimed to.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-05-04 12:22:14 +10:00
parent 4597be7fda
commit de5eb9641f
7 changed files with 183 additions and 0 deletions
+10
View File
@@ -67,6 +67,7 @@ private slots:
void onModelTransformations();
void onObjectPicked(uint32_t object_id);
void onTreeSelectionChanged();
void onTreeContextMenu(const QPoint& pos);
void onLoadStarted(uint32_t mid, QString display_name);
void onLoadProgressChanged(int percent);
@@ -99,6 +100,15 @@ private:
const std::string& type);
void writeSidecarForModel(uint32_t mid);
void removeModelUi(uint32_t mid);
void removeModel(uint32_t mid);
// Returns the model_id whose tree root is `item`, or 0 if `item` is not
// a model root (i.e. an element row, or null).
uint32_t modelIdForRoot(QTreeWidgetItem* item) const;
// Push the federation's `visible` flag for `mid` onto the viewport.
// No-op if `mid` is not in the federation map. Idempotent — safe to
// call before the model is finalised on the viewport (hideModel is a
// lookup-and-set on models_gpu_; missing entries are skipped).
void applyModelVisibilityToViewport(uint32_t mid);
void applyPendingBenchmark();
// Push a model's CoordinateOperation matrix to the viewport (or