Skip to content

Commit

Permalink
Add more bounds to Projection for more flexible API
Browse files Browse the repository at this point in the history
  • Loading branch information
Quba1 committed Apr 7, 2024
1 parent ea424db commit 98c2c7a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mappers"
version = "0.7.0"
version = "0.7.1"
edition = "2021"
description = "Pure Rust geographical projections library"
repository = "https://github.com/ScaleWeather/mappers"
Expand Down
15 changes: 7 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@
//! conversion between two projections. It can be constructed directly from
//! [`Projection`] with [`pipe_to`](Projection::pipe_to) method or directly
//! with [`ConversionPipe::new()`].
//!
//!
//! Before using it please read the documentation of [`ConversionPipe`].
//!
//!
//! ### Example
//!
//!
//!```
//!# use mappers::{Ellipsoid, Projection, ProjectionError, ConversionPipe};
//!# use mappers::projections::{LambertConformalConic, LongitudeLatitude};
Expand All @@ -88,9 +88,9 @@
//! // to show how a normal projection can be done with ConversionPipe
//! let target_proj = LambertConformalConic::new(2.0, 0.0, 30.0, 60.0, Ellipsoid::WGS84)?;
//! let source_proj = LongitudeLatitude;
//!
//!
//! let (lon, lat) = (6.8651, 45.8326);
//!
//!
//! // Now we can convert to LCC and back to LongitudeLatitude
//! let (x, y) = source_proj.pipe_to(&target_proj).convert(lon, lat)?;
//! let (pipe_lon, pipe_lat) = target_proj.pipe_to(&source_proj).convert(x, y)?;
Expand All @@ -104,7 +104,6 @@
//!# }
//!```

use std::fmt::Debug;

pub use ellipsoids::Ellipsoid;
Expand All @@ -119,7 +118,7 @@ pub mod projections;
/// 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.
pub trait Projection: Debug + Send + Sync + Copy {
pub trait Projection: Debug + Send + Sync + Copy + Clone + PartialEq + PartialOrd {
/// Function to project geographical coordinates (in degrees) to cartographical
/// coordinates (in meters) on a map with specified projection.
///
Expand Down Expand Up @@ -170,7 +169,7 @@ pub trait Projection: Debug + Send + Sync + Copy {
}

/// A struct that allows for easy conversion between two projections.
///
///
/// It can be constructed directly with the constructor or
/// from [`Projection`] with [`pipe_to`](Projection::pipe_to) method.
///
Expand Down

0 comments on commit 98c2c7a

Please sign in to comment.