-
Notifications
You must be signed in to change notification settings - Fork 3
/
Poi.kt
36 lines (29 loc) · 928 Bytes
/
Poi.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package me.zipi.navitotesla.model
import java.util.Locale
data class Poi(
var poiName: String? = null,
private var roadAddress: String? = null,
private var address: String? = null,
var longitude: String? = null,
var latitude: String? = null,
) {
@Suppress("unused")
fun isAddressEmpty(): Boolean =
(roadAddress == null || roadAddress == "") && (address == null || address == "")
fun getRoadAddress(): String {
// roadAddress, address, gps
return if (roadAddress != null && roadAddress!!.isNotEmpty()) {
roadAddress!!
} else {
getAddress()
}
}
fun getAddress(): String {
return if (address != null && address!!.isNotEmpty()) {
address!!
} else {
getGpsAddress()
}
}
fun getGpsAddress(): String = String.format(Locale.getDefault(), "%s,%s", latitude, longitude)
}