From 7461ed3cfd60327f620d49d5511c6657f01218d7 Mon Sep 17 00:00:00 2001 From: Alexander Barthel Date: Tue, 12 Mar 2024 13:57:42 +0100 Subject: [PATCH] Fixed missing navaids in tabs `Airport` -> `Nearest` and added missing links to navaids. --- CHANGELOG.txt | 1 + src/common/htmlinfobuilder.cpp | 44 +++++++++++++++++++++------------- src/query/mapquery.cpp | 4 +++- 3 files changed, 32 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 474ace485..97e9113c2 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -16,6 +16,7 @@ or below for the full changelog from 2.8.12. * Hotfix to avoid error message `Caught exception: Invalid lat/long format` when loading the new MSFS PLN files with `*` as degree sign, as used since 3.0.4. +* Fixed missing navaids in tabs `Airport` -> `Nearest` and added missing links to navaids. ---- diff --git a/src/common/htmlinfobuilder.cpp b/src/common/htmlinfobuilder.cpp index cd78beb66..6c142dea2 100644 --- a/src/common/htmlinfobuilder.cpp +++ b/src/common/htmlinfobuilder.cpp @@ -589,22 +589,20 @@ void HtmlInfoBuilder::nearestMapObjectsTextRow(const MapAirport& airport, HtmlBu // Create table row ========================== html.tr(QColor()); - if(airportCol) - { - // Airports have no type and link is on name - html.td(displayIdent, ahtml::BOLD); - html.tdF(ahtml::ALIGN_RIGHT).a(name, url, ahtml::LINK_NO_UL).tdEnd(); - } + QString displayText; + if(name.isEmpty()) + displayText = displayIdent; else - { + displayText = tr("%1 (%2)").arg(name).arg(displayIdent); + + html.tdF(ahtml::ALIGN_LEFT).a(displayText, url, ahtml::LINK_NO_UL).tdEnd(); + + if(!airportCol) // Navaid type html.td(type, ahtml::BOLD); - html.td(displayIdent, ahtml::BOLD); - html.tdF(ahtml::ALIGN_RIGHT).a(name, url, ahtml::LINK_NO_UL).tdEnd(); - } if(frequencyCol) - html.td(freq, ahtml::ALIGN_RIGHT); + html.td(freq, ahtml::ALIGN_CENTER); html.td(courseTextFromTrue(bearingTrue, magVar), ahtml::ALIGN_RIGHT | ahtml::NO_ENTITIES). td(Unit::distMeter(distance, false), ahtml::ALIGN_RIGHT). @@ -622,12 +620,11 @@ bool HtmlInfoBuilder::nearestMapObjectsText(const MapAirport& airport, HtmlBuild // Create table header ========================== html.tr(QColor()); + html.th(tr("Name") % tr(" ") % tr("Ident")); + if(!airportCol) html.th(tr("Type")); - html.th(tr("Ident")). - th(tr("Name")); - if(frequencyCol) // Only for navaids html.th(tr("Frequency\nkHz/MHz")); @@ -637,10 +634,10 @@ bool HtmlInfoBuilder::nearestMapObjectsText(const MapAirport& airport, HtmlBuild trEnd(); // Go through mixed list of map objects ============================================ - int row = 1; + int row = 0; for(const map::MapBase *baseNav : *nearestNav) { - if(row++ > maxRows) + if(row > maxRows) // Stop at max break; @@ -654,29 +651,44 @@ bool HtmlInfoBuilder::nearestMapObjectsText(const MapAirport& airport, HtmlBuild // Omit center airport used as reference if(apSim.isValid() && apSim.id != airport.id) + { nearestMapObjectsTextRow(airport, html, QString(), apSim.displayIdent(), apSim.name, QString(), &apSim, apSim.magvar, frequencyCol, airportCol); + row++; + } } const map::MapVor *vor = baseNav->asPtr(); if(vor != nullptr) + { nearestMapObjectsTextRow(airport, html, map::vorType(*vor), vor->ident, vor->name, locale.toString(vor->frequency / 1000., 'f', 2), vor, vor->magvar, frequencyCol, airportCol); + row++; + } const map::MapNdb *ndb = baseNav->asPtr(); if(ndb != nullptr) + { nearestMapObjectsTextRow(airport, html, tr("NDB"), ndb->ident, ndb->name, locale.toString(ndb->frequency / 100., 'f', 1), ndb, ndb->magvar, frequencyCol, airportCol); + row++; + } const map::MapWaypoint *waypoint = baseNav->asPtr(); if(waypoint != nullptr) + { nearestMapObjectsTextRow(airport, html, tr("Waypoint"), waypoint->ident, QString(), QString(), waypoint, waypoint->magvar, frequencyCol, airportCol); + row++; + } const map::MapIls *ils = baseNav->asPtr(); if(ils != nullptr && !ils->isAnyGlsRnp()) + { nearestMapObjectsTextRow(airport, html, map::ilsType(*ils, true /* gs */, true /* dme */, tr(", ")), ils->ident, ils->name, ils->freqMHzLocale(), ils, ils->magvar, frequencyCol, airportCol); + row++; + } } html.tableEnd(); return true; diff --git a/src/query/mapquery.cpp b/src/query/mapquery.cpp index df493d0b4..9fcc6da2f 100644 --- a/src/query/mapquery.cpp +++ b/src/query/mapquery.cpp @@ -329,7 +329,9 @@ map::MapResultIndex *MapQuery::nearestNavaidsInternal(const Pos& pos, float dist query::fetchObjectsForRect(rect, ilsByRectQuery, [ =, &ilsRes](atools::sql::SqlQuery *query) -> void { MapIls obj; mapTypesFactory->fillIls(query->record(), obj); - ilsRes.append(obj); + + if(!obj.isAnyGlsRnp()) + ilsRes.append(obj); }); maptools::removeByDistance(ilsRes, pos, atools::geo::nmToMeter(maxIlsDist)); maptools::sortByDistance(ilsRes, pos);