Skip to main content

AreaStrategy

Trait AreaStrategy 

Source
pub trait AreaStrategy<G: Geometry> {
    type Out: CoordinateScalar;

    // Required method
    fn area(&self, g: &G) -> Self::Out;
}
Expand description

A strategy for computing the area of a geometry.

Mirrors the per-CS area-strategy concept declared in boost/geometry/strategies/area/services.hpp and refined per coordinate system in strategies/area/{cartesian,spherical, geographic}.hpp. The Boost concept exposes a stateful apply(p1, p2, state) accumulator plus a final result(state) reduction; the Rust analogue collapses the two phases into a single method AreaStrategy::area keyed on the geometry type, because the per-segment walk shape is identical for every CS — only the per-segment kernel changes.

§Associated items

  • Self::Out — the scalar the area comes back as. Equivalent to Boost’s area_result<Geometry, Strategies>::type (algorithms/area_result.hpp); typically the coordinate scalar of G’s point type.

Required Associated Types§

Source

type Out: CoordinateScalar

The output scalar type. Typically the geometry’s coordinate scalar. Mirrors area_result<G, Strategies>::type from algorithms/area_result.hpp.

Required Methods§

Source

fn area(&self, g: &G) -> Self::Out

Compute the area of g.

Mirrors the result(strategy.apply(...)) pair from algorithms/area.hpp:111-116 together with the CS-specific strategy::area::cartesian::apply walk at strategy/cartesian/area.hpp:91-112.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<B> AreaStrategy<B> for ShoelaceBoxArea

Source§

type Out = <<B as Geometry>::Point as Point>::Scalar

Source§

impl<MPg> AreaStrategy<MPg> for ShoelaceMultiPolygonArea

Source§

type Out = <<MPg as Geometry>::Point as Point>::Scalar

Source§

impl<P> AreaStrategy<P> for GeographicPolygonArea
where P: Polygon, GeographicArea: AreaStrategy<P::Ring, Out = f64>,

Available on crate feature std only.
Source§

impl<P> AreaStrategy<P> for ShoelacePolygonArea
where P: Polygon, ShoelaceArea: AreaStrategy<P::Ring, Out = <P::Point as Point>::Scalar>,

Source§

type Out = <<P as Geometry>::Point as Point>::Scalar

Source§

impl<P> AreaStrategy<P> for SphericalPolygonArea
where P: Polygon, SphericalArea: AreaStrategy<P::Ring, Out = f64>,

Available on crate feature std only.
Source§

impl<R> AreaStrategy<R> for GeographicArea
where R: Ring, <R::Point as Point>::Cs: CoordinateSystem + HasAngularUnits, <<R::Point as Point>::Cs as CoordinateSystem>::Family: SameAs<GeographicFamily>, R::Point: Point<Scalar = f64>,

Available on crate feature std only.
Source§

impl<R> AreaStrategy<R> for ShoelaceArea

Source§

type Out = <<R as Geometry>::Point as Point>::Scalar

Source§

impl<R> AreaStrategy<R> for SphericalArea
where R: Ring, <R::Point as Point>::Cs: CoordinateSystem + HasAngularUnits, <<R::Point as Point>::Cs as CoordinateSystem>::Family: SameAs<SphericalFamily>, R::Point: Point<Scalar = f64>,

Available on crate feature std only.