pub struct FileTileSource { /* private fields */ }Expand description
Reads raster tiles from a slippy-map directory tree on disk.
ⓘ
use slint_mapping::sources::FileTileSource;
let src = FileTileSource::new("/data/tiles")
.with_extension("png")
.with_tile_size(256)
.with_zoom_range(0, 14);Implementations§
Source§impl FileTileSource
impl FileTileSource
pub fn new(root: impl Into<PathBuf>) -> Self
Sourcepub fn with_extension(self, ext: impl Into<String>) -> Self
pub fn with_extension(self, ext: impl Into<String>) -> Self
Override the tile file extension (default "png").
Sourcepub fn with_tile_size(self, size: u32) -> Self
pub fn with_tile_size(self, size: u32) -> Self
Override the tile edge length (default 256).
Sourcepub fn with_zoom_range(self, min: u8, max: u8) -> Self
pub fn with_zoom_range(self, min: u8, max: u8) -> Self
Override the available zoom range. Tiles outside this range won’t be requested by the controller, even if the user zooms past it.
Trait Implementations§
Source§impl TileSource for FileTileSource
impl TileSource for FileTileSource
Source§fn tile(&self, key: TileKey) -> Option<Image>
fn tile(&self, key: TileKey) -> Option<Image>
Return the tile at
(x, y, z), or None if it isn’t available
(out of bounds, missing from disk, not yet downloaded, …).
Implementations must not block the caller for long — kick off
any expensive fetch on a background task and return None until
the result lands in your cache.Source§fn tile_size(&self) -> u32
fn tile_size(&self) -> u32
Tile edge length in pixels. Default 256 matches every common
slippy-map source; vector / retina sources may emit 512.
Source§fn max_zoom(&self) -> u8
fn max_zoom(&self) -> u8
Inclusive maximum zoom level this source serves. Used by the
controller to clamp user-initiated zoom. Default is “any zoom
up to Web Mercator’s practical ceiling”.
Source§fn cancel_all_except(&self, _keep: &HashSet<TileKey>)
fn cancel_all_except(&self, _keep: &HashSet<TileKey>)
Drop any queued (but not yet started) work for keys NOT in
keep. Default no-op — synchronous sources have no in-flight
work to cancel. Fetching / decoding implementations should
override this so rapidly-panning consumers don’t accumulate
off-screen requests that waste bandwidth on tiles nobody will
see by the time they arrive.Auto Trait Implementations§
impl Freeze for FileTileSource
impl RefUnwindSafe for FileTileSource
impl Send for FileTileSource
impl Sync for FileTileSource
impl Unpin for FileTileSource
impl UnsafeUnpin for FileTileSource
impl UnwindSafe for FileTileSource
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