-
Notifications
You must be signed in to change notification settings - Fork 3
/
NaverMap.kt
40 lines (30 loc) · 1.02 KB
/
NaverMap.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
37
38
39
40
package me.zipi.navitotesla.model
import com.google.gson.annotations.SerializedName
class NaverMap {
data class Response(
var result: Result? = null
)
data class Result(
var site: Site? = null
)
data class Site(
var list: List<Place>? = null
)
data class Place(
var name: String? = null,
var address: String? = null, // 지번주소
var roadAddress: String? = null, // 도로명주소
var abbrAddress: String? = null, // 지번만. 봉래동2가 122-21
@SerializedName("x")
var longitude: String? = null,
@SerializedName("y")
var latitude: String? = null,
) {
fun getRoadAddressName(withLocalName: Boolean): String {
return if (withLocalName && roadAddress != null && abbrAddress != null) {
"$roadAddress (" + abbrAddress!!.split(" ".toRegex())
.dropLastWhile { it.isEmpty() }.toTypedArray()[0] + ")"
} else roadAddress ?: ""
}
}
}