Skip to main content

Crate mln_engine

Crate mln_engine 

Source
Expand description

The map engine: the map and camera (map, camera, gestures), renderer and frames (render, draw), sources (source), tiles and workers (tile, tile_store, worker), layers’ layouts and buckets (layer), placement, queries, text/images, and storage/offline caching.

Re-exports§

pub use render::events::FontStack;
pub use render::events::GlyphRange;
pub use render::events::RenderMode;
pub use render::events::RendererEvent;
pub use render::events::RendererEvents;
pub use render::events::TileOperation;

Modules§

camera
The camera: its options, momentum and limits, bound options, the transform that moves it, the transform state, and the view it shows and draws with.
draw
What a layer draws with: the other half of the layer contract.
exec
Where the engine’s work runs: the thread pool and its task groups (pool), the run loop’s queue (queue), the queue that wakes a host’s loop (event_queue), named threads (thread) and what a panic on one of them reports (panic).
geo
The map’s geometry: the camera’s screen coordinates, edge insets and orientation; spherical Mercator (projection); the camera’s frustum and the bounding volumes it culls (bounding_volumes); intersection tests, point math, and the Earth’s size (constants). How lng/lat maps to the world square is mln_style::crs::WorldMapping.
gestures
A gesture recognizer that every host shares: pointer, touch, platform pinch and other camera input turned into camera moves on a GestureCamera, such as mln_runtime::Map, through the map’s camera calls with their gesture phases (Map::apply_camera_delta), and releases continued with the map’s momentum. Hosts translate each platform event into an Input: which buttons and keys map to a pointer’s DragAction, PointerFlags and Modes, and how far a wheel, a dial or a key moves the camera. The recognizer interprets them over time, and reports what gestures mean beyond camera moves as GestureEvents: taps, which hosts answer, and the notches where hosts play haptic feedback. GestureOptions separates camera-axis rules (GestureAxes), per-gesture behavior (GestureBehavior), and platform/accessibility metrics (GestureMetrics).
image
Images: the codecs (decode_image for PNG, JPEG and WebP, and encode_png), which fail with an error that carries a message.
layer
The layer contract: what a crate implements to add a layer type that the renderer draws.
map
The map: Map, its options, its snapshots, its style’s loading and feature state, and the events it reports. Its camera is in camera.
offline
Offline regions: OfflineDownload, which downloads an offline region’s resources into the OfflineDatabase, Downloads, which keeps a database’s downloads beside it on the database’s worker, and the offline region API of that database (RegionDatabase).
placement
The placement contract: which of the frame’s labels and other marks show, each where it collides with nothing placed before it, and how they fade between placements. A tile-mode placement can record what it placed (PlacedSymbolData).
plugin
Direct in-process host adapter for mln_plugin plugins.
query
source
The source type contract: what a crate implements to add a source type whose sources the renderer draws. mln_builtins implements it for the style specification’s source types.
storage
Resource loading: Resource, Response, the FileSource trait, the Loader over the built-in file sources (assets, local files, MBTiles, PMTiles, the cache database and the network), OfflineDatabase and the offline region definitions. OfflineDownload is in offline.
text
Text shaping and glyphs.
tile
Tiles’ ids and data: unwrapped and overscaled tile ids around mln_style::tile_id’s canonical one, and tile ranges (tile_id, tile_range); the layers and features of vector tiles, and the geometry functions that work on them; and DEM data (dem_data).
tile_store
The tiles and their store: which tiles each source covers, where their data comes from, and how it becomes what they draw.
worker
The tiles’ jobs and the workers they run on.

Macros§

paint_property_binders
Declares the binders of one layer type’s data-driven paint properties: a struct with one binder per property, each with the names of the attributes a program reads its values from (fields in the interleaved vertex order), and the shared InterleavedVertexBuffer, and its PaintBinders.
vertex_attributes
Declares the attributes of a #[repr(C)] vertex type: each field, the program attribute it binds to and the format the program reads it as.

Structs§

DrawnFrame
A frame that Renderer::render drew, for Renderer::finish_frame once the target handed it off.
Registry
The expression functions, layer types, source types and extension members that a style parses against, its renderer draws and its tile workers lay out, and the projections that the style’s projection.type names, built by a RegistryBuilder. It doesn’t change once built.
RegistryBuilder
What a Registry is built from.
RenderTimings
What the last frame that Renderer::render drew spent on each of its steps, on the CPU, from its update on. They follow each other, and together take nearly all of update and render.
Renderer
Draws a map’s updates into the frames of one backend’s Gpu: it keeps the map’s sources, tiles and layers between frames, and the GPU objects they draw with.
RenderingStats
Counters of the rendering backend. The num_* and mem_* counters of buffers, textures and frame buffers count the live resources; total_*, *_updates and *_bytes grow over the context’s life.
Update
An update that a slot published.
UpdateParameters
UpdateReader
The reading side of an UpdateSlot, for the renderer that draws the map. Clones read the same slot, each with a waker of its own.
UpdateSlot
The writing side, which the map owns. Dropping it closes the slot: its readers see no update from then on.
UpdatedFrame
A frame that Renderer::update brought the renderer’s state to, for Renderer::render to draw.

Enums§

MapMode
Whether the map draws frames as it changes or one still image, which a source and a layout load and lay out tiles for.
RenderMode
RendererEvent
An event of a renderer.
TileOperation

Functions§

register_builtin_projections
Adds the built-in projections, whose names have no colon: identity (Crs::identity). Fails when an earlier call added them.

Type Aliases§

FontStack
An ordered list of font names.
RendererEvents
The queue a renderer pushes its events to.