gistools/proj/convert/
geocent.rs

1use crate::proj::{CoordinateStep, IoUnits, Proj, ProjectCoordinates, TransformCoordinates};
2use alloc::rc::Rc;
3use core::cell::RefCell;
4
5/// # Conversion from geographic to geocentric latitude and back.
6///
7/// Stub projection for geocentric.  The transformation isn't
8/// really done here since this code is 2D.  The real transformation
9/// is handled by pj_transform.c.
10#[derive(Debug, Clone, PartialEq)]
11pub struct GeocentricConverter {
12    proj: Rc<RefCell<Proj>>,
13}
14impl ProjectCoordinates for GeocentricConverter {
15    fn code(&self) -> i64 {
16        -1
17    }
18
19    fn name(&self) -> &'static str {
20        "geocentric latitude"
21    }
22
23    fn names() -> &'static [&'static str] {
24        &["geocent", "geocentric latitude"]
25    }
26}
27impl CoordinateStep for GeocentricConverter {
28    fn new(proj: Rc<RefCell<Proj>>) -> Self {
29        {
30            let proj = &mut proj.borrow_mut();
31            proj.left = IoUnits::RADIANS;
32            proj.right = IoUnits::CARTESIAN;
33            proj.x0 = 0.;
34            proj.y0 = 0.;
35            proj.is_geocent = true;
36        }
37        GeocentricConverter { proj }
38    }
39    /// Geographical to geocentric
40    fn forward<P: TransformCoordinates>(&self, _coords: &mut P) {}
41    /// Geocentric to geographical
42    fn inverse<P: TransformCoordinates>(&self, _coords: &mut P) {}
43}