routingalternatives: consider transit options

This commit is contained in:
2026-01-08 00:32:50 +01:00
parent ca41233397
commit 41bda73041
7 changed files with 144 additions and 11 deletions
+15 -1
View File
@@ -10,5 +10,19 @@ public enum Modality {
TRAIN,
CAR,
MOTORCYCLE,
TAXI
TAXI;
public static Modality fromCartaString(String cartaType) {
return switch (cartaType.toLowerCase()) {
case "tram", "subway" -> TRAM;
case "rail", "monorail" -> TRAIN;
case "bus", "trolleybus" -> BUS;
case "ferry", "cablecar", "gondola", "funicular" ->
throw new UnsupportedOperationException("Transport type needs to be added to backend: " + cartaType);
// these are to dervive modality from carta step type
case "walkingstep" -> WALKING;
case "cyclingstep" -> BICYCLE;
default -> throw new IllegalArgumentException("Unknown CARTA modality: " + cartaType);
};
}
}