Commit 22169ffe authored by Beat Küng's avatar Beat Küng

AirMapManager: update polygons to changed airmapd interface

parent 6599fde0
...@@ -210,21 +210,20 @@ void AirMapRestrictionManager::setROI(const QGeoCoordinate& center, double radiu ...@@ -210,21 +210,20 @@ void AirMapRestrictionManager::setROI(const QGeoCoordinate& center, double radiu
void AirMapRestrictionManager::_addPolygonToList(const airmap::Geometry::Polygon& polygon, QList<PolygonAirspaceRestriction*>& list) void AirMapRestrictionManager::_addPolygonToList(const airmap::Geometry::Polygon& polygon, QList<PolygonAirspaceRestriction*>& list)
{ {
QVariantList polygonArray; QVariantList polygonArray;
if (polygon.size() == 1) { for (const auto& vertex : polygon.outer_ring.coordinates) {
for (const auto& vertex : polygon[0].coordinates) { QGeoCoordinate coord;
QGeoCoordinate coord; if (vertex.altitude) {
if (vertex.altitude) { coord = QGeoCoordinate(vertex.latitude, vertex.longitude, vertex.altitude.get());
coord = QGeoCoordinate(vertex.latitude, vertex.longitude, vertex.altitude.get()); } else {
} else { coord = QGeoCoordinate(vertex.latitude, vertex.longitude);
coord = QGeoCoordinate(vertex.latitude, vertex.longitude);
}
polygonArray.append(QVariant::fromValue(coord));
} }
list.append(new PolygonAirspaceRestriction(polygonArray)); polygonArray.append(QVariant::fromValue(coord));
}
list.append(new PolygonAirspaceRestriction(polygonArray));
} else { if (polygon.inner_rings.size() > 0) {
// no need to support those (they are rare, and in most cases, there's a more restrictive polygon filling the hole) // no need to support those (they are rare, and in most cases, there's a more restrictive polygon filling the hole)
qCDebug(AirMapManagerLog) << "Empty polygon, or Polygon with holes. Size: "<<polygon.size(); qCDebug(AirMapManagerLog) << "Polygon with holes. Size: "<<polygon.inner_rings.size();
} }
} }
......
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