TiledVectorLayer

abstract class TiledVectorLayer<C : Any>(levelSet: LevelSet, tileFactory: TileFactory, maxLoadedTiles: Int = 256, maxConcurrentFetches: Int = 4, displayName: String? = null, maxLoadedTileBytes: Long = 0, maxTileAdmitWeightPerFrame: Int = 0) : AbstractLayer, VectorLayer

Reusable base for tiled vector layers (WFS features, MVT vector tiles, OSM buildings). Owns the parts every such layer shares so they aren't reimplemented per layer:

  • Selection — a screen-space-error quadtree over a LevelSet (Tile.mustSubdivide + frustum culling), the same machinery the imagery layer uses; the tile scheme (geographic vs Web-Mercator slippy) is the caller's LevelSet/TileFactory.

  • Transitions — each frame doRender assembles a single non-overlapping cut: for every visible ground cell it draws the best-available tile, substituting a coarser ancestor (zoom-in) or finer resident descendants (zoom-out) while the ideal tile loads. A tile is RENDERED or REFINED, never both, so there is no blank gap and no double-paint of translucent fills.

  • Lifecycle — an LRU content cache, an in-flight pending set, exponential backoff, an off-thread fetch → render-thread drain channel, stale-while-revalidate invalidation, and globe-state invalidation.

Subclasses provide only the content type C and three things: how to loadTileContent, how to renderTileContent, and (if the content owns GPU buffers) how to release it in onContentEvicted. The thin per-frame seams beginFrame/endFrame/prepareTileForRender cover cross-tile passes (e.g. MVT label collision) and per-frame content tweaks (e.g. MVT line zoom-scale). Always close.

Type Parameters

C

the per-tile content type held in the cache (e.g. List<Renderable>, a batched tile).

Inheritors

Constructors

Link copied to clipboard
constructor(levelSet: LevelSet, tileFactory: TileFactory, maxLoadedTiles: Int = 256, maxConcurrentFetches: Int = 4, displayName: String? = null, maxLoadedTileBytes: Long = 0, maxTileAdmitWeightPerFrame: Int = 0)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Tile keys currently in fetch-failure backoff.

Link copied to clipboard

Screen-space-error knob: lower = finer (more, smaller on-screen tiles); higher = coarser.

Link copied to clipboard
open override var displayName: String?
Link copied to clipboard
open override var isDynamic: Boolean
Link copied to clipboard
open override var isEnabled: Boolean
Link copied to clipboard
open override var isPickEnabled: Boolean
Link copied to clipboard

Tiles currently resident in the content cache (visible + fallback).

Link copied to clipboard
open override var maxActiveAltitude: Double
Link copied to clipboard

Cap on launched-but-unfinished fetch Jobs (vs semaphore, which gates concurrent round-trips); bounds the queue so a huge changing cut can't pile up unbounded coroutines + HTTP/SSL → OOM. Over-cap tiles re-request a later frame.

Link copied to clipboard
open override var minActiveAltitude: Double
Link copied to clipboard
open override var opacity: Float
Link copied to clipboard

Tiles with a fetch coroutine in flight.

Link copied to clipboard
override val sector: Sector

Vector content bounding sector — real data availability can be smaller than the tile grid. Full sphere by default; tiled layers skip tiles outside it. Cache reopen narrows it from the persisted content bbox; bulk download widens and persists it. Mirrors earth.worldwind.globe.elevation.coverage.ElevationCoverage.sector.

Functions

Link copied to clipboard
abstract fun clone(): VectorLayer

Makes a fresh copy carrying only this layer's configuration; caches and fetch scope are not shared.

Link copied to clipboard
open fun close()

Cancel in-flight fetches, release GPU buffers, and free the caches. Idempotent.

Link copied to clipboard
open override fun getUserProperty(key: Any): Any?
Link copied to clipboard
open override fun hasUserProperty(key: Any): Boolean
Link copied to clipboard
Link copied to clipboard
open override fun putUserProperty(key: Any, value: Any): Any?
Link copied to clipboard
open override fun removeUserProperty(key: Any): Any?
Link copied to clipboard
open override fun render(rc: RenderContext)
Link copied to clipboard
fun VectorLayer.setOfflineOnly(offlineOnly: Boolean = true)

See setOfflineOnly on TiledImageLayer. Dispatches by VectorLayer subtype to reach the right source field. No-op for unknown subtypes.