Move select_trkpt into its own function.

This commit is contained in:
voussoir 2023-09-03 11:00:42 -07:00
parent 00ee14303d
commit b4e1762a2f

View file

@ -470,6 +470,22 @@ class TrackFragment : Fragment(), MapListener, YesNoDialog.YesNoDialogListener
super.onResume() super.onResume()
} }
fun select_trkpt(trkpt: Trkpt)
{
selected_trkpt = trkpt
selected_trkpt_info.text = "${trkpt.time}\n${iso8601_local(trkpt.time)}\n${trkpt.latitude}\n${trkpt.longitude}\n${trkpt.accuracy}"
selected_trkpt_marker.position = trkpt
if (selected_trkpt_marker !in mapView.overlays)
{
mapView.overlays.add(selected_trkpt_marker)
}
interpolate_points_button.visibility = View.VISIBLE
straighten_points_button.visibility = View.VISIBLE
delete_selected_trkpt_button.visibility = View.VISIBLE
use_trkpt_as_start_button.visibility = View.VISIBLE
use_trkpt_as_end_button.visibility = View.VISIBLE
isolate_trkseg_button.visibility = View.VISIBLE
}
fun deselect_trkpt() fun deselect_trkpt()
{ {
if (track_points_overlay != null) if (track_points_overlay != null)
@ -602,19 +618,7 @@ class TrackFragment : Fragment(), MapListener, YesNoDialog.YesNoDialogListener
handler.post(requery_and_render) handler.post(requery_and_render)
return return
} }
selected_trkpt = trkpt select_trkpt(trkpt)
selected_trkpt_info.text = "${trkpt.time}\n${iso8601_local(trkpt.time)}\n${trkpt.latitude}\n${trkpt.longitude}\n${trkpt.accuracy}"
selected_trkpt_marker.position = trkpt
if (selected_trkpt_marker !in mapView.overlays)
{
mapView.overlays.add(selected_trkpt_marker)
}
interpolate_points_button.visibility = View.VISIBLE
straighten_points_button.visibility = View.VISIBLE
delete_selected_trkpt_button.visibility = View.VISIBLE
use_trkpt_as_start_button.visibility = View.VISIBLE
use_trkpt_as_end_button.visibility = View.VISIBLE
isolate_trkseg_button.visibility = View.VISIBLE
return return
} }
}) })