Skip to content

Commit

Permalink
getAdasAttributes improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
dzinad committed Oct 19, 2023
1 parent 4114b7e commit 59f2311
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
6 changes: 4 additions & 2 deletions libnavigation-core/api/current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
) {

Expand All @@ -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
Expand All @@ -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
}
Expand All @@ -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 {
Expand All @@ -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
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ abstract class SensorData internal constructor() {
* Fog weather condition
*/
object Fog : Condition()

/**
* Wet road weather condition
*/
object WetRoad : Condition()
}
}

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 59f2311

Please sign in to comment.