pub struct CoordinateWithElevation { /* private fields */ }Expand description
A three dimensional geographic coordinate expressed as a (latitude, longitude, elevation) triple.
§Examples
use lat_long::{Elevation, Angle, CoordinateWithElevation, Latitude, Longitude};
let lat = Latitude::try_from(47.6204).unwrap();
let lon = Longitude::try_from(-122.3491).unwrap();
let height = Elevation::meters(226.0);
let top_of_seattle_space_needle = CoordinateWithElevation::new_from(lat, lon, height);
println!("{top_of_seattle_space_needle}"); // decimal degrees
println!("{top_of_seattle_space_needle:#}"); // degrees–minutes–secondsImplementations§
Source§impl CoordinateWithElevation
impl CoordinateWithElevation
Sourcepub const fn new(point: Coordinate, elevation: Elevation) -> Self
pub const fn new(point: Coordinate, elevation: Elevation) -> Self
Construct a new 3d coordinate from a 2d point and an elevation.
Sourcepub const fn new_from(
lat: Latitude,
long: Longitude,
elevation: Elevation,
) -> Self
pub const fn new_from( lat: Latitude, long: Longitude, elevation: Elevation, ) -> Self
Construct a new 3d coordinate from a 2d point, expressed as latitude and longitude values, and an elevation.
Sourcepub const fn with_point(self, point: Coordinate) -> Self
pub const fn with_point(self, point: Coordinate) -> Self
Return a new 3d coordinate with the point component replaced.
Sourcepub const fn with_new_point(self, lat: Latitude, long: Longitude) -> Self
pub const fn with_new_point(self, lat: Latitude, long: Longitude) -> Self
Return a new 3d coordinate with the point component replaced by a new 2d coordinate.
Sourcepub const fn with_elevation(self, elevation: Elevation) -> Self
pub const fn with_elevation(self, elevation: Elevation) -> Self
Return a new CoordinateWithElevation with the elevation component replaced.
Sourcepub const fn point(&self) -> Coordinate
pub const fn point(&self) -> Coordinate
Returns the 2d coordinate component of this 3d coordinate.
Sourcepub const fn elevation(&self) -> Elevation
pub const fn elevation(&self) -> Elevation
Returns the elevation component of this 3d coordinate.
Sourcepub fn is_on_equator(&self) -> bool
pub fn is_on_equator(&self) -> bool
Returns true if this coordinate lies on the equator.
Sourcepub fn is_northern(&self) -> bool
pub fn is_northern(&self) -> bool
Returns true if this coordinate is in the northern hemisphere.
Sourcepub fn is_southern(&self) -> bool
pub fn is_southern(&self) -> bool
Returns true if this coordinate is in the southern hemisphere.
Sourcepub fn is_on_international_reference_meridian(&self) -> bool
pub fn is_on_international_reference_meridian(&self) -> bool
Returns true if this coordinate lies on the international reference meridian.
Sourcepub fn is_western(&self) -> bool
pub fn is_western(&self) -> bool
Returns true if this coordinate is in the western hemisphere.
Sourcepub fn is_eastern(&self) -> bool
pub fn is_eastern(&self) -> bool
Returns true if this coordinate is in the eastern hemisphere.
Sourcepub fn is_zero_elevation(&self) -> bool
pub fn is_zero_elevation(&self) -> bool
Returns true if this coordinate lies on the equator.
Trait Implementations§
Source§impl Clone for CoordinateWithElevation
impl Clone for CoordinateWithElevation
Source§fn clone(&self) -> CoordinateWithElevation
fn clone(&self) -> CoordinateWithElevation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CoordinateWithElevation
impl Debug for CoordinateWithElevation
Source§impl<'de> Deserialize<'de> for CoordinateWithElevation
impl<'de> Deserialize<'de> for CoordinateWithElevation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for CoordinateWithElevation
impl Display for CoordinateWithElevation
Source§impl Formatter for CoordinateWithElevation
impl Formatter for CoordinateWithElevation
fn format<W: Write>(&self, f: &mut W, options: &FormatOptions) -> Result
fn to_formatted_string(&self, fmt: &FormatOptions) -> String
Source§impl FromStr for CoordinateWithElevation
impl FromStr for CoordinateWithElevation
Source§impl Hash for CoordinateWithElevation
impl Hash for CoordinateWithElevation
Source§impl PartialEq for CoordinateWithElevation
impl PartialEq for CoordinateWithElevation
Source§fn eq(&self, other: &CoordinateWithElevation) -> bool
fn eq(&self, other: &CoordinateWithElevation) -> bool
self and other values to be equal, and is used by ==.