Skip to main content

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

1/// 3D plot for a spatial dataset or channel (point cloud, BVH mesh, etc.) loaded by RID.
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    conjure_object::private::DeriveWith
8)]
9#[serde(crate = "conjure_object::serde")]
10#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
11#[conjure_object::private::staged_builder::staged_builder]
12#[builder(crate = conjure_object::private::staged_builder, update, inline)]
13pub struct GeoPlot3dSpatial {
14    #[builder(into)]
15    #[serde(rename = "plotId")]
16    plot_id: String,
17    #[builder(default, into)]
18    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none", default)]
19    enabled: Option<bool>,
20    #[builder(default, into)]
21    #[serde(rename = "label", skip_serializing_if = "Option::is_none", default)]
22    label: Option<String>,
23    #[serde(rename = "spatialRid")]
24    spatial_rid: conjure_object::ResourceIdentifier,
25    #[builder(
26        default,
27        custom(
28            type = impl
29            Into<Option<super::SpatialColoring>>,
30            convert = |v|v.into().map(Box::new)
31        )
32    )]
33    #[serde(rename = "coloring", skip_serializing_if = "Option::is_none", default)]
34    coloring: Option<Box<super::SpatialColoring>>,
35    #[builder(
36        default,
37        custom(
38            type = impl
39            Into<Option<super::GeoPlot3dSpatialProperties>>,
40            convert = |v|v.into().map(Box::new)
41        )
42    )]
43    #[serde(rename = "properties", skip_serializing_if = "Option::is_none", default)]
44    properties: Option<Box<super::GeoPlot3dSpatialProperties>>,
45}
46impl GeoPlot3dSpatial {
47    /// Constructs a new instance of the type.
48    #[inline]
49    pub fn new(
50        plot_id: impl Into<String>,
51        spatial_rid: conjure_object::ResourceIdentifier,
52    ) -> Self {
53        Self::builder().plot_id(plot_id).spatial_rid(spatial_rid).build()
54    }
55    #[inline]
56    pub fn plot_id(&self) -> &str {
57        &*self.plot_id
58    }
59    #[inline]
60    pub fn enabled(&self) -> Option<bool> {
61        self.enabled.as_ref().map(|o| *o)
62    }
63    #[inline]
64    pub fn label(&self) -> Option<&str> {
65        self.label.as_ref().map(|o| &**o)
66    }
67    #[inline]
68    pub fn spatial_rid(&self) -> &conjure_object::ResourceIdentifier {
69        &self.spatial_rid
70    }
71    /// How to color the asset. If omitted, renderers use a +Z direction ramp with colormap
72    /// VIRIDIS and default bounds (`SpatialColoringGeometryAxis` with axis { x: 0, y: 0, z: 1 }).
73    #[deprecated(note = "Use properties instead.")]
74    #[inline]
75    pub fn coloring(&self) -> Option<&super::SpatialColoring> {
76        self.coloring.as_ref().map(|o| &**o)
77    }
78    /// Full versioned appearance and time-binding properties. Takes precedence over the
79    /// deprecated coloring field when present. Absent on plots created before this field
80    /// was added; clients should migrate via resolveGeo3dSpatialAppearance.
81    #[inline]
82    pub fn properties(&self) -> Option<&super::GeoPlot3dSpatialProperties> {
83        self.properties.as_ref().map(|o| &**o)
84    }
85}