aboutsummaryrefslogtreecommitdiff
path: root/src/Enmarcha.Backend/Controllers
diff options
context:
space:
mode:
authorAriel Costas Guerrero <ariel@costas.dev>2026-03-05 01:38:13 +0100
committerAriel Costas Guerrero <ariel@costas.dev>2026-03-05 01:38:13 +0100
commitcde15534041499a0baf4153476805ee7f2db7f0d (patch)
tree33617fa52bf17ff901a6982c8d784304cbe9e0cc /src/Enmarcha.Backend/Controllers
parent6bc0b28d68f9b4d2779cea403e4af987d6e9dd0e (diff)
Support for Ourense!!
Squashed commit of the following: commit 6c70396fe66ff8bc64655dd8e8c393001d2df8c3 Author: Ariel Costas Guerrero <ariel@costas.dev> Date: Thu Mar 5 01:35:52 2026 +0100 feat: enhance stop sorting logic for bus and coach in map component commit 380396c78a0b9dc8b0435a479236031e0910b57e Author: Ariel Costas Guerrero <ariel@costas.dev> Date: Thu Mar 5 01:30:46 2026 +0100 Update sprite and map colours commit cc3662922d8cf7d8d87c52444bc582c8332160c1 Author: Ariel Costas Guerrero <ariel@costas.dev> Date: Thu Mar 5 01:02:22 2026 +0100 update ourense colour codes and refactor route fetching logic commit a2d8e8b0ecc57989dc79214947ed805d98ebddaa Author: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Date: Wed Mar 4 23:42:49 2026 +0000 feat: add ourense urban bus feed (schedule-only, no real-time) Co-authored-by: arielcostas <94913521+arielcostas@users.noreply.github.com> commit 639a9cf75a71dabc07d1cdf2b39edfd264ccc220 Author: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Date: Wed Mar 4 23:35:44 2026 +0000 Initial plan
Diffstat (limited to 'src/Enmarcha.Backend/Controllers')
-rw-r--r--src/Enmarcha.Backend/Controllers/TileController.cs18
-rw-r--r--src/Enmarcha.Backend/Controllers/TransitController.cs2
2 files changed, 17 insertions, 3 deletions
diff --git a/src/Enmarcha.Backend/Controllers/TileController.cs b/src/Enmarcha.Backend/Controllers/TileController.cs
index 856f2c6..ef71b67 100644
--- a/src/Enmarcha.Backend/Controllers/TileController.cs
+++ b/src/Enmarcha.Backend/Controllers/TileController.cs
@@ -97,6 +97,8 @@ public class TileController : ControllerBase
VectorTile vt = new() { TileId = tileDef.Id };
var stopsLayer = new Layer { Name = "stops" };
+ var features = new List<Feature>();
+
responseBody.Data?.StopsByBbox?.ForEach(stop =>
{
var idParts = stop.GtfsId.Split(':', 2);
@@ -129,9 +131,20 @@ public class TileController : ControllerBase
}
};
- stopsLayer.Features.Add(feature);
+ features.Add(feature);
});
+ foreach (var feature in features.OrderBy(f => f.Attributes["transitKind"] as string switch
+ {
+ "bus" => 3,
+ "train" => 2,
+ "coach" => 1,
+ _ => 0
+ }))
+ {
+ stopsLayer.Features.Add(feature);
+ }
+
vt.Layers.Add(stopsLayer);
using var ms = new MemoryStream();
@@ -150,6 +163,7 @@ public class TileController : ControllerBase
"vitrasa" => "stop-vitrasa",
"tussa" => "stop-tussa",
"tranvias" => "stop-tranvias",
+ "ourense" => "stop-ourense",
"xunta" => "stop-xunta",
"renfe" => "stop-renfe",
"feve" => "stop-feve",
@@ -161,7 +175,7 @@ public class TileController : ControllerBase
{
return feedId switch
{
- "vitrasa" or "tussa" or "tranvias" or "shuttle" => "bus",
+ "vitrasa" or "tussa" or "tranvias" or "shuttle" or "ourense" => "bus",
"xunta" => "coach",
"renfe" or "feve" => "train",
_ => "unknown"
diff --git a/src/Enmarcha.Backend/Controllers/TransitController.cs b/src/Enmarcha.Backend/Controllers/TransitController.cs
index a70f46e..7876dbe 100644
--- a/src/Enmarcha.Backend/Controllers/TransitController.cs
+++ b/src/Enmarcha.Backend/Controllers/TransitController.cs
@@ -42,7 +42,7 @@ public class TransitController : ControllerBase
using var activity = Telemetry.Source.StartActivity("GetRoutes");
if (feeds.Length == 0)
{
- feeds = ["tussa", "vitrasa", "tranvias", "feve", "shuttle"];
+ feeds = ["tussa", "vitrasa", "tranvias", "ourense", "feve", "shuttle"];
}
activity?.SetTag("feeds", string.Join(",", feeds));