mapbox / mapbox/mapbox-plugins-android

Line manager won't show lines

オープン
#1,155 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Java
スター
242
フォーク
116
PR マージ指標
30日以内にマージされた PR はありません

説明

On Android 6.0 - Android 7.0 (I've tested on those versions) the lines are not displayed.

On Android 10.0 lines are normally showed with exact same implementation as on Android 6.0 - Android 7.0 (not sure for 8.0 - 10.0 versions).

 lineManager = LineManager(map, this, style).apply {
        lineCap = Property.LINE_CAP_ROUND
 }

 points.map { line ->
        val lineOptions = LineOptions()
            .withLineColor(linesColor)
            .withLineWidth(3f)
            .withGeometry(
                LineString.fromLngLats(line.map { Point.fromLngLat(it.longitude, it.latitude) })
            )
        lines.add(lineManager.create(lineOptions))
 }

Then I've just noticed that the line appeared for a brief second and then disappeared.

Then I tried with a different approach:
I tried adding GeoJsonSource and LineLayer. Lines are shown, but when I update GeoJsonSource with different data, lines are hidden again 👎 When I load the exact same data as previously into GeoJsonSource, lines are shown again.

This is also happening on Android 6.0 - Android 7.0

fun addOrEditRouteLines(style: Style?, color: String, data: List<List<LatLng>>) {
    with(style ?: return) {
        (sources.find { it.id == DEFAULT_LAYER_LINES } as? GeoJsonSource)?.apply {
            (getLayer(DEFAULT_LAYER_LINES) as LineLayer).apply {
                withProperties(PropertyFactory.lineColor(color))
            }
        
        clearLines(style)
            setGeoJson(
                fromFeatures(
                    data.map { line ->
                        Feature.fromGeometry(
                            LineString.fromLngLats(line.map { Point.fromLngLat(it.longitude, it.latitude) })
                        )
                    }
                )
            )
            return
        }
        val routeLines = GeoJsonSource(
            DEFAULT_LAYER_LINES,
                fromFeatures(
                    data.map { line ->
                        Feature.fromGeometry(
                            LineString.fromLngLats(line.map { Point.fromLngLat(it.longitude, it.latitude) })
                        )
                    }
                )
        )
        addSource(routeLines)

        addLayer(
            LineLayer(DEFAULT_LAYER_LINES, DEFAULT_LAYER_LINES).withProperties(
                    PropertyFactory.lineWidth(3f),
                    PropertyFactory.lineColor(color),
                    PropertyFactory.lineCap(Property.LINE_CAP_ROUND)
            )
        )
    }
}

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず Android 6.0–7.0 で、最初に LineManager を使用し、次に GeoJsonSource と LineLayer を使用して、addOrEditRouteLines 経由で報告内容を再現します。ソースを更新した後に一時的に表示されて消えることを確認します。データが変化する場合も含め、更新後もルートラインが表示されたままになれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
android, kotlin
領域
mobile-dev
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
32/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。