diff --git a/src/MissionManager/AirMapManager.cc b/src/MissionManager/AirMapManager.cc index ba91d724ad559a8f4b8e9afddd52908badbe7beb..f95b0fff733dba3ea43e3066b11a0c53ac932d6e 100644 --- a/src/MissionManager/AirMapManager.cc +++ b/src/MissionManager/AirMapManager.cc @@ -210,21 +210,20 @@ void AirMapRestrictionManager::setROI(const QGeoCoordinate& center, double radiu void AirMapRestrictionManager::_addPolygonToList(const airmap::Geometry::Polygon& polygon, QList& list) { QVariantList polygonArray; - if (polygon.size() == 1) { - for (const auto& vertex : polygon[0].coordinates) { - QGeoCoordinate coord; - if (vertex.altitude) { - coord = QGeoCoordinate(vertex.latitude, vertex.longitude, vertex.altitude.get()); - } else { - coord = QGeoCoordinate(vertex.latitude, vertex.longitude); - } - polygonArray.append(QVariant::fromValue(coord)); + for (const auto& vertex : polygon.outer_ring.coordinates) { + QGeoCoordinate coord; + if (vertex.altitude) { + coord = QGeoCoordinate(vertex.latitude, vertex.longitude, vertex.altitude.get()); + } else { + coord = QGeoCoordinate(vertex.latitude, vertex.longitude); } - 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) - qCDebug(AirMapManagerLog) << "Empty polygon, or Polygon with holes. Size: "<