use crate::bindings;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum FacilityType {
Airport,
Waypoint,
NDB,
VOR,
}
impl From<FacilityType> for i32 {
fn from(facility_type: FacilityType) -> Self {
match facility_type {
FacilityType::Airport => {
bindings::SIMCONNECT_FACILITY_LIST_TYPE_SIMCONNECT_FACILITY_LIST_TYPE_AIRPORT
}
FacilityType::Waypoint => {
bindings::SIMCONNECT_FACILITY_LIST_TYPE_SIMCONNECT_FACILITY_LIST_TYPE_WAYPOINT
}
FacilityType::NDB => {
bindings::SIMCONNECT_FACILITY_LIST_TYPE_SIMCONNECT_FACILITY_LIST_TYPE_NDB
}
FacilityType::VOR => {
bindings::SIMCONNECT_FACILITY_LIST_TYPE_SIMCONNECT_FACILITY_LIST_TYPE_VOR
}
}
}
}
impl FacilityType {
pub fn to_type_name(&self) -> String {
match self {
FacilityType::Airport => std::any::type_name::<Airport>(),
FacilityType::Waypoint => std::any::type_name::<Waypoint>(),
FacilityType::NDB => std::any::type_name::<NDB>(),
FacilityType::VOR => std::any::type_name::<VOR>(),
}
.into()
}
}
#[derive(Debug, Clone)]
pub struct Airport {
pub icao: String,
pub lat: f64,
pub lon: f64,
pub alt: f64,
}
#[derive(Debug, Clone)]
pub struct Waypoint {
pub icao: String,
pub lat: f64,
pub lon: f64,
pub alt: f64,
pub mag_var: f32,
}
#[derive(Debug, Clone)]
pub struct NDB {
pub icao: String,
pub lat: f64,
pub lon: f64,
pub alt: f64,
pub mag_var: f32,
pub frequency: u32,
}
#[derive(Debug, Clone)]
pub struct VOR {
pub icao: String,
pub lat: f64,
pub lon: f64,
pub alt: f64,
pub mag_var: f32,
pub has_nav_signal: bool,
pub has_localizer: bool,
pub has_glide_slope: bool,
pub has_dme: bool,
pub localizer: Option<f32>,
pub glide_lat: Option<f64>,
pub glide_lon: Option<f64>,
pub glide_alt: Option<f64>,
pub glide_slope_angle: Option<f32>,
pub frequency: Option<u32>,
}