-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better handling of routes
- Loading branch information
Showing
32 changed files
with
292 additions
and
287 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 6 additions & 14 deletions
20
shared/src/commonMain/kotlin/ca/derekellis/reroute/models/Route.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,18 @@ | ||
package ca.derekellis.reroute.models | ||
|
||
import io.github.dellisd.spatialk.geojson.LineString | ||
import kotlinx.serialization.Serializable | ||
|
||
/** | ||
* A (simplified) representation of a transit route and its variants/branches. | ||
* A unique combination of [gtfsId] + [headsign] + [directionId] is considered a unique route variant. | ||
* A transit route in a given direction. A route can have multiple [variants][RouteVariant]. | ||
* | ||
* @param id A unique identifier for this route variation | ||
* @param gtfsId The id used to reference this route in GTFS data | ||
* @param name The display name of the route | ||
* @param headsign The destination of this variant of the route | ||
* @param directionId The GTFS direction ID associated with this route+headsign combo | ||
* @param weight The number of scheduled trips for this particular variant | ||
* @param identifier The identifier of the route shown to users, typically a route number | ||
* @param destinations The destinations of the different directions for this route. The index in the list corresponds | ||
* to the directionId property in GTFS trips. | ||
*/ | ||
@Serializable | ||
data class Route( | ||
val id: String, | ||
val gtfsId: String, | ||
val name: String, | ||
val headsign: String, | ||
val directionId: Int, | ||
val weight: Int, | ||
val shape: LineString, | ||
val identifier: String, | ||
val destinations: List<String>, | ||
) |
24 changes: 24 additions & 0 deletions
24
shared/src/commonMain/kotlin/ca/derekellis/reroute/models/RouteVariant.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package ca.derekellis.reroute.models | ||
|
||
import io.github.dellisd.spatialk.geojson.LineString | ||
import kotlinx.serialization.Serializable | ||
|
||
/** | ||
* A variant/branch of a [Route]. | ||
* | ||
* @param id A unique id for the route variation | ||
* @param gtfsId The GTFS id of the route | ||
* @param directionId The GTFS direction id for trips on this route variant | ||
* @param headsign The destination of this particular variant of the route | ||
* @param weight The number of trips on this variant, used to weight different variants against each other. | ||
* @param shape The GeoJSON shape of this variant. | ||
*/ | ||
@Serializable | ||
data class RouteVariant( | ||
val id: String, | ||
val gtfsId: String, | ||
val directionId: Int, | ||
val headsign: String, | ||
val weight: Int, | ||
val shape: LineString, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.