Skip to main content

Crate slint_mapping

Crate slint_mapping 

Source
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 Slint MapView instance to a TileSource.
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::TileSource implementations.
viewport
Visible-tile computation.

Structs§

Layer
MapPageDemo
MapPanel
MapView
Marker
Polyline
Tile
_ValidateEntry

Constants§

SAMPLE_TILES_DIR
Filesystem path to this crate’s bundled sample-tiles/ directory. Suitable for feeding into sources::FileTileSource for 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 a PathBuf) to slint_build::CompilerConfiguration::with_library_paths from a consuming crate’s build.rs and you can write import { MapEmbed } from "@mapping/map.slint"; in your .slint files.