Package-level declarations

Types

Link copied to clipboard

Where the spatial map reads elevation from: the terrain store in the app, a synthetic source in tests.

Link copied to clipboard
data class LatLon(val latitude: Double, val longitude: Double)

A latitude and longitude in degrees.

Link copied to clipboard
class SpatialBezelMesh(innerRadius: Float, width: Float, bottom: Float, top: Float, chamfer: Float, segments: Int = 128)

A raised ring with chamfered top edges: inner wall, inner chamfer, flat top, outer chamfer, outer wall. Each face has its own vertices so the edges stay crisp.

Link copied to clipboard
data class SpatialCircle(val latitude: Double, val longitude: Double, val radiusMeters: Double)

The round area the spatial map shows. The terrain is a disk of this radius; the elevation grid, the map image and terrain downloads cover bounds, the square around it.

Link copied to clipboard
data class SpatialFrame(val bounds: GeoBounds)

The local frame a spatial map is built in: meters from the center of a geographic box, with x east, y up and z south (north is away from a viewer standing south of the model). The box is small enough that a flat-earth conversion around its center is accurate to well under a meter, which is finer than any mesh position.

Link copied to clipboard
class SpatialHeightGrid(val columns: Int, val rows: Int, val heights: FloatArray, val covered: BooleanArray, val baseElevation: Float, val maxElevation: Float)

Elevations sampled on a regular lon/lat grid over a box: the ground the terrain mesh is built on.

Link copied to clipboard

Which circle the spatial map shows. The circle is rebuilt only when it has to be: a node outside it, or the mesh having shrunk well inside it, so the terrain is not rebuilt on every refresh.

Link copied to clipboard
class SpatialModelTransform(val frame: SpatialFrame, val baseElevation: Double, maxElevation: Double, verticalExaggeration: Double = 1.5, modelSize: Vec3 = Vec3(1f, 0.3f, 1f))

Scales the local meters frame into the model: the box fits a footprint of about a meter and relief is exaggerated so a tabletop model still reads as hills.

Link copied to clipboard
data class SpatialNodeSnapshot(val id: Long, val coordinate: LatLon, val isConnectedRadio: Boolean = false, val shortName: String = "", val color: Int = 0, val isOnline: Boolean = true, val isFavorite: Boolean = false, val viaMqtt: Boolean = false, val hopsAway: Int = -1, val signal: SpatialSignal? = null, val isInfrastructure: Boolean = false, val lastHeard: Int = 0)

What the spatial map needs to know about one mesh node.

Link copied to clipboard
data class SpatialOfflineRegion(val id: String, val bounds: GeoBounds, val hasTerrain: Boolean, val hasBasemap: Boolean, val managedBy: String? = null, val createdMillis: Long = 0, val totalByteCount: Long = 0)

A downloaded offline map region, as the spatial map's coverage checks see it.

Link copied to clipboard
class SpatialOverlayMesh(val positions: FloatArray, val normals: FloatArray, val uvs: FloatArray, val indices: IntArray)

The buffers of a mesh drawn over the terrain. Positions and normals are xyz triples, uvs are uv pairs.

Link copied to clipboard

How well the connected radio hears a node, weakest first.

Link copied to clipboard
data class SpatialStorageLimits(val maxRegionBytes: Long = 512L * 1024 * 1024, val maxTotalBytes: Long = 3L * 1024 * 1024 * 1024)

Storage caps the download decision measures against.

Link copied to clipboard

What the spatial map should do to keep its box covered by an offline map: streets and terrain. The app keeps one full offline map of its own and grows or moves it as the mesh changes; the user's regions count as coverage but are never changed.

Link copied to clipboard
data class SpatialTerrainBackoff(val target: GeoBounds? = null, val failures: Int = 0, val retryAfterMillis: Long? = null, val cancelled: Boolean = false)

Retry rules for automatic downloads, per target area: a failure waits 10 min · 2^n before the next try and stops after three; a cancel stops automatic tries for that area this session.

Link copied to clipboard

Why the spatial map can't download its map for the whole box.

Link copied to clipboard

How much of a box the downloaded terrain covers.

Link copied to clipboard
class SpatialTerrainGeometry(source: SpatialHeightGrid, val transform: SpatialModelTransform, skirtDepth: Float = DEFAULT_SKIRT_DEPTH)

The terrain mesh plus the height field it was built from, in model units. The mesh is a disk inscribed in the box: a regular grid with the vertices outside the circle moved onto it, and a round skirt below the edge so the model reads as a solid table. Buffers are flat: positions and normals hold xyz triples, textureCoordinates uv pairs.

Link copied to clipboard
class SpatialVolumeFit(volumeWidth: Float, volumeDepth: Float, modelDiskRadius: Float)

How the round map sits in the volume: centered on the baseplate and filling its footprint, less a margin around the rim for the bezel and its handles. Resizing the volume resizes the map.

Link copied to clipboard
class SpatialWheelDrag(val startYaw: Float, x: Float, z: Float)

A drag that follows the hand around the middle of the table, like turning a wheel.

Link copied to clipboard

Sizes of the compass bezel and the handles around the disk, in meters.

Link copied to clipboard

The wheel's turn as it is shown, stepped once per frame. A drag sets where the wheel is heading; each frame eases the shown turn toward it, and a release with some speed keeps the wheel spinning until friction stops it. Times are in seconds, angles in radians.

Link copied to clipboard

Turns a sideways hand movement into a spin. A look-and-pinch drag moves the hand only a few centimeters, so following its angle around the middle barely turned the map; this turns the map by the distance moved, in the direction that carries the grabbed point along with the hand.

Link copied to clipboard

Zooming the spatial map into the geography. The table keeps its size; the circle it shows gets smaller around a center, and the terrain is rebuilt for it. Zoom 1 is the whole mesh.

Link copied to clipboard

Tile-grid math the height grid samples through.

Link copied to clipboard
data class Vec2(val x: Float, val y: Float)

A point or vector on the table plane, x east and y toward the viewer.

Link copied to clipboard
data class Vec3(val x: Float, val y: Float, val z: Float)

A point or vector in meters or model units.

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun GeoBounds.expandedForTerrain(ratio: Double = 0.15, minPadMeters: Double): GeoBounds

Pads each side by max(minPadMeters, ratio × the box's size) and snaps outward to z10 tile edges, so small moves of the mesh give the same area and nothing is downloaded again.

Link copied to clipboard
Link copied to clipboard

Width and height in meters, measured across the middle of the box.

Link copied to clipboard