feat: di, db, and preliminary server-side gtfs parsing
This commit is contained in:
parent
ccc748dc1f
commit
6770c01613
22 changed files with 555 additions and 24 deletions
12
shared/src/commonMain/kotlin/moe/lava/banksia/model/Route.kt
Normal file
12
shared/src/commonMain/kotlin/moe/lava/banksia/model/Route.kt
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
package moe.lava.banksia.model
|
||||
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
|
||||
@Entity
|
||||
data class Route(
|
||||
@PrimaryKey val id: String,
|
||||
val type: RouteType,
|
||||
val number: String?,
|
||||
val name: String,
|
||||
)
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package moe.lava.banksia.model
|
||||
|
||||
import androidx.room.TypeConverter
|
||||
|
||||
enum class RouteType(val value: Int) {
|
||||
MetroTrain(2),
|
||||
MetroTram(3),
|
||||
MetroBus(4),
|
||||
RegionalTrain(1),
|
||||
RegionalCoach(5),
|
||||
RegionalBus(6),
|
||||
SkyBus(11),
|
||||
Interstate(10),
|
||||
;
|
||||
|
||||
companion object {
|
||||
@TypeConverter
|
||||
fun from(value: Int) = RouteType.entries.first { it.value == value }
|
||||
|
||||
@TypeConverter
|
||||
fun to(routeType: RouteType) = routeType.value
|
||||
}
|
||||
}
|
||||
16
shared/src/commonMain/kotlin/moe/lava/banksia/model/Shape.kt
Normal file
16
shared/src/commonMain/kotlin/moe/lava/banksia/model/Shape.kt
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
package moe.lava.banksia.model
|
||||
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
import androidx.room.TypeConverters
|
||||
import moe.lava.banksia.room.converter.ShapeConverter
|
||||
import moe.lava.banksia.util.Point
|
||||
|
||||
typealias ShapePath = List<Point>
|
||||
|
||||
@Entity
|
||||
@TypeConverters(ShapeConverter::class)
|
||||
data class Shape(
|
||||
@PrimaryKey val id: String,
|
||||
val path: ShapePath,
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue