pub struct DMS {
pub degrees: u16,
pub minutes: u8,
pub seconds: f64,
pub cardinal: Option<Cardinal>,
}Expand description
Angle expressed as D°M'S",
in Degrees D°, Minutes M’ and fractionnal
Seconds S“ (double precision) with an optionnal Cardinal.
When a cardinal is associated to this angle,
we consider this angle represents either a Latitude
or a Longitude angle.
Fields§
§degrees: u16Degrees D°
minutes: u8Minutes M’
seconds: f64Seconds with fractionnal part S“
cardinal: Option<Cardinal>Optionnal cardinal associated to this angle
Implementations§
Source§impl DMS
impl DMS
Sourcepub fn new(
degrees: u16,
minutes: u8,
seconds: f64,
cardinal: Option<Cardinal>,
) -> DMS
pub fn new( degrees: u16, minutes: u8, seconds: f64, cardinal: Option<Cardinal>, ) -> DMS
Builds D°M'S" angle, from given D°, M’, S“ values.
This method allows overflow, it will wrapp values to correct range
itself.
Sourcepub fn from_seconds(seconds: f64) -> Self
pub fn from_seconds(seconds: f64) -> Self
Builds D°M'S" angle from total amount of seconds
Sourcepub fn with_cardinal(&self, cardinal: Cardinal) -> Self
pub fn with_cardinal(&self, cardinal: Cardinal) -> Self
Returns same D°M’S“ angle but attaches a cardinal to it. Useful to convert make this D°M’S“ angle a Latitude or a Longitude.
Sourcepub fn from_ddeg_angle(angle: f64) -> Self
pub fn from_ddeg_angle(angle: f64) -> Self
Builds D°M’S“ angle from given angle expressed in decimal degrees, with no cardinal associated to returned value
Sourcepub fn from_ddeg_latitude(angle: f64) -> Self
pub fn from_ddeg_latitude(angle: f64) -> Self
Builds Latitude angle, expressed in D°M’S“, from given angle expressed in decimal degrees
Sourcepub fn from_ddeg_longitude(angle: f64) -> Self
pub fn from_ddeg_longitude(angle: f64) -> Self
Builds Longitude angle, expressed in D°M’S“, from given angle expressed in decimal degrees
Sourcepub fn to_ddeg_angle(&self) -> f64
pub fn to_ddeg_angle(&self) -> f64
Returns Self expressed in decimal degrees If no cardinal is associated, returned angle strictly > 0.
Sourcepub fn add_ddeg(&mut self, angle: f64)
pub fn add_ddeg(&mut self, angle: f64)
Adds given angle to Self, angle expressed a decimal degrees
Sourcepub fn with_ddeg_angle(&self, angle: f64) -> Self
pub fn with_ddeg_angle(&self, angle: f64) -> Self
Returns copy of Self with given angle added, as decimal degrees
Sourcepub fn total_seconds(&self) -> f64
pub fn total_seconds(&self) -> f64
Returns total of seconds (base unit) contained in Self
Sourcepub fn to_radians(&self) -> f64
pub fn to_radians(&self) -> f64
Converts self to radians
Sourcepub fn to_europe50(&self) -> Result<DMS, Error>
pub fn to_europe50(&self) -> Result<DMS, Error>
Returns D°M’S“ angle copy with WGS84 to EU50 conversion applied. For conversion to be applied, we need a cardinal to be associated, otherwise this simply returns a copy
Trait Implementations§
Source§impl AddAssign<f64> for DMS
impl AddAssign<f64> for DMS
Source§fn add_assign(&mut self, rhs: f64)
fn add_assign(&mut self, rhs: f64)
+= operation. Read moreSource§impl AddAssign for DMS
impl AddAssign for DMS
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moreSource§impl DivAssign<f64> for DMS
impl DivAssign<f64> for DMS
Source§fn div_assign(&mut self, rhs: f64)
fn div_assign(&mut self, rhs: f64)
/= operation. Read moreSource§impl MulAssign<f64> for DMS
impl MulAssign<f64> for DMS
Source§fn mul_assign(&mut self, rhs: f64)
fn mul_assign(&mut self, rhs: f64)
*= operation. Read moreSource§impl SubAssign<f64> for DMS
impl SubAssign<f64> for DMS
Source§fn sub_assign(&mut self, rhs: f64)
fn sub_assign(&mut self, rhs: f64)
-= operation. Read moreimpl Copy for DMS
impl StructuralPartialEq for DMS
Auto Trait Implementations§
impl Freeze for DMS
impl RefUnwindSafe for DMS
impl Send for DMS
impl Sync for DMS
impl Unpin for DMS
impl UnwindSafe for DMS
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more