Skip to content
This repository has been archived by the owner on Dec 3, 2021. It is now read-only.

Commit

Permalink
refactor: Add Longitude && Latitude to CSV
Browse files Browse the repository at this point in the history
close  #57
  • Loading branch information
aoudiamoncef committed Mar 18, 2018
1 parent 7457b11 commit 57036d5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
23 changes: 23 additions & 0 deletions app/src/main/java/science/apolline/models/Device.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import com.google.gson.JsonObject
import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName
import science.apolline.utils.CheckUtility
import science.apolline.utils.GeoHashHelper
import science.apolline.utils.GeoHashHelper.decode


@Entity
Expand Down Expand Up @@ -42,6 +44,25 @@ data class Device(
@PrimaryKey(autoGenerate = true)
var id: Long = 0

@Ignore
private var longitude: Double = -1.0
get() {
if (position?.geohash != "no") {
return GeoHashHelper.decode(position!!.geohash).longitude
}
return -1.0
}


@Ignore
private var latitude: Double = -1.0
get() {
if (position?.geohash != "no") {
return GeoHashHelper.decode(position!!.geohash).latitude
}
return -1.0
}


@Ignore
constructor() : this("", "", 0, null, null, 0)
Expand All @@ -63,6 +84,8 @@ data class Device(
objectArray.add(device)
objectArray.add(CheckUtility.dateParser(date))
objectArray.add(position?.geohash.orEmpty())
objectArray.add(longitude.toString())
objectArray.add(latitude.toString())
objectArray.add(position?.provider.orEmpty())
objectArray.add(position?.transport.orEmpty())

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/science/apolline/utils/DataExport.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ object DataExport : AnkoLogger {
add("Device")
add("Date")
add("Geohash")
add("Longitude")
add("Latitude")
add("Provider")
add("Transport")
}
Expand Down

0 comments on commit 57036d5

Please sign in to comment.