MapLayer

interface MapLayer<DataType : TileData, RenderContext : LayerRenderContext<Any>> : MapEventObserver, EventSource

A tile-backed map layer: grid dimensions, source, paint, renderer, timeline, and visibility.

Concrete implementations include TileLayer subclasses (encoded sample, raster, vector, particles). Register layers with com.xweather.mapsgl.map.MapController.addLayer / weather helpers; the controller wires mapController, renderer, and Mapbox custom layer hosting.

Parameters

DataType

Tile payload type from source.

RenderContext

Renderer context type passed into the GL pipeline.

Inheritors

Types

Link copied to clipboard
data class SourceEventHandler(val event: String, val handler: (Any?) -> Unit)

Registered source event name and callback (future hook parity with JS event bus).

Link copied to clipboard
data class TimeSeriesData(val loading: Boolean = false, val valid: Boolean = false)

Properties

Link copied to clipboard
abstract var alpha: Float
Link copied to clipboard
abstract var animator: TimeSeriesAnimator<Data>?
Link copied to clipboard
abstract var enabled: Boolean
Link copied to clipboard
Link copied to clipboard
abstract val id: String
Link copied to clipboard
abstract var invertMaskLayer: Boolean

Whether to invert the mask layer's output.

Link copied to clipboard
abstract var isDirty: Boolean
Link copied to clipboard
Link copied to clipboard

The map controller that this layer is associated with.

Link copied to clipboard
abstract var numH: Int
Link copied to clipboard
abstract var numW: Int
Link copied to clipboard
abstract var paint: LayerPaint
Link copied to clipboard
abstract var renderer: LayerRenderer<Any>
Link copied to clipboard
abstract var source: TileSource<DataType>
Link copied to clipboard
abstract var timeSeries: AnyTimeSeries?

The time series associated with the layer, if any.

Link copied to clipboard
abstract var timing: LayerTiming

The layer's timing configuration.

Link copied to clipboard
abstract var type: LayerType

The type of layer.

Link copied to clipboard
abstract val viewport: Viewport?
Link copied to clipboard
val MapLayer<*, *>.viewport: Viewport?
Link copied to clipboard
abstract var visible: Boolean
Link copied to clipboard
abstract var waitingOnDL: Boolean
Link copied to clipboard
abstract var wasWaitingOnDL: Boolean

Functions

Link copied to clipboard
open fun addSourceEventHandler(event: String, handler: (e: Any?) -> Unit, once: Boolean = false)
Link copied to clipboard

Returns the time series data provider to use for animating the layer, if any.

Link copied to clipboard
abstract fun getInfoForLocation(lat: Double, lng: Double, zoom: Int): String
Link copied to clipboard
abstract fun getVisibleTileCoords(latLonBounds: LatLonBounds, tileBounds: TileBounds, zoom: Double, wrap: Boolean): List<TileCoord>
Link copied to clipboard
open fun hide()
Link copied to clipboard
open fun onAdd(context: Context, controller: MapController)

abstract fun onAdd()

Called when the observer is attached with no tile-layer context (simple registration).

abstract fun onAdd(context: RenderContext<Any>, tileLayer: TileLayer, controller: MapboxMapController)

Called when the observer is attached with render context and owning tile layer / controller.

Link copied to clipboard
abstract fun onClick()

Map tap / click routed from the gestures plugin.

Link copied to clipboard
open override fun onHidden()

Observer or host layer became hidden.

Link copied to clipboard
abstract suspend fun onMove()

Invoked while the map camera is moving (per frame or throttled).

Link copied to clipboard
abstract suspend fun onMoveEnd()

Invoked once when a camera movement settles.

Link copied to clipboard
abstract fun onMoveStart()

First callback when a gesture or programmatic camera change begins.

Link copied to clipboard
open fun onReady()
Link copied to clipboard
abstract fun onRemove()

Called when the observer is removed from the map; release GL or listeners here.

Link copied to clipboard
abstract fun onResize()

Host view size or map drawable size changed.

Link copied to clipboard
open fun onSourceMetadata()

Called when the data source's metadata has been loaded.

Link copied to clipboard
open override fun onVisible()

Observer or host layer became visible.

Link copied to clipboard
abstract fun prerender(elapsedTime: Double)
Link copied to clipboard
inline fun <EventType : Event> EventSource.publisher(eventType: Class<EventType>): Flow<EventType>
Link copied to clipboard
abstract fun queryFeatures(zoomVar: Int, latTile: Int, lonTile: Int, latPix: Int, lonPix: Int, queryLon: Double? = null, queryLat: Double? = null): Any?
Link copied to clipboard
open fun refresh(clear: Boolean = false)

Refreshes the layer by re-rendering it. If a complete refresh is needed including triggering the associated data source to reload, then pass an argument of true when calling the method. Otherwise, existing cached data will be used when the layer is re-rendered.

Link copied to clipboard
abstract fun render(texUnit: <Error class: unknown class><String, Int>, camera: Camera)
Link copied to clipboard
open fun setNeedsUpdate(force: Boolean = false)

Flags the layer as dirty so that it is updated during the next render frame.

Link copied to clipboard
open fun show()
Link copied to clipboard
inline suspend fun <EventType : Event> EventSource.subscribe(eventType: Class<EventType>, crossinline handler: (EventType) -> Unit)
Link copied to clipboard
Link copied to clipboard
abstract suspend fun update()

Periodic or explicit update tick (animation, data refresh hooks).