Repository navigation
Show ground images on ArcGIS again, and keep rasters under them - #27
Merged
Merged
Conversation
…r layer GroundImage drew nothing on ArcGIS, in 3D and 2D. Its WebTiledLayer still built the levels of detail on a 256 reference when handed 512-pixel tiles, so level L covered the ground of level L-1 and ArcGIS asked for "z=15, x=9618" over Eswatini, where z=15 is x=19235. The ground image tile provider draws the tile the URL names, which is outside the image, so every tile came back transparent (fetched from the device: 512x512, all alpha 0). The raster layer stopped doing this in d0f4819, after ArcGIS 300 (the bump to 300.1.0 in the 1.3.0 release) no longer needed the reading for SceneView. The ground image kept its own copy of the old ladder. Both now take the resolution and scale from one place, WebMercatorTileLevels, so the two cannot drift again. Measured on the TB520FU: the University of Eswatini image is back inside its frame on ArcGIS 3D and 2D. Raster, polygon, marker and heatmap pages look the same before and after. WebMercatorTileLevels is internal; the API dump lists it like ArcGIS2DTiltEmulation, so it is added to the baseline (additions only).
On ArcGIS 3D a raster added after a ground image went on top of it: the ground image's band key could not be found again (logged as "?" for the very layer registered a moment earlier), so the raster's insertion point was "none above" and it was appended. ArcGIS's Layer overrides equals and hashCode, and a WeakHashMap keyed on it does not reliably find the same layer again. The 2D map happened to work; the 3D one did not. The stacking table now holds layers by weak reference and looks them up with ===. It holds at most a few dozen entries, so a linear scan is fine. Measured on the TB520FU (stack check page, raster at 0.85 opacity under a checker ground image): before, in reverse order the checker showed only as a faint tint through the raster on 3D; after, it sits above the raster in both orders on 3D and 2D, under polygons, circles and polylines as before. IdentityWeakTable is internal; the API dump lists it, so it is added to the baseline (additions only).
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.
なぜ
ArcGIS で GroundImage が表示されていませんでした(3D・2D とも)。
いつから壊れたかを android-sdk の履歴で切り分けました。
原因は GroundImage の
WebTiledLayerに渡すレベルの梯子です。512px のタイルなのに、解像度を 256px 基準のまま刻んでいたため、level L のタイルが L-1 の広さを覆い、ArcGIS 300 は番号だけ 1 段深い (z, x, y) を要求していました(例: エスワティニ上空でz=15, x=9618。正しくは z=15 なら x=19235)。GroundImageTileProviderは URL が指すタイルを素直に描くので、どのタイルも画像の外になり、全面透明でした(端末から取得したタイルは 512x512・アルファ 0)。200.x の SceneView は自前の 256px 格子で (col, row) を数えていたので、この読み替えで合っていました。ラスターレイヤーは d0f4819 で同じ問題を直していましたが、GroundImage は古い梯子のコピーを持ったまま残っていました。
何を変えたか
WebMercatorTileLevelsの 1 か所から取るようにして、片方だけ直す状態に戻らないようにしました。ArcGISOverlayStackingがWeakHashMap<Layer, …>で帯の鍵を持っていて、ArcGIS のLayerはequals/hashCodeを上書きしているため、直前に登録した層の鍵が引けないことがありました(ログでは同じ層が「鍵なし」になり、ラスターが一番上に足されていた)。弱参照で持ち、===で引く表に替えました。WebMercatorTileLevelsとIdentityWeakTableは internal です。API ダンプにはArcGIS2DTiltEmulationと同じく載るので、ベースラインに追加しました(追加のみ)。検証
WebMercatorTileLevelsTest(512px の level が 256px の level+1 と同じ地面を覆うこと等)とIdentityWeakTableTest(鍵のhashCodeが変わっても引けること等)を足しました。WebMercatorTileLevelsTestは、GroundImage が持っていた古い読み替え(512 のとき 256 基準)に戻すと 3 件中 2 件落ちます。testDebugUnitTestは全部通過。apiCheck: 残る差分は develop に既にあるArcGISMarkerControllerのコンストラクタのずれ(今回とは無関係)だけです。web について
web(react-for-arcgis)はこの PR では変更していません。最新の develop で example(
examples/basic、API キーは.envから vite 経由で読み込み)を Playwright で開き、ArcGIS 2D・3D とも、ラスターレイヤー(GSI の陰影起伏図)と GroundImage(University of Eswatini の画像が枠どおり)が表示されることを確かめました。確認できていないもの・残った課題
関連 PR
それぞれ独立していて、マージの順番の制約はありません。