diff --git a/CMakeLists.txt b/CMakeLists.txt index fa28fce7d..e93b23556 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ option(QTDEPLOY "Generate and run Qt deployment scripts" OFF) # Project data # -project(enroute VERSION 2.32.9) +project(enroute VERSION 2.32.10) set(APP_ID de.akaflieg_freiburg.enroute) set(DISPLAY_NAME "Enroute") math(EXPR PROJECT_VERSION_CODE 10000*${PROJECT_VERSION_MAJOR}+100*${PROJECT_VERSION_MINOR}+${PROJECT_VERSION_PATCH}) diff --git a/src/geomaps/VACLibrary.cpp b/src/geomaps/VACLibrary.cpp index 3597f68ca..b9b678d23 100644 --- a/src/geomaps/VACLibrary.cpp +++ b/src/geomaps/VACLibrary.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -305,6 +306,25 @@ QVector GeoMaps::VACLibrary::vacsByDistance(const QGeoCoordinate& return result; } +QVector GeoMaps::VACLibrary::vacs4Point(const QGeoCoordinate& position) +{ + QVector result; + const auto constvacs = m_vacs; + for(const auto& vac : constvacs) { + if (!vac.isValid()) + { + continue; + } + const QGeoRectangle rc(vac.topLeft, vac.bottomRight); + if (rc.contains(position)) + { + result.append(vac); + } + } + std::sort(result.begin(), result.end(), [](const GeoMaps::VAC& first, const GeoMaps::VAC& second) {return first.name < second.name; }); + return result; +} + // diff --git a/src/geomaps/VACLibrary.h b/src/geomaps/VACLibrary.h index 3f0278b8a..878b057f8 100644 --- a/src/geomaps/VACLibrary.h +++ b/src/geomaps/VACLibrary.h @@ -157,6 +157,16 @@ class VACLibrary : public QObject */ [[nodiscard]] Q_INVOKABLE QVector vacsByDistance(const QGeoCoordinate& position, const QString& filter); + /*! \brief List of all VACs installed + * + * This method returns the list of all installed VACs that contain the given point. + * + * @param position Geographic position + * + * @returns List of all VACs installed + */ + [[nodiscard]] Q_INVOKABLE QVector vacs4Point(const QGeoCoordinate& position); + signals: /*! \brief Notifier signal */ void dataChanged(); diff --git a/src/qml/dialogs/WaypointDescription.qml b/src/qml/dialogs/WaypointDescription.qml index a69253223..2e110cdec 100644 --- a/src/qml/dialogs/WaypointDescription.qml +++ b/src/qml/dialogs/WaypointDescription.qml @@ -71,6 +71,11 @@ CenteringDialog { for (i in asl) airspaceDelegate.createObject(co, {airspace: asl[i]}); + // Create airspace description items + var vac = VACLibrary.vacs4Point(waypoint.coordinate) + for (i in vac) + vacButtonDelegate.createObject(co, {vac: vac[i]}); + satButtonDelegate.createObject(co, {}); } @@ -197,7 +202,6 @@ CenteringDialog { wrapMode: Text.WordWrap textFormat: Text.StyledText } - } } @@ -393,6 +397,40 @@ CenteringDialog { } } + Component { + id: vacButtonDelegate + + RowLayout { + id: vb + + Layout.preferredWidth: sv.width + + property vac vac + + Icon { + Layout.preferredWidth: button.font.pixelSize*3 + Layout.alignment: Qt.AlignVCenter + source: "/icons/material/ic_map.svg" + } + + Button { + id: button + text: "" + vb.vac.name + "" + flat: true + Layout.alignment: Qt.AlignVCenter + onPressed: { + PlatformAdaptor.vibrateBrief() + Global.currentVAC = vb.vac + waypointDescriptionDialog.close() + } + } + + Item { + Layout.fillWidth: true + } + } + } + Component { id: satButtonDelegate @@ -428,7 +466,6 @@ CenteringDialog { } } - ColumnLayout { anchors.fill: parent