Vector Tile Layer
VectorTileLayer.kt
Author
Jason Suto 5/26/25
Constructors
Properties
Tile coordinates already queued for download by requestVisibleTiles this session.
The most recently computed tile bounds for this layer's viewport.
Scale factor derived from quality via the internal DataQuality lookup table, applied in zoomForVisibleTiles.
Coroutine scope used for this layer's background tile-download and prep work.
Optional ISO alpha-2 for COUNTRY base masks.
GLES stencil base mask kind for this layer (LAND/WATER/TRANSPORTATION/COUNTRY).
Selects vector draw path. VectorGraphicsBackend.CUSTOM_WEBGL_MESHES draws via com.xweather.mapsgl.renderers.VectorFillLayerRenderer / com.xweather.mapsgl.renderers.VectorLineLayerRenderer in a Mapbox custom GL layer with an invisible hook layer driving tile fetches. VectorGraphicsBackend.MAPBOX_STYLE_SPEC uses native Mapbox fill/line paint.
When true, glStencilMaskKind runs first (marine clip), then line-only stencilLayerMask layers are intersected on land (highways on land, not oceans).
Unique identifier for this layer within the map, used to look it up (e.g. via MapController).
Unimplemented on TileLayer.
Whether this layer needs to be redrawn; set via setNeedsUpdate.
Tile bounds computed prior to the current currentTileBounds.
The per-frame render state (paint style, renderables, elapsed time, zoom) passed to tileLayerRenderer.
The map controller this layer is attached to; set by onAdd when the layer is added to the map.
The paint/style configuration used to render this layer's data.
Tile bounds computed by the most recent requestVisibleTiles call, retained for later reference.
Manages this layer's tile download requests, tile cache, and per-source timeline/interval bookkeeping.
Data quality/resolution to request and render tiles at. Defaults to DataQuality.exact.
The tile data source this layer downloads and renders tiles from.
Handlers registered via MapLayer.addSourceEventHandler to react to this layer's data-source events.
Optional custom multi-layer stencil mask (JS-style mask.layerIds).
When true, com.xweather.mapsgl.map.mapbox.MapboxMapController.addToMap does not add a Mapbox vector style layer; geometry is used only for GLES stencil (custom mask coordinator, geo mask paths).
Whether the tile bounds have changed since they were last checked.
The GL renderer that builds and draws this layer's tile geometry each frame.
HTTP request options (method, headers, reload/pending behavior, radar flag, etc.) used for this layer's tile downloads.
The time series associated with this layer, if any.
This layer's time-series animation configuration (mode, clamp, valid date range, interval count, etc.).
Whether this layer is currently waiting on a tile download to complete.
Whether this layer was waiting on a tile download as of the previous check.
Offset applied to the map's zoom level when computing which tile z/x/y to request and draw for this layer.
Functions
Registers listener to receive this layer's TileLayerEventType events. No-op if already registered.
Returns the time series data provider to use for animating the layer, if any.
Returns the current tile-index bounds (zoom/left/right/top/bottom) covering this layer's visible viewport, recomputing from bounds only when the render bounds are dirty or the zoom tier has changed since the last call.
Returns the features from this layer that intersect the current on‑screen viewport.
Used in TileTimeSeriesDataProvider. Needs testing
Recieves LatLonBounds and zoom level
True when this layer draws via MapsGL custom GL meshes rather than Mapbox style layers. Used by com.xweather.mapsgl.layers.tile.TileLayer to skip the encoded-tile prefetch path.
Not yet implemented on TileLayer; simple no-context registration is not used by this layer.
Not yet implemented on TileLayer; this render-context/owning-layer overload is used by renderer classes instead.
Attaches this layer to controller, wires up its GL renderer, and starts observing the timeline's play/pause state.
Notifies tileLayerRenderer that the layer was hidden and marks it dirty so it updates accordingly.
Called once a camera movement settles. Re-syncs bounds, and either re-binds already-resident tiles (when a full-range playback load is held resident and the timeline isn't playing) or requests visible tiles for the settled viewport, skipping the request while playback is already handling a coalesced refresh.
No-op on TileLayer; this layer does not need to react to the start of a camera move.
Like onMove, but always calls requestVisibleTiles for the new bounds, without the playback/zoom-tier gating onMove applies to limit download churn during timeline playback.
Called when the data source's metadata has been loaded.
Notifies tileLayerRenderer that the layer became visible and marks it dirty so it redraws.
Warms MVT cache for custom GL mesh layers when CustomGeometrySource has not yet delivered tiles for the current viewport (e.g. fire observation icons on fires_obs).
Same viewport and coord selection as requestVisibleTiles, but only counts how many new encoded (coord×time) pairs would be queued — no HTTP, no cache or pending-list mutation. Summed across layers in MapController.refreshVisibleLayers to set a fixed download % denominator.
Refreshes layerRenderContext's renderables/paint style for this frame, then delegates to tileLayerRenderer.
Queries features for this layer within a given geometry.
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.
Unregisters a previously added TileLayerEventListener; no-op if not registered.
Refreshes MVT/triangulation for the current viewport during timeline playback (pan/zoom).
Marks this layer dirty so it redraws on the next frame, propagates the request to tileLayerRenderer, and asks mapController to redraw. Does nothing if the layer is currently hidden, unless force is true.