Skip to main content

DefaultArea

Trait DefaultArea 

Source
pub trait DefaultArea<Family> {
    type Strategy: Default;
}
Expand description

“Which (polygon) area strategy do we pick by default for this CS family?”

Mirrors v1’s DefaultDistance and DefaultLength — the Rust analogue of Boost’s services::default_strategy<Geometry, cs_tag> in strategies/area/services.hpp, specialised per CS in strategies/area/{cartesian,spherical,geographic}.hpp.

Keyed on the polygon area strategy, since the area(&polygon) free function is the entry point that dispatches through it:

impl DefaultArea<CartesianFamily>  for CartesianFamily  { type Strategy = ShoelacePolygonArea;   }
impl DefaultArea<SphericalFamily>  for SphericalFamily  { type Strategy = SphericalPolygonArea;  }
impl DefaultArea<GeographicFamily> for GeographicFamily { type Strategy = GeographicPolygonArea; }

Required Associated Types§

Source

type Strategy: Default

The area strategy chosen for this family. Must implement Default because the free-function area(g) builds it without arguments.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl DefaultArea<CartesianFamily> for CartesianFamily

Cartesian family defaults to ShoelacePolygonArea.

Source§

impl DefaultArea<GeographicFamily> for GeographicFamily

Geographic family defaults to GeographicPolygonArea — the authalic-sphere approximation (see its docs for the precision caveat).

Source§

impl DefaultArea<SphericalFamily> for SphericalFamily

Spherical family defaults to SphericalPolygonArea.

Implementors§