pub struct LayerSet { /* private fields */ }Expand description
The layers of one model and, optionally, the files they import.
Implementations§
Source§impl LayerSet
impl LayerSet
Sourcepub fn push_layer(&mut self, bytes: Vec<u8>)
pub fn push_layer(&mut self, bytes: Vec<u8>)
Adds a layer’s UTF-8 JSON bytes on top of the layers already added.
Sourcepub fn resolve_imports(&mut self)
pub fn resolve_imports(&mut self)
Resolves imports, even if no import file is added: every import of every layer must then be one of the added files.
Sourcepub fn add_import(&mut self, uri: String, bytes: Vec<u8>)
pub fn add_import(&mut self, uri: String, bytes: Vec<u8>)
Serves bytes for imports whose uri is exactly uri, and turns on
import resolution.
Sourcepub fn federate(&self) -> Result<IfcxFile, BindingError>
pub fn federate(&self) -> Result<IfcxFile, BindingError>
All layers merged into one file. Without imports, the layers’ schemas and data are concatenated in order. With imports, the layers are the imports of a synthetic main layer, each after the layers it imports, so a layer overrides its imports and the next layer overrides both. The header is that of the last layer in this order, the strongest.
Sourcepub fn compose(&self) -> Result<Composition, BindingError>
pub fn compose(&self) -> Result<Composition, BindingError>
Flattens and composes the federated layers.
Sourcepub fn compose_json(&self) -> Result<String, BindingError>
pub fn compose_json(&self) -> Result<String, BindingError>
The composed tree as JSON text: the artificial root over every root
node, each node {"path", "attributes", "children"}.
Sourcepub fn to_glb(&self, settings: &GlbSettings) -> Result<Vec<u8>, BindingError>
pub fn to_glb(&self, settings: &GlbSettings) -> Result<Vec<u8>, BindingError>
The composed layers as a binary glTF 2.0 (.glb) file: their flat
render scene with transformed, instanced meshes, lines and points and
their materials, one glTF node per instance named by its IFCX path.
Geometry values that do not decode are left out of the scene, as
RenderScene does; the file is still written.
Sourcepub fn validate_json(&self) -> Result<String, BindingError>
pub fn validate_json(&self) -> Result<String, BindingError>
Checks the attributes of the federated layers against their merged
schemas, those of resolved imports included (as
openbim_ifcx::layers::LayerStack::validate does), and returns the
report as JSON text:
{"valid": bool, "failures": [{"node", "attribute", "pointer", "kind", "message"}]}. kind is a stable code such as missing-schema or
type-mismatch.