Mapbox Map Controller
MapController implementation backed by Mapbox Maps SDK: wires style sources/layers, custom GL weather layers (MapboxLayerHost), camera sync (CameraSync), and Mapbox gestures (e.g. map clicks).
Construct with the same MapView you show in your activity and an XweatherAccount for API access.
See also
for weather layers, timeline, data inspector, and legends.
Constructors
Properties
Configuration options that control the behavior of timeline animations and data preloading.
Geographic center of the map in latitude/longitude degrees, kept in sync with the camera.
Pick/inspect weather values at a tap location; enable with addDataInspectorControl.
Internal debounce job for camera move-end handling; managed by MapboxMapController.
Approximate download progress fraction (0f–1f) while tiles are in flight.
All MapsGL map layers currently registered on this controller, keyed by layer id.
Optional UI control for layer legends; install with add.
Observes encoded-tile metadata keys; when a layer id is emitted, that TileLayer refreshes visible tiles. Attach only if you extend encoded sources; normally the controller wires this internally.
Posted when the current load session completes (encoded downloads and bind pipeline idle).
Emits MapLoadProgress while map data loads. Use onLoadProgress.observe(this) { progress -> ... } like other LiveData on this controller. For coroutine / flow access, see onLoadProgressValue.
Same progress as onLoadProgress, exposed as a Signal for coroutine collectors.
Posted when loading begins for any tracked data source (e.g. tile wave started).
Fires with a source id after addSource registers it and the source is ready for layers.
The primary interface for communicating with the Xweather backend.
Library-internal: at least one visible layer is waiting on tile data.
Library-internal: edge detection for post-download refresh.
Library-internal: previous frame had pending tile downloads.
Functions
Installs the provided legend control, wiring it to map events and populating initial legends.
Hook for map SDK–specific registration of a custom layer host after MapsGL created the layer.
Activates and initializes the Data Inspector control for the map.
Adds a new layer to the map.
Adds or refreshes the legend defined on forConfig into the current legendControl.
Registers a data source. When the descriptor leaves ImageSourceDescriptor.authenticator / EncodedSourceDescriptor.authenticator / VectorSourceDescriptor.authenticator / GeoJSONSourceDescriptor.authenticator unset, this controller supplies service.authenticator automatically.
Adds a weather layer from an explicit WeatherConfiguration (use when you built the config from WeatherService factories instead of LayerCode).
Formats a Date as an ISO-8601-like UTC string (first 19 chars + Z) for display or logging.
Visible geographic bounds derived from Mapbox unwrapped camera bounds and VisibleGeoBounds.
Resolves the WeatherConfiguration that would be used for addWeatherLayer with this layerCode.
Raw unwrapped longitudes from Mapbox — not passed through VisibleGeoBounds, which can collapse the viewport to a single -180,180 strip and hide extra world copies for encoded tile draws.
Returns A layer given its LayerCode.
Returns whether the map currently contains a weather layer with the specified identifier.
ComponentCallbacks2: no-op; orientation is handled via camera callbacks.
Mapbox map click: forwards to the data inspector when it is enabled.
TileLayer.TileLayerEventListener hook; reserved for future tile-layer events from Mapbox path.
Clears encoded tile caches outside the visible viewport when the OS reports memory pressure (ComponentCallbacks2); aggressive only for background / UI-hidden levels.
Triggers a manual pre-fetch of tile animation data.
Mapbox queryRenderedFeatures at a screen point for the given vector layers; fills data-inspector vector fields when onTouch matches the active inspector buffer.
Queries features within a rectangular area.
Legacy vector query implementation kept for compatibility; prefer queryFeatures.
Recomputes visible tiles for every visible MapsGL layer and marks custom layer hosts dirty.
Deactivates the Data Inspector control and cleans up its associated resources.
Removes a layer by id, detaches consumers, and cleans encoded-grid sidecars when present.
Removes the currently installed legend control and clears any associated observers.
Unregisters a data source from this controller (does not remove layers that still reference it).
Removes the weather layer(s) for code from the map, sources, legends, and mask sidecars as needed.
Sets map bearing (rotation in degrees; 0 = north up).
Moves the camera center while preserving the current getZoom.
Marks the custom layer host for layerId so textures/uniforms are uploaded on the next draw pass.
Syncs MapsGL layer visibility, custom layer host visibility, and Mapbox style visibility for id.
Sets a paint-related property on a layer (reserved for future Mapbox style parity; not fully implemented).
Shows or hides every map layer (and optional legend) belonging to code, including composite children.