Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Libraries
KPublicTransport
Commits
d07e108b
Commit
d07e108b
authored
Mar 01, 2022
by
Volker Krause
Browse files
Add overnight train coach types and parse corresponding UIC coach types
parent
ebe069c8
Changes
5
Hide whitespace changes
Inline
Side-by-side
autotests/uicrailwaycoachtest.cpp
View file @
d07e108b
...
...
@@ -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
);
}
};
...
...
src/lib/datatypes/vehicle.h
View file @
d07e108b
...
...
@@ -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. */
...
...
src/lib/uic/uicrailwaycoach.cpp
View file @
d07e108b
...
...
@@ -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
},
...
...
src/quick/VehicleSectionItem.qml
View file @
d07e108b
...
...
@@ -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
)
...
...
tests/VehicleLayoutPage.qml
View file @
d07e108b
...
...
@@ -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
"
}
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment