Skip to main content

LengthStrategy

Trait LengthStrategy 

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

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

A strategy for computing the length of a sequence of points.

Mirrors the per-CS length-strategy concept declared in boost/geometry/strategies/length/services.hpp and refined per coordinate system in strategies/length/{cartesian,spherical, geographic}.hpp. The Boost concept exposes a distance(p1, p2) helper that hands the algorithm a point-to-point distance kernel; the Rust analogue collapses the two layers (strategy + algorithm walk) into a single method LengthStrategy::length keyed on the geometry type, because the walk shape is identical for every CS — only the inner distance kernel changes.

§Associated items

  • Self::Out — the scalar the length comes back as. Equivalent to Boost’s default_length_result<Geometry>::type (strategies/default_length_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 default_length_result<G>::type from strategies/default_length_result.hpp.

Required Methods§

Source

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

Sum the per-segment distances along g.

Mirrors detail::length::range_length::apply from algorithms/length.hpp:80-107 together with the CS-specific strategies::length::*::distance call at strategies/length/cartesian.hpp:33-39.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<L> LengthStrategy<L> for CartesianLength

Source§

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

Source§

impl<L> LengthStrategy<L> for GeographicLength

Source§

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

Source§

impl<L> LengthStrategy<L> for Rhumb
where L: Linestring, L::Point: Point<Scalar = f64>, <L::Point as Point>::Cs: HasAngularUnits + CoordinateSystem, <<L::Point as Point>::Cs as CoordinateSystem>::Family: RhumbFamily,

Source§

impl<L> LengthStrategy<L> for SphericalLength

Source§

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

Source§

impl<R> LengthStrategy<R> for CartesianPerimeter

Source§

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

Source§

impl<R> LengthStrategy<R> for GeographicPerimeter

Source§

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

Source§

impl<R> LengthStrategy<R> for SphericalPerimeter

Source§

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