Skip to main content

Area

Enum Area 

Source
#[non_exhaustive]
pub enum Area { BoundingBox { south_west: GeoPoint, north_east: GeoPoint, }, PointRadius { center: GeoPoint, radius_nm: f64, }, LocationRadius { ident: String, radius_nm: f64, }, Polygon { vertices: Vec<GeoPoint>, }, }
Expand description

The geographic area a briefing covers.

Not every source supports every shape natively; adapters either convert (a point radius encloses a bounding box and vice versa) or return crate::ProviderError::Unsupported.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

BoundingBox

Axis-aligned bounding box.

Fields

§south_west: GeoPoint

South-west corner.

§north_east: GeoPoint

North-east corner.

§

PointRadius

Circle of radius_nm nautical miles around a coordinate.

Fields

§center: GeoPoint

Circle center.

§radius_nm: f64

Radius in nautical miles.

§

LocationRadius

Circle of radius_nm nautical miles around a published location (ICAO/FAA aerodrome, navaid or fix identifier).

Fields

§ident: String

Location identifier, e.g. "KSFO".

§radius_nm: f64

Radius in nautical miles.

§

Polygon

A polygon over vertices, treated as an implicitly closed ring (the last vertex connects back to the first). Vertex order may be either winding; self-intersecting rings give ray-cast semantics.

Fields

§vertices: Vec<GeoPoint>

Ring vertices, at least three.

Implementations§

Source§

impl Area

Source

pub fn enclosing_bbox(&self) -> Option<(GeoPoint, GeoPoint)>

Smallest axis-aligned bounding box enclosing this area, as (south_west, north_east), when one can be computed without a location database.

Returns None for areas anchored to a published identifier; only the provider can resolve those. The radius conversion uses the small-area approximation (1 NM of latitude = 1/60 degree) and is not meaningful within a radius of the poles.

Source

pub fn contains(&self, point: GeoPoint) -> Option<bool>

Whether the area contains point, when that is decidable without a location database: None for Area::LocationRadius (mirroring the Self::enclosing_bbox contract), Some otherwise. This is the spatial-association hook TFR/NOTAM/weather modules filter geo-referenced products with.

Trait Implementations§

Source§

impl Clone for Area

Source§

fn clone(&self) -> Area

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Area

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Area

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Area

Source§

fn eq(&self, other: &Area) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Area

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Area

Auto Trait Implementations§

§

impl Freeze for Area

§

impl RefUnwindSafe for Area

§

impl Send for Area

§

impl Sync for Area

§

impl Unpin for Area

§

impl UnsafeUnpin for Area

§

impl UnwindSafe for Area

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.