CachedGeometry

@Serializable
sealed class CachedGeometry

Platform-neutral geometry envelope for feature cache rows. Platform implementations convert to/from their native geometry (mil.nga.sf on JVM, JSON on JS). Z is altitude in meters.

Pinned SerialNames decouple the cache wire format from the class FQN so package moves don't invalidate every cache file (kotlinx-serialization's default discriminator is the FQN).

Inheritors

Types

Link copied to clipboard
@Serializable
@SerialName(value = "GeometryCollection")
data class GeometryCollection(val geometries: List<CachedGeometry>) : CachedGeometry

A heterogeneous collection of geometries belonging to one feature (GeoJSON GeometryCollection, GPKG GEOMETRYCOLLECTION). Consumers fan it out recursively.

Link copied to clipboard
@Serializable
@SerialName(value = "LineString")
class LineString(val xy: DoubleArray, val z: DoubleArray? = null) : CachedGeometry

A polyline / polygon ring stored as flat primitive arrays rather than one Point object per vertex — dense WFS/OSM geometry is mostly thousands of vertices per ring, and the object-per- vertex graph was the dominant decode-time allocation (the GC-pressure source). xy is interleaved [lon0, lat0, lon1, lat1, …] in degrees (size 2 * vertexCount); z is the per-vertex altitude in meters parallel to the vertices, or null for a 2D ring (clamp to ground). The closing vertex may or may not be present.

Link copied to clipboard
@Serializable
@SerialName(value = "MultiLineString")
data class MultiLineString(val lines: List<CachedGeometry.LineString>) : CachedGeometry

N independent line strings sharing one feature (GeoJSON MultiLineString, GPKG MULTILINESTRING).

Link copied to clipboard
@Serializable
@SerialName(value = "MultiPoint")
data class MultiPoint(val points: List<CachedGeometry.Point>) : CachedGeometry

N independent points sharing one feature (GeoJSON MultiPoint, GPKG MULTIPOINT).

Link copied to clipboard
@Serializable
@SerialName(value = "MultiPolygon")
data class MultiPolygon(val polygons: List<CachedGeometry.Polygon>) : CachedGeometry

A composite of N independent polygons that belong to one feature (GeoJSON MultiPolygon, GPKG MULTIPOLYGON). Consumers fan it out into N renderables that share one properties map.

Link copied to clipboard
@Serializable
@SerialName(value = "Point")
data class Point(val x: Double, val y: Double, val z: Double? = null) : CachedGeometry
Link copied to clipboard
@Serializable
@SerialName(value = "Polygon")
data class Polygon(val rings: List<CachedGeometry.LineString>) : CachedGeometry

First ring is outer; remaining rings are holes. Closing vertex may or may not be present.

Functions

Link copied to clipboard

Envelope-center (longitude, latitude) of this geometry — a deterministic representative point. Used to assign a feature to a single tile (the one containing its center), so a geometry that straddles a tile boundary renders in exactly one tile instead of every tile its envelope touches.