Skip to main content

ifc_style/surface_style/
lighting.rs

1//! `IfcSurfaceStyleLighting` projection.
2
3use ifc_model::EntityId;
4
5use crate::error::StyleResult;
6use crate::view::Record;
7
8/// Borrowed projection of `IfcSurfaceStyleLighting`: the four colour
9/// coefficients driving IFC's simplified BRDF-like lighting model.
10#[derive(Debug, Clone, Copy)]
11pub struct SurfaceStyleLighting<'m, 's> {
12    record: Record<'m, 's>,
13}
14
15impl<'m, 's> SurfaceStyleLighting<'m, 's> {
16    pub(crate) fn from_record(record: Record<'m, 's>) -> Self {
17        Self { record }
18    }
19
20    /// The `DiffuseTransmissionColour` attribute. Mandatory.
21    pub fn diffuse_transmission_colour(&self) -> StyleResult<EntityId> {
22        self.record
23            .required_ref("DiffuseTransmissionColour", "IfcColourRgb")
24    }
25
26    /// The `DiffuseReflectionColour` attribute. Mandatory.
27    pub fn diffuse_reflection_colour(&self) -> StyleResult<EntityId> {
28        self.record
29            .required_ref("DiffuseReflectionColour", "IfcColourRgb")
30    }
31
32    /// The `TransmissionColour` attribute. Mandatory.
33    pub fn transmission_colour(&self) -> StyleResult<EntityId> {
34        self.record
35            .required_ref("TransmissionColour", "IfcColourRgb")
36    }
37
38    /// The `ReflectanceColour` attribute. Mandatory.
39    pub fn reflectance_colour(&self) -> StyleResult<EntityId> {
40        self.record
41            .required_ref("ReflectanceColour", "IfcColourRgb")
42    }
43}