From 78766263b146552a7135720d6da8b497ac2923a5 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Thu, 27 Apr 2023 00:26:04 -0400 Subject: [PATCH] Revert ddmmss to skyvector --- spatial-coordinate-systems/src/all.rs | 6 +++--- spatial-coordinate-systems/src/lib.rs | 20 +++++++++---------- .../src/{ddmmss.rs => sky_vector.rs} | 2 +- xpin-wasm/src/lib.rs | 6 +++--- 4 files changed, 17 insertions(+), 17 deletions(-) rename spatial-coordinate-systems/src/{ddmmss.rs => sky_vector.rs} (99%) diff --git a/spatial-coordinate-systems/src/all.rs b/spatial-coordinate-systems/src/all.rs index a0eddc6..0a52432 100644 --- a/spatial-coordinate-systems/src/all.rs +++ b/spatial-coordinate-systems/src/all.rs @@ -4,10 +4,10 @@ use std::str::FromStr; use crate::{ dd, - ddmmss, dmm, dms, plus, //xpin + sky_vector, utm, Coordinate, Error, @@ -26,7 +26,7 @@ pub struct Coordinates { pub utm: utm::Coordinate, // pub xpin: xpin::Xpin, pub plus: plus::Coordinate, - pub ddmmss: ddmmss::Coordinate, + pub sky_vector: sky_vector::Coordinate, } impl TryFrom for Coordinates { @@ -40,7 +40,7 @@ impl TryFrom for Coordinates { dmm: dmm::Coordinate::from(latlon), utm: utm::Coordinate::try_from(latlon)?, plus: plus::Coordinate::try_from(latlon)?, - ddmmss: ddmmss::Coordinate::from(latlon), + sky_vector: sky_vector::Coordinate::from(latlon), }) } } diff --git a/spatial-coordinate-systems/src/lib.rs b/spatial-coordinate-systems/src/lib.rs index 26e40ca..9887a89 100644 --- a/spatial-coordinate-systems/src/lib.rs +++ b/spatial-coordinate-systems/src/lib.rs @@ -2,11 +2,11 @@ use std::{fmt, str::FromStr}; pub mod all; mod common; pub mod dd; -pub mod ddmmss; pub mod dmm; pub mod dms; pub mod latlon; pub mod plus; +pub mod sky_vector; pub mod urls; pub mod utm; pub use error::Error; @@ -88,7 +88,7 @@ pub enum Coordinate { UTM(utm::Coordinate), // Xpin(xpin::Xpin), Plus(plus::Coordinate), - DDMMSS(ddmmss::Coordinate), + SkyVector(sky_vector::Coordinate), } impl Coordinate { @@ -108,7 +108,7 @@ impl Coordinate { map(dd::Coordinate::parse, Coordinate::DD), // map(xpin::Coordinate::parse, Cordinate::Xpin), map(plus::Coordinate::parse, Coordinate::Plus), - map(ddmmss::Coordinate::parse, Coordinate::DDMMSS), + map(sky_vector::Coordinate::parse, Coordinate::SkyVector), // Try to parse as a URL last map(urls::CoordinateUrls::parse, |coordinate_urls| { Coordinate::DD(dd::Coordinate::from(coordinate_urls.latlon)) @@ -130,7 +130,7 @@ impl Coordinate { CoordinateType::DMM => Self::DMM(dmm::Coordinate::from(lat_lon)), CoordinateType::UTM => Self::UTM(utm::Coordinate::try_from(lat_lon)?), CoordinateType::Plus => Self::Plus(plus::Coordinate::try_from(lat_lon)?), - CoordinateType::DDMMSS => Self::DDMMSS(ddmmss::Coordinate::from(lat_lon)), + CoordinateType::SkyVector => Self::SkyVector(sky_vector::Coordinate::from(lat_lon)), }) } @@ -142,7 +142,7 @@ impl Coordinate { Self::UTM(_) => CoordinateType::UTM, // Self::Xpin(_) => CoordinateType::Xpin, Self::Plus(_) => CoordinateType::Plus, - Self::DDMMSS(_) => CoordinateType::DDMMSS, + Self::SkyVector(_) => CoordinateType::SkyVector, } } } @@ -162,7 +162,7 @@ impl From<&Coordinate> for LatLon { Coordinate::UTM(utm) => utm.into(), // Coordinate::Xpin(xpin) => xpin.into(), Coordinate::Plus(plus) => plus.into(), - Coordinate::DDMMSS(ddmmss) => ddmmss.into(), + Coordinate::SkyVector(sky_vector) => sky_vector.into(), } } } @@ -206,9 +206,9 @@ impl From for Coordinate { Self::Plus(c) } } -impl From for Coordinate { - fn from(c: ddmmss::Coordinate) -> Self { - Self::DDMMSS(c) +impl From for Coordinate { + fn from(c: sky_vector::Coordinate) -> Self { + Self::SkyVector(c) } } @@ -245,7 +245,7 @@ impl fmt::Display for Coordinate { Coordinate::DMS(dms) => write!(f, "{}", dms), Coordinate::UTM(utm) => write!(f, "{}", utm), Coordinate::Plus(plus) => write!(f, "{}", plus), - Coordinate::DDMMSS(ddmmss) => write!(f, "{}", ddmmss), + Coordinate::SkyVector(sky_vector) => write!(f, "{}", sky_vector), } } } diff --git a/spatial-coordinate-systems/src/ddmmss.rs b/spatial-coordinate-systems/src/sky_vector.rs similarity index 99% rename from spatial-coordinate-systems/src/ddmmss.rs rename to spatial-coordinate-systems/src/sky_vector.rs index 52ca6d7..547defd 100644 --- a/spatial-coordinate-systems/src/ddmmss.rs +++ b/spatial-coordinate-systems/src/sky_vector.rs @@ -78,7 +78,7 @@ impl Coordinate { ) } - pub fn get_ddmmss(&self) -> &str { + pub fn get_sky_vector(&self) -> &str { &self.0 } } diff --git a/xpin-wasm/src/lib.rs b/xpin-wasm/src/lib.rs index 9a9216d..c23c68e 100644 --- a/xpin-wasm/src/lib.rs +++ b/xpin-wasm/src/lib.rs @@ -74,8 +74,8 @@ pub struct Coordinates { // pub xpin: String, #[wasm_bindgen(js_name = "Plus")] pub plus: String, - #[wasm_bindgen(js_name = "DDMMSS")] - pub ddmmss: String, + #[wasm_bindgen(js_name = "SkyVector")] + pub sky_vector: String, } impl From<&spatial_coordinate_systems::all::Coordinates> for Coordinates { @@ -86,7 +86,7 @@ impl From<&spatial_coordinate_systems::all::Coordinates> for Coordinates { dmm: value.dmm.to_string(), utm: value.utm.to_string(), plus: value.plus.to_string(), - ddmmss: value.ddmmss.to_string(), + sky_vector: value.sky_vector.to_string(), } } }