Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
dependencies ▾

Modern-Apps.git / library / map / AGENTS.md

AGENTS.md3.6 KiBRenderedCodeRaw
1# AGENTS.md — library/map/ (':library:map')
2
3> Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `library/map/` + allowed shared modules. Do not root-scan.
4
5- Gradle: :library:map / dir: library/map/
6- Package roots present: (vector-map renderer — one package + Rust core)
7- Entry files: VectorMap.kt + MapScope.kt (no MainActivity/Route — library)
8- Deps: (none — no project dependencies by design)
9- Network: tile range fetches reach the host app's `NetworkClient` over JNI
10 (`NativeHttpBridge`, resolved at runtime from the app classpath — every map
11 host already depends on `:library:network` directly); the live
12 online/offline signal is injected per call site via `VectorMap(online = …)`
13 for the same reason. This module declares INTERNET itself.
14- Metadata: metadata_data/library-map.md (absent — libraries have none by design)
15- Rust: yes / screenshotTest: no
16
17## Overview
18**Purpose:** Offline vector-map renderer on a Rust core — Vulkan surface, layers/markers/routes/traffic, gestures, camera state. Declares INTERNET itself (tile fetches). Used by maps, weather, taxi, fooddelivery.
19**How to use:** `VectorMap` composable in a `MapScope` with `MapStyle` + `LayerOptions`; camera via `CameraState`; overlays for routes/markers/image layers; gestures via `MapGestures`. Tile/bridge work crosses JNI (`MapNative`).
20**Globe camera:** while the globe is active the same `CameraPosition.bearing`/`pitch` model applies in sphere terms — the two-finger twist rolls the sphere in its plane and the two-finger vertical drag tips it about its screen-east axis, both persisted by `CameraState` (pitch clamped to the flat map's `MAX_PITCH`). The view rotation is `globeViewRotate` (Kotlin `Projection`, mirrored by the native `globe_view_rotate` and the `*_globe` shaders); pan un-rolls by the bearing before rotating the sphere.
21**Entry points:** `VectorMap.kt` → `MapScope.kt` → `MapStyle.kt` → `SurfaceMapRenderer.kt`.
22**Gotchas:** Another agent is mid-refactor here (tile cache moved `tile/cache.rs` → `tile/cache/` dir, `MapTileCache` touched in maps/) — check `git status`/`git log` on this module before deep work; rendering bugs are usually Rust-side.
23
24## Key files
25- com/vayunmathur/library/map/VectorMap.kt
26- com/vayunmathur/library/map/MapScope.kt
27- com/vayunmathur/library/map/MapStyle.kt
28- com/vayunmathur/library/map/MapNative.kt — Rust bridge
29- com/vayunmathur/library/map/SurfaceMapRenderer.kt
30- com/vayunmathur/library/map/VulkanMapSurface.kt
31- com/vayunmathur/library/map/CameraState.kt
32- com/vayunmathur/library/map/MapRenderState.kt
33- com/vayunmathur/library/map/MapGestures.kt
34- com/vayunmathur/library/map/MapMarker.kt
35- com/vayunmathur/library/map/LayerOptions.kt
36- com/vayunmathur/library/map/RouteOverlay.kt
37- com/vayunmathur/library/map/RouteStyle.kt
38- com/vayunmathur/library/map/SurfaceMapOverlays.kt
39- com/vayunmathur/library/map/ImageOverlay.kt
40- com/vayunmathur/library/map/UserPuck.kt
41- com/vayunmathur/library/map/TrafficColorTable.kt
42- com/vayunmathur/library/map/GeoTypes.kt
43- com/vayunmathur/library/map/Mercator.kt
44- com/vayunmathur/library/map/Projection.kt
45- com/vayunmathur/library/map/FrameStatsOverlay.kt
46- Raster body globes (maps-only): `MapBody` in MapOptions.kt, `MoonTextures` holder in SurfaceMapFrame.kt, JNI `setBodyTextures`/`setMoonTextures` in MapNative.kt, Rust `bridge/moon.rs` + `vulkan/renderer/record_moon.rs`/`upload_moon.rs` (`BodyParams`: DEM packing, relief, ring radii/opacity) + `shaders/moon.frag` (disc + equatorial ring projection)
47
48## Verify (this module only)
49```
50./gradlew :library:map:compileDevKotlin
51./gradlew :library:map:lint
52```