Commit 65f46692 authored by Volker Krause's avatar Volker Krause
Browse files

Add data about covered UIC company codes

This will be useful for Itinerary to pick a suitable backend prior to
having geo coordinates, based on the carrier code of a ticket.
parent f15dee44
Pipeline #75116 passed with stage
in 19 seconds
......@@ -21,6 +21,7 @@ class CoverageAreaPrivate : public QSharedData {
public:
CoverageArea::Type type = CoverageArea::Any;
QStringList regions;
QStringList uicCompanyCodes;
std::vector<QPolygonF> areas;
QRectF boundingBox;
};
......@@ -29,6 +30,7 @@ public:
KPUBLICTRANSPORT_MAKE_GADGET(CoverageArea)
KPUBLICTRANSPORT_MAKE_PROPERTY(CoverageArea, CoverageArea::Type, type, setType)
KPUBLICTRANSPORT_MAKE_PROPERTY(CoverageArea, QStringList, regions, setRegions)
KPUBLICTRANSPORT_MAKE_PROPERTY(CoverageArea, QStringList, uicCompanyCodes, setUicCompanyCodes)
bool CoverageArea::isEmpty() const
{
......@@ -79,6 +81,7 @@ CoverageArea CoverageArea::fromJson(const QJsonObject &obj)
{
CoverageArea ca;
ca.setRegions(Json::toStringList(obj.value(QLatin1String("region"))));
ca.setUicCompanyCodes(Json::toStringList(obj.value(QLatin1String("uicCompanyCodes"))));
std::sort(ca.d->regions.begin(), ca.d->regions.end());
ca.d->areas = GeoJson::readOuterPolygons(obj.value(QLatin1String("area")).toObject());
for (const auto &area : ca.d->areas) {
......
......@@ -36,6 +36,9 @@ public:
*/
KPUBLICTRANSPORT_PROPERTY(QStringList, regions, setRegions)
/** UIC company codes of operators covered by this backend. */
KPUBLICTRANSPORT_PROPERTY(QStringList, uicCompanyCodes, setUicCompanyCodes)
public:
/** Checks whether this coverage area is empty.
* coversLocation() would always return @p false for empty areas.
......
......@@ -76,7 +76,8 @@
},
"region": [
"AT"
]
],
"uicCompanyCodes": [ "0081", "1181" ]
},
"regularCoverage": {
"region": [
......
......@@ -175,7 +175,8 @@
},
"region": [
"CH"
]
],
"uicCompanyCodes": [ "0085", "1185", "1285", "1385" ]
}
},
"options": {
......
......@@ -80,7 +80,8 @@
"DE",
"LI",
"LU"
]
],
"uicCompanyCodes": [ "0080", "1080", "1180" ]
}
},
"options": {
......
......@@ -77,7 +77,8 @@
},
"region": [
"DK"
]
],
"uicCompanyCodes": [ "1086", "1186", "1286" ]
}
},
"options": {
......
......@@ -71,7 +71,8 @@
},
"region": [
"FI"
]
],
"uicCompanyCodes": [ "0010", "2910" ]
}
},
"options": {
......
......@@ -75,7 +75,8 @@
},
"region": [
"LU"
]
],
"uicCompanyCodes": [ "0082" ]
}
},
"options": {
......
......@@ -72,7 +72,8 @@
},
"region": [
"NL"
]
],
"uicCompanyCodes": [ "1084", "1184" ]
}
},
"options": {
......
......@@ -80,7 +80,8 @@
},
"region": [
"NO"
]
],
"uicCompanyCodes": [ "0076", "1076", "3403" ]
}
},
"options": {
......
......@@ -77,7 +77,8 @@
},
"region": [
"PL"
]
],
"uicCompanyCodes": [ "0051", "1051", "1151", "1251", "1351" ]
}
},
"options": {
......
......@@ -74,7 +74,8 @@
},
"region": [
"SE"
]
],
"uicCompanyCodes": [ "0074", "1074", "1174" ]
}
},
"options": {
......
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