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

Move network coverage format closer to the transport API standard format

This uses the correct GeoJSON format for areas, but still doesn't qualify
coverage areas correctly, nor does it add the ISO 3166-1/2 region data.
parent ef24b2ce
......@@ -19,6 +19,7 @@
#include "datatypes/attributionutil_p.h"
#include "datatypes/backend.h"
#include "datatypes/disruption.h"
#include "datatypes/geojson_p.h"
#include "datatypes/platform.h"
#include "datatypes/vehicle.h"
#include "datatypes/vehiclelayoutresult_p.h"
......@@ -239,15 +240,13 @@ static void applyBackendOptions(AbstractBackend *backend, const QMetaObject *mo,
}
}
const auto filter = obj.value(QLatin1String("filter")).toObject();
const auto geoFilter = filter.value(QLatin1String("geo")).toArray();
if (!geoFilter.isEmpty()) {
QPolygonF poly;
poly.reserve(geoFilter.size());
for (const auto &coordV : geoFilter) {
const auto coordA = coordV.toArray();
poly.push_back({coordA[0].toDouble(), coordA[1].toDouble()});
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);
}
......
......@@ -38,25 +38,36 @@
"Name[uk]": "Verkehrsverbund Ostregion (VOR)",
"Name[x-test]": "xxVerkehrsverbund Ostregion (VOR)xx"
},
"filter": {
"geo": [
[
14.3352,
47.9871
],
[
16.2767,
46.6744
],
[
17.574,
48.5545
],
[
14.9609,
49.2139
]
]
"coverage": {
"anyCoverage": {
"area": {
"coordinates": [
[
[
14.3352,
47.9871
],
[
16.2767,
46.6744
],
[
17.574,
48.5545
],
[
14.9609,
49.2139
],
[
14.3352,
47.9871
]
]
],
"type": "Polygon"
}
}
},
"options": {
"auth": {
......
......@@ -38,25 +38,36 @@
"Name[uk]": "Linz AG",
"Name[x-test]": "xxLinz AGxx"
},
"filter": {
"geo": [
[
14.1792,
48.3923
],
[
14.4991,
48.41236
],
[
14.5091,
48.179
],
[
14.1892,
48.1257
]
]
"coverage": {
"anyCoverage": {
"area": {
"coordinates": [
[
[
14.1792,
48.3923
],
[
14.4991,
48.41236
],
[
14.5091,
48.179
],
[
14.1892,
48.1257
],
[
14.1792,
48.3923
]
]
],
"type": "Polygon"
}
}
},
"options": {
"endpoint": "https://www.linzag.at/linz2/"
......
......@@ -37,25 +37,36 @@
"Name[uk]": "Oberösterreichischer Verkehrsverbund (OÖVV)",
"Name[x-test]": "xxOberösterreichischer Verkehrsverbund (OÖVV)xx"
},
"filter": {
"geo": [
[
12.6675,
48.0845
],
[
13.6613,
48.8819
],
[
15.4156,
48.3973
],
[
13.9864,
47.1644
]
]
"coverage": {
"anyCoverage": {
"area": {
"coordinates": [
[
[
12.6675,
48.0845
],
[
13.6613,
48.8819
],
[
15.4156,
48.3973
],
[
13.9864,
47.1644
],
[
12.6675,
48.0845
]
]
],
"type": "Polygon"
}
}
},
"options": {
"auth": {
......
......@@ -38,25 +38,36 @@
"Name[uk]": "Salzburger Verkehrsverbund (SVV)",
"Name[x-test]": "xxSalzburger Verkehrsverbund (SVV)xx"
},
"filter": {
"geo": [
[
12.7865,
48.0288
],
[
11.9051,
47.0342
],
[
14.1444,
46.8972
],
[
13.3701,
48.0764
]
]
"coverage": {
"anyCoverage": {
"area": {
"coordinates": [
[
[
12.7865,
48.0288
],
[
11.9051,
47.0342
],
[
14.1444,
46.8972
],
[
13.3701,
48.0764
],
[
12.7865,
48.0288
]
]
],
"type": "Polygon"
}
}
},
"options": {
"auth": {
......
......@@ -38,25 +38,36 @@
"Name[uk]": "Verkehrsverbund Steiermark (VVSt)",
"Name[x-test]": "xxVerkehrsverbund Steiermark (VVSt)xx"
},
"filter": {
"geo": [
[
13.4446,
47.7198
],
[
16.1595,
47.8887
],
[
16.1309,
46.6204
],
[
13.8844,
46.5981
]
]
"coverage": {
"anyCoverage": {
"area": {
"coordinates": [
[
[
13.4446,
47.7198
],
[
16.1595,
47.8887
],
[
16.1309,
46.6204
],
[
13.8844,
46.5981
],
[
13.4446,
47.7198
]
]
],
"type": "Polygon"
}
}
},
"options": {
"compactXmlRepsonse": true,
......
......@@ -37,25 +37,36 @@
"Name[uk]": "Verkehrsverbund Tirol (VVT)",
"Name[x-test]": "xxVerkehrsverbund Tirol (VVT)xx"
},
"filter": {
"geo": [
[
13.0081,
46.6172
],
[
12.5874,
47.7814
],
[
10.1625,
47.5524
],
[
10.0635,
46.8041
]
]
"coverage": {
"anyCoverage": {
"area": {
"coordinates": [
[
[
13.0081,
46.6172
],
[
12.5874,
47.7814
],
[
10.1625,
47.5524
],
[
10.0635,
46.8041
],
[
13.0081,
46.6172
]
]
],
"type": "Polygon"
}
}
},
"options": {
"auth": {
......
......@@ -38,25 +38,36 @@
"Name[uk]": "Verkehrsverbund Vorarlberg (VVV)",
"Name[x-test]": "xxVerkehrsverbund Vorarlberg (VVV)xx"
},
"filter": {
"geo": [
[
9.5377,
47.5847
],
[
10.2702,
47.6116
],
[
10.1613,
46.8297
],
[
9.4614,
47.0601
]
]
"coverage": {
"anyCoverage": {
"area": {
"coordinates": [
[
[
9.5377,
47.5847
],
[
10.2702,
47.6116
],
[
10.1613,
46.8297
],
[
9.4614,
47.0601
],
[
9.5377,
47.5847
]
]
],
"type": "Polygon"
}
}
},
"options": {
"auth": {
......
......@@ -39,25 +39,36 @@
"Name[uk]": "Österreichische Bundesbahnen (ÖBB)",
"Name[x-test]": "xxÖsterreichische Bundesbahnen (ÖBB)xx"
},
"filter": {
"geo": [
[
9.145,
47.724
],
[
17.052,
49.537
],
[
17.325,
46.267
],
[
9.622,
46.492
]
]
"coverage": {
"anyCoverage": {
"area": {
"coordinates": [
[
[
9.145,
47.724
],
[
17.052,
49.537
],
[
17.325,
46.267
],
[
9.622,
46.492
],
[
9.145,
47.724
]
]
],
"type": "Polygon"
}
}
},
"options": {
"auth": {
......
......@@ -36,25 +36,36 @@
"Name[uk]": "Транспорт у Новому Південному Уельсі",
"Name[x-test]": "xxTransport for NSWxx"
},
"filter": {
"geo": [
[
140.8182,
-28.7755
],
[
154.2714,
-27.9933
],
[
151.0906,
-39.5172
],
[
140.766,
-34.2506
]
]
"coverage": {
"anyCoverage": {
"area": {
"coordinates": [
[
[
140.8182,
-28.7755
],
[
154.2714,
-27.9933
],
[
151.0906,
-39.5172
],
[
140.766,
-34.2506
],
[
140.8182,
-28.7755
]
]
],
"type": "Polygon"
}
}
},
"options": {
"endpoint": "https://transportnsw.info/web/"
......
......@@ -38,25 +38,36 @@
"Name[uk]": "Національна залізнична компаній Бельгії (NMBS/SNCB)",
"Name[x-test]": "xxNational Railway Company of Belgium (NMBS/SNCB)xx"
},
"filter": {
"geo": [
[
1.797,
51.1
],
[
5.55,
49.124
],
[
6.598,
50.464
],
[
5.154,
51.837
]
]
"coverage": {
"anyCoverage": {
"area": {
"coordinates": [
[
[
1.797,
51.1
],
[
5.55,
49.124
],
[
6.598,
50.464
],
[
5.154,
51.837
],
[
1.797,
51.1
]
]
],
"type": "Polygon"
}
}
},
"options": {
"auth": {
......
......@@ -37,25 +37,36 @@
"Name[uk]": "Федеральна залізниця Швейцарії (SBB/CFF/FFS)",
"Name[x-test]": "xxSwiss Federal Railways (SBB/CFF/FFS)xx"
},
"filter": {
"geo": [
[
5.865,
45.912
],
[
10.432,
45.704
],
[
10.532,
47.851
],
[
6.381,
47.773
]