From 59f2311bffadfed0392cfe056ee22efccfa69e8f Mon Sep 17 00:00:00 2001 From: Dzina Date: Thu, 19 Oct 2023 10:26:20 +0200 Subject: [PATCH] getAdasAttributes improvements --- libnavigation-core/api/current.txt | 6 ++++-- .../java/com/mapbox/navigation/core/adasis/ValueOnEdge.kt | 8 +------- .../java/com/mapbox/navigation/core/sensor/SensorData.kt | 6 ++++++ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/libnavigation-core/api/current.txt b/libnavigation-core/api/current.txt index 0511816d994..38ccd5d0747 100644 --- a/libnavigation-core/api/current.txt +++ b/libnavigation-core/api/current.txt @@ -430,10 +430,8 @@ package com.mapbox.navigation.core.adasis { } @com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI public final class ValueOnEdge { - method public double getPercentAlong(); method public float getShapeIndex(); method public double getValue(); - property public final double percentAlong; property public final float shapeIndex; property public final double value; } @@ -1269,6 +1267,10 @@ package com.mapbox.navigation.core.sensor { field public static final com.mapbox.navigation.core.sensor.SensorData.Weather.Condition.Snow INSTANCE; } + public static final class SensorData.Weather.Condition.WetRoad extends com.mapbox.navigation.core.sensor.SensorData.Weather.Condition { + field public static final com.mapbox.navigation.core.sensor.SensorData.Weather.Condition.WetRoad INSTANCE; + } + @com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI public fun interface UpdateExternalSensorDataCallback { method public void onResult(boolean result); } diff --git a/libnavigation-core/src/main/java/com/mapbox/navigation/core/adasis/ValueOnEdge.kt b/libnavigation-core/src/main/java/com/mapbox/navigation/core/adasis/ValueOnEdge.kt index 9f5db66642b..a73eab08002 100644 --- a/libnavigation-core/src/main/java/com/mapbox/navigation/core/adasis/ValueOnEdge.kt +++ b/libnavigation-core/src/main/java/com/mapbox/navigation/core/adasis/ValueOnEdge.kt @@ -9,14 +9,11 @@ import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI * Integer part is an index of edge segment and fraction is a position on the segment: * 0 - left point, 1 - right point, 0.5 - in the middle between the segment points. * Ex.: 3.5 means the middle the the 3rd segment on the Edge shape, shape has more then 4 points - * @param percentAlong Position along edge shape [0-1]. - * The value's added for compliance with Navigator interface, functionally it duplicates `shapeIndex` * @param value Floating point value, e.g. curvature in 1/m or slope as {elevation diff}/{horizontal length} */ @ExperimentalPreviewMapboxNavigationAPI class ValueOnEdge private constructor( val shapeIndex: Float, - val percentAlong: Double, val value: Double, ) { @@ -30,7 +27,6 @@ class ValueOnEdge private constructor( other as ValueOnEdge if (shapeIndex != other.shapeIndex) return false - if (percentAlong != other.percentAlong) return false if (value != other.value) return false return true @@ -41,7 +37,6 @@ class ValueOnEdge private constructor( */ override fun hashCode(): Int { var result = shapeIndex.hashCode() - result = 31 * result + percentAlong.hashCode() result = 31 * result + value.hashCode() return result } @@ -50,7 +45,7 @@ class ValueOnEdge private constructor( * Returns a string representation of the object. */ override fun toString(): String { - return "ValueOnEdge(shapeIndex=$shapeIndex, percentAlong=$percentAlong, value=$value)" + return "ValueOnEdge(shapeIndex=$shapeIndex, value=$value)" } internal companion object { @@ -59,7 +54,6 @@ class ValueOnEdge private constructor( fun createFromNativeObject(nativeObj: com.mapbox.navigator.ValueOnEdge) = ValueOnEdge( shapeIndex = nativeObj.shapeIndex, - percentAlong = nativeObj.percentAlong, value = nativeObj.value ) } diff --git a/libnavigation-core/src/main/java/com/mapbox/navigation/core/sensor/SensorData.kt b/libnavigation-core/src/main/java/com/mapbox/navigation/core/sensor/SensorData.kt index a6a1bbaaa0f..7abfa0cf4c5 100644 --- a/libnavigation-core/src/main/java/com/mapbox/navigation/core/sensor/SensorData.kt +++ b/libnavigation-core/src/main/java/com/mapbox/navigation/core/sensor/SensorData.kt @@ -65,6 +65,11 @@ abstract class SensorData internal constructor() { * Fog weather condition */ object Fog : Condition() + + /** + * Wet road weather condition + */ + object WetRoad : Condition() } } @@ -138,6 +143,7 @@ abstract class SensorData internal constructor() { is Weather.Condition.Rain -> 0 is Weather.Condition.Snow -> 1 is Weather.Condition.Fog -> 2 + is Weather.Condition.WetRoad -> 3 else -> error("Unsupported weather condition type: $condition") } return Value.valueOf(order)