mapbox / mapbox/mapbox-plugins-android

Line manager won't show lines

Đang mở
#1,155 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Java
Star
242
Fork
116
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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)
)
)
}
}

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện báo cáo thông qua addOrEditRouteLines, trước tiên với LineManager rồi với GeoJsonSource và LineLayer, trên Android 6.0–7.0. Quan sát việc xuất hiện và biến mất trong thời gian ngắn sau khi cập nhật source; được xem là hoàn tất khi các đường tuyến vẫn hiển thị sau các lần cập nhật, kể cả khi dữ liệu thay đổi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
android, kotlin
Lĩnh vực
mobile-dev
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
32/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.