Skip to content

Commit 9187d50

Browse files
dzinadgithub-actions[bot]
authored andcommitted
NAVAND-6445: add LocationIndicator3DConfig#emissiveStrength
GitOrigin-RevId: 6ada7ed07808e811f18569625a16c643dd844a48
1 parent 9a7b8c5 commit 9187d50

File tree

23 files changed

+143
-129
lines changed

23 files changed

+143
-129
lines changed

base/api/current.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,7 +1379,6 @@ package com.mapbox.navigation.base.route {
13791379
field public static final String INPUT_ERROR = "INPUT_ERROR";
13801380
field public static final String NETWORK_ERROR = "NETWORK_ERROR";
13811381
field public static final String RESPONSE_PARSING_ERROR = "RESPONSE_PARSING_ERROR";
1382-
field public static final String ROUTER_RECREATION_ERROR = "ROUTER_RECREATION_ERROR";
13831382
field public static final String ROUTE_CREATION_ERROR = "ROUTE_CREATION_ERROR";
13841383
field public static final String THROTTLING_ERROR = "THROTTLING_ERROR";
13851384
field public static final String UNKNOWN_ERROR = "UNKNOWN_ERROR";
@@ -1390,7 +1389,6 @@ package com.mapbox.navigation.base.route {
13901389
field public static final String INPUT_ERROR = "INPUT_ERROR";
13911390
field public static final String NETWORK_ERROR = "NETWORK_ERROR";
13921391
field public static final String RESPONSE_PARSING_ERROR = "RESPONSE_PARSING_ERROR";
1393-
field public static final String ROUTER_RECREATION_ERROR = "ROUTER_RECREATION_ERROR";
13941392
field public static final String ROUTE_CREATION_ERROR = "ROUTE_CREATION_ERROR";
13951393
field public static final String THROTTLING_ERROR = "THROTTLING_ERROR";
13961394
field public static final String UNKNOWN_ERROR = "UNKNOWN_ERROR";

base/src/main/java/com/mapbox/navigation/base/route/RouterFailureType.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@ annotation class RouterFailureType {
5454
*/
5555
const val RESPONSE_PARSING_ERROR = "RESPONSE_PARSING_ERROR"
5656

57-
/**
58-
* Indicates that router was recreated for some internal reason.
59-
*/
60-
const val ROUTER_RECREATION_ERROR = "ROUTER_RECREATION_ERROR"
61-
6257
/**
6358
* Error has an unknown type
6459
*/

changelog/unreleased/bugfixes/11200.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog/unreleased/bugfixes/11274.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog/unreleased/bugfixes/11276.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

changelog/unreleased/features/11151.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

driver-notification/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ android {
4141

4242
dependencies {
4343

44-
implementation dependenciesList.mapboxSdkTurf
4544
implementation project(':navigation')
4645
testImplementation dependenciesList.androidxTestJunit
4746
testImplementation dependenciesList.coroutinesTestAndroid

driver-notification/src/main/java/com/mapbox/navigation/driver/notification/internal/SlowTrafficSegment.kt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.mapbox.navigation.driver.notification.internal
22

33
import androidx.annotation.RestrictTo
4-
import com.mapbox.geojson.Point
54
import kotlin.time.Duration
65

76
/**
@@ -28,10 +27,4 @@ data class SlowTrafficSegment(
2827
val distanceMeters: Double,
2928
val freeFlowDuration: Duration,
3029
val duration: Duration,
31-
// Note: it is mutable only as an optimization, in order not to create too many Lists
32-
// during object's construction.
33-
internal val _points: MutableList<Point> = mutableListOf(),
34-
) {
35-
36-
val points: List<Point> get() = _points
37-
}
30+
)

driver-notification/src/main/java/com/mapbox/navigation/driver/notification/internal/SlowTrafficSegmentsFinder.kt

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ package com.mapbox.navigation.driver.notification.internal
22

33
import androidx.annotation.RestrictTo
44
import com.mapbox.api.directions.v5.models.RouteLeg
5-
import com.mapbox.core.constants.Constants
6-
import com.mapbox.geojson.Point
75
import com.mapbox.navigation.base.trip.model.RouteProgress
8-
import com.mapbox.navigation.utils.internal.geometryPoints
96
import kotlinx.coroutines.Dispatchers
107
import kotlinx.coroutines.withContext
118
import kotlin.time.Duration
@@ -16,15 +13,9 @@ import kotlin.time.Duration.Companion.seconds
1613
*
1714
* Note: The core logic is computationally intensive as it iterates through potentially thousands
1815
* of geometry points
19-
*
20-
* @param extractPoints for testing purposes only ([geometryPoints] is a static function)
2116
*/
2217
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
23-
class SlowTrafficSegmentsFinder(
24-
private val extractPoints: (RouteLeg) -> List<Point> = {
25-
it.geometryPoints(Constants.PRECISION_6)
26-
},
27-
) {
18+
class SlowTrafficSegmentsFinder {
2819

2920
/**
3021
* Scans the route, starting from the user's current progress, to find continuous
@@ -76,7 +67,7 @@ class SlowTrafficSegmentsFinder(
7667
0
7768
}
7869

79-
val geometry = Geometry.of(leg, extractPoints(leg)) ?: Geometry.Companion.EMPTY
70+
val geometry = Geometry.Companion.of(leg) ?: Geometry.Companion.EMPTY
8071
var currentSegment: SlowTrafficSegment? = null
8172

8273
for (geometryIndex in firstGeometryIndex until geometry.size) {
@@ -126,35 +117,25 @@ class SlowTrafficSegmentsFinder(
126117
// Applying conversion of the speed from km/h -> m/s
127118
geometry.distance(geometryIndex) * KM_PER_H_TO_M_PER_SEC_RATE / legFreeFlowSpeed
128119
}
129-
130120
0.0 < this.distanceMeters -> {
131121
// Adding average duration based on the previous geometry
132122
val avgTimePerMeter =
133123
this.freeFlowDuration.inWholeSeconds.toDouble() / this.distanceMeters
134124
geometry.distance(geometryIndex) * avgTimePerMeter
135125
}
136-
137126
else -> 0.0
138127
}
139-
140128
return this.copy(
141129
freeFlowDuration = this.freeFlowDuration + freeFlowDurationSec.seconds,
142130
duration = this.duration + geometry.duration(geometryIndex),
143131
distanceMeters = this.distanceMeters + geometry.distance(geometryIndex),
144132
geometryRange = geometryRange.first..geometryIndex,
145-
).apply {
146-
// Each geometry consists of 2 points
147-
if (_points.isEmpty()) {
148-
_points.add(geometry.point(geometryIndex))
149-
}
150-
_points.add(geometry.point(geometryIndex + 1))
151-
}
133+
)
152134
}
153135

154136
private fun List<IntRange>.rangeOf(congestion: Int?) = firstOrNull { it.contains(congestion) }
155137

156138
private companion object {
157-
158139
// Calc time with seconds:
159140
// dist_m / speed_km_h = dist_m / (speed_km_h * 1000 / 3600) = dist_m * 3.6 / speed_km_h = duration_sec
160141
private const val KM_PER_H_TO_M_PER_SEC_RATE = 3.6
@@ -169,29 +150,20 @@ private class Geometry(
169150
private val durations: List<Double>,
170151
private val freeFlowSpeeds: List<Int?>,
171152
private val congestions: List<Int?>,
172-
private val points: List<Point>,
173153
) {
174-
175154
val size: Int = listOf(
176155
distances.size,
177156
durations.size,
178157
freeFlowSpeeds.size,
179158
congestions.size,
180159
).min()
181-
182160
fun distance(index: Int): Double = distances[index]
183161
fun duration(index: Int): Duration = durations[index].seconds
184162
fun freeFlowSpeed(index: Int): Int? = freeFlowSpeeds[index]
185163
fun congestion(index: Int): Int? = congestions[index]
186164

187-
/**
188-
* Note: there will be `size + 1` number of points, because each geometry consists of 2 points.
189-
*/
190-
fun point(index: Int): Point = points[index]
191-
192165
companion object {
193-
194-
fun of(leg: RouteLeg, points: List<Point>): Geometry? {
166+
fun of(leg: RouteLeg): Geometry? {
195167
val legDistances = leg.annotation()?.distance() ?: return null
196168
val legDurations = leg.annotation()?.duration() ?: return null
197169
val legFreeFlowSpeeds = leg.annotation()?.freeflowSpeed() ?: return null
@@ -202,10 +174,9 @@ private class Geometry(
202174
legDurations,
203175
legFreeFlowSpeeds,
204176
legCongestions,
205-
points,
206177
)
207178
}
208179

209-
val EMPTY = Geometry(emptyList(), emptyList(), emptyList(), emptyList(), emptyList())
180+
val EMPTY = Geometry(emptyList(), emptyList(), emptyList(), emptyList())
210181
}
211182
}

driver-notification/src/test/kotlin/com/mapbox/navigation/driver/notification/internal/SlowTrafficSegmentsFinderTest.kt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package com.mapbox.navigation.driver.notification.internal
33
import com.mapbox.api.directions.v5.models.DirectionsRoute
44
import com.mapbox.api.directions.v5.models.LegAnnotation
55
import com.mapbox.api.directions.v5.models.RouteLeg
6-
import com.mapbox.geojson.Point
76
import com.mapbox.navigation.base.internal.utils.Constants
87
import com.mapbox.navigation.base.internal.utils.Constants.CongestionRange.HEAVY_CONGESTION_RANGE
98
import com.mapbox.navigation.base.internal.utils.Constants.CongestionRange.SEVERE_CONGESTION_RANGE
@@ -20,15 +19,7 @@ class SlowTrafficSegmentsFinderTest {
2019
private val lowCongestion = Constants.CongestionRange.LOW_CONGESTION_RANGE.middle
2120
private val heavyCongestion = HEAVY_CONGESTION_RANGE.middle
2221
private val severeCongestion = SEVERE_CONGESTION_RANGE.middle
23-
private val finder = SlowTrafficSegmentsFinder(
24-
extractPoints = {
25-
// We don't really care about the specific points
26-
leg ->
27-
List(leg.annotation()!!.distance()!!.size + 1) {
28-
Point.fromLngLat(10.0, 20.0)
29-
}
30-
},
31-
)
22+
private val finder = SlowTrafficSegmentsFinder()
3223

3324
@Test
3425
fun `finds single slow segment in middle of leg`() = runBlocking {

0 commit comments

Comments
 (0)