Removed all java dependencies from domain.predict package

This commit is contained in:
Arty Bishop committed 2021-10-28 19:32:21 +01:00
1 parent 8ef0d103e4
commit 88c7bb6bca
5 files changed
+67 -77

No files matched your search

@@ -116,7 +116,7 @@ class MapViewModel @Inject constructor(
val currentTrack = mutableListOf<GeoPos>()
val endDate = Date(date.time + (satellite.orbitalPeriod * 2.4 * 60000L).toLong())
var oldLongitude = 0.0
predictor.getSatTrack(satellite, pos, date, endDate).forEach { satPos ->
predictor.getSatTrack(satellite, pos, date.time, endDate.time).forEach { satPos ->
val osmLat = clipLat(Math.toDegrees(satPos.latitude))
val osmLon = clipLon(Math.toDegrees(satPos.longitude))
val currentPosition = GeoPos(osmLat, osmLon)
@@ -143,7 +143,7 @@ class MapViewModel @Inject constructor(
private suspend fun getPositions(satellites: List<Satellite>, pos: GeoPos, date: Date) {
val positions = mutableMapOf<Satellite, GeoPos>()
satellites.forEach { satellite ->
val satPos = predictor.getSatPos(satellite, pos, date)
val satPos = predictor.getSatPos(satellite, pos, date.time)
val osmLat = clipLat(Math.toDegrees(satPos.latitude))
val osmLon = clipLon(Math.toDegrees(satPos.longitude))
positions[satellite] = GeoPos(osmLat, osmLon)
@@ -152,7 +152,7 @@ class MapViewModel @Inject constructor(
}
private suspend fun getSatFootprint(satellite: Satellite, pos: GeoPos, date: Date) {
val satPos = predictor.getSatPos(satellite, pos, date)
val satPos = predictor.getSatPos(satellite, pos, date.time)
val satFootprint = satPos.getRangeCircle().map { rangePos ->
val osmLat = clipLat(rangePos.latitude)
val osmLon = clipLon(rangePos.longitude)
@@ -162,7 +162,7 @@ class MapViewModel @Inject constructor(
}
private suspend fun getSatData(satellite: Satellite, pos: GeoPos, date: Date) {
val satPos = predictor.getSatPos(satellite, pos, date)
val satPos = predictor.getSatPos(satellite, pos, date.time)
val osmLat = clipLat(Math.toDegrees(satPos.latitude))
val osmLon = clipLon(Math.toDegrees(satPos.longitude))
val osmPos = GeoPos(osmLat, osmLon)
@@ -49,12 +49,12 @@ class PassesViewModel @Inject constructor(
if (preferences.isSetupDone()) {
viewModelScope.launch {
_passes.postValue(DataState.Loading)
val dateNow = Date()
val timeNow = System.currentTimeMillis()
val satellites = dataRepository.getSelectedSatellites()
val stationPos = preferences.loadStationPosition()
val hoursAhead = preferences.getHoursAhead()
val minElev = preferences.getMinElevation()
predictor.triggerCalculation(satellites, stationPos, dateNow, hoursAhead, minElev)
predictor.triggerCalculation(satellites, stationPos, timeNow, hoursAhead, minElev)
}
} else {
_isFirstLaunchDone.value = false
@@ -77,7 +77,7 @@ class PassesViewModel @Inject constructor(
val minElev = preferences.getMinElevation()
dataRepository.updateDataFromWeb()
dataRepository.updateSelection(isSelected = true)
predictor.forceCalculation(satellites, stationPos, Date(), hoursAhead, minElev)
predictor.forceCalculation(satellites, stationPos, Date().time, hoursAhead, minElev)
preferences.setSetupDone()
_isFirstLaunchDone.value = true
}
@@ -87,12 +87,12 @@ class PassesViewModel @Inject constructor(
viewModelScope.launch {
_passes.postValue(DataState.Loading)
passesProcessing?.cancelAndJoin()
val dateNow = Date()
val timeNow = System.currentTimeMillis()
val satellites = dataRepository.getSelectedSatellites()
val stationPos = preferences.loadStationPosition()
val hoursAhead = preferences.getHoursAhead()
val minElev = preferences.getMinElevation()
predictor.forceCalculation(satellites, stationPos, dateNow, hoursAhead, minElev)
predictor.forceCalculation(satellites, stationPos, timeNow, hoursAhead, minElev)
}
}
@@ -79,12 +79,12 @@ class RadarViewModel @Inject constructor(
viewModelScope.launch {
var satTrack: List<SatPos> = emptyList()
if (!satPass.isDeepSpace) {
val startDate = Date(satPass.aosTime)
val endDate = Date(satPass.losTime)
val startDate = satPass.aosTime
val endDate = satPass.losTime
satTrack = predictor.getSatTrack(satPass.satellite, stationPos, startDate, endDate)
}
while (isActive) {
val satPos = predictor.getSatPos(satPass.satellite, stationPos, Date())
val satPos = predictor.getSatPos(satPass.satellite, stationPos, Date().time)
if (preferences.isRotatorEnabled()) {
val server = preferences.getRotatorServer().first
val port = preferences.getRotatorServer().second
@@ -102,7 +102,7 @@ class RadarViewModel @Inject constructor(
viewModelScope.launch {
val transmitters = dataRepository.getTransmitters(satPass.catNum)
while (isActive) {
val satPos = predictor.getSatPos(satPass.satellite, stationPos, Date())
val satPos = predictor.getSatPos(satPass.satellite, stationPos, Date().time)
val copiedList = transmitters.map { it.copy() }
copiedList.forEach { transmitter ->
transmitter.downlink?.let {