pub struct MapController { /* private fields */ }Expand description
Owns the source + camera; refreshes the MapView’s tile model.
Implementations§
Source§impl MapController
impl MapController
Sourcepub fn new<S: TileSource + 'static>(map: &MapView, source: S) -> Self
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.
Sourcepub fn refresh(&self)
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.
pub fn set_centre(&self, longitude: f64, latitude: f64)
pub fn set_zoom(&self, zoom: f64)
Sourcepub fn set_source<S: TileSource + 'static>(&self, source: S)
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§
impl Freeze for MapController
impl !RefUnwindSafe for MapController
impl !Send for MapController
impl !Sync for MapController
impl Unpin for MapController
impl UnsafeUnpin for MapController
impl !UnwindSafe for MapController
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
Mutably borrows from an owned value. Read more