Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
10a0a8d
Make bearing a clockwise map rotation (#5)
wf9a5m75 Sep 12, 2026
7951b9b
Pass declutterPx through to the marker tile renderer
wf9a5m75 Sep 21, 2026
6f8ee27
Put raster overlays under the basemap's labels
wf9a5m75 Sep 27, 2026
acf8da8
update dependencies (#6)
wf9a5m75 Oct 5, 2026
45f71e6
Update Play Services Maps to 20.1.0 and OkHttp to 5.5.1 (#7)
wf9a5m75 Oct 24, 2026
de90ac8
Vector style support (#8)
wf9a5m75 Oct 24, 2026
4e5599b
Add .claude/settings.json
wf9a5m75 Oct 28, 2026
7e655f7
Use the core reapplyStyle() for raster layers
wf9a5m75 Oct 29, 2026
b0dc193
Merge pull request #9 from MapConductor/fix/reapply-style-under-lock
wf9a5m75 Oct 29, 2026
131a70c
Redraw tiles once per burst of tiled-marker changes
wf9a5m75 Nov 5, 2026
b23d17d
Merge pull request #10 from MapConductor/perf/tiled-marker-update
wf9a5m75 Nov 6, 2026
5d22054
Keep the whole map design across configuration changes
wf9a5m75 Nov 7, 2026
2e21097
Merge pull request #11 from MapConductor/fix/saver-state
wf9a5m75 Nov 7, 2026
18f5187
Draw large polygon sets as raster tiles (PolygonTiler)
wf9a5m75 Nov 7, 2026
172c814
Destroy the MapView when the map leaves the composition
wf9a5m75 Nov 7, 2026
f02f641
Dispose the polygon tiler when the conductor is destroyed
wf9a5m75 Nov 7, 2026
f557259
Read the controller through the state base, which MapViewBase clears
wf9a5m75 Nov 8, 2026
2056aad
Extend core PolygonController for Mappls polygons
wf9a5m75 Nov 8, 2026
eafdc6e
Polygon conductor: move a tiled polygon to the GeoJSON layers when a …
wf9a5m75 Nov 8, 2026
848ba1d
Redraw markers after clearing them
wf9a5m75 Nov 8, 2026
c1c1c9d
Merge pull request #14 from MapConductor/fix/overlay-clear-order
wf9a5m75 Nov 8, 2026
c4cc9e9
Merge pull request #13 from MapConductor/fix/mapview-teardown
wf9a5m75 Nov 8, 2026
a5fe7fc
Merge develop into refactor/polygon-controller
wf9a5m75 Nov 8, 2026
8e5b8e9
Merge pull request #12 from MapConductor/refactor/polygon-controller
wf9a5m75 Nov 8, 2026
011fcf8
Clear strategy markers in clearOverlays()
wf9a5m75 Nov 8, 2026
53d00f3
Stack overlays by band, independent of add order and style reloads
wf9a5m75 Nov 8, 2026
c8903bd
Merge pull request #15 from MapConductor/fix/clear-strategy
wf9a5m75 Nov 8, 2026
768d797
Merge pull request #16 from MapConductor/fix/overlay-stacking-order
wf9a5m75 Nov 8, 2026
8573b87
Merge remote-tracking branch 'origin/develop' into feat/polygon-tiling
wf9a5m75 Nov 9, 2026
1d52e9d
Update the API baseline
wf9a5m75 Nov 9, 2026
5544ec9
Merge pull request #17 from MapConductor/feat/polygon-tiling
wf9a5m75 Nov 9, 2026
87cddcc
Draw large polyline sets as raster tiles (PolylineTiler)
wf9a5m75 Nov 9, 2026
045952c
Merge pull request #18 from MapConductor/feat/polyline-tiling
wf9a5m75 Nov 10, 2026
d31f26d
Support bulk Circles with raster tiles
wf9a5m75 Nov 11, 2026
72ac87b
Merge pull request #19 from MapConductor/feat/circles-bulk-cache
wf9a5m75 Nov 11, 2026
aa39643
Order markers with MarkerDrawOrder
wf9a5m75 Nov 11, 2026
10ba512
Reorder markers when the map rotates
wf9a5m75 Nov 11, 2026
08d150c
Merge pull request #20 from MapConductor/fix/marker-zindex-order
wf9a5m75 Nov 12, 2026
bf31187
Apply camera paddings and report fov on Mappls
wf9a5m75 Nov 12, 2026
d19d489
Merge remote-tracking branch 'origin/develop' into feat/camera-paddings
wf9a5m75 Nov 12, 2026
0221b30
Merge pull request #21 from MapConductor/feat/camera-paddings
wf9a5m75 Nov 12, 2026
a37cfdd
Emulate camera paddings by shifting the centre
wf9a5m75 Nov 12, 2026
e3447e3
Merge pull request #22 from MapConductor/fix/padding-emulation
wf9a5m75 Nov 12, 2026
75d5eee
Release 1.4.0
wf9a5m75 Nov 13, 2026
b14ab67
Merge pull request #23 from MapConductor/release/1.4.0
wf9a5m75 Nov 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"attribution": {
"commit": "",
"pr": ""
}
}
25 changes: 23 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,29 @@ jobs:
cache: 'gradle'

- name: Build core and compose locally
env:
HEAD_REF: ${{ github.head_ref }}
run: |
git clone --depth 1 https://github.com/MapConductor/android-sdk-core.git _core
# コア側に PR と同名のブランチがあるなら、そちらを組む。
#
# ここを default ブランチ固定にしていると、**コアの未マージな変更に追随する
# PR は永久に赤いまま**になる。実際 CameraBearing をコアへ足したとき、
# プロバイダ側の PR が 10 本まとめて Unresolved reference で落ちた。
# コアが先にマージされるまで待つ、という運用は取り込み順の事故を呼ぶので、
# 同名ブランチがあれば拾う形にしてある(無ければ従来どおり default)。
clone_matching() {
repo="$1"; dir="$2"
url="https://github.com/MapConductor/$repo.git"
if [ -n "$HEAD_REF" ] && git ls-remote --exit-code --heads "$url" "$HEAD_REF" >/dev/null 2>&1; then
echo "$repo: matching branch $HEAD_REF"
git clone --depth 1 --branch "$HEAD_REF" "$url" "$dir"
else
echo "$repo: default branch"
git clone --depth 1 "$url" "$dir"
fi
}

clone_matching android-sdk-core _core
cd _core
./gradlew --no-daemon publishToMavenLocal
cd ..
Expand All @@ -53,7 +74,7 @@ jobs:
}
EOF

git clone --depth 1 https://github.com/MapConductor/android-sdk-compose.git _compose
clone_matching android-sdk-compose _compose
cd _compose
./gradlew --no-daemon publishToMavenLocal
cd ..
Expand Down
80 changes: 54 additions & 26 deletions api/android-for-mappls.api

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ android {

defaultConfig {
minSdk = project.property("minSdk").toString().toInt()
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

Expand Down Expand Up @@ -82,8 +83,11 @@ dependencies {
}

testImplementation(libs.junit)
}

// Saver の保存 → 復元を実機の Bundle / Parcel で確かめる(SaverRoundTripTest)。
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
}

// Set project version for NMCP plugin
version = libraryVersion
Expand All @@ -92,9 +96,10 @@ val libraryDescription = "Mappls (MapmyIndia) implementation for MapConductor un

// Gradle 9.6 で `by tasks.registering` は非推奨(スクリプトコンパイルエラーになる)。
// googlemaps 等の既存モジュールは古い形のままなので、再コンパイル時に同じ問題が出る。
val javadocJar = tasks.register<Jar>("javadocJar") {
archiveClassifier.set("javadoc")
}
val javadocJar =
tasks.register<Jar>("javadocJar") {
archiveClassifier.set("javadoc")
}

afterEvaluate {
publishing {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ android.useAndroidX=true
kotlin.code.style=official
android.nonTransitiveRClass=true

compileSdk=35
compileSdk=37
minSdk=26
javaVersion=17
jvmTarget=17

libraryVersion=1.3.1
libraryVersion=1.4.0
android.generateSyncIssueWhenLibraryConstraintsAreEnabled=false
29 changes: 16 additions & 13 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
[versions]
composeLibs = "1.7.8"
mapplsSdk = "9.0.3"
coroutines = "1.9.0"
agp = "9.2.1"
kotlin = "2.0.21"

composeBom = "2025.02.00"
coreKtx = "1.16.0"
lifecycleRuntimeKtx = "2.8.7"
okhttp = "5.3.2"
playServicesMaps = "20.0.0"
activityCompose = "1.9.3"
composeLibs = "1.12.1"
# material3 は compose-ui とは別のバージョン系列。composeLibs(ui 系)を流用すると
# 存在しない material3:1.7.8 を要求してクラスパスごと解決に失敗する。
material3 = "1.4.0"
mapplsSdk = "9.0.4"
coroutines = "1.11.0"
agp = "9.4.1"
kotlin = "2.4.20"

composeBom = "2026.09.00"
coreKtx = "1.19.1"
lifecycleRuntimeKtx = "2.11.0"
okhttp = "5.5.1"
playServicesMaps = "20.1.0"
activityCompose = "1.13.0"
ktLint = "14.2.0"

junit = "4.13.2"
Expand All @@ -37,7 +40,7 @@ play-services-maps = { module = "com.google.android.gms:play-services-maps", ver

# Sample app
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
androidx-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "composeLibs" }
androidx-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3" }
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling", version.ref = "composeLibs" }

# Test
Expand Down
1 change: 0 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,3 @@ dependencyResolutionManagement {
}

rootProject.name = "android-for-mappls"

Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package com.mapconductor.mappls

import androidx.compose.runtime.saveable.Saver
import androidx.compose.runtime.saveable.SaverScope
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.mapconductor.core.features.GeoPoint
import com.mapconductor.core.map.AttributionRule
import com.mapconductor.core.map.MapCameraPosition
import com.mapconductor.core.map.MapUISettings
import org.junit.Assert.assertEquals
import org.junit.Assert.assertSame
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
import android.os.Bundle
import android.os.Parcel

/**
* 回転などの構成変更で state が [MapplsMapViewSaver] を通って作り直されても、デザイン(id・
* attributionRules ほか)と uiSettings・カメラが落ちないこと。Bundle は実機の Parcel を一度通す。
*/
@RunWith(AndroidJUnit4::class)
class MapplsMapViewSaverTest {
private val rules =
listOf(AttributionRule("© test"), AttributionRule("© ranged", minZoom = 3, maxZoom = 15))

private val camera =
MapCameraPosition(
position = GeoPoint(21.38, -157.93),
zoom = 12.0,
bearing = 20.0,
tilt = 10.0,
)

@Test
fun keepsDesignWithAttributionRules() {
val design = MapplsDesign(id = "contract-style", styleName = "contract_style_name", attributionRules = rules)
val state = MapplsViewState(mapDesignType = design, id = "mappls-1", cameraPosition = camera)
state.uiSettings = MapUISettings(rotateGesture = false, tiltGesture = false)

val restored = roundTrip(MapplsMapViewSaver().createSaver(), state)

// 以前は styleName しか保存しておらず、id は default に戻っていた。
assertEquals(design, restored.mapDesignType)
assertCommon(restored, "mappls-1")
}

@Test
fun keepsPresetDesign() {
val state = MapplsViewState(mapDesignType = MapplsDesign.StandardDay, id = "mappls-2")
assertEquals(MapplsDesign.StandardDay, roundTrip(MapplsMapViewSaver().createSaver(), state).mapDesignType)
}

private fun assertCommon(restored: com.mapconductor.core.map.MapViewStateInterface<*>, id: String) {
assertEquals(id, restored.id)
assertEquals(false, restored.uiSettings.rotateGesture)
assertEquals(false, restored.uiSettings.tiltGesture)
assertEquals(true, restored.uiSettings.scrollGesture)
assertEquals(12.0, restored.cameraPosition.zoom, 1e-9)
assertEquals(20.0, restored.cameraPosition.bearing, 1e-9)
assertEquals(21.38, restored.cameraPosition.position.latitude, 1e-9)
}

private fun <T : Any> roundTrip(
saver: Saver<T, Bundle>,
value: T,
): T {
val saved = with(saver) { SaverScope { true }.save(value) }!!
// 一度 Parcel に書いて読み戻す(プロセスが落ちたあとの復元と同じ経路)。
val parcel = Parcel.obtain()
try {
parcel.writeBundle(saved)
parcel.setDataPosition(0)
return saver.restore(parcel.readBundle(javaClass.classLoader)!!)!!
} finally {
parcel.recycle()
}
}
}
70 changes: 58 additions & 12 deletions src/main/java/com/mapconductor/mappls/MapCameraPosition.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package com.mapconductor.mappls

import com.mapconductor.core.features.GeoPoint
import com.mapconductor.core.map.CameraBearing
import com.mapconductor.core.map.MapCameraPosition
import com.mapconductor.core.map.MapCameraPositionInterface
import com.mapconductor.core.map.MapPaddings
import com.mapconductor.core.map.MapPaddingsInterface
import com.mapconductor.core.spherical.Spherical
import com.mapconductor.mappls.zoom.ZoomAltitudeConverter
import com.mappls.sdk.maps.camera.CameraPosition
Expand All @@ -11,19 +14,48 @@ import kotlin.math.cos
import kotlin.math.tan

private val converter = ZoomAltitudeConverter()

/**
* Mappls のカメラの縦方向の視野角(度)。Mappls は MapLibre Native 派生で、既定値は地図の大きさに
* よらず一定(焦点距離 = 地図の高さ × 1.5)。TB520FU で 36.9° を実測。
*/
internal const val MAPPLS_VERTICAL_FOV = 36.87

/** dp のパディング → Mappls の px のパディング(left, top, right, bottom)。 */
internal fun MapPaddingsInterface.toMapplsPadding(density: Float): DoubleArray =
doubleArrayOf(left * density, top * density, right * density, bottom * density)

/** Mappls の px のパディング(left, top, right, bottom)→ dp のパディング。 */
internal fun DoubleArray.toMapPaddings(density: Float): MapPaddings? {
if (size < 4 || density <= 0f) return null
return MapPaddings(
top = this[1] / density,
left = this[0] / density,
bottom = this[3] / density,
right = this[2] / density,
)
}

private const val NEGATIVE_TILT_TARGET_DISTANCE_SCALE = 1.83
private const val NEGATIVE_TILT_ZOOM_OFFSET_AT_MAX_TILT = -0.9

fun MapCameraPosition.toCameraPosition(): CameraPosition {
fun MapCameraPosition.toCameraPosition(): CameraPosition = toCameraPosition(density = null)

/**
* [density] があれば [MapCameraPosition.paddings] を Mappls のパディングとして渡す。
* Mappls はパディングを除いた領域の中央にカメラの中心を置き、tilt の遠近もエンジンが解く。
* Mappls のパディングは次に変えるまで残るので、null(未指定)のときは渡さない。
*/
internal fun MapCameraPosition.toCameraPosition(density: Float?): CameraPosition {
val padding = if (density != null) paddings?.toMapplsPadding(density) else null
if (tilt >= 0) {
return CameraPosition
.Builder()
.target(GeoPoint.from(position).toLatLng())
.zoom(ZoomAltitudeConverter.googleZoomToMapplsZoom(zoom))
.tilt(tilt)
.bearing(bearing)
// TODO:
// .padding(paddings?.toEdgeInsects())
.bearing(CameraBearing.toNativeHeading(bearing))
.apply { padding?.let { padding(it) } }
.build()
} else {
// tilt < 0: Mappls cannot represent an upward pitch directly.
Expand All @@ -37,17 +69,16 @@ fun MapCameraPosition.toCameraPosition(): CameraPosition {
cos(tiltAbsRad) *
tan(tiltAbsRad) *
NEGATIVE_TILT_TARGET_DISTANCE_SCALE
val target = Spherical.computeOffset(position, distanceForward, bearing)
val target = Spherical.computeOffset(position, distanceForward, CameraBearing.toNativeHeading(bearing))
val adjustedZoom = zoom + NEGATIVE_TILT_ZOOM_OFFSET_AT_MAX_TILT * (tiltAbsDeg / 60.0)

return CameraPosition
.Builder()
.target(target.toLatLng())
.zoom(ZoomAltitudeConverter.googleZoomToMapplsZoom(adjustedZoom))
.tilt(tiltAbsDeg)
.bearing(bearing)
// TODO:
// .padding(paddings?.toEdgeInsects())
.bearing(CameraBearing.toNativeHeading(bearing))
.apply { padding?.let { padding(it) } }
.build()
}
}
Expand All @@ -61,7 +92,9 @@ fun MapCameraPosition.Companion.from(cameraPosition: MapCameraPositionInterface)
zoom = cameraPosition.zoom,
bearing = cameraPosition.bearing,
tilt = cameraPosition.tilt,
paddings = cameraPosition.paddings,
visibleRegion = cameraPosition.visibleRegion,
fov = cameraPosition.fov,
)
}

Expand All @@ -70,21 +103,32 @@ fun CameraPosition.toMapCameraPosition() = toMapCameraPosition(logicalTiltHint =
internal data class MapplsCameraStateSnapshot(
val cameraPosition: CameraPosition,
val logicalTiltHint: Double?,
val density: Float? = null,
) {
fun toMapCameraPosition(): MapCameraPosition = cameraPosition.toMapCameraPosition(logicalTiltHint)
fun toMapCameraPosition(): MapCameraPosition = cameraPosition.toMapCameraPosition(logicalTiltHint, density)
}

internal fun CameraPosition.toMapCameraPosition(logicalTiltHint: Double?): MapCameraPosition {
internal fun CameraPosition.toMapCameraPosition(logicalTiltHint: Double?): MapCameraPosition =
toMapCameraPosition(logicalTiltHint, density = null)

/** [density] があれば Mappls のパディングを dp に直して paddings として返す。 */
internal fun CameraPosition.toMapCameraPosition(
logicalTiltHint: Double?,
density: Float?,
): MapCameraPosition {
val paddings = density?.let { d -> padding?.toMapPaddings(d) } ?: MapPaddings.Zeros
val pitch = tilt
val pitchAbsDeg = abs(pitch).coerceIn(0.0, 60.0)

if (logicalTiltHint == null || logicalTiltHint >= 0.0 || pitchAbsDeg == 0.0) {
return MapCameraPosition(
position = target?.toGeoPoint() ?: GeoPoint.fromLongLat(0.0, 0.0),
zoom = ZoomAltitudeConverter.mapplsZoomToGoogleZoom(zoom),
bearing = bearing,
bearing = CameraBearing.bearingFromNativeHeading(bearing),
tilt = pitch,
paddings = paddings,
visibleRegion = null,
fov = MAPPLS_VERTICAL_FOV,
)
}

Expand All @@ -104,8 +148,10 @@ internal fun CameraPosition.toMapCameraPosition(logicalTiltHint: Double?): MapCa
return MapCameraPosition(
position = originalPosition,
zoom = originalGoogleZoom,
bearing = bear,
bearing = CameraBearing.bearingFromNativeHeading(bear),
tilt = -pitchAbsDeg,
paddings = paddings,
visibleRegion = null,
fov = MAPPLS_VERTICAL_FOV,
)
}
Loading
Loading