Skip to content
GitLab
Menu
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
6ba69baf
Commit
6ba69baf
authored
Apr 18, 2021
by
Volker Krause
Browse files
Remove the leftovers of the old coverage area handling
parent
9e1fc016
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/lib/backends/abstractbackend.cpp
View file @
6ba69baf
...
...
@@ -32,22 +32,6 @@ void AbstractBackend::setBackendId(const QString& id)
m_backendId
=
id
;
}
bool
AbstractBackend
::
isLocationExcluded
(
const
Location
&
loc
)
const
{
if
(
loc
.
hasCoordinate
()
&&
!
m_geoFilter
.
isEmpty
())
{
return
!
m_geoFilter
.
containsPoint
({
loc
.
longitude
(),
loc
.
latitude
()},
Qt
::
WindingFill
);
}
if
(
loc
.
country
().
size
()
==
2
&&
backendId
().
size
()
>
3
&&
backendId
().
at
(
2
)
==
QLatin1Char
(
'_'
))
{
return
loc
.
country
().
compare
(
backendId
().
leftRef
(
2
),
Qt
::
CaseInsensitive
)
!=
0
;
}
return
false
;
}
void
AbstractBackend
::
setGeoFilter
(
const
QPolygonF
&
poly
)
{
m_geoFilter
=
poly
;
}
QTimeZone
AbstractBackend
::
timeZone
()
const
{
return
m_timeZone
;
...
...
src/lib/backends/abstractbackend.h
View file @
6ba69baf
...
...
@@ -50,10 +50,6 @@ public:
QString
backendId
()
const
;
void
setBackendId
(
const
QString
&
id
);
/** Checks if this location has been filtered by the network configuration. */
bool
isLocationExcluded
(
const
Location
&
loc
)
const
;
void
setGeoFilter
(
const
QPolygonF
&
poly
);
/** Static timezone for all times used by and provided by the backend.
* Set to invalid if the backend supports multiple timezones.
*/
...
...
@@ -197,7 +193,6 @@ private:
void
setCustomCaCertificate
(
const
QString
&
caCert
);
QString
m_backendId
;
QPolygonF
m_geoFilter
;
Attribution
m_attribution
;
QTimeZone
m_timeZone
;
QStringList
m_supportedLanguages
;
...
...
src/lib/manager.cpp
View file @
6ba69baf
...
...
@@ -221,16 +221,6 @@ static void applyBackendOptions(AbstractBackend *backend, const QMetaObject *mo,
}
}
const
auto
coverageData
=
obj
.
value
(
QLatin1String
(
"coverage"
)).
toObject
();
for
(
const
auto
&
coverageType
:
{
"anyCoverage"
,
"regularCoverage"
,
"realtimeCoverage"
})
{
const
auto
coverage
=
coverageData
.
value
(
QLatin1String
(
coverageType
)).
toObject
();
if
(
coverage
.
empty
())
{
continue
;
}
const
auto
poly
=
GeoJson
::
readOuterPolygon
(
coverage
.
value
(
QLatin1String
(
"area"
)).
toObject
());
backend
->
setGeoFilter
(
poly
);
}
const
auto
attrObj
=
obj
.
value
(
QLatin1String
(
"attribution"
)).
toObject
();
const
auto
attr
=
Attribution
::
fromJson
(
attrObj
);
backend
->
setAttribution
(
attr
);
...
...
@@ -731,8 +721,8 @@ VehicleLayoutReply* Manager::queryVehicleLayout(const VehicleLayoutRequest &req)
if
(
d
->
shouldSkipBackend
(
backend
,
req
))
{
continue
;
}
if
(
req
.
stopover
().
stopPoint
().
hasCoordinate
()
&&
backend
->
isLocationExcluded
(
req
.
stopover
().
stopPoint
()))
{
qCDebug
(
Log
)
<<
"Skipping backend based on location filter:"
<<
backend
->
backendId
();
const
auto
coverage
=
b
.
coverageArea
(
CoverageArea
::
Realtime
);
if
(
coverage
.
isEmpty
()
||
!
coverage
.
coversLocation
(
req
.
stopover
().
stopPoint
()))
{
continue
;
}
reply
->
addAttribution
(
backend
->
attribution
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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