Skip to main content

nominal_api/conjure/objects/scout/chartdefinition/api/
spatial_time_binding.rs

1/// Drives point-cloud visibility from the workbook playhead. When enabled,
2/// only points with a time attribute value ≤ the mapped playhead position
3/// are shown, revealing the cloud progressively as the playhead advances.
4#[derive(
5    Debug,
6    Clone,
7    conjure_object::serde::Serialize,
8    conjure_object::serde::Deserialize,
9    conjure_object::private::DeriveWith
10)]
11#[serde(crate = "conjure_object::serde")]
12#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
13#[conjure_object::private::staged_builder::staged_builder]
14#[builder(crate = conjure_object::private::staged_builder, update, inline)]
15pub struct SpatialTimeBinding {
16    #[serde(rename = "enabled")]
17    enabled: bool,
18    #[builder(into)]
19    #[serde(rename = "attribute")]
20    attribute: String,
21    #[serde(rename = "unit")]
22    unit: super::SpatialTimeUnit,
23    #[builder(default, into)]
24    #[serde(
25        rename = "relativeStartUs",
26        skip_serializing_if = "Option::is_none",
27        default
28    )]
29    relative_start_us: Option<conjure_object::SafeLong>,
30    #[builder(default, into)]
31    #[serde(rename = "relativeEndUs", skip_serializing_if = "Option::is_none", default)]
32    relative_end_us: Option<conjure_object::SafeLong>,
33    #[builder(
34        default,
35        custom(
36            type = impl
37            Into<Option<super::SpatialTimeWindow>>,
38            convert = |v|v.into().map(Box::new)
39        )
40    )]
41    #[serde(rename = "timeWindow", skip_serializing_if = "Option::is_none", default)]
42    time_window: Option<Box<super::SpatialTimeWindow>>,
43}
44impl SpatialTimeBinding {
45    /// Constructs a new instance of the type.
46    #[inline]
47    pub fn new(
48        enabled: bool,
49        attribute: impl Into<String>,
50        unit: super::SpatialTimeUnit,
51    ) -> Self {
52        Self::builder().enabled(enabled).attribute(attribute).unit(unit).build()
53    }
54    #[inline]
55    pub fn enabled(&self) -> bool {
56        self.enabled
57    }
58    /// Name of the per-point attribute that encodes time (e.g. "timestamp").
59    #[inline]
60    pub fn attribute(&self) -> &str {
61        &*self.attribute
62    }
63    #[inline]
64    pub fn unit(&self) -> &super::SpatialTimeUnit {
65        &self.unit
66    }
67    /// User-supplied start of the point cloud's time range in µs. Used as a
68    /// fallback when the ingest pipeline has not yet populated the spatial
69    /// asset's relative_start_us property.
70    #[inline]
71    pub fn relative_start_us(&self) -> Option<conjure_object::SafeLong> {
72        self.relative_start_us.as_ref().map(|o| *o)
73    }
74    /// User-supplied end of the point cloud's time range in µs. Used as a
75    /// fallback when the ingest pipeline has not yet populated the spatial
76    /// asset's relative_end_us property.
77    #[inline]
78    pub fn relative_end_us(&self) -> Option<conjure_object::SafeLong> {
79        self.relative_end_us.as_ref().map(|o| *o)
80    }
81    /// Controls which returns are visible relative to the playhead. Defaults to accumulated.
82    #[inline]
83    pub fn time_window(&self) -> Option<&super::SpatialTimeWindow> {
84        self.time_window.as_ref().map(|o| &**o)
85    }
86}