Added satellite visibility and phase to MapFragment.kt #62

This commit is contained in:
Arty Bishop committed 2022-03-09 13:22:20 +00:00
1 parent 7fdc939450
commit 488fe352cd
6 files changed
+45 -6

No files matched your search

@@ -28,5 +28,7 @@ data class MapData(
val altitude: Double,
val velocity: Double,
val qthLoc: String,
val osmPos: GeoPos
val osmPos: GeoPos,
val phase: Double,
val eclipsed: Boolean
)
@@ -208,6 +208,14 @@ class MapFragment : Fragment(R.layout.fragment_map) {
String.format(getString(R.string.map_latitude), mapData.osmPos.lat)
mapDataLon.text =
String.format(getString(R.string.map_longitude), mapData.osmPos.lon)
mapDataPhase.text = String.format(getString(R.string.map_phase), mapData.phase)
if (mapData.eclipsed) {
val eclipsed = getString(R.string.map_eclipsed)
mapDataVisibility.text = String.format(getString(R.string.map_visibility), eclipsed)
} else {
val visible = getString(R.string.map_visible)
mapDataVisibility.text = String.format(getString(R.string.map_visibility), visible)
}
}
binding.mapView.invalidate()
}
@@ -162,9 +162,11 @@ class MapViewModel @Inject constructor(
val osmLon = clipLon(satPos.longitude.toDegrees())
val osmPos = GeoPos(osmLat, osmLon)
val qthLoc = QthConverter.positionToQth(osmPos.lat, osmPos.lon) ?: "-- --"
val phase = satPos.phase.toDegrees()
val visibility = satPos.eclipsed
val satData = MapData(
satellite, satellite.data.catnum, satellite.data.name, satPos.distance,
satPos.altitude, satPos.getOrbitalVelocity(), qthLoc, osmPos
satPos.altitude, satPos.getOrbitalVelocity(), qthLoc, osmPos, phase, visibility
)
_mapData.postValue(satData)
}