mapbox / mapbox/mapbox-plugins-android
Line manager won't show lines
Personne n'a encore pris cette issue.
- Langage dominant
- Java
- Étoiles
- 242
- Forks
- 116
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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>) {
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)
)
)
}
}
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par reproduire le rapport via addOrEditRouteLines, d’abord avec LineManager, puis avec GeoJsonSource et LineLayer, sur Android 6.0–7.0. Observez la brève apparition et disparition après la mise à jour de la source ; c’est terminé lorsque les lignes d’itinéraire restent visibles après les mises à jour, y compris lorsque les données changent.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- android, kotlin
- Domaine
- mobile-dev
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 32/100