Skip to content

Commit

Permalink
Implement #492
Browse files Browse the repository at this point in the history
  • Loading branch information
kebekus committed Feb 17, 2025
1 parent 8c4f639 commit 5776302
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
20 changes: 20 additions & 0 deletions src/geomaps/VACLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <QCoreApplication>
#include <QDirIterator>
#include <QGeoRectangle>
#include <QImage>
#include <QTemporaryDir>
#include <QTimer>
Expand Down Expand Up @@ -305,6 +306,25 @@ QVector<GeoMaps::VAC> GeoMaps::VACLibrary::vacsByDistance(const QGeoCoordinate&
return result;
}

QVector<GeoMaps::VAC> GeoMaps::VACLibrary::vacs4Point(const QGeoCoordinate& position)
{
QVector<GeoMaps::VAC> 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;
}



//
Expand Down
10 changes: 10 additions & 0 deletions src/geomaps/VACLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ class VACLibrary : public QObject
*/
[[nodiscard]] Q_INVOKABLE QVector<GeoMaps::VAC> 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<GeoMaps::VAC> vacs4Point(const QGeoCoordinate& position);

signals:
/*! \brief Notifier signal */
void dataChanged();
Expand Down
41 changes: 39 additions & 2 deletions src/qml/dialogs/WaypointDescription.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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, {});
}

Expand Down Expand Up @@ -197,7 +202,6 @@ CenteringDialog {
wrapMode: Text.WordWrap
textFormat: Text.StyledText
}

}
}

Expand Down Expand Up @@ -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: "<a href='xx'>" + vb.vac.name + "</a>"
flat: true
Layout.alignment: Qt.AlignVCenter
onPressed: {
PlatformAdaptor.vibrateBrief()
Global.currentVAC = vb.vac
waypointDescriptionDialog.close()
}
}

Item {
Layout.fillWidth: true
}
}
}

Component {
id: satButtonDelegate

Expand Down Expand Up @@ -428,7 +466,6 @@ CenteringDialog {
}
}


ColumnLayout {
anchors.fill: parent

Expand Down

0 comments on commit 5776302

Please sign in to comment.