Skip to main content

MapController

Struct MapController 

Source
pub struct MapController { /* private fields */ }
Expand description

Owns the source + camera; refreshes the MapView’s tile model.

Implementations§

Source§

impl MapController

Source

pub fn new<S: TileSource + 'static>(map: &MapView, source: S) -> Self

Wire a MapView instance to a tile source. The controller immediately computes the visible tiles for the current camera and pushes them into the view; subsequent refresh calls do the same.

Callbacks (pan, zoom-by) on the MapView are bound to camera-mutating handlers — user gestures Just Work.

Source

pub fn refresh(&self)

Recompute the visible tiles for the current camera and push them into the view. Called automatically after every gesture; call manually after set_centre / set_zoom / a viewport resize.

Source

pub fn set_centre(&self, longitude: f64, latitude: f64)

Source

pub fn set_zoom(&self, zoom: f64)

Source

pub fn set_source<S: TileSource + 'static>(&self, source: S)

Swap the underlying tile source at runtime — useful for layer toggling. Triggers an immediate refresh.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.