pub trait Projection:
Debug
+ Send
+ Sync
+ Copy
+ Clone
+ PartialEq
+ PartialOrd {
// Required methods
fn project_unchecked(&self, lon: f64, lat: f64) -> (f64, f64);
fn inverse_project_unchecked(&self, x: f64, y: f64) -> (f64, f64);
// Provided methods
fn project(&self, lon: f64, lat: f64) -> Result<(f64, f64), ProjectionError> { ... }
fn inverse_project(
&self,
x: f64,
y: f64,
) -> Result<(f64, f64), ProjectionError> { ... }
fn pipe_to<TARGET: Projection>(
&self,
target: &TARGET,
) -> ConversionPipe<Self, TARGET> { ... }
}Expand description
An interface for all projections included in the crate.
This trait is kept relatively simple and the most basic version of projection functions are implemented. Alternative functions for more complex types should be implemented by the user.
Available projections are available in projections module documentation.
Required Methods§
Sourcefn project_unchecked(&self, lon: f64, lat: f64) -> (f64, f64)
fn project_unchecked(&self, lon: f64, lat: f64) -> (f64, f64)
Same as Projection::project() but does not check the result.
Sourcefn inverse_project_unchecked(&self, x: f64, y: f64) -> (f64, f64)
fn inverse_project_unchecked(&self, x: f64, y: f64) -> (f64, f64)
Same as Projection::inverse_project() but does not check the result.
Provided Methods§
Sourcefn project(&self, lon: f64, lat: f64) -> Result<(f64, f64), ProjectionError>
fn project(&self, lon: f64, lat: f64) -> Result<(f64, f64), ProjectionError>
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.
Sourcefn inverse_project(&self, x: f64, y: f64) -> Result<(f64, f64), ProjectionError>
fn inverse_project(&self, x: f64, y: f64) -> Result<(f64, f64), ProjectionError>
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.
Sourcefn pipe_to<TARGET: Projection>(
&self,
target: &TARGET,
) -> ConversionPipe<Self, TARGET>
fn pipe_to<TARGET: Projection>( &self, target: &TARGET, ) -> ConversionPipe<Self, TARGET>
Creates ConversionPipe from this projection to provided target projection.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.