Commit d07e108b authored by Volker Krause's avatar Volker Krause
Browse files

Add overnight train coach types and parse corresponding UIC coach types

parent ebe069c8
......@@ -73,6 +73,9 @@ private Q_SLOTS:
QCOMPARE(UicRailwayCoach::type(u"938058080061", u"Bpmzf"), VehicleSection::ControlCar);
QCOMPARE(UicRailwayCoach::type(u"505486720019", u"ABfbdmteeo"), VehicleSection::ControlCar);
QCOMPARE(UicRailwayCoach::type(u"615485711035", u"ARmpee"), VehicleSection::PassengerCar);
QCOMPARE(UicRailwayCoach::type(u"618072900000", u"WLABmz"), VehicleSection::SleepingCar);
QCOMPARE(UicRailwayCoach::type(u"618159900000", u"Bcmz"), VehicleSection::CouchetteCar);
QCOMPARE(UicRailwayCoach::type(u"738159913000", u"Bbcmvz"), VehicleSection::CouchetteCar);
}
};
......
......@@ -45,6 +45,8 @@ class KPUBLICTRANSPORT_EXPORT VehicleSection
ControlCar, ///< usually at the head of the train, but accessible for passengers and the same way as a PassengerCar
PassengerCar, ///< passenger car of a train
RestaurantCar, ///< full-car restaurant
SleepingCar, ///< sleeping passenger car of an overnight train
CouchetteCar, ///< couchette passenger car of an overnight train
};
Q_ENUM(Type)
/** Type of this vehicle section. */
......
......@@ -44,7 +44,7 @@ struct {
{ "DA", VehicleSection::FirstClass, VehicleSection::NoFeatures, VehicleSection::UnknownType, 2 },
{ "DB", VehicleSection::SecondClass, VehicleSection::NoFeatures, VehicleSection::UnknownType, 2 },
{ "DD", VehicleSection::UnknownClass, VehicleSection::NoFeatures, VehicleSection::UnknownType, 2 }, // TODO car transport coach
{ "WLAB", VehicleSection::FirstClass | VehicleSection::SecondClass, VehicleSection::NoFeatures, VehicleSection::UnknownType, 1 },
{ "WLAB", VehicleSection::FirstClass | VehicleSection::SecondClass, VehicleSection::NoFeatures, VehicleSection::SleepingCar, 1 },
{ "WLA", VehicleSection::FirstClass, VehicleSection::NoFeatures, VehicleSection::UnknownType, 1 },
{ "WLB", VehicleSection::SecondClass, VehicleSection::NoFeatures, VehicleSection::UnknownType, 1 },
{ "WR", VehicleSection::UnknownClass, VehicleSection::Restaurant, VehicleSection::RestaurantCar, 1 },
......@@ -84,9 +84,9 @@ struct {
VehicleSection::Features features;
} static constexpr const number_prefix_table[] = {
{ "50", VehicleSection::PassengerCar, VehicleSection::NoFeatures },
{ "70", VehicleSection::PassengerCar, VehicleSection::AirConditioning }, // also: air conditioned
// { "71", VehicleSection:: TODO }, // TODO sleeping car
{ "73", VehicleSection::PassengerCar, VehicleSection::AirConditioning }, // also: air conditioned
{ "70", VehicleSection::PassengerCar, VehicleSection::AirConditioning },
{ "71", VehicleSection::SleepingCar, VehicleSection::NoFeatures },
{ "73", VehicleSection::PassengerCar, VehicleSection::AirConditioning },
{ "91", VehicleSection::Engine, VehicleSection::NoFeatures },
{ "92", VehicleSection::Engine, VehicleSection::NoFeatures },
};
......@@ -102,7 +102,7 @@ struct UicClassificationSecondary {
// 54: Czech Republic
static constexpr const UicClassificationSecondary secondary_54_table[] = {
{ "b", VehicleSection::WheelchairAccessible, VehicleSection::UnknownType, 1 },
// "c" Couchettes - TODO needs enum
{ "c", VehicleSection::NoFeatures, VehicleSection::CouchetteCar, 1 },
{ "d", VehicleSection::BikeStorage, VehicleSection::UnknownType, 1 },
{ "f", VehicleSection::NoFeatures, VehicleSection::ControlCar, 1 },
{ "o", VehicleSection::NoFeatures, VehicleSection::UnknownType, 2 }, // ### could also be 't'?
......@@ -112,7 +112,7 @@ static constexpr const UicClassificationSecondary secondary_54_table[] = {
// 80: Germany
static constexpr const UicClassificationSecondary secondary_80_table[] = {
{ "b", VehicleSection::WheelchairAccessible, VehicleSection::UnknownType, 1 },
// "c" Couchettes - TODO needs enum
{ "c", VehicleSection::NoFeatures, VehicleSection::CouchetteCar, 1 },
{ "d", VehicleSection::BikeStorage, VehicleSection::UnknownType, 1 },
{ "f", VehicleSection::NoFeatures, VehicleSection::ControlCar, 1 },
{ "k", VehicleSection::Restaurant, VehicleSection::UnknownType, 1 },
......@@ -123,7 +123,7 @@ static constexpr const UicClassificationSecondary secondary_80_table[] = {
// 81: Austria
static constexpr const UicClassificationSecondary secondary_81_table[] = {
{ "b", VehicleSection::WheelchairAccessible, VehicleSection::UnknownType, 1 }, // TODO wheelchair accessible toilets specifically
// "c" Couchettes - TODO needs enum
{ "c", VehicleSection::NoFeatures, VehicleSection::CouchetteCar, 1 },
{ "f", VehicleSection::NoFeatures, VehicleSection::ControlCar, 1 },
{ "p", VehicleSection::NoFeatures, VehicleSection::PassengerCar, 1 },
{ "-s", VehicleSection::NoFeatures, VehicleSection::ControlCar, 1 },
......
......@@ -52,6 +52,8 @@ StyledFrameSvgItem {
case VehicleSection.PassengerCar:
case VehicleSection.RestaurantCar:
case VehicleSection.ControlCar:
case VehicleSection.SleepingCar:
case VehicleSection.CouchetteCar:
svgName += "-double-deck";
break;
}
......@@ -68,6 +70,8 @@ StyledFrameSvgItem {
return restaurantBackground;
case VehicleSection.PassengerCar:
case VehicleSection.ControlCar:
case VehicleSection.SleepingCar:
case VehicleSection.CouchetteCar:
if (section.classes == VehicleSection.FirstClass)
return firstClassBackground;
else if (section.classes & VehicleSection.FirstClass)
......
......@@ -148,6 +148,10 @@ Kirigami.ScrollablePage {
return "Unknown class";
}
}
QQC2.Label {
visible: section.type == KPublicTransport.VehicleSection.SleepingCar || section.type == KPublicTransport.VehicleSection.CouchetteCar
text: section.type == KPublicTransport.VehicleSection.SleepingCar ? "Sleeping car" : "Couchette car"
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment