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
PIM
KItinerary
Commits
df3fc8c1
Commit
df3fc8c1
authored
Oct 17, 2021
by
Volker Krause
Browse files
Remove unused train station timezone helper method
This is meanwhile done more generically in the post-processing code.
parent
ef761bfe
Changes
3
Hide whitespace changes
Inline
Side-by-side
autotests/knowledgedbtest.cpp
View file @
df3fc8c1
...
...
@@ -106,26 +106,21 @@ private Q_SLOTS:
{
auto
station
=
KnowledgeDb
::
stationForIbnr
(
IBNR
{
1234567
});
QVERIFY
(
!
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
());
station
=
KnowledgeDb
::
stationForIbnr
({});
QVERIFY
(
!
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
());
station
=
KnowledgeDb
::
stationForIbnr
(
IBNR
{
8011160
});
QVERIFY
(
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
(
"Europe/Berlin"
));
QCOMPARE
(
station
.
country
,
CountryId
{
"DE"
});
station
=
KnowledgeDb
::
stationForIbnr
(
IBNR
{
8501687
});
QVERIFY
(
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
(
"Europe/Zurich"
));
QCOMPARE
(
station
.
country
,
CountryId
{
"CH"
});
// Aachen West, very close to the NL border, should be in DE timezone
station
=
KnowledgeDb
::
stationForIbnr
(
IBNR
{
8000404
});
QVERIFY
(
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
(
"Europe/Berlin"
));
QCOMPARE
(
station
.
country
,
CountryId
{
"DE"
});
}
...
...
@@ -133,15 +128,12 @@ private Q_SLOTS:
{
auto
station
=
KnowledgeDb
::
stationForUic
(
UICStation
{
1234567
});
QVERIFY
(
!
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
());
station
=
KnowledgeDb
::
stationForUic
({});
QVERIFY
(
!
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
());
station
=
KnowledgeDb
::
stationForUic
(
UICStation
{
1001332
});
QVERIFY
(
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
(
"Europe/Helsinki"
));
QCOMPARE
(
station
.
country
,
CountryId
{
"FI"
});
}
...
...
@@ -149,34 +141,27 @@ private Q_SLOTS:
{
auto
station
=
KnowledgeDb
::
stationForSncfStationId
({});
QVERIFY
(
!
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
());
station
=
KnowledgeDb
::
stationForSncfStationId
(
SncfStationId
{
"XXXXX"
});
QVERIFY
(
!
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
());
station
=
KnowledgeDb
::
stationForSncfStationId
(
SncfStationId
{
"FRAES"
});
QVERIFY
(
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
(
"Europe/Paris"
));
QCOMPARE
(
station
.
country
,
CountryId
{
"FR"
});
station
=
KnowledgeDb
::
stationForSncfStationId
(
SncfStationId
{
QStringLiteral
(
"FRXYT"
)});
QVERIFY
(
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
(
"Europe/Paris"
));
QCOMPARE
(
station
.
country
,
CountryId
{
"FR"
});
station
=
KnowledgeDb
::
stationForSncfStationId
(
SncfStationId
{
"CHGVA"
});
QVERIFY
(
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
(
"Europe/Zurich"
));
QCOMPARE
(
station
.
country
,
CountryId
{
"CH"
});
station
=
KnowledgeDb
::
stationForSncfStationId
(
SncfStationId
{
"FRHWO"
});
// alias for CHGVA...
QVERIFY
(
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
(
"Europe/Zurich"
));
QCOMPARE
(
station
.
country
,
CountryId
{
"CH"
});
station
=
KnowledgeDb
::
stationForSncfStationId
(
SncfStationId
{
"NLAMA"
});
// vs. SNCB ID of NLASC
QVERIFY
(
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
(
"Europe/Amsterdam"
));
QCOMPARE
(
station
.
country
,
CountryId
{
"NL"
});
}
...
...
@@ -184,15 +169,12 @@ private Q_SLOTS:
{
auto
station
=
KnowledgeDb
::
stationForBenerailId
({});
QVERIFY
(
!
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
());
station
=
KnowledgeDb
::
stationForBenerailId
(
BenerailStationId
{
"XXXXX"
});
QVERIFY
(
!
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
());
station
=
KnowledgeDb
::
stationForBenerailId
(
BenerailStationId
{
"NLASC"
});
QVERIFY
(
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
(
"Europe/Amsterdam"
));
QCOMPARE
(
station
.
country
,
CountryId
{
"NL"
});
}
...
...
@@ -375,27 +357,22 @@ private Q_SLOTS:
{
auto
station
=
KnowledgeDb
::
stationForIndianRailwaysStationCode
(
QString
());
QVERIFY
(
!
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
());
station
=
KnowledgeDb
::
stationForIndianRailwaysStationCode
(
QStringLiteral
(
"NDLS"
));
QVERIFY
(
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
(
"Asia/Kolkata"
));
QCOMPARE
(
station
.
country
,
CountryId
{
"IN"
});
station
=
KnowledgeDb
::
stationForIndianRailwaysStationCode
(
QStringLiteral
(
"ndls"
));
QVERIFY
(
!
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
());
}
void
testFinishStationCodeLookup
()
{
auto
station
=
KnowledgeDb
::
stationForVRStationCode
(
VRStationCode
(
QStringLiteral
(
"HKI"
)));
QVERIFY
(
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
(
"Europe/Helsinki"
));
station
=
KnowledgeDb
::
stationForVRStationCode
(
VRStationCode
(
QStringLiteral
(
"BLÄ"
)));
QVERIFY
(
!
station
.
coordinate
.
isValid
());
QCOMPARE
(
toQTimeZone
(
station
.
timezone
()),
QTimeZone
());
}
};
...
...
src/lib/knowledgedb/trainstationdb.cpp
View file @
df3fc8c1
...
...
@@ -24,11 +24,6 @@ static_assert(trainstation_table_size < (1 << (sizeof(TrainStationIndex) * 8)),
}
}
Tz
TrainStation
::
timezone
()
const
{
return
timezoneForLocation
(
coordinate
.
latitude
,
coordinate
.
longitude
,
country
);
}
template
<
typename
Id
,
std
::
size_t
Size
>
static
TrainStation
lookupStation
(
Id
id
,
const
TrainStationIdIndex
<
Id
>
(
&
tab
)[
Size
])
{
...
...
src/lib/knowledgedb/trainstationdb.h
View file @
df3fc8c1
...
...
@@ -47,8 +47,6 @@ struct TrainStationIdIndex {
struct
TrainStation
{
Coordinate
coordinate
;
CountryId
country
;
KITINERARY_EXPORT
Tz
timezone
()
const
;
};
...
...
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