-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
84 changed files
with
2,833 additions
and
1,286 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 0 additions & 62 deletions
62
...ion-base/src/main/java/com/mapbox/navigation/base/trip/model/alert/RestrictedAreaAlert.kt
This file was deleted.
Oops, something went wrong.
65 changes: 0 additions & 65 deletions
65
libnavigation-base/src/main/java/com/mapbox/navigation/base/trip/model/alert/RouteAlert.kt
This file was deleted.
Oops, something went wrong.
45 changes: 0 additions & 45 deletions
45
...vigation-base/src/main/java/com/mapbox/navigation/base/trip/model/alert/RouteAlertType.kt
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
...igation-base/src/main/java/com/mapbox/navigation/base/trip/model/alert/RouteAlertUtils.kt
This file was deleted.
Oops, something went wrong.
73 changes: 73 additions & 0 deletions
73
...igation-base/src/main/java/com/mapbox/navigation/base/trip/model/roadobject/RoadObject.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package com.mapbox.navigation.base.trip.model.roadobject | ||
|
||
/** | ||
* Abstract class that serves as a base for all road objects. | ||
* | ||
* Available road object types are: | ||
* - [TunnelEntrance] | ||
* - [TunnelExit] | ||
* - [CountryBorderCrossing] | ||
* - [TollCollection] | ||
* - [RestStop] | ||
* - [RestrictedAreaEntrance] | ||
* - [RestrictedAreaExit] | ||
* - [BridgeEntrance] | ||
* - [BridgeExit] | ||
* - [Incident] | ||
* - [Custom] | ||
* | ||
* @param objectType constant describing the object type, see [RoadObjectType]. | ||
* @param distanceFromStartOfRoute distance to this object since the start of the route. | ||
* Will be null for road objects returned by Electronic Horizon. | ||
* @param objectGeometry geometry details of the object. | ||
*/ | ||
abstract class RoadObject( | ||
val objectType: Int, | ||
distanceFromStartOfRoute: Double?, | ||
val objectGeometry: RoadObjectGeometry, | ||
) { | ||
/** | ||
* Distance to this object since the start of the route. | ||
* Will be null for road objects returned by Electronic Horizon. | ||
*/ | ||
val distanceFromStartOfRoute: Double? = distanceFromStartOfRoute?.let { | ||
if (it >= 0) it else null | ||
} | ||
|
||
/** | ||
* Indicates whether some other object is "equal to" this one. | ||
*/ | ||
override fun equals(other: Any?): Boolean { | ||
if (this === other) return true | ||
if (javaClass != other?.javaClass) return false | ||
|
||
other as RoadObject | ||
|
||
if (objectType != other.objectType) return false | ||
if (distanceFromStartOfRoute != other.distanceFromStartOfRoute) return false | ||
if (objectGeometry != other.objectGeometry) return false | ||
|
||
return true | ||
} | ||
|
||
/** | ||
* Returns a hash code value for the object. | ||
*/ | ||
override fun hashCode(): Int { | ||
var result = objectType.hashCode() | ||
result = 31 * result + distanceFromStartOfRoute.hashCode() | ||
result = 31 * result + (objectGeometry.hashCode()) | ||
return result | ||
} | ||
|
||
/** | ||
* Returns a string representation of the object. | ||
*/ | ||
override fun toString(): String { | ||
return "RoadObject(" + | ||
"type=$objectType, " + | ||
"distanceFromStartOfRoute=$distanceFromStartOfRoute, " + | ||
"objectGeometry=$objectGeometry" + | ||
")" | ||
} | ||
} |
Oops, something went wrong.