use arma_rs::{FromArma, FromArmaError}; pub struct CircleCoTPayload { pub uuid: String, pub center_lat: f64, pub center_lon: f64, pub center_hae: f32, pub major: f64, pub minor: f64, pub angle: f32, pub callsign: String, pub creator_uid: String, pub creator_callsign: String, } impl FromArma for CircleCoTPayload { fn from_arma(data: String) -> Result { let ( uuid, center_lat, center_lon, center_hae, major, minor, angle, callsign, creator_uid, creator_callsign, ) = <(String, f64, f64, f32, f64, f64, f32, String, String, String)>::from_arma(data)?; Ok(Self { uuid, center_lat, center_lon, center_hae, major, minor, angle, callsign, creator_uid, creator_callsign, }) } } pub struct ShapeCircleCoT { pub uid: String, pub lat: f64, pub lon: f64, pub hae: f32, pub major: f64, pub minor: f64, pub angle: f32, pub callsign: String, pub creator_uid: String, pub creator_callsign: String, } impl CircleCoTPayload { pub fn to_cot(&self) -> ShapeCircleCoT { ShapeCircleCoT { uid: self.uuid.clone(), lat: self.center_lat, lon: self.center_lon, hae: self.center_hae, major: self.major, minor: self.minor, angle: self.angle, callsign: self.callsign.clone(), creator_uid: self.creator_uid.clone(), creator_callsign: self.creator_callsign.clone(), } } } impl ShapeCircleCoT { pub fn to_xml(&self, now: &str, stale: &str) -> String { format!( r#" <__shapeExtras cpvis="true" editable="true" /> "#, uid = self.uid, t = now, stale = stale, lat = self.lat, lon = self.lon, hae = self.hae, major = self.major, minor = self.minor, angle = self.angle, callsign = self.callsign, creator_uid = self.creator_uid, creator_callsign = self.creator_callsign ) } }