Skip to main content

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

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    conjure_object::private::DeriveWith
7)]
8#[serde(crate = "conjure_object::serde")]
9#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[conjure_object::private::staged_builder::staged_builder]
11#[builder(crate = conjure_object::private::staged_builder, update, inline)]
12pub struct Geo3dDefinitionV1 {
13    #[builder(default, list(item(type = super::GeoPlot3d)))]
14    #[serde(rename = "plots", skip_serializing_if = "Vec::is_empty", default)]
15    plots: Vec<super::GeoPlot3d>,
16    #[builder(default, into)]
17    #[serde(rename = "title", skip_serializing_if = "Option::is_none", default)]
18    title: Option<String>,
19    #[builder(default, into)]
20    #[serde(rename = "spatialPlots", skip_serializing_if = "Option::is_none", default)]
21    spatial_plots: Option<Vec<super::GeoPlot3dSpatial>>,
22    #[builder(
23        default,
24        custom(
25            type = impl
26            Into<Option<super::Geo3dCrs>>,
27            convert = |v|v.into().map(Box::new)
28        )
29    )]
30    #[serde(rename = "crs", skip_serializing_if = "Option::is_none", default)]
31    crs: Option<Box<super::Geo3dCrs>>,
32}
33impl Geo3dDefinitionV1 {
34    /// Constructs a new instance of the type.
35    #[inline]
36    pub fn new() -> Self {
37        Self::builder().build()
38    }
39    #[inline]
40    pub fn plots(&self) -> &[super::GeoPlot3d] {
41        &*self.plots
42    }
43    #[inline]
44    pub fn title(&self) -> Option<&str> {
45        self.title.as_ref().map(|o| &**o)
46    }
47    /// Spatial dataset or channel plots in the 3D viewport.
48    #[inline]
49    pub fn spatial_plots(&self) -> Option<&[super::GeoPlot3dSpatial]> {
50        self.spatial_plots.as_ref().map(|o| &**o)
51    }
52    /// Coordinate reference system for spatial assets in this panel.
53    /// Absent means ECEF (the original default).
54    #[inline]
55    pub fn crs(&self) -> Option<&super::Geo3dCrs> {
56        self.crs.as_ref().map(|o| &**o)
57    }
58}