Minor cleanup

This commit is contained in:
Arty Bishop committed 2019-12-07 18:35:07 +00:00
1 parent 571164cdd5
commit d8bb1ae796
5 files changed
+6 -71

No files matched your search

@@ -101,15 +101,6 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
tleSelectedMap = mutableMap
}
fun updatePassPrefs(hoursAhead: Int, maxEl: Double) {
passPrefs = SatPassPrefs(hoursAhead, maxEl)
preferences.edit {
putInt(keyHours, hoursAhead)
putLong(keyMinEl, maxEl.toRawBits())
apply()
}
}
fun updateGsp() {
val lat = preferences.getString(keyLat, defValueLoc)!!.toDouble()
val lon = preferences.getString(keyLon, defValueLoc)!!.toDouble()
@@ -131,11 +131,8 @@ class WorldMapFragment : Fragment() {
drawFootprint(canvas, frameWidth, frameHeight, footprintPositions)
var longitude = rad2Deg(satPos.longitude)
if (longitude > 180.0) {
longitude -= 180.0
} else {
longitude += 180.0
}
if (longitude > 180.0) longitude -= 180.0
else longitude += 180.0
}
private fun drawGroundTrack(canvas: Canvas, width: Int, height: Int, list: List<SatPos>) {
@@ -151,9 +148,8 @@ class WorldMapFragment : Fragment() {
else trackX -= 180
trackX *= width / 360f
trackY = ((90.0 - rad2Deg(satPos.latitude)) * (height / 180.0))
.roundToInt()
.toFloat()
trackY =
((90.0 - rad2Deg(satPos.latitude)) * (height / 180.0)).roundToInt().toFloat()
if (index == 0 || abs(trackX - prevX) > 180) trackPath.moveTo(trackX, trackY)
else trackPath.lineTo(trackX, trackY)
@@ -176,9 +172,7 @@ class WorldMapFragment : Fragment() {
else printX -= 180f
printX *= width / 360f
printY = ((90.0 - position.lat) * (height / 180.0))
.roundToInt()
.toFloat()
printY = ((90.0 - position.lat) * (height / 180.0)).roundToInt().toFloat()
if (index == 0 || abs(printX - prevX) > 180) printPath.moveTo(printX, printY)
else printPath.lineTo(printX, printY)