EncodedGridVectorTileSource

class EncodedGridVectorTileSource(val id: String, encodedSource: XweatherEncodedTileSource, gridSpacing: Double, iconEncodedColorScale: ColorScaleOptions? = null, iconEncodedScalarMax: Double? = null, val timelineMeldInvalidatesMapboxTiles: Boolean = true, instancedQuadMonochromeWhite: Boolean = false) : VectorTileSource

Sidecar vector source for gridded/symbol layers backed by XweatherEncodedTileSource.

Mapbox requests geometry per tile via requestTile; features are placed on a global Web Mercator world-pixel grid (512×2^zoom) for even screen spacing. Wind uses G/B u/v (atan2(u,-v); sampleFieldsFromEncodedRgb). Maritime *_dir.fill (instancedQuadMonochromeWhite) uses blue-only scalar degrees like JS EXPRESSION_ANGLE (norm * 360 - 180, wrapped to 0–360°).

Constructors

Link copied to clipboard
constructor(id: String, encodedSource: XweatherEncodedTileSource, gridSpacing: Double, iconEncodedColorScale: ColorScaleOptions? = null, iconEncodedScalarMax: Double? = null, timelineMeldInvalidatesMapboxTiles: Boolean = true, instancedQuadMonochromeWhite: Boolean = false)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var bounds: LatLonBounds?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val eventDispatcher: EventDispatcher
Link copied to clipboard
open override val id: String

The unique identifier for the data source.

Link copied to clipboard
open val isEncoded: Boolean
Link copied to clipboard
Link copied to clipboard
open override var isReady: Boolean

Indicates whether the data source is ready to be used by consuming layers, which may be false if data has not been loaded from a remote source yet or the data has not been fully prepared for rendering.

Link copied to clipboard
Link copied to clipboard
open override val kind: DataSourceKind

type in MapsGL JS

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override var tileCache: TileCache<DataType>
Link copied to clipboard
open var tileManager: TileRequestManager<VectorData>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Mapbox symbol overlays need timeline meld invalidation so custom-geometry tiles refetch blended icons. Instanced GL wind barbs meld on the GPU (com.xweather.mapsgl.anim.Timeline.dataMeld) and skip this work.

Link copied to clipboard
open override var timeRange: ClosedRange<Date>?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun abortTile(x: Int, y: Int, z: Int)
Link copied to clipboard
open override fun addConsumer(consumer: DataSourceConsumer)

Adds a map layer as a consumer of the data source.

Link copied to clipboard
fun addToAnimationQueue(inputString: String)
Link copied to clipboard
fun adjustDateBySeconds(dateString: String, offsetSeconds: Long): String?

Used by prepareTileRequest() to increment or decremnet the time and reformate it for sources with time offets

Link copied to clipboard
fun applyIconColorOptions(scale: ColorScaleOptions?, encodedScalarMax: Double?)

Rebuilds the CPU palette used for instanced wind barb/arrow RGB when SamplePaint.colorScale or SamplePaint.encodedScalarNormMax changes. Safe to call when reusing a cached gridVector sidecar source.

Link copied to clipboard
suspend fun buildInstancedWindBufferDualPhase(coords: List<TileCoord>, mapZoom: Double, visibleGeoBounds: VisibleGeoBounds?, maxInstances: Int, viewportGridMarginWorldPx: Double = 0.0, viewportExtraEastFraction: Double = 0.0): Pair<FloatArray, Int>

Packed instanced wind barbs: endpoint phase A and B only (no Timeline.dataMeld in sampling). Matches encoded raster layers: the GPU applies dataMeld each frame so timeline crossfade stays smooth without rebuilding this buffer at playback frame rate.

Link copied to clipboard
open fun contains(coord: TileCoord): Boolean
Link copied to clipboard
fun <DataType : TileData> TileSource<DataType>.contains(coord: TileCoord): Boolean
Link copied to clipboard
open suspend override fun fetchMetadata(startDate: Date?, endDate: Date?): Result<Unit>

Returns the metadata for the source, which can be loaded from a remote source.

Link copied to clipboard
open override fun getMetadataURL(): URL?
Link copied to clipboard
open override fun getTileData(coord: TileCoord): Any?
Link copied to clipboard
fun <DataType : TileData> TileSource<DataType>.init(id: String, authenticator: Authenticator<MediaSession.Token>?)
Link copied to clipboard
fun inspectorSampleMaritimeDirDeg(lon: Double, latDeg: Double, mapZoom: Double): Float?

Data inspector for maritime *_dir.fill: bilinear sample at lon/latDeg using the same placement zoom as buildInstancedWindBufferDualPhase (stablePlacementZoomInt\(mapZoom\)), then vector-blend phases like the GPU. Nearest-neighbor tile bytes in EncodedTileLayer do not match instanced sampling.

Link copied to clipboard
fun intervalToURLTime(intervalTime: String): String

convert from \"2025-04-22T03:49:31Z\" to 20250422030000

Link copied to clipboard
open override fun invalidate()
Link copied to clipboard

Timeline-only invalidation: keep cached placement geometry, refresh only sampled icon properties.

Link copied to clipboard
fun makeTileURL(coord: TileCoord, variables: Map<String, Any>?): URL
Link copied to clipboard
suspend fun mergeFeaturesForTiles(coords: List<TileCoord>, mapZoom: Double, visibleGeoBounds: VisibleGeoBounds?): List<Pair<TileCoord, Feature>>

Same feature generation as the Mapbox sidecar path, merged for OpenGL instanced drawing (no Mapbox vector layer).

Link copied to clipboard
Link copied to clipboard
fun onTileError(tile: TileType, error: Error)
Link copied to clipboard
suspend fun parseTile(tile: TileType, data: ByteArray, headers: <Error class: unknown class><Any, Any>?): Bitmap
Link copied to clipboard
inline fun <EventType : Event> EventSource.publisher(eventType: Class<EventType>): Flow<EventType>
Link copied to clipboard
open override fun removeConsumer(layerId: String)

Removes a map layer as a consumer of the data source.

Link copied to clipboard
Link copied to clipboard
open suspend override fun requestTile(x: Int, y: Int, z: Int, mapZoomForDensity: Double?, visibleGeoBounds: VisibleGeoBounds?): VectorData?
Link copied to clipboard
open suspend override fun requestTiles(coord: TileCoord, options: TileRequestOptions, currentDate: String, fromAnimation: Boolean, intervals: List<String>?): Any
Link copied to clipboard
fun setBatchInvalidateFunction(batchInvalidateFunction: (List<Triple<Int, Int, Int>>) -> Unit?)
Link copied to clipboard
fun setInvalidateFunction(invalidateFunction: (Int, Int, Int) -> Unit?)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline suspend fun <EventType : Event> EventSource.subscribe(eventType: Class<EventType>, crossinline handler: (EventType) -> Unit)
Link copied to clipboard
fun syncGridSpacingFromPaint(authoredSpacing: Double, displayDensity: Float)

JS GridPaint.spacing is in logical px; instanced gridded placement uses authored × density × 0.5 (same density convention as com.xweather.mapsgl.renderers.GridLayerRenderer icon sizing). Safe when reusing a cached sidecar: bumps spacing and invalidates placement caches when the effective value changes.

Link copied to clipboard