Skip to content

Commit

Permalink
Kennyhu/fence 1888 add distance field to radaraddress (#354)
Browse files Browse the repository at this point in the history
* add distance field to radar address

* fix method

* change to optional int
  • Loading branch information
KennyHuRadar authored Jun 11, 2024
1 parent 77fc7b3 commit 72b1bce
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sdk/src/main/java/io/radar/sdk/model/RadarAddress.kt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ class RadarAddress(
*/
val plus4: String?,

/**
* The distance to the search anchor in meters
*/
val distance: Int?,

/**
* The layer of the address
*/
Expand Down Expand Up @@ -155,6 +160,7 @@ class RadarAddress(
private const val FIELD_PLACE_LABEL = "placeLabel"
private const val FIELD_UNIT = "unit"
private const val FIELD_PLUS4 = "plus4"
private const val FIELD_DISTANCE = "distance"
private const val FIELD_LAYER = "layer"
private const val FIELD_METADATA = "metadata"
private const val FIELD_CONFIDENCE = "confidence"
Expand Down Expand Up @@ -185,6 +191,7 @@ class RadarAddress(
val placeLabel = obj.optString(FIELD_PLACE_LABEL) ?: null
val unit = obj.optString(FIELD_UNIT) ?: null
val plus4 = obj.optString(FIELD_PLUS4) ?: null
val distance = obj.optInt(FIELD_DISTANCE)
val layer = obj.optString(FIELD_LAYER) ?: null
val metadata: JSONObject? = obj.optJSONObject(FIELD_METADATA) ?: null
val confidence = when(obj.optString(FIELD_CONFIDENCE)) {
Expand Down Expand Up @@ -215,6 +222,7 @@ class RadarAddress(
placeLabel,
unit,
plus4,
distance,
layer,
metadata,
confidence
Expand Down Expand Up @@ -288,6 +296,7 @@ class RadarAddress(
obj.putOpt(FIELD_PLACE_LABEL, this.placeLabel)
obj.putOpt(FIELD_UNIT, this.unit)
obj.putOpt(FIELD_PLUS4, this.plus4)
obj.putOpt(FIELD_DISTANCE, this.distance)
obj.putOpt(FIELD_LAYER, this.layer)
obj.putOpt(FIELD_METADATA, this.metadata)
obj.putOpt(FIELD_CONFIDENCE, stringForConfidence(this.confidence))
Expand Down

0 comments on commit 72b1bce

Please # to comment.