mapbox / mapbox/mapbox-plugins-android
Line manager won't show lines
まだ誰も着手していません。
- 主要言語
- 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)
)
)
}
}
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず Android 6.0–7.0 で、最初に LineManager を使用し、次に GeoJsonSource と LineLayer を使用して、addOrEditRouteLines 経由で報告内容を再現します。ソースを更新した後に一時的に表示されて消えることを確認します。データが変化する場合も含め、更新後もルートラインが表示されたままになれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- android, kotlin
- 領域
- mobile-dev
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 32/100