Revert ddmmss to skyvector

This commit is contained in:
Austen Adler 2023-04-27 00:26:04 -04:00
parent 3eb4c59b6a
commit 78766263b1
4 changed files with 17 additions and 17 deletions

View File

@ -4,10 +4,10 @@ use std::str::FromStr;
use crate::{ use crate::{
dd, dd,
ddmmss,
dmm, dmm,
dms, dms,
plus, //xpin plus, //xpin
sky_vector,
utm, utm,
Coordinate, Coordinate,
Error, Error,
@ -26,7 +26,7 @@ pub struct Coordinates {
pub utm: utm::Coordinate, pub utm: utm::Coordinate,
// pub xpin: xpin::Xpin, // pub xpin: xpin::Xpin,
pub plus: plus::Coordinate, pub plus: plus::Coordinate,
pub ddmmss: ddmmss::Coordinate, pub sky_vector: sky_vector::Coordinate,
} }
impl TryFrom<LatLon> for Coordinates { impl TryFrom<LatLon> for Coordinates {
@ -40,7 +40,7 @@ impl TryFrom<LatLon> for Coordinates {
dmm: dmm::Coordinate::from(latlon), dmm: dmm::Coordinate::from(latlon),
utm: utm::Coordinate::try_from(latlon)?, utm: utm::Coordinate::try_from(latlon)?,
plus: plus::Coordinate::try_from(latlon)?, plus: plus::Coordinate::try_from(latlon)?,
ddmmss: ddmmss::Coordinate::from(latlon), sky_vector: sky_vector::Coordinate::from(latlon),
}) })
} }
} }

View File

@ -2,11 +2,11 @@ use std::{fmt, str::FromStr};
pub mod all; pub mod all;
mod common; mod common;
pub mod dd; pub mod dd;
pub mod ddmmss;
pub mod dmm; pub mod dmm;
pub mod dms; pub mod dms;
pub mod latlon; pub mod latlon;
pub mod plus; pub mod plus;
pub mod sky_vector;
pub mod urls; pub mod urls;
pub mod utm; pub mod utm;
pub use error::Error; pub use error::Error;
@ -88,7 +88,7 @@ pub enum Coordinate {
UTM(utm::Coordinate), UTM(utm::Coordinate),
// Xpin(xpin::Xpin), // Xpin(xpin::Xpin),
Plus(plus::Coordinate), Plus(plus::Coordinate),
DDMMSS(ddmmss::Coordinate), SkyVector(sky_vector::Coordinate),
} }
impl Coordinate { impl Coordinate {
@ -108,7 +108,7 @@ impl Coordinate {
map(dd::Coordinate::parse, Coordinate::DD), map(dd::Coordinate::parse, Coordinate::DD),
// map(xpin::Coordinate::parse, Cordinate::Xpin), // map(xpin::Coordinate::parse, Cordinate::Xpin),
map(plus::Coordinate::parse, Coordinate::Plus), 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 // Try to parse as a URL last
map(urls::CoordinateUrls::parse, |coordinate_urls| { map(urls::CoordinateUrls::parse, |coordinate_urls| {
Coordinate::DD(dd::Coordinate::from(coordinate_urls.latlon)) Coordinate::DD(dd::Coordinate::from(coordinate_urls.latlon))
@ -130,7 +130,7 @@ impl Coordinate {
CoordinateType::DMM => Self::DMM(dmm::Coordinate::from(lat_lon)), CoordinateType::DMM => Self::DMM(dmm::Coordinate::from(lat_lon)),
CoordinateType::UTM => Self::UTM(utm::Coordinate::try_from(lat_lon)?), CoordinateType::UTM => Self::UTM(utm::Coordinate::try_from(lat_lon)?),
CoordinateType::Plus => Self::Plus(plus::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::UTM(_) => CoordinateType::UTM,
// Self::Xpin(_) => CoordinateType::Xpin, // Self::Xpin(_) => CoordinateType::Xpin,
Self::Plus(_) => CoordinateType::Plus, 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::UTM(utm) => utm.into(),
// Coordinate::Xpin(xpin) => xpin.into(), // Coordinate::Xpin(xpin) => xpin.into(),
Coordinate::Plus(plus) => plus.into(), Coordinate::Plus(plus) => plus.into(),
Coordinate::DDMMSS(ddmmss) => ddmmss.into(), Coordinate::SkyVector(sky_vector) => sky_vector.into(),
} }
} }
} }
@ -206,9 +206,9 @@ impl From<plus::Coordinate> for Coordinate {
Self::Plus(c) Self::Plus(c)
} }
} }
impl From<ddmmss::Coordinate> for Coordinate { impl From<sky_vector::Coordinate> for Coordinate {
fn from(c: ddmmss::Coordinate) -> Self { fn from(c: sky_vector::Coordinate) -> Self {
Self::DDMMSS(c) Self::SkyVector(c)
} }
} }
@ -245,7 +245,7 @@ impl fmt::Display for Coordinate {
Coordinate::DMS(dms) => write!(f, "{}", dms), Coordinate::DMS(dms) => write!(f, "{}", dms),
Coordinate::UTM(utm) => write!(f, "{}", utm), Coordinate::UTM(utm) => write!(f, "{}", utm),
Coordinate::Plus(plus) => write!(f, "{}", plus), Coordinate::Plus(plus) => write!(f, "{}", plus),
Coordinate::DDMMSS(ddmmss) => write!(f, "{}", ddmmss), Coordinate::SkyVector(sky_vector) => write!(f, "{}", sky_vector),
} }
} }
} }

View File

@ -78,7 +78,7 @@ impl Coordinate {
) )
} }
pub fn get_ddmmss(&self) -> &str { pub fn get_sky_vector(&self) -> &str {
&self.0 &self.0
} }
} }

View File

@ -74,8 +74,8 @@ pub struct Coordinates {
// pub xpin: String, // pub xpin: String,
#[wasm_bindgen(js_name = "Plus")] #[wasm_bindgen(js_name = "Plus")]
pub plus: String, pub plus: String,
#[wasm_bindgen(js_name = "DDMMSS")] #[wasm_bindgen(js_name = "SkyVector")]
pub ddmmss: String, pub sky_vector: String,
} }
impl From<&spatial_coordinate_systems::all::Coordinates> for Coordinates { 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(), dmm: value.dmm.to_string(),
utm: value.utm.to_string(), utm: value.utm.to_string(),
plus: value.plus.to_string(), plus: value.plus.to_string(),
ddmmss: value.ddmmss.to_string(), sky_vector: value.sky_vector.to_string(),
} }
} }
} }