Make separate polylines when two devices recorded the same time.

This commit is contained in:
voussoir 2024-03-24 10:45:48 -07:00
parent 6c82f6f25e
commit 931a89976e
2 changed files with 8 additions and 2 deletions
app/src/main/java/net/voussoir/trkpt

View file

@ -111,7 +111,7 @@ class Database(val trackbook: Trackbook)
SELECT device_id, lat, lon, time, provider, ele, accuracy, sat
FROM trkpt
WHERE lat >= ? AND lat <= ? AND lon >= ? AND lon <= ? AND accuracy <= ?
ORDER BY time ASC
ORDER BY device_id ASC, time ASC
""",
arrayOf(south.toString(), north.toString(), west.toString(), east.toString(), max_accuracy.toString())
))

View file

@ -731,9 +731,15 @@ class TrackFragment : Fragment(), MapListener, YesNoDialog.YesNoDialogListener
var pl = new_track_segment_overlay()
var previous_time: Long = 0
var previous_device: String = "";
for (trkpt in track.trkpts)
{
if (previous_time > 0 && (trkpt.time - previous_time) > Keys.STOP_OVER_THRESHOLD)
val need_new_polyline = (
(previous_time > 0 && (trkpt.time - previous_time) > Keys.STOP_OVER_THRESHOLD)
||
(previous_device != "" && trkpt.device_id != previous_device)
)
if (need_new_polyline)
{
pl = new_track_segment_overlay()
}