Trait mappers::Projection

source ·
pub trait Projection: Debug + DynClone + Send + Sync {
    fn project_unchecked(&self, lon: f64, lat: f64) -> (f64, f64);
    fn inverse_project_unchecked(&self, x: f64, y: f64) -> (f64, f64);

    fn project(&self, lon: f64, lat: f64) -> Result<(f64, f64), ProjectionError> { ... }
    fn inverse_project(
        &self,
        x: f64,
        y: f64
    ) -> Result<(f64, f64), ProjectionError> { ... } }
Expand description

An interface for all projections included in the crate.

This trait is kept as simple as possible and the most basic version of projection functions are implemented. Alternative functions for more complex types should be implemented by the user.

Required Methods§

Same as Projection::project() but does not check the result.

Same as Projection::inverse_project() but does not check the result.

Provided Methods§

Function to project geographical coordinates (in degrees) to cartographical coordinates (in meters) on a map with specified projection.

Errors

Returns ProjectionError::ProjectionImpossible when result of projection is not finite.

Function to inversly project cartographical coordinates (in meters) to geographical coordinates (in degrees) on a map with specified projection.

Errors

Returns ProjectionError::InverseProjectionImpossible when result of inverse projection is not finite.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Implementors§