Skip to main content

LocationExt

Trait LocationExt 

Source
pub trait LocationExt: IsA<Location> + 'static {
    // Provided methods
    fn distance(&self, other: &impl IsA<Location>) -> f64 { ... }
    fn latitude(&self) -> f64 { ... }
    fn longitude(&self) -> f64 { ... }
    fn set_location(&self, latitude: f64, longitude: f64) { ... }
    fn set_latitude(&self, latitude: f64) { ... }
    fn set_longitude(&self, longitude: f64) { ... }
    fn connect_latitude_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId { ... }
    fn connect_longitude_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all Location methods.

§Implementors

Coordinate, Location, Marker, Point, SymbolEvent, Viewport

Provided Methods§

Source

fn distance(&self, other: &impl IsA<Location>) -> f64

Calculates the distance in meters between two locations.

This function uses the great-circle distance formula, which assumes Earth is a perfect sphere. This limits the accuracy of the result, but is good enough for most purposes.

§other

a Location

§Returns

the distance in meters between @self and @other

Source

fn latitude(&self) -> f64

Gets the latitude coordinate in degrees.

§Returns

the latitude coordinate in degrees.

Source

fn longitude(&self) -> f64

Gets the longitude coordinate in degrees.

§Returns

the longitude coordinate in degrees.

Source

fn set_location(&self, latitude: f64, longitude: f64)

Sets the coordinates of the location

§latitude

the latitude in degrees

§longitude

the longitude in degrees

Source

fn set_latitude(&self, latitude: f64)

The latitude coordonate in degrees

Source

fn set_longitude(&self, longitude: f64)

The longitude coordonate in degrees

Source

fn connect_latitude_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_longitude_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§