Revert ddmmss to skyvector
This commit is contained in:
parent
3eb4c59b6a
commit
78766263b1
@ -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<LatLon> for Coordinates {
|
||||
@ -40,7 +40,7 @@ impl TryFrom<LatLon> 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),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -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<plus::Coordinate> for Coordinate {
|
||||
Self::Plus(c)
|
||||
}
|
||||
}
|
||||
impl From<ddmmss::Coordinate> for Coordinate {
|
||||
fn from(c: ddmmss::Coordinate) -> Self {
|
||||
Self::DDMMSS(c)
|
||||
impl From<sky_vector::Coordinate> 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),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ impl Coordinate {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn get_ddmmss(&self) -> &str {
|
||||
pub fn get_sky_vector(&self) -> &str {
|
||||
&self.0
|
||||
}
|
||||
}
|
@ -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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user