dis_rs/common/designator/
builder.rs

1use crate::common::designator::model::Designator;
2use crate::common::model::{EntityId, Location, VectorF32};
3use crate::enumerations::{DeadReckoningAlgorithm, DesignatorCode, DesignatorSystemName};
4
5pub struct DesignatorBuilder(Designator);
6
7impl Default for DesignatorBuilder {
8    fn default() -> Self {
9        Self::new()
10    }
11}
12
13impl DesignatorBuilder {
14    #[must_use]
15    pub fn new() -> Self {
16        DesignatorBuilder(Designator::default())
17    }
18
19    #[must_use]
20    pub fn new_from_body(body: Designator) -> Self {
21        DesignatorBuilder(body)
22    }
23
24    #[must_use]
25    pub fn build(self) -> Designator {
26        self.0
27    }
28
29    #[must_use]
30    pub fn with_designating_entity_id(mut self, designating_entity_id: EntityId) -> Self {
31        self.0.designating_entity_id = designating_entity_id;
32        self
33    }
34
35    #[must_use]
36    pub fn with_system_name(mut self, system_name: DesignatorSystemName) -> Self {
37        self.0.system_name = system_name;
38        self
39    }
40
41    #[must_use]
42    pub fn with_designated_entity_id(mut self, designated_entity_id: EntityId) -> Self {
43        self.0.designated_entity_id = designated_entity_id;
44        self
45    }
46
47    #[must_use]
48    pub fn with_code(mut self, code: DesignatorCode) -> Self {
49        self.0.code = code;
50        self
51    }
52
53    #[must_use]
54    pub fn with_power(mut self, power: f32) -> Self {
55        self.0.power = power;
56        self
57    }
58
59    #[must_use]
60    pub fn with_wavelength(mut self, wavelength: f32) -> Self {
61        self.0.wavelength = wavelength;
62        self
63    }
64
65    #[must_use]
66    pub fn with_spot_wrt_designated_entity(
67        mut self,
68        spot_wrt_designated_entity: VectorF32,
69    ) -> Self {
70        self.0.spot_wrt_designated_entity = spot_wrt_designated_entity;
71        self
72    }
73
74    #[must_use]
75    pub fn with_spot_location(mut self, spot_location: Location) -> Self {
76        self.0.spot_location = spot_location;
77        self
78    }
79
80    #[must_use]
81    pub fn with_dead_reckoning_algorithm(
82        mut self,
83        dead_reckoning_algorithm: DeadReckoningAlgorithm,
84    ) -> Self {
85        self.0.dead_reckoning_algorithm = dead_reckoning_algorithm;
86        self
87    }
88
89    #[must_use]
90    pub fn with_linear_acceleration(mut self, linear_acceleration: VectorF32) -> Self {
91        self.0.linear_acceleration = linear_acceleration;
92        self
93    }
94}