Skip to main content

TileManager

Struct TileManager 

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

Orchestrates tile fetching, caching, and visible-set computation.

Implementations§

Source§

impl TileManager

Source

pub fn new(source: Box<dyn TileSource>, cache_capacity: usize) -> Self

Create a new tile manager with the given source and cache capacity.

Source

pub fn new_with_config( source: Box<dyn TileSource>, cache_capacity: usize, selection_config: TileSelectionConfig, ) -> Self

Create a new tile manager with an explicit tile-selection policy.

Source

pub fn update( &mut self, viewport_bounds: &WorldBounds, zoom: u8, camera_world: (f64, f64), camera_distance: f64, ) -> VisibleTileSet

Update the tile manager for the current frame.

Source

pub fn update_with_frustum( &mut self, frustum: &Frustum, zoom: u8, camera_world: (f64, f64), ) -> VisibleTileSet

Update the tile manager using frustum-based quadtree traversal.

This is the MapLibre-equivalent covering-tiles path. Instead of enumerating a rectangular AABB tile range and then filtering against a sampled ground footprint, this performs a depth-first quadtree descent from zoom 0, pruning any subtree whose world-space AABB does not intersect the camera frustum.

Source

pub fn update_with_covering( &mut self, frustum: &Frustum, cam: &CoveringCamera, opts: &CoveringTilesOptions, camera_world: (f64, f64), ) -> VisibleTileSet

Update the tile manager using MapLibre-equivalent covering-tiles quadtree traversal with per-tile variable zoom heuristics.

This is the preferred path for perspective cameras at steep pitch. It performs frustum-culled depth-first traversal where distant tiles may use lower zoom levels than near tiles, matching MapLibre’s coveringTiles() behaviour.

Source

pub fn update_with_view( &mut self, viewport_bounds: &WorldBounds, zoom: u8, camera_world: (f64, f64), _camera_distance: f64, flat_view: Option<&FlatTileView>, ) -> VisibleTileSet

Update the tile manager with optional shared flat-view selection parameters for pitched perspective raster rendering.

Source

pub fn last_selection_stats(&self) -> &TileSelectionStats

Read-only access to the most recent tile-selection/update stats.

Source

pub fn desired_tiles(&self) -> &HashSet<TileId>

Read-only access to the last desired source-tile set used for request selection.

Source

pub fn counters(&self) -> &TileManagerCounters

Read-only access to cumulative tile-manager counters.

Source

pub fn selection_config(&self) -> &TileSelectionConfig

Read-only access to the current tile-selection policy.

Source

pub fn set_selection_config(&mut self, config: TileSelectionConfig)

Replace the tile-selection policy used by future updates.

Source

pub fn cache(&self) -> &TileCache

Read-only access to the cache.

Source

pub fn cache_stats(&self) -> TileCacheStats

Snapshot counts of the current tile-cache state.

Source

pub fn source_diagnostics(&self) -> Option<TileSourceDiagnostics>

Optional runtime diagnostics from the underlying tile source.

Source

pub fn lifecycle_diagnostics(&self) -> TileLifecycleDiagnostics

Snapshot of recent tile lifecycle diagnostics.

Source

pub fn cached_count(&self) -> usize

The number of tiles currently cached in any state.

Source

pub fn prefetch_with_view( &mut self, viewport_bounds: &WorldBounds, zoom: u8, camera_world: (f64, f64), flat_view: Option<&FlatTileView>, max_requests: usize, ) -> usize

Speculatively prefetch tiles for a predicted viewport without affecting the visible tile set.

Only tiles outside the current frame’s last_desired_tiles are requested, and existing cached or pending entries are skipped.

Source

pub fn prefetch_zoom_direction( &mut self, camera_world: (f64, f64), direction: ZoomPrefetchDirection, max_requests: usize, ) -> usize

Speculatively prefetch tiles implied by the current desired set and a zoom direction.

Source

pub fn prefetch_route( &mut self, route: &[GeoCoord], zoom: u8, camera_world: (f64, f64), max_requests: usize, ) -> usize

Speculatively prefetch tiles along a geographic route polyline.

The route is walked from the segment nearest to the camera position forward, sampling tile boundaries at the given zoom level. Only tiles that are ahead of the camera (further along the route) and not already in the current desired set or cache are requested.

Returns the number of new tile requests issued.

Source

pub fn promote_decoded(&mut self, decoded: Vec<(TileId, TileResponse)>)

Promote externally decoded tiles into the cache.

This is the integration point for the background MVT decode pipeline: after poll() returns a TileData::RawVector entry and the async pipeline decodes it, the decoded TileResponse is fed back here to replace the raw entry with a fully decoded TileData::Vector entry.

Trait Implementations§

Source§

impl Debug for TileManager

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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.