use crate::mission::geometry::{LocalFrame, TerrainMask};
#[derive(Debug, Clone, PartialEq)]
pub struct Location {
pub id: String,
pub frame: LocalFrame,
pub mask: Option<TerrainMask>,
}
impl Location {
pub fn new(id: impl Into<String>, frame: LocalFrame) -> Self {
Self {
id: id.into(),
frame,
mask: None,
}
}
pub fn with_mask(mut self, mask: TerrainMask) -> Self {
self.mask = Some(mask);
self
}
}
#[cfg(test)]
mod tests {
use super::*;
use qtty::Quantity;
#[test]
fn location_with_mask_round_trip() {
let frame = LocalFrame::new(Quantity::new(0.5), Quantity::new(0.3));
let mask = TerrainMask::new(vec![(Quantity::new(0.0), Quantity::new(0.1))]);
let loc = Location::new("VLBI-A", frame).with_mask(mask);
assert_eq!(loc.id, "VLBI-A");
assert!(loc.mask.is_some());
}
}