Skip to content

Commit ae2d311

Browse files
committed
Trains map: no Te Huia line to Hamilton
The map shows AT's three lines only; The Strand, Huntly and the Hamilton stations are gone with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011C2fAvFFcMRkaF7qSvRA1v
1 parent 1f951f9 commit ae2d311

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎README.md‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,6 @@ with every train live on it.
199199
they meet and part without crossing. Stations whose platforms are on different
200200
tracks get a bar joining them, as on AT's map. Straight lines stand in until
201201
the timetable has loaded.
202-
- **Te Huia** runs from The Strand out along the eastern line and on to
203-
Hamilton.
204202
- **Every train, live**, snapped onto its own line and pointing the way it's
205203
going, with an orange or red dot when it's running 2 or 5+ minutes late.
206204
- **Diagram, Satellite or Map.** Diagram is a quiet map (land, water, parks and

‎app/src/main/java/nz/aryan/akllive/gtfs/Rail.kt‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,10 @@ object Rail {
124124
fun asks(stations: List<RailStation>, segs: List<RailSeg>, lineIds: List<String>): List<TrackAsk> {
125125
fun piece(line: String, a: Int, b: Int) = TrackAsk(line, stations[a].lon, stations[a].lat, stations[b].lon, stations[b].lat)
126126
val idx = { n: String -> stations.indexOfFirst { it.name == n } }
127+
// Te Huia's run south only when its stations are on the map
128+
val south = HUIA_SOUTH.map(idx)
127129
return segs.map { piece(lineIds[it.line], it.from, it.to) } +
128-
HUIA_SOUTH.zipWithNext().map { (a, b) -> piece("HUIA", idx(a), idx(b)) }
130+
if (south.any { it < 0 }) emptyList() else south.zipWithNext().map { (a, b) -> piece("HUIA", a, b) }
129131
}
130132

131133
/** Each line as one route along its track ([cut]: the real track per ask, null for straight lines between stations). */
@@ -235,7 +237,7 @@ object Rail {
235237
* track. [shown]: the AT lines showing (Te Huia always is).
236238
*/
237239
fun layout(stations: List<RailStation>, geo: RailGeo, shown: Set<Int>): RailDrawing {
238-
val lines = geo.routes.filter { it.line == HUIA || it.line in shown }
240+
val lines = geo.routes.filter { (it.line == HUIA || it.line in shown) && it.pts.size > 1 }
239241
// every little segment of track, in a grid, so finding the rails near a point is quick
240242
val cell = 0.0015
241243
val grid = HashMap<Long, MutableList<Long>>()

‎app/src/main/java/nz/aryan/akllive/ui/TrainScreen.kt‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ import nz.aryan.akllive.data.TrainState
8282
import nz.aryan.akllive.data.TripDetail
8383
import nz.aryan.akllive.data.occupancyText
8484

85-
/** The network's stations and segments, plus Te Huia's own stops, for the rail layout. */
85+
/** The network's stations and segments, for the rail layout: AT's lines only (no Te Huia on to Hamilton). */
8686
object TrainNet {
8787
val stations: List<RailStation> =
88-
MapData.STATIONS.map { RailStation(it.name, it.lat, it.lon, it.lines, it.priority) } + Rail.HUIA_STOPS
88+
MapData.STATIONS.map { RailStation(it.name, it.lat, it.lon, it.lines, it.priority) }
8989
val segs: List<RailSeg> = MapData.SEGS.map { RailSeg(it.line, it.from, it.to) }
9090
/** straight lines between stations, until the timetable's in */
9191
val straight: RailGeo by lazy { Rail.build(stations, segs, null) }
@@ -117,7 +117,7 @@ private fun bearing(a: Pt, b: Pt) = ((Math.toDegrees(atan2((b.x - a.x) * KX, b.y
117117

118118
/**
119119
* Trains: Auckland's rail network drawn along the real tracks in AT's line
120-
* colours (lines side by side where they share rails, Te Huia on to Hamilton),
120+
* colours (lines side by side where they share rails),
121121
* with every train live on its own line where its GPS puts it. Over a quiet
122122
* diagram map, satellite photos or a street map; tap a train or a station.
123123
*/
@@ -378,7 +378,7 @@ private fun Overview(state: TrainState, now: Long) {
378378
Spacer(Modifier.height(10.dp))
379379
Text("Tap a train for where it's going, its speed and its next stops. Tap a station for live " +
380380
"departures from every platform. The lines follow the real tracks, side by side where they share rails, " +
381-
"with every train where its GPS puts it, pointing the way it's heading. Te Huia runs on to Hamilton.",
381+
"with every train where its GPS puts it, pointing the way it's heading.",
382382
style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
383383
}
384384

0 commit comments

Comments
 (0)