miniproj 0.10.4

This crate implements general and specific geodetic operations like geographic projections.
Documentation
//This file is licensed under EUPL v1.2

use miniproj_ops::albers_equal_area::AlbersEqualAreaProjection;
use miniproj_ops::identity_projection::IdentityProjection;
use miniproj_ops::lambert_azimuthal_equal_area::LambertAzimuthalEqualAreaProjection;
use miniproj_ops::lambert_conic_conformal::{
    LambertConic1SPAProjection, LambertConic2SPProjection,
};
use miniproj_ops::popvis_pseudo_mercator::PopVisPseudoMercatorProjection;
use miniproj_ops::stereographic::{ObliqueStereographicProjection, PolarStereographicAProjection};
use miniproj_ops::transverse_mercator::TransverseMercatorProjection;
use miniproj_ops::Projection;

include!(concat!(env!("OUT_DIR"), "/projection_constructors.rs"));

/// Returns the Coordinate Reference System corresponding to the EPSG code passed as the argument.
/// If the code refers to a projection that is not implemented, the method returns `None`
pub fn get_projection(code: u32) -> Option<&'static dyn Projection> {
    PROJECTIONS.get(&code).cloned()
}

/// Returns the EPSG code of the ellipsoid that is associated with the projection
/// corresponding to `projection_code`. Returns `None` if the projection is
/// unknown.
pub fn get_ellipsoid_code(projection_code: u32) -> Option<u32> {
    ELLIPSOIDS.get(&projection_code).copied()
}

/// Returns the Name of the Coordinate Reference System. This is a temporary method that will be removed.
#[deprecated]
pub fn get_reference_system_name(code: u32) -> Option<&'static str> {
    NAMES.get(&code).copied()
}

/// Returns one or multiple geographic areas that the reference system applies to.
/// Values are in `[east, north, west, south]`` order. This is a temporary method that will be removed.
#[deprecated]
pub fn get_reference_system_areas(code: u32) -> Option<&'static [[f64; 4]]> {
    AREAS.get(&code).filter(|a| !a.is_empty()).copied()
}

#[deprecated]
pub fn all_names() -> impl Iterator<Item = (u32, &'static str)> {
    NAMES.entries().map(|(c, n)| (*c, *n))
}

/// Create the Projection corresponding to the EPSG code passed as the argument, using the passed ellipsoid.
/// The `&Ellipsoid` is not held by the returned projection, if you want the projection for a different
/// ellipsoid you need to construct it again.
//pub fn create_projection(code: u32, ellipsoid: &Ellipsoid) -> Option<Box<dyn Projection>> {
//    todo!()
//}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn dyn_projection_is_send_sync() {
        fn is_send_sync<T: Send + Sync>(_: T) {}

        is_send_sync(get_projection(4326));
    }
}