pub struct SpatialTree { /* private fields */ }Expand description
The containment tree of one model.
Implementations§
Source§impl SpatialTree
impl SpatialTree
Source§impl SpatialTree
impl SpatialTree
Sourcepub fn node(&self, id: EntityId) -> Option<&SpatialNode>
pub fn node(&self, id: EntityId) -> Option<&SpatialNode>
The node describing id, if it is a spatial container.
Sourcepub fn roots(&self) -> &[EntityId]
pub fn roots(&self) -> &[EntityId]
Containers with no parent, most-general kind first.
A conformant file yields exactly one root, the IfcProject. More than
one means the file omits an aggregation relationship somewhere.
Sourcepub fn containers(&self) -> impl Iterator<Item = &SpatialNode>
pub fn containers(&self) -> impl Iterator<Item = &SpatialNode>
Every spatial container in the model, ordered by entity id.
Sourcepub fn of_kind(
&self,
kind: SpatialKind,
) -> impl Iterator<Item = &SpatialNode> + '_
pub fn of_kind( &self, kind: SpatialKind, ) -> impl Iterator<Item = &SpatialNode> + '_
Containers of a given kind, ordered by entity id.
Sourcepub fn elements_of(&self, container: EntityId) -> &[EntityId]
pub fn elements_of(&self, container: EntityId) -> &[EntityId]
Elements placed directly in container.
Direct only: an element in a space inside a storey is not returned for
the storey. Use elements_recursive for the
transitive set.
Sourcepub fn elements_recursive(&self, container: EntityId) -> Vec<EntityId>
pub fn elements_recursive(&self, container: EntityId) -> Vec<EntityId>
Every element in container or any container beneath it.
Breadth-first, so a container’s own elements precede those of its children. Bounded by the tree’s depth, which is finite because each node holds at most one parent.
Sourcepub fn ancestors(&self, id: EntityId) -> Vec<EntityId>
pub fn ancestors(&self, id: EntityId) -> Vec<EntityId>
The chain of containers above id, nearest first.
Empty for a root. Terminates even if the file contains a containment cycle, because the walk stops at the first repeated entity.
Sourcepub fn container_of(&self, element: EntityId) -> Option<EntityId>
pub fn container_of(&self, element: EntityId) -> Option<EntityId>
The container holding element, if any relationship places it.
Answers the question a drawing or take-off actually asks: which storey is this wall on? Backed by a map built during assembly, so this is a lookup rather than a scan over every container.
Sourcepub fn dangling(&self) -> &[(EntityId, EntityId)]
pub fn dangling(&self) -> &[(EntityId, EntityId)]
Relationship/target pairs naming an entity the model does not contain.
Sourcepub fn orphans(&self) -> &[EntityId]
pub fn orphans(&self) -> &[EntityId]
Containers that no relationship places under a parent, excluding the most-general root.
A conformant file has none: every site is aggregated into the project, every building into a site. Entries here mean the file omits an aggregation relationship, which a viewer would show as a detached branch.