Skip to main content

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

1/// Sensor configuration for 3D scene.
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 Geo3dSensor {
14    #[builder(into)]
15    #[serde(rename = "sensorId")]
16    sensor_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 = "name", skip_serializing_if = "Option::is_none", default)]
22    name: Option<String>,
23    #[builder(
24        default,
25        custom(
26            type = impl
27            Into<Option<super::Geo3dSensorOrientationConfig>>,
28            convert = |v|v.into().map(Box::new)
29        )
30    )]
31    #[serde(rename = "orientation", skip_serializing_if = "Option::is_none", default)]
32    orientation: Option<Box<super::Geo3dSensorOrientationConfig>>,
33    #[builder(default, into)]
34    #[serde(rename = "color", skip_serializing_if = "Option::is_none", default)]
35    color: Option<super::super::super::api::HexColor>,
36    #[builder(
37        default,
38        custom(
39            type = impl
40            Into<Option<super::Geo3dSensorShape>>,
41            convert = |v|v.into().map(Box::new)
42        )
43    )]
44    #[serde(rename = "viewShape", skip_serializing_if = "Option::is_none", default)]
45    view_shape: Option<Box<super::Geo3dSensorShape>>,
46}
47impl Geo3dSensor {
48    /// Constructs a new instance of the type.
49    #[inline]
50    pub fn new(sensor_id: impl Into<String>) -> Self {
51        Self::builder().sensor_id(sensor_id).build()
52    }
53    #[inline]
54    pub fn sensor_id(&self) -> &str {
55        &*self.sensor_id
56    }
57    #[inline]
58    pub fn enabled(&self) -> Option<bool> {
59        self.enabled.as_ref().map(|o| *o)
60    }
61    /// The name of the sensor.
62    #[inline]
63    pub fn name(&self) -> Option<&str> {
64        self.name.as_ref().map(|o| &**o)
65    }
66    /// The orientation of the sensor.
67    #[inline]
68    pub fn orientation(&self) -> Option<&super::Geo3dSensorOrientationConfig> {
69        self.orientation.as_ref().map(|o| &**o)
70    }
71    /// The color of the sensor.
72    #[inline]
73    pub fn color(&self) -> Option<&super::super::super::api::HexColor> {
74        self.color.as_ref().map(|o| &*o)
75    }
76    /// The shape of the sensor's view volume.
77    #[inline]
78    pub fn view_shape(&self) -> Option<&super::Geo3dSensorShape> {
79        self.view_shape.as_ref().map(|o| &**o)
80    }
81}