pub trait SpatialQuery: Send + Sync {
// Required methods
fn spatial_tree(&self) -> Option<&SpatialNode>;
fn storeys(&self) -> Vec<StoreyInfo>;
fn elements_in_storey(&self, storey_id: EntityId) -> Vec<EntityId>;
fn containing_storey(&self, element_id: EntityId) -> Option<EntityId>;
fn search(&self, query: &str) -> Vec<EntityId>;
fn elements_by_type(&self, ifc_type: &IfcType) -> Vec<EntityId>;
// Provided methods
fn all_elements(&self) -> Vec<EntityId> { ... }
fn element_count(&self) -> usize { ... }
}Expand description
Spatial query interface
Provides access to the spatial structure hierarchy and search capabilities.
§Example
ⓘ
use bimifc_model::{SpatialQuery, EntityId};
fn explore_building(spatial: &dyn SpatialQuery) {
// Get spatial tree
if let Some(tree) = spatial.spatial_tree() {
println!("Project: {}", tree.name);
for child in &tree.children {
println!(" {}: {}", child.node_type.display_name(), child.name);
}
}
// List storeys
for storey in spatial.storeys() {
println!("Storey {} at elevation {}m ({} elements)",
storey.name, storey.elevation, storey.element_count);
}
// Search for walls
let wall_ids = spatial.search("wall");
println!("Found {} walls", wall_ids.len());
}Required Methods§
Sourcefn spatial_tree(&self) -> Option<&SpatialNode>
fn spatial_tree(&self) -> Option<&SpatialNode>
Get the spatial hierarchy tree
Returns the root of the spatial structure tree (typically IfcProject). The tree contains all spatial structure elements and their contained elements.
§Returns
The root spatial node, or None if no spatial structure exists
Sourcefn storeys(&self) -> Vec<StoreyInfo>
fn storeys(&self) -> Vec<StoreyInfo>
Get all building storeys
Returns information about all storeys in the model, sorted by elevation.
§Returns
A vector of storey information
Sourcefn elements_in_storey(&self, storey_id: EntityId) -> Vec<EntityId>
fn elements_in_storey(&self, storey_id: EntityId) -> Vec<EntityId>
Sourcefn containing_storey(&self, element_id: EntityId) -> Option<EntityId>
fn containing_storey(&self, element_id: EntityId) -> Option<EntityId>
Provided Methods§
Sourcefn all_elements(&self) -> Vec<EntityId>
fn all_elements(&self) -> Vec<EntityId>
Sourcefn element_count(&self) -> usize
fn element_count(&self) -> usize
Get element count