gistools/proj/convert/
geocent.rs1use crate::proj::{CoordinateStep, IoUnits, Proj, ProjectCoordinates, TransformCoordinates};
2use alloc::rc::Rc;
3use core::cell::RefCell;
4
5#[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 fn forward<P: TransformCoordinates>(&self, _coords: &mut P) {}
41 fn inverse<P: TransformCoordinates>(&self, _coords: &mut P) {}
43}