diff options
| author | Ariel Costas Guerrero <ariel@costas.dev> | 2026-03-22 00:04:11 +0100 |
|---|---|---|
| committer | Ariel Costas Guerrero <ariel@costas.dev> | 2026-03-22 00:04:11 +0100 |
| commit | 53c3c0293bbacefb9ed0d56f61695f0b76a9f385 (patch) | |
| tree | f634d7ecbbf04e18c9b302dc201851cb5a1ed27d | |
| parent | f1b0b5f7ceaf6d23ae347e12cf29eef617c7dc9b (diff) | |
Urbanos de Lugo
| -rw-r--r-- | src/Enmarcha.Backend/Controllers/ArrivalsController.cs | 7 | ||||
| -rw-r--r-- | src/Enmarcha.Backend/Controllers/TileController.cs | 1 | ||||
| -rw-r--r-- | src/Enmarcha.Backend/Controllers/TransitController.cs | 2 | ||||
| -rw-r--r-- | src/Enmarcha.Backend/Helpers/SortingHelper.cs | 54 | ||||
| -rw-r--r-- | src/Enmarcha.Backend/Services/FareService.cs | 12 | ||||
| -rw-r--r-- | src/Enmarcha.Backend/Services/FeedService.cs | 2 | ||||
| -rw-r--r-- | src/Enmarcha.Backend/Types/ConsolidatedCirculation.cs | 1 | ||||
| -rw-r--r-- | src/frontend/app/routes/favourites.tsx | 1 | ||||
| -rw-r--r-- | src/frontend/app/routes/map.tsx | 14 | ||||
| -rw-r--r-- | src/frontend/app/routes/routes.tsx | 1 | ||||
| -rw-r--r-- | src/frontend/public/maps/spritesheet/sprite.json | 16 | ||||
| -rw-r--r-- | src/frontend/public/maps/spritesheet/sprite.png | bin | 6208 -> 7288 bytes | |||
| -rw-r--r-- | src/frontend/public/maps/spritesheet/sprite@2x.json | 16 | ||||
| -rw-r--r-- | src/frontend/public/maps/spritesheet/sprite@2x.png | bin | 14126 -> 16564 bytes |
14 files changed, 113 insertions, 14 deletions
diff --git a/src/Enmarcha.Backend/Controllers/ArrivalsController.cs b/src/Enmarcha.Backend/Controllers/ArrivalsController.cs index f922ca9..9216004 100644 --- a/src/Enmarcha.Backend/Controllers/ArrivalsController.cs +++ b/src/Enmarcha.Backend/Controllers/ArrivalsController.cs @@ -219,11 +219,16 @@ public partial class ArrivalsController : ControllerBase { string feedId = id.Split(':', 2)[0]; - if (feedId is "vitrasa" or "tranvias" or "tussa") + if (feedId is "vitrasa" or "tranvias") { return 0; } + if (feedId is "tussa" or "ourense" or "lugo") + { + return -5; + } + return -30; } diff --git a/src/Enmarcha.Backend/Controllers/TileController.cs b/src/Enmarcha.Backend/Controllers/TileController.cs index 63e8a9a..5ef8dd6 100644 --- a/src/Enmarcha.Backend/Controllers/TileController.cs +++ b/src/Enmarcha.Backend/Controllers/TileController.cs @@ -164,6 +164,7 @@ public class TileController : ControllerBase "tussa" => "stop-tussa", "tranvias" => "stop-tranvias", "ourense" => "stop-ourense", + "lugo" => "stop-lugo", "xunta" => "stop-xunta", "renfe" => "stop-renfe", "feve" => "stop-feve", diff --git a/src/Enmarcha.Backend/Controllers/TransitController.cs b/src/Enmarcha.Backend/Controllers/TransitController.cs index 9b13972..bda7152 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", "ourense", "feve", "shuttle"]; + feeds = ["tussa", "vitrasa", "tranvias", "ourense", "lugo", "feve", "shuttle"]; } activity?.SetTag("feeds", string.Join(",", feeds)); diff --git a/src/Enmarcha.Backend/Helpers/SortingHelper.cs b/src/Enmarcha.Backend/Helpers/SortingHelper.cs index fe39521..7fd4e37 100644 --- a/src/Enmarcha.Backend/Helpers/SortingHelper.cs +++ b/src/Enmarcha.Backend/Helpers/SortingHelper.cs @@ -49,12 +49,13 @@ public class SortingHelper var feed = routeId?.Split(':')[0]; - if (feed is "vitrasa" or "tussa") + if (feed is "vitrasa" or "tussa" or "lugo") { int group = feed switch { "vitrasa" => GetVitrasaRouteGroup(shortName), "tussa" => GetTussaRouteGroup(shortName), + "lugo" => GetLugoRouteGroup(shortName), _ => throw new ArgumentOutOfRangeException() }; @@ -90,27 +91,39 @@ public class SortingHelper { // Circular: "C" followed by a digit if (shortName.Length > 1 && shortName[0] == 'C' && char.IsDigit(shortName[1])) + { return 0; + } // Hospital: starts with "H" if (shortName[0] == 'H') + { return 2; + } // Night: "N" followed by a digit if (shortName[0] == 'N' && shortName.Length > 1 && char.IsDigit(shortName[1])) + { return 3; + } // PSA shuttle lines if (shortName.StartsWith("PSA", StringComparison.OrdinalIgnoreCase)) + { return 3; + } // University: "U" followed by a digit if (shortName[0] == 'U' && shortName.Length > 1 && char.IsDigit(shortName[1])) + { return 3; + } // Multi-letter codes with no digits (LZD, PTL) if (shortName.Length >= 2 && shortName.All(char.IsLetter)) + { return 3; + } // Everything else is regular (numbered routes like 4A, 6, 10, single letters like A) return 1; @@ -126,6 +139,45 @@ public class SortingHelper return 0; } + private static int GetLugoRouteGroup(string shortName) + { + if (char.IsLetter(shortName[0])) + { + return 50000; + } + + // Sort something like 2,6,1.1,1.2,1.4,3.1,5.1,PAZO1,PAZO2,CDL + // 1.1, 1.2, 1.4, 2, 3.1, 5.1, 6, then PAZO1, PAZO2, then CDL + if (shortName.Contains('.')) + { + var parts = shortName.Split('.', 2); + if (int.TryParse(parts[0], out int main) && int.TryParse(parts[1], out int sub)) + { + return main * 100 + sub; // 1.1 -> 101, 1.2 -> 102, etc. + } + } + + string numericPart = string.Empty; + foreach (char c in shortName) + { + if (char.IsDigit(c)) + { + numericPart += c; + } + else + { + break; + } + } + + if (int.TryParse(numericPart, out int leadingNumber)) + { + return leadingNumber * 100 + 50; // Sort by leading number if present, with a large multiplier to come after pure numbers + } + + return 0; + } + private static int ExtractNumber(string name) { var digits = new string(name.Where(char.IsDigit).ToArray()); diff --git a/src/Enmarcha.Backend/Services/FareService.cs b/src/Enmarcha.Backend/Services/FareService.cs index fda5eb5..294166d 100644 --- a/src/Enmarcha.Backend/Services/FareService.cs +++ b/src/Enmarcha.Backend/Services/FareService.cs @@ -25,6 +25,9 @@ public class FareService private const decimal OurenseCashFare = 0.85M; private const decimal OurenseCardFare = 0.49M; + private const decimal LugoCashFare = 0.64M; + private const decimal LugoCardFare = 0.45M; + public FareService( IOptions<AppConfiguration> config, XuntaFareProvider xuntaFareProvider, @@ -77,6 +80,9 @@ public class FareService case "ourense": total += OurenseCashFare; break; + case "lugo": + total += LugoCashFare; + break; case "xunta": // TODO: Handle potentiall blow-ups if (leg.From is not { ZoneId: not null }) @@ -137,6 +143,12 @@ public class FareService maxUsages = 2; initialFare = OurenseCardFare; break; + case "lugo": + // IDK About card rules, so we set it to zero + maxMinutes = 0; + maxUsages = 0; + initialFare = LugoCardFare; + break; case "xunta": if (leg.From?.ZoneId == null || leg.To?.ZoneId == null) { diff --git a/src/Enmarcha.Backend/Services/FeedService.cs b/src/Enmarcha.Backend/Services/FeedService.cs index 4ea3752..4e0547b 100644 --- a/src/Enmarcha.Backend/Services/FeedService.cs +++ b/src/Enmarcha.Backend/Services/FeedService.cs @@ -30,7 +30,6 @@ public class FeedService { "Riós", "Ríos" }, { "Avda. Beiramar Porto Pesqueiro Berbés", "Berbés" }, { "Conde de Torrecedeira", "Torrecedeira" }, - }; public (string Color, string TextColor) GetFallbackColourForFeed(string feed) @@ -41,6 +40,7 @@ public class FeedService "tussa" => ("#508096", "#FFFFFF"), "tranvias" => ("#E61C29", "#FFFFFF"), "ourense" => ("#ffb319", "#000000"), + "lugo" => ("#FDC609", "#000000"), "xunta" => ("#007BC4", "#FFFFFF"), "renfe" => ("#870164", "#FFFFFF"), "feve" => ("#EE3D32", "#FFFFFF"), diff --git a/src/Enmarcha.Backend/Types/ConsolidatedCirculation.cs b/src/Enmarcha.Backend/Types/ConsolidatedCirculation.cs index 298e2f4..3f5b61a 100644 --- a/src/Enmarcha.Backend/Types/ConsolidatedCirculation.cs +++ b/src/Enmarcha.Backend/Types/ConsolidatedCirculation.cs @@ -45,6 +45,5 @@ public class Epsg25829 public class Shape { - public string ShapeId { get; set; } public List<Epsg25829> Points { get; set; } = []; } diff --git a/src/frontend/app/routes/favourites.tsx b/src/frontend/app/routes/favourites.tsx index 9632123..3d786b6 100644 --- a/src/frontend/app/routes/favourites.tsx +++ b/src/frontend/app/routes/favourites.tsx @@ -35,6 +35,7 @@ export default function Favourites() { "tranvias", "tussa", "ourense", + "lugo", "feve", "shuttle", ]; diff --git a/src/frontend/app/routes/map.tsx b/src/frontend/app/routes/map.tsx index efc97e4..0aceec7 100644 --- a/src/frontend/app/routes/map.tsx +++ b/src/frontend/app/routes/map.tsx @@ -586,6 +586,8 @@ export default function StopMap() { "#E61C29", "ourense", "#ffb319", + "lugo", + "#FDC609", "xunta", "#007BC4", "renfe", @@ -599,9 +601,19 @@ export default function StopMap() { ["get", "feed"], "ourense", "#000000", + "lugo", + "#000000", "#FFF", ], - "text-halo-width": ["match", ["get", "feed"], "ourense", 1.5, 1], + "text-halo-width": [ + "match", + ["get", "feed"], + "ourense", + 1.5, + "lugo", + 1.5, + 1, + ], }} /> diff --git a/src/frontend/app/routes/routes.tsx b/src/frontend/app/routes/routes.tsx index 6f07571..57dfe00 100644 --- a/src/frontend/app/routes/routes.tsx +++ b/src/frontend/app/routes/routes.tsx @@ -31,6 +31,7 @@ export default function RoutesPage() { "tranvias", "tussa", "ourense", + "lugo", "feve", "shuttle", ]; diff --git a/src/frontend/public/maps/spritesheet/sprite.json b/src/frontend/public/maps/spritesheet/sprite.json index 48e7554..ee51274 100644 --- a/src/frontend/public/maps/spritesheet/sprite.json +++ b/src/frontend/public/maps/spritesheet/sprite.json @@ -31,9 +31,17 @@ "height": 32, "pixelRatio": 1 }, + "stop-lugo": { + "id": "stop-lugo", + "x": 128, + "y": 0, + "width": 32, + "height": 32, + "pixelRatio": 1 + }, "stop-xunta": { "id": "stop-xunta", - "x": 128, + "x": 160, "y": 0, "width": 32, "height": 32, @@ -41,7 +49,7 @@ }, "stop-renfe": { "id": "stop-renfe", - "x": 160, + "x": 192, "y": 0, "width": 32, "height": 32, @@ -49,7 +57,7 @@ }, "stop-feve": { "id": "stop-feve", - "x": 192, + "x": 224, "y": 0, "width": 32, "height": 32, @@ -57,7 +65,7 @@ }, "stop-generic": { "id": "stop-generic", - "x": 224, + "x": 256, "y": 0, "width": 32, "height": 32, diff --git a/src/frontend/public/maps/spritesheet/sprite.png b/src/frontend/public/maps/spritesheet/sprite.png Binary files differindex fd13c62..f23cd41 100644 --- a/src/frontend/public/maps/spritesheet/sprite.png +++ b/src/frontend/public/maps/spritesheet/sprite.png diff --git a/src/frontend/public/maps/spritesheet/sprite@2x.json b/src/frontend/public/maps/spritesheet/sprite@2x.json index 28dd220..5a09edf 100644 --- a/src/frontend/public/maps/spritesheet/sprite@2x.json +++ b/src/frontend/public/maps/spritesheet/sprite@2x.json @@ -31,9 +31,17 @@ "height": 64, "pixelRatio": 2 }, + "stop-lugo": { + "id": "stop-lugo", + "x": 256, + "y": 0, + "width": 64, + "height": 64, + "pixelRatio": 2 + }, "stop-xunta": { "id": "stop-xunta", - "x": 256, + "x": 320, "y": 0, "width": 64, "height": 64, @@ -41,7 +49,7 @@ }, "stop-renfe": { "id": "stop-renfe", - "x": 320, + "x": 384, "y": 0, "width": 64, "height": 64, @@ -49,7 +57,7 @@ }, "stop-feve": { "id": "stop-feve", - "x": 384, + "x": 448, "y": 0, "width": 64, "height": 64, @@ -57,7 +65,7 @@ }, "stop-generic": { "id": "stop-generic", - "x": 448, + "x": 512, "y": 0, "width": 64, "height": 64, diff --git a/src/frontend/public/maps/spritesheet/sprite@2x.png b/src/frontend/public/maps/spritesheet/sprite@2x.png Binary files differindex f431b7f..4b71f72 100644 --- a/src/frontend/public/maps/spritesheet/sprite@2x.png +++ b/src/frontend/public/maps/spritesheet/sprite@2x.png |
