Package-level declarations

Types

Link copied to clipboard
class LayerOpacityStore(mapPrefs: MapPrefs, dispatchers: CoroutineDispatchers)

The user's per-layer opacity, for every layer either engine can draw.

Link copied to clipboard

The imported-overlay model, shared by every renderer.

Link copied to clipboard
data class MapLayerItem(val id: String = Uuid.random().toString(), val name: String, val uri: String? = null, val isVisible: Boolean = true, val layerType: LayerType, val isNetwork: Boolean = false, val createdAt: Long? = null, val isRefreshing: Boolean = false, val refreshToken: Int = 0)
Link copied to clipboard

Platform-agnostic handle for opening the picker.

Link copied to clipboard
class MapLayersManager(dispatchers: CoroutineDispatchers, httpClient: HttpClient, mapPrefs: MapPrefs, layersDir: Path = mapLayersDirectory(), fileSystem: FileSystem = mapLayerFileSystem())

Owner of the imported map-layer list, its on-disk persistence, and the import plumbing.

Link copied to clipboard
class PickedMapFile(val displayName: String, val extensionOrMime: String?, val read: suspend () -> ByteArray?)

A file the user picked, handed to MapLayersManager by whatever picker the platform uses.

Properties

Link copied to clipboard

On-disk extension marking a saved coverage estimate, so LayerType.COVERAGE survives a restart.

Link copied to clipboard
const val LAYER_OPACITY_OPAQUE: Float = 1.0f

Per-layer opacity, keyed the way each kind of layer is already identified elsewhere.

Link copied to clipboard

Ceiling on the bytes one KMZ may inflate to, summed across every entry read from it.

Functions

Link copied to clipboard

Decodes stored entries, dropping any that no longer parse.

Link copied to clipboard
fun displayNameFromFileName(fileNameWithoutExtension: String): String

Recover a layer's display name from its on-disk file name (sans extension).

Link copied to clipboard

Encodes for storage, dropping every fully-opaque layer.

Link copied to clipboard
fun Uri.getFileName(context: Context): String

Resolve a display file name for this URI, querying the content resolver for content:// URIs. Untrusted providers (share/open-with from other apps) can throw or return a null display name, so guard both and fall back to the URI's last path segment.

Link copied to clipboard

True if this starts with the zip magic bytes, meaning a nominally-LayerType.KML source (.kml and .kmz both resolve to that one type) is actually a KMZ archive. Sniffed rather than taken from the file extension, which a content resolver can get wrong.

Link copied to clipboard

Whether url is one MapLayersManager.addNetworkMapLayer will accept: an explicit, parseable http(s) URL.

Link copied to clipboard
fun layerFileName(displayName: String, extension: String): String

Build the on-disk file name for a layer from its displayName.

Link copied to clipboard
actual fun mapLayerFileSystem(): FileSystem

The file system layers are stored on.

expect fun mapLayerFileSystem(): FileSystem

The file system layers are stored on.

actual fun mapLayerFileSystem(): FileSystem

The file system layers are stored on.

Link copied to clipboard
actual fun mapLayersCacheDirectory(): Path

The app cache, which Android may clear under pressure — exactly right for a reconvertible copy.

expect fun mapLayersCacheDirectory(): Path

Where converted copies of imported layers are cached (KML rendered down to GeoJSON, for the renderer that has no KML source). Disposable, unlike mapLayersDirectory — losing it only costs a reconversion.

actual fun mapLayersCacheDirectory(): Path

Where converted copies of imported layers are cached (KML rendered down to GeoJSON, for the renderer that has no KML source). Disposable, unlike mapLayersDirectory — losing it only costs a reconversion.

Link copied to clipboard
actual fun mapLayersDirectory(): Path

App-internal storage, so imported layers are private to the app and removed with it.

expect fun mapLayersDirectory(): Path

Where imported layer files are kept for this platform.

actual fun mapLayersDirectory(): Path

Alongside the desktop database, which already lives in ~/.meshtastic.

Link copied to clipboard

This layer's opacity, or fully opaque when the user has never moved its slider.

Link copied to clipboard

Returns a launcher that asks the user for a map file and hands it back as a PickedMapFile.

Returns a launcher that asks the user for a map file and hands it back as a PickedMapFile.

Returns a launcher that asks the user for a map file and hands it back as a PickedMapFile.

Link copied to clipboard
fun resolveLayerType(extensionOrMime: String?): LayerType?

Resolve a file extension or MIME subtype (e.g. geojson, vnd.geo+json) to a LayerType, or null if unsupported.

Link copied to clipboard
fun String.toLocalPath(): Path

The local path behind a file:// URI (or a bare path, which is what a hand-made item may carry). Public because the renderer's conversion cache also stores its files under file:// URIs and reads them back through this.

Link copied to clipboard

Wrap a picked content:// as a PickedMapFile for the layer store.