Expand description
Map widget — MVT tile + MapCSS → SVG → DOM (AzulMaps goal app, P3).
Cache lives in a dataset RefAny owned by a merge callback so it
survives relayout. See layout/src/widgets/map.rs for the design.
AzulMaps map widget. The P3 goal-app’s central primitive.
Architecture (per the user’s design in MOBILE_SESSION_LOG and the follow-up clarification):
- Widget, not a NodeType.
MapWidgetbuilds a regular<div>that owns aMapTileCacheRefAnydataset. The cache holds decoded SVG bytes perMapTileId; the dataset is the unit of persistence across relayout. - Tile cache survives relayout via a
DatasetMergeCallback. Every relayout creates a freshMapTileCacheskeleton; the merge callback transfers allReady/Pendingentries from the old dataset into the new one, so in-flight fetches and already-decoded SVGs aren’t dropped. - VirtualView drives lazy rendering. The widget’s body is a
VirtualViewcallback that:- Computes which tile XYZs are visible from the current viewport + viewport size.
- For each visible tile not yet in the cache, marks it
Pendingand (eventually) enqueues an HTTP fetch. - Returns a
Domwhose children are one<div>per visible tile, GPU-translated into screen space viatransform: translate(x, y) scale(z). Each tile div’s inner content is the cached SVG DOM, or an empty placeholder while the fetch is in flight.
- MVT + MapCSS → SVG → DOM. The decode pipeline (MVT protobuf
bytes + a MapCSS stylesheet → an
<svg>tree → the framework’s existing svg-to-dom path) lands in a follow-up tick. This tick provides the widget shell + the dataset / merge-callback / virtual- view wiring; tiles render as empty placeholders. - Geolocation dot composes on top. Users stack a normal child
Dom(with aNodeType::GeolocationProbedeeper in the subtree) on top of the map widget - the widget doesn’t bake in any geolocation feature itself.
Compile gate: no new HTTP / MVT / proj4 dependencies in this tick. Those land alongside the actual decode pipeline.
Structs§
- MapLat
Lon - A geographic coordinate in degrees. Returned by
MapWidget::latlon_at_pxand (P3) the map’son_pin_taphook. - MapPin
Tap - MapPin
TapCallback - MapTile
Cache - MapTile
Id - Identity of one tile in a tiled-map XYZ scheme. Matches Leaflet /
OpenLayers/ Mapbox conventions (Web Mercator, origin top-left). - MapTile
Layer - Configuration of one map tile layer - usually the base raster /
vector layer. Additional layers (heatmaps, custom
GeoJSON) compose as furtherMapWidgetinstances stacked atop. - MapViewport
- Centre + zoom + rotation state. The Leaflet shape
(
map.setView([lat, lon], zoom)).bearing_deg+pitch_degare reserved for future 3D-camera work; most callers leave them at zero. - MapViewport
Changed - MapViewport
Changed Callback - MapWidget
- Tile
Fetch Init - Worker-thread input: which tile to fetch, the resolved URL, and the
MapCSSstylesheet to apply when converting features to SVG. Boxed into theThread::createinitRefAny. - Tile
Ready Msg - Worker-thread output, sent back via
ThreadWriteBackMsg. Themap_tile_writebackcallback downcasts to this and stamps the cache.
Enums§
Statics§
- MAP_
PIN_ TAP_ INVOKER - Process-global slot for this callback kind’s host-side invoker.
- MAP_
VIEWPORT_ CHANGED_ INVOKER - Process-global slot for this callback kind’s host-side invoker.
Functions§
- AzApp_
setMap PinTap Callback Invoker - Register the host-side invoker for this callback kind.
- AzApp_
setMap Viewport Changed Callback Invoker - Register the host-side invoker for this callback kind.
- AzMap
PinTap Callback_ create From Host Handle - C-ABI export wrapping
<Wrapper>::create_from_host_handle. - AzMap
Viewport Changed Callback_ create From Host Handle - C-ABI export wrapping
<Wrapper>::create_from_host_handle. - map_
tile_ writeback - Worker-thread → main-thread writeback.
- svg_
string_ to_ dom - Parse a standalone
<svg>…</svg>string into aDomsubtree via the framework’s existing XML→DOM path.
Type Aliases§
- AzMap
PinTap Callback Invoker - Pointer-arg variant of this callback kind’s typedef.
- AzMap
Viewport Changed Callback Invoker - Pointer-arg variant of this callback kind’s typedef.
- MapPin
TapCallback Type - User hook fired when the user taps the map (a press + release at ~the same point, no pan/pinch).
- MapViewport
Changed Callback Type - User hook fired when the user pans or zooms the map.