Skip to content

Commit 4be844b

Browse files
stanis-kgithub-actions[bot]
authored andcommitted
Set geojson buffer from 128 to 32 for EV, route line and maneuver arrows (#10039)
* Set buffer to 32 to EV, route line and maneuver arrows geojson * Add changelog GitOrigin-RevId: c51c81defd4ca13fbc21d1ae5930864bf16542bd
1 parent 9a8c82d commit 4be844b

4 files changed

Lines changed: 16 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Decrased excessively high GeoJSON buffer size from 128 to 32 to improve the memory footprint.

ui-maps/src/main/java/com/mapbox/navigation/ui/maps/internal/route/line/MapboxRouteLineUtils.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,6 +1273,7 @@ internal object MapboxRouteLineUtils {
12731273
"maxzoom" to Value(16),
12741274
"lineMetrics" to Value(useLineMetrics),
12751275
"tolerance" to Value(tolerance),
1276+
"buffer" to Value(32L),
12761277
)
12771278
val recreateSource = source == null || !sourcePropertiesCompatible(id, expectedProperties)
12781279
if (recreateSource) {

ui-maps/src/main/java/com/mapbox/navigation/ui/maps/route/arrow/RouteArrowUtils.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,15 @@ internal object RouteArrowUtils {
9999
geoJsonSource(RouteLayerConstants.ARROW_SHAFT_SOURCE_ID) {
100100
maxzoom(16)
101101
tolerance(options.tolerance)
102+
buffer(32)
102103
}.bindTo(style)
103104
}
104105

105106
if (!style.styleSourceExists(RouteLayerConstants.ARROW_HEAD_SOURCE_ID)) {
106107
geoJsonSource(RouteLayerConstants.ARROW_HEAD_SOURCE_ID) {
107108
maxzoom(16)
108109
tolerance(options.tolerance)
110+
buffer(32)
109111
}.bindTo(style)
110112
}
111113

ui-maps/src/test/java/com/mapbox/navigation/ui/maps/internal/route/line/MapboxRouteLineUtilsTest.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,13 +555,15 @@ class MapboxRouteLineUtilsTest {
555555
"maxzoom" to Value(16),
556556
"lineMetrics" to Value(true),
557557
"tolerance" to Value(options.tolerance),
558+
"buffer" to Value(32L),
558559
)
559560
val expectedWaypointSourceProperties = hashMapOf(
560561
"type" to Value("geojson"),
561562
"sharedCache" to Value(false),
562563
"maxzoom" to Value(16),
563564
"lineMetrics" to Value(false),
564565
"tolerance" to Value(options.tolerance),
566+
"buffer" to Value(32L),
565567
)
566568
val style = mockk<Style> {
567569
every { styleSourceExists(any()) } returns true
@@ -596,6 +598,8 @@ class MapboxRouteLineUtilsTest {
596598
"lineMetrics" to Value(false),
597599
"tolerance" to Value(options.tolerance),
598600
"data" to Value("{}"),
601+
"buffer" to Value(32L),
602+
599603
)
600604
val expectedLineSourceProperties = hashMapOf(
601605
"type" to Value("geojson"),
@@ -604,6 +608,7 @@ class MapboxRouteLineUtilsTest {
604608
"lineMetrics" to Value(true),
605609
"tolerance" to Value(options.tolerance),
606610
"data" to Value("{}"),
611+
"buffer" to Value(32L),
607612
)
608613
listOf(
609614
hashMapOf(
@@ -613,6 +618,7 @@ class MapboxRouteLineUtilsTest {
613618
"lineMetrics" to Value(true),
614619
"tolerance" to Value(options.tolerance),
615620
"data" to Value("{}"),
621+
"buffer" to Value(32L),
616622
),
617623
hashMapOf(
618624
"type" to Value("geojson"),
@@ -621,6 +627,7 @@ class MapboxRouteLineUtilsTest {
621627
"lineMetrics" to Value(true),
622628
"tolerance" to Value(options.tolerance),
623629
"data" to Value("{}"),
630+
"buffer" to Value(32L),
624631
),
625632
hashMapOf(
626633
"type" to Value("geojson"),
@@ -629,6 +636,7 @@ class MapboxRouteLineUtilsTest {
629636
"lineMetrics" to Value(false),
630637
"tolerance" to Value(options.tolerance),
631638
"data" to Value("{}"),
639+
"buffer" to Value(32L),
632640
),
633641
hashMapOf(
634642
"type" to Value("geojson"),
@@ -637,6 +645,7 @@ class MapboxRouteLineUtilsTest {
637645
"lineMetrics" to Value(true),
638646
"tolerance" to Value(options.tolerance + 0.5),
639647
"data" to Value("{}"),
648+
"buffer" to Value(32L),
640649
),
641650
).forEach { existingLineSourceProperties ->
642651
val style = mockk<Style> {
@@ -689,6 +698,7 @@ class MapboxRouteLineUtilsTest {
689698
"lineMetrics" to Value(true),
690699
"tolerance" to Value(options.tolerance),
691700
"data" to Value("{}"),
701+
"buffer" to Value(32L),
692702
)
693703
val expectedWaypointSourceProperties = hashMapOf(
694704
"type" to Value("geojson"),
@@ -697,6 +707,7 @@ class MapboxRouteLineUtilsTest {
697707
"lineMetrics" to Value(false),
698708
"tolerance" to Value(options.tolerance),
699709
"data" to Value("{}"),
710+
"buffer" to Value(32L),
700711
)
701712
listOf(
702713
hashMapOf(
@@ -706,6 +717,7 @@ class MapboxRouteLineUtilsTest {
706717
"lineMetrics" to Value(false),
707718
"tolerance" to Value(options.tolerance + 0.5),
708719
"data" to Value("{}"),
720+
"buffer" to Value(32L),
709721
),
710722
).forEach { existingWaypointSourceProperties ->
711723
val style = mockk<Style> {

0 commit comments

Comments
 (0)