Skip to content

Remove the unused K-D tree and hex cell registry - #20

Merged
wf9a5m75 merged 1 commit into
developfrom
chore/remove-kdtree
Nov 5, 2026
Merged

wf9a5m75 merged 1 commit into
developfrom
chore/remove-kdtree

Conversation

@wf9a5m75

@wf9a5m75 wf9a5m75 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

公開 API の破壊的変更です。 同じ削除を android-sdk-core と js-sdk-core でも進めています。

削除するもの

  • KDTree(Sources/MapConductorCore/geocell/KDTree.swift)
  • HexCellRegistry と RegistryStats(Sources/MapConductorCore/geocell/HexCellRegistry.swift)
  • HexCellWithDistance(上 2 つの戻り値にしか使われていなかった)
  • MarkerManager.findByIdPrefix(_:) と、それのためだけにあった cellRegistry / ensureCellRegistryLocked()、メモリ見積もりの hex レジストリ分
  • Tests/MapConductorCoreTests/KDTreeRadiusTests.swift、MarkerManagerDestroyTests の findByIdPrefix アサーション
  • api/MapConductorCore.api.swift から上記の宣言

HexGeocell / HexCell / HexGeocellProtocol などは残します。MarkerManager ほかが今も geocell を受け取っているためです。

理由

f6d85c8(2026-09-05、"Give iOS the same marker grid index...")で MarkerManager の空間検索は MarkerGridIndex に移りました。それ以降 HexCellRegistry を作るのは MarkerManager.findByIdPrefix の遅延構築だけで、その findByIdPrefix には呼び出し元がありません(SDK の各モジュール、サンプル、ドキュメントのどこにも無く、テストのアサーション 1 箇所だけ)。KDTree は HexCellRegistry からしか使われていません。使われていない公開 API を残すとプラットフォーム間で形がずれていくので、移植ではなく削除で揃えます。

確認

  • xcodebuild build-for-testing -scheme mapconductor-core -destination 'generic/platform=iOS' → ** TEST BUILD SUCCEEDED **
  • grep: KDTree|HexCellRegistry|RegistryStats|HexCellWithDistance|findByIdPrefix は、ios-sdk 配下の他モジュール(*.swift / *.md)と new-design のドキュメントで 0 件。他モジュールが参照していないので、そちらのビルドは確認していません。
  • API ベースライン: ローカルの Xcode(27.2)は api/TOOLCHAIN(27.0)と違うため、scripts/api-surface.sh dump の出力をそのまま置くとコンパイラ由来の差分が混ざります。そこで手で宣言を消し、develop と本ブランチの .swiftinterface を同じ手順(BUILD_LIBRARY_FOR_DISTRIBUTION=YES、iOS Simulator 向け)で生成して、その差分が手編集の差分と完全に一致することを確かめました。
  • テストはシミュレータで実行していません。 ローカルの CoreSimulator が Xcode より古く(更新には管理者権限が要る)シミュレータが使えないこと、swift test は TilePng.xcframework に macOS スライスが無く macOS で動かないことが理由です。今回は削除のみなので、ビルドが通ることで確認としています。

Since f6d85c8 moved MarkerManager's spatial queries onto MarkerGridIndex,
HexCellRegistry has only been built lazily by MarkerManager.findByIdPrefix,
and nothing calls findByIdPrefix: no SDK module, sample or doc, only one
assertion in MarkerManagerDestroyTests. KDTree existed only to back the
registry, and HexCellWithDistance and RegistryStats only to carry their
results.

Delete KDTree, HexCellRegistry, RegistryStats, HexCellWithDistance and
MarkerManager.findByIdPrefix, along with the lazy registry plumbing in
MarkerManager and its share of the memory estimate. HexGeocell, HexCell
and HexGeocellProtocol stay; MarkerManager and others still take a
geocell.

This is a breaking change to the public API; the baseline drops exactly
those declarations. The same removal is being made in android-sdk-core
and js-sdk-core.
@wf9a5m75
wf9a5m75 merged commit 5965f15 into develop Nov 5, 2026
2 checks passed
@wf9a5m75
wf9a5m75 deleted the chore/remove-kdtree branch November 5, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant