spatial hierarchy from IFC + active-model concept

Build the spatial hierarchy panel from the loaded model's real IFC
spatial structure instead of mock data:
- helpers/element: add get_spatial_children (IsDecomposedBy -> RelatedObjects,
  filtered to spatial elements) to walk IfcProject -> IfcSite -> IfcBuilding
  -> IfcBuildingStorey -> IfcSpace.
- SessionState: relay dataSourceReady as modelDataSourceReady (the .ifc for a
  sidecar hit loads asynchronously, so the tree can only build once it arrives).
- spatial_hierarchy/View: walk the active model's IFC file into a TreeNode
  tree, naming nodes by Name (fallback to class), mapping site/building/storey
  kinds; siblings sorted with natural (numeric) collation.
- spatial_hierarchy/Panel: tree now fills the panel height (setBodyExpanding +
  Expanding size policy); right-click menu for recursive Expand/Collapse
  Subtree and Expand/Collapse All.

Add the concept of an active model:
- SessionState: activeModelId / setActiveModelId / activeModelChanged; the
  first loaded model is active by default; reassigns/clears on removal.
- Models panel: clicking a model makes it active; its cube icon is drawn with
  the accent colour (makeAccentSvgIcon) via FederationItemModel::setActiveModelId.
- The spatial hierarchy reflects only the active model.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-07-08 16:38:42 +10:00
parent ec285fc32c
commit 60cab3e7c4
11 changed files with 221 additions and 11 deletions
+5
View File
@@ -54,6 +54,11 @@ express::Base get_container(const express::Base& element);
std::optional<std::string> get_string_attribute(const express::Base& element,
const std::string& name);
// The spatial-structure elements aggregated directly under `element` (its
// IsDecomposedBy → RelatedObjects, filtered to spatial elements). Used to walk
// the IfcProject → IfcSite → IfcBuilding → IfcBuildingStorey → IfcSpace tree.
std::vector<express::Base> get_spatial_children(const express::Base& element);
// The element's direct EXPRESS attributes that have a primitive scalar value
// (string / enum / integer / real / boolean / logical), as (name, formatted
// value) pairs in declaration order. Attributes that are entity references,