Gpkg Cached Elevation Source Factory
Elevation source factory that pairs a GeoPackage cache with an optional upstream TileSource. Owns the source-format → storage-format transcoding end-to-end.
On cache miss the factory fetches bytes from networkSource (decoded via outputFormat) and writes them into the gpkg in the storage layout dictated by isFloat:
isFloat = true→ TIFF-Float32 blob,gpkg_2d_gridded_tile_ancillary.scale = 1,offset = 0. Lossless for Float32 sources; widening for Int16 sources.isFloat = false→ PNG-Int16 blob with per-tile(scale, offset)packed from the in-memoryFloatBufferdirectly — the lossy step is the 16-bit quantization ((max - min) / 65535per code), never a WorldWindShortArrayrounding step. Int16 sources are written as-is withscale = 1, offset = 0.
Read path is the inverse: PNG with non-trivial scale/offset decodes to a FloatBuffer preserving the storage precision; PNG with (1, 0) decodes to a ShortBuffer; TIFF-Float32 decodes to a FloatBuffer. The single ShortArray conversion that WorldWind's render pipeline requires happens downstream in ElevationDecoder.decodeBuffer, not inside this factory.
Set networkSource = null for offline replay (cache hits served, misses return null).
Constructors
Properties
Unique elevation source factory content type name
When true, the factory never calls networkSource — cache hits are served as usual; cache misses return null from fetchElevationData. Toggleable at runtime so a single layer can flip between online and offline modes without re-wiring its source factory. Shares the earth.worldwind.layer.cache.OfflineToggleable interface with earth.worldwind.layer.cache.CachedTileSource so app-level offline toggles dispatch generically.
Invoked (off the render thread, with the tile's (matrix ordinal, column, row)) after a stale tile is re-downloaded; the coverage wires this to drop the tile's cached array, bump its timestamp, and request a redraw so the tessellator re-pulls the fresh tile.
Functions
Bulk-download path: bypass isCacheOnly and force a network fetch + persist on cache miss. When overrideCache is true, also skip the cache hit short-circuit so every tile is re-downloaded. See earth.worldwind.layer.cache.CachedElevationSourceFactory.fetchAndCacheTile for the motivating contract.