fix: Model rebuilt
This commit is contained in:
parent
75e10c1579
commit
785a35473e
6 changed files with 136 additions and 137 deletions
|
@ -12,7 +12,6 @@ enum class OutType(val value: Int) {
|
|||
|
||||
}
|
||||
|
||||
|
||||
enum class OutAngle(val value: Int) {
|
||||
|
||||
Down(0x01),
|
||||
|
@ -52,7 +51,7 @@ enum class Lane(val value: Int) {
|
|||
|
||||
}
|
||||
|
||||
open class Arrows(val lanes: List<Lane>) {
|
||||
class Arrows(val lanes: List<Lane>) {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
|
@ -68,11 +67,9 @@ open class Arrows(val lanes: List<Lane>) {
|
|||
}
|
||||
}
|
||||
|
||||
class Lanes(lanes: List<Lane>) : Arrows(lanes)
|
||||
class Lanes(val outlines: Arrows, val lanes: Arrows)
|
||||
|
||||
class Outlines(lanes: List<Lane>) : Arrows(lanes)
|
||||
|
||||
class Distance(val distance: Int, val unit: Unit) {
|
||||
class Distance(val distance: Double, val unit: Unit) {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
|
@ -87,7 +84,7 @@ class Distance(val distance: Int, val unit: Unit) {
|
|||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = distance
|
||||
var result = distance.hashCode()
|
||||
result = 31 * result + unit.hashCode()
|
||||
return result
|
||||
}
|
||||
|
@ -98,47 +95,12 @@ class Speed(val speed: Int, val limit: Int)
|
|||
|
||||
class Arrival(val hours: Int, val minutes: Int)
|
||||
|
||||
class State {
|
||||
|
||||
var lineArrows: Lanes? = null
|
||||
var lineOutlines: Outlines? = null
|
||||
var direction : Direction? = null
|
||||
var distance: Distance? = null
|
||||
var speed: Speed? = null
|
||||
var arrival: Arrival? = null
|
||||
// TODO: Bearing
|
||||
// TODO: support
|
||||
var traffic: Boolean? = null
|
||||
var flag: Boolean? = null
|
||||
var control: Boolean? = null
|
||||
|
||||
fun merge(other: State) {
|
||||
if (other.lineArrows != null) {
|
||||
this.lineArrows = other.lineArrows
|
||||
}
|
||||
if (other.lineOutlines != null) {
|
||||
this.lineOutlines = other.lineOutlines
|
||||
}
|
||||
if (other.direction != null) {
|
||||
this.direction = other.direction
|
||||
}
|
||||
if (other.distance != null) {
|
||||
this.distance = other.distance
|
||||
}
|
||||
if (other.speed != null) {
|
||||
this.speed = other.speed
|
||||
}
|
||||
if (other.arrival != null) {
|
||||
this.arrival = other.arrival
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Direction {
|
||||
var angle: OutAngle = OutAngle.AsDirection
|
||||
var out: OutType = OutType.Lane
|
||||
class Direction(
|
||||
var angle: OutAngle = OutAngle.AsDirection,
|
||||
var out: OutType = OutType.Lane,
|
||||
var roundabout: OutAngle = OutAngle.AsDirection
|
||||
) {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
@ -160,3 +122,39 @@ class Direction {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
interface GarminModelItem {
|
||||
|
||||
fun merge(item: GarminModelItem)
|
||||
}
|
||||
|
||||
class GarminManeuver : GarminModelItem {
|
||||
|
||||
lateinit var lanes: Lanes
|
||||
lateinit var direction: Direction
|
||||
lateinit var distance: Distance
|
||||
var flag: Boolean = false // WTF?
|
||||
|
||||
override fun merge(item: GarminModelItem) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
val empty: () -> GarminManeuver = {
|
||||
val manouver = GarminManeuver()
|
||||
manouver.lanes = Lanes(Arrows(listOf()), Arrows(listOf()))
|
||||
manouver.direction = Direction(out = OutType.Off)
|
||||
manouver.distance = Distance(0.0, Unit.Any)
|
||||
manouver
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class GarminLocation : GarminModelItem {
|
||||
|
||||
override fun merge(item: GarminModelItem) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue