mirror of
https://github.com/rt-bishop/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
Removed redundant StationPos.kt class
This commit is contained in:
1 parent
a82915c0ca
commit
673474a51f
8 files changed
+28
-53
No files matched your search
@@ -22,8 +22,8 @@ import android.hardware.GeomagneticField
|
||||
import android.location.LocationManager
|
||||
import androidx.core.content.edit
|
||||
import com.rtbishop.look4sat.data.PreferencesSource
|
||||
import com.rtbishop.look4sat.domain.GeoPos
|
||||
import com.rtbishop.look4sat.domain.QthConverter
|
||||
import com.rtbishop.look4sat.domain.StationPos
|
||||
import com.rtbishop.look4sat.utility.round
|
||||
import com.squareup.moshi.Moshi
|
||||
import com.squareup.moshi.Types
|
||||
@@ -88,15 +88,15 @@ class PreferencesProvider @Inject constructor(
|
||||
return QthConverter.positionToQTH(lat, lon)
|
||||
}
|
||||
|
||||
override fun loadStationPosition(): StationPos {
|
||||
override fun loadStationPosition(): GeoPos {
|
||||
val defaultSP = "0.0"
|
||||
val latitude = preferences.getString(keyLatitude, null) ?: defaultSP
|
||||
val longitude = preferences.getString(keyLongitude, null) ?: defaultSP
|
||||
val altitude = preferences.getString(keyAltitude, null) ?: defaultSP
|
||||
return StationPos(latitude.toDouble(), longitude.toDouble(), altitude.toDouble())
|
||||
return GeoPos(latitude.toDouble(), longitude.toDouble(), altitude.toDouble())
|
||||
}
|
||||
|
||||
override fun saveStationPosition(pos: StationPos) {
|
||||
override fun saveStationPosition(pos: GeoPos) {
|
||||
preferences.edit {
|
||||
putString(keyLatitude, pos.latitude.toString())
|
||||
putString(keyLongitude, pos.longitude.toString())
|
||||
@@ -112,7 +112,7 @@ class PreferencesProvider @Inject constructor(
|
||||
val latitude = location.latitude.round(4)
|
||||
val longitude = location.longitude.round(4)
|
||||
val altitude = location.altitude.round(1)
|
||||
val stationPosition = StationPos(latitude, longitude, altitude)
|
||||
val stationPosition = GeoPos(latitude, longitude, altitude)
|
||||
saveStationPosition(stationPosition)
|
||||
return true
|
||||
}
|
||||
@@ -123,7 +123,7 @@ class PreferencesProvider @Inject constructor(
|
||||
|
||||
override fun updatePositionFromQTH(qthString: String): Boolean {
|
||||
val position = QthConverter.qthToPosition(qthString) ?: return false
|
||||
val stationPosition = StationPos(position.latitude, position.longitude, 0.0)
|
||||
val stationPosition = GeoPos(position.latitude, position.longitude, 0.0)
|
||||
saveStationPosition(stationPosition)
|
||||
return true
|
||||
}
|
||||
|
||||
+4
-4
@@ -105,7 +105,7 @@ class SatMapViewModel @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun getSatTrack(satellite: Satellite, pos: StationPos, date: Date) {
|
||||
private suspend fun getSatTrack(satellite: Satellite, pos: GeoPos, date: Date) {
|
||||
val satTracks = mutableListOf<List<GeoPos>>()
|
||||
val currentTrack = mutableListOf<GeoPos>()
|
||||
val endDate = Date(date.time + (satellite.orbitalPeriod * 2.4 * 60000L).toLong())
|
||||
@@ -134,7 +134,7 @@ class SatMapViewModel @Inject constructor(
|
||||
_satTrack.postValue(satTracks)
|
||||
}
|
||||
|
||||
private suspend fun getPositions(satellites: List<Satellite>, pos: StationPos, date: Date) {
|
||||
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)
|
||||
@@ -145,7 +145,7 @@ class SatMapViewModel @Inject constructor(
|
||||
_satPositions.postValue(positions)
|
||||
}
|
||||
|
||||
private suspend fun getSatFootprint(satellite: Satellite, pos: StationPos, date: Date) {
|
||||
private suspend fun getSatFootprint(satellite: Satellite, pos: GeoPos, date: Date) {
|
||||
val satPos = predictor.getSatPos(satellite, pos, date)
|
||||
val satFootprint = satPos.getRangeCircle().map { rangePos ->
|
||||
val osmLat = clipLat(rangePos.latitude)
|
||||
@@ -155,7 +155,7 @@ class SatMapViewModel @Inject constructor(
|
||||
_satFootprint.postValue(satFootprint)
|
||||
}
|
||||
|
||||
private suspend fun getSatData(satellite: Satellite, pos: StationPos, date: Date) {
|
||||
private suspend fun getSatData(satellite: Satellite, pos: GeoPos, date: Date) {
|
||||
val satPos = predictor.getSatPos(satellite, pos, date)
|
||||
val osmLat = clipLat(Math.toDegrees(satPos.latitude))
|
||||
val osmLon = clipLon(Math.toDegrees(satPos.longitude))
|
||||
|
||||
+3
-3
@@ -22,8 +22,8 @@ import android.graphics.*
|
||||
import android.view.View
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.rtbishop.look4sat.R
|
||||
import com.rtbishop.look4sat.domain.GeoPos
|
||||
import com.rtbishop.look4sat.domain.SatPass
|
||||
import com.rtbishop.look4sat.domain.StationPos
|
||||
import java.util.*
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.min
|
||||
@@ -38,7 +38,7 @@ class PassInfoView(context: Context) : View(context) {
|
||||
private val radarRadius = radarWidth * 0.48f
|
||||
private val piDiv2 = Math.PI / 2.0
|
||||
private val strokeSize = scale * 2f
|
||||
private var stationPos: StationPos = StationPos(0.0, 0.0, 0.0)
|
||||
private var stationPos: GeoPos = GeoPos(0.0, 0.0, 0.0)
|
||||
|
||||
private var radarColor = ContextCompat.getColor(context, R.color.greyLight)
|
||||
private var radarCircleNum = 3
|
||||
@@ -103,7 +103,7 @@ class PassInfoView(context: Context) : View(context) {
|
||||
this.satPass = satPass
|
||||
}
|
||||
|
||||
fun setStationPos(stationPos: StationPos) {
|
||||
fun setStationPos(stationPos: GeoPos) {
|
||||
this.stationPos = stationPos
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user