Expand description
slint-mapping — a map framework for Slint.
Minimal usage (offline raster tiles from a slippy-map directory):
ⓘ
use slint::ComponentHandle;
use slint_mapping::{MapView, MapController, sources::FileTileSource};
let map = MapView::new()?;
let _controller = MapController::new(
&map,
FileTileSource::new("/data/osm-tiles").with_extension("png"),
);
map.show()?;
slint::run_event_loop()?;§Adapters
Tile sources are pluggable: implement TileSource for any
backing store (filesystem, MBTiles, in-memory generator, HTTP cache,
…). sources::FileTileSource is the only adapter that ships
today.
§Status
v0.x. Pan + scroll-zoom work; pinch-zoom waits on Slint exposing multi-pointer touch events. No marker / polyline overlays yet.
Re-exports§
pub use slint::ComponentHandle as _;pub use slint::Global as _;pub use slint::ModelExt as _;pub use cache::CacheError;pub use cache::FileTileCache;pub use cache::LayeredTileCache;pub use cache::TileCache;pub use controller::MapController;pub use source::TileKey;pub use source::TileSource;
Modules§
- cache
TileCache— abstract local storage for tiles.- camera
- Pure-Rust camera math — what happens to
(centre_lon, centre_lat, zoom)when the user pans by some pixel delta or zooms by some scroll delta? - controller
MapController— wires a SlintMapViewinstance to aTileSource.- projection
- Web Mercator projection — the one every slippy-map tile source uses.
- source
TileSource— the adapter trait every map data source implements.- sources
- Concrete
crate::TileSourceimplementations. - viewport
- Visible-tile computation.
Structs§
Constants§
- SAMPLE_
TILES_ DIR - Filesystem path to this crate’s bundled
sample-tiles/directory. Suitable for feeding intosources::FileTileSourcefor demos without external assets; covers zoom levels 0–3 (the whole world, 85 tiles, ~450 KB). - UI_
LIBRARY_ DIR - Filesystem path to this crate’s
ui/directory — the entry point Slint resolves@mapping/...library_paths imports against. Pass this (wrapped in aPathBuf) toslint_build::CompilerConfiguration::with_library_pathsfrom a consuming crate’sbuild.rsand you can writeimport { MapEmbed } from "@mapping/map.slint";in your.slintfiles.