Repository navigation
Draw many polylines as raster tiles (PolylineTiler) - #10
Merged
Merged
Conversation
Natively drawn markers are reported by MarkerIngestionEngine once the renderer has created them; markers that went into the tiles are reported after the tile layer has been handed to the map.
Give the polyline controller a PolylineTiler whose template is upserted as the "mc-polyline-tiles" raster layer (removed by id when nothing is tiled), as the polygon tiles are. The content's polylineTilingOptions reach the tiler on every content update; a change re-routes the current list. The tile layer stacks at the bottom of the polyline band (OverlayStacking.rasterKey).
MCTextureLoader gives the PNG to MTKTextureLoader as is (straight alpha) but the raster pipeline blends premultiplied colour and clips each channel to the alpha. The polygon tiles' 35 % blue (51, 102, 255, 89) came out as (51, 89, 89): a faint grey-green, the squares almost invisible on the stacking check. Tiles from the local tile server are now fetched with loadDataAsync and turned into a texture with TextureHolder(premultipliedData:). Remote map tiles keep the SDK's path. Checked on an iPad: the polygon pixels now match 35 % blue over the map (mean error 0.8/255).
Contributor
Author
|
向け先を |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
なぜ
ポリゴンと同じように、ポリラインも数万本を渡せるようにするためです。ボストン市内の道路(54,645 本・234,765 頂点)をネイティブの線で描くと、iOS の Google で全 onAdded まで 114 秒・1.5 GB、Android の Google は Java ヒープが尽きて落ちます。ポリゴンのタイル化(
feat/polygon-tiling)と同じ仕組みで、多数のポリラインをラスタータイルとして描きます。設計の要点(web・Android・iOS で同じ)
Polylines(states):Polygonsと同じ形のまとめて渡す部品。そのインスタンスが足した id だけを足し引きするので、複数のPolylines/Polylineが同じ地図で共存できます(iOS は既存のPolylines(_:)のまま)。PolylineTilingOptions/PolylineTileSet/PolylineTiler/PolylineController.tiler: 名前と既定値(2,000 本以上または頂点 50,000 以上)はポリゴンと 1 対 1。レイヤー id はmc-polyline-tiles。ShapeTileSet/ShapeTiler/ShapeTileRendererに移し、Polygon*はその上の薄い層になりました。公開 API は追加のみです。polylineTilingOptions、Android は compose のPolylineTiling(options)、iOS はMapViewContent.polylineTilingOptions/PolylineTiling要素。このリポジトリで変えたこと
PolylineTilerを付け、テンプレートをmc-polyline-tilesのラスターレイヤーとして upsert(何も無いときは removeById)します。polylineTilingOptionsを content 更新ごとに tiler へ渡し、変わったら今の一覧を振り分け直します。OverlayStacking.rasterKey)。検証(iOS、追従後の 4ea1d59)
scripts/api-surface.sh check): core と googlemaps 以外の 10 プロバイダ ok。core は +18 / -0(PolylineTiling・MapViewContent.polylineTilingOptions・PolylineTilingOptionsほか)、プロバイダは変化なし。挙動の変わる所
PolylineManager.find、タイルでもネイティブでも同じ)。許容距離 = 既存の指の大きさ(tapTolerance)+ 線幅 / 2。太い線は縁から指の大きさ以内であたります。複数あたれば最も近い線。外接矩形で先に候補を絞るので、5 万本でも毎タップ全点をなめません。返す位置(線上の最近点)は今までどおりです。OverlayStacking.rasterKey(styleLayerId:))。追加の順に関係なく、ポリラインのタイルがネイティブのポリラインの下に入ります。SDK の制約で重なり順を守れないもの
確認できていないもの
OutOfMemoryErrorで落ちます(GoogleMap.addPolyline→PolylineOptions.writeToParcel、Java ヒープが上限 512 MB に到達)。1 本ずつ Parcel に詰めて GMS に渡すためで、タイル化ありなら落ちません。このため Google のタイル化あり/なしの時間は並べられていません。OpenMobileMapsDriverConformanceTest1 件(develop のLog.isLoggableがモックされていない)、iOS ArcGIS・TomTom の単体テスト各 1 件、iOS Google のテストターゲットのビルド(GoogleMaps が iOS 17 を要求)。base について
ポリラインの差分だけをレビューできるように、base は
feat/overlay-on-added(feat/polygon-tiling+ onAdded + ボストンのサンプル。そのリポジトリに無い場合は develop)にしています。feat/polygon-tilingは develop にマージ済みなので、feat/overlay-on-addedが develop に入ったら、この PR の base を develop に付け替えてください。追従は rebase せず merge commit で行いました(
origin/feat/polygon-tiling→feat/overlay-on-added→feat/polyline-tiling)。マージの順番
各リポジトリの
feat/overlay-on-added→(base を develop に付け替えて)ios-sdk-core → 各プロバイダ → 親。プロバイダは ios-sdk-core のPolylineTiler/ 重なり順を使うので core が先です。マージはレビューのうえで判断してください(この PR はまだマージしていません)。親の PR: MapConductor/ios-sdk#18