TilePyramid

TilePyramid.kt

Adapted from IOS version.

Author

Jason Suto on 12/18/23.

Constructors

Link copied to clipboard
constructor(layer: TileLayer)

Types

Link copied to clipboard
interface Collection

Vestigial marker interface carried over from the iOS port's Collection-protocol conformance (see the class-level "Adapted from IOS version" note). Not currently implemented by TilePyramid or any other type in this codebase.

Link copied to clipboard

Vestigial marker interface carried over from the iOS port's Dictionary-protocol conformance (see the class-level "Adapted from IOS version" note). Not currently implemented by TilePyramid or any other type in this codebase.

Link copied to clipboard
interface Sequence

Vestigial marker interface carried over from the iOS port's Sequence-protocol conformance (see the class-level "Adapted from IOS version" note). Not currently implemented by TilePyramid or any other type in this codebase.

Properties

Link copied to clipboard
lateinit var fallbackOptions: TileRequestOptions

The TileRequestOptions captured by ensureFormattedDate the first time it runs for this pyramid, retained for later fallback requests.

Link copied to clipboard

The bracketed ISO-8601 UTC date string (see bracketedRasterInterval) resolved by ensureFormattedDate; null until the first request pass runs.

Link copied to clipboard
val key: String

Cache-scoping key combining this layer's account id and secret, identifying which account's credentials this pyramid's tile data was downloaded under.

Link copied to clipboard
val maxIntervals: Int = 8

Legacy per-layer interval cap; not consulted elsewhere in this class (superseded by the global caps in Timeline).

Link copied to clipboard

The TileCache.memUsage value observed on the last checkAndClearMemory call, used to detect memory-usage changes.

Link copied to clipboard

Convenience accessor for this pyramid's tileSource's TileCache.

Link copied to clipboard

The TileSource backing this pyramid; delegates to (and stays in sync with) TileLayer.source.

Functions

Link copied to clipboard

Tracks TileCache.memUsage (updating memUsageLast) and logs it whenever it changes. The actual cache-trimming logic below is currently commented out, so this is presently a no-op beyond logging/bookkeeping.

Link copied to clipboard

Enables coord in pyramid syntax; delegates to tileSource's own containment check.

Link copied to clipboard
operator fun TilePyramid<DataType>.get(coord: TileCoord): Tile<DataType>?

Enables pyramid[coord] syntax; delegates to tileCache's indexed lookup.

Link copied to clipboard

True if this list is already in non-decreasing order. Used defensively to verify a layer's valid-time list before binarySearch, which silently returns wrong results on unsorted input.

Link copied to clipboard
suspend fun preflightEncodedNewPairCount(coords: List<TileCoord>, options: TileRequestOptions): Int

Read-only estimate of how many new encoded (coord×time) pairs would be queued for coords, using the same metadata, time filtering, and cache checks as requestTilesForDownload but without mutating caches, Timeline pending lists, or requesting bytes. Used to fix download % across multiple layers before any layer runs.

Link copied to clipboard
suspend fun requestTilesForDownload(coords: List<TileCoord>, options: TileRequestOptions, externalScope: CoroutineScope): Result<Unit>

Determine which tiles are already downloaded, and request the ones that aren't