ifc_style/curve_style/
style.rs1use ifc_model::{EntityId, Value};
4
5use crate::error::StyleResult;
6use crate::view::Record;
7
8#[derive(Debug, Clone, Copy)]
10pub struct CurveStyle<'m, 's> {
11 record: Record<'m, 's>,
12}
13
14impl<'m, 's> CurveStyle<'m, 's> {
15 pub(crate) fn from_record(record: Record<'m, 's>) -> Self {
16 Self { record }
17 }
18
19 pub fn id(&self) -> EntityId {
21 self.record.id
22 }
23
24 pub fn name(&self) -> StyleResult<Option<&'m str>> {
26 self.record.optional_text("Name")
27 }
28
29 pub fn curve_font(&self) -> StyleResult<Option<&'m Value>> {
33 self.record.optional_raw("CurveFont")
34 }
35
36 pub fn curve_width(&self) -> StyleResult<Option<&'m Value>> {
39 self.record.optional_raw("CurveWidth")
40 }
41
42 pub fn curve_colour(&self) -> StyleResult<Option<EntityId>> {
45 self.record.optional_ref_select(
46 "CurveColour",
47 "IfcColour",
48 &["IfcColourSpecification", "IfcPreDefinedColour"],
49 )
50 }
51
52 pub fn model_or_draughting(&self) -> StyleResult<Option<bool>> {
55 self.record.optional_bool("ModelOrDraughting")
56 }
57}
58
59#[derive(Debug, Clone, Copy)]
62pub struct CurveStyleFont<'m, 's> {
63 record: Record<'m, 's>,
64}
65
66impl<'m, 's> CurveStyleFont<'m, 's> {
67 pub(crate) fn from_record(record: Record<'m, 's>) -> Self {
68 Self { record }
69 }
70
71 pub fn name(&self) -> StyleResult<Option<&'m str>> {
73 self.record.optional_text("Name")
74 }
75
76 pub fn patterns(&self) -> StyleResult<Vec<EntityId>> {
80 self.record
81 .required_refs("PatternList", "IfcCurveStyleFontPattern", 1, None)
82 }
83}
84
85#[derive(Debug, Clone, Copy)]
88pub struct CurveStyleFontPattern<'m, 's> {
89 record: Record<'m, 's>,
90}
91
92impl<'m, 's> CurveStyleFontPattern<'m, 's> {
93 pub(crate) fn from_record(record: Record<'m, 's>) -> Self {
94 Self { record }
95 }
96
97 pub fn visible_segment_length(&self) -> StyleResult<f64> {
99 self.record.required_number("VisibleSegmentLength")
100 }
101
102 pub fn invisible_segment_length(&self) -> StyleResult<f64> {
104 self.record.required_number("InvisibleSegmentLength")
105 }
106}