mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 01:45:38 +08:00
refs #484 Revise XBus airports-in-range code using CNavDataReferenceList.
This commit is contained in:
@@ -112,22 +112,10 @@ namespace XBus
|
||||
if (icao[0] != 0)
|
||||
{
|
||||
using namespace BlackMisc::Math;
|
||||
m_airports.insert(CMathUtils::deg2rad(lat), CMathUtils::deg2rad(lon), i);
|
||||
m_airports.push_back(BlackMisc::Simulation::XPlane::CNavDataReference(i, lat, lon));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int total = 0, count = 0, max = 0;
|
||||
for (auto key : m_airports.keys())
|
||||
{
|
||||
qDebug() << "<><><><>" << QString("%1").arg(key, 6, 16, QChar('0')) << m_airports.count(key);
|
||||
total += m_airports.count(key);
|
||||
count++;
|
||||
if (m_airports.count(key) > max) { max = m_airports.count(key); }
|
||||
}
|
||||
qDebug() << "<><><><> total" << total;
|
||||
qDebug() << "<><><><> max" << max;
|
||||
qDebug() << "<><><><> mean" << (total / count);
|
||||
}
|
||||
|
||||
void CService::updateAirportsInRange()
|
||||
@@ -137,13 +125,14 @@ namespace XBus
|
||||
readAirportsDatabase();
|
||||
}
|
||||
using namespace BlackMisc::Math;
|
||||
using namespace BlackMisc::Geo;
|
||||
QStringList icaos, names;
|
||||
QDoubleList lats, lons, alts;
|
||||
for (auto navref : m_airports.inAdjacentTiles(CMathUtils::deg2rad(getLatitude()), CMathUtils::deg2rad(getLongitude())))
|
||||
for (const auto &navref : m_airports.findClosest(20, CCoordinateGeodetic(getLatitude(), getLongitude(), 0)))
|
||||
{
|
||||
float lat, lon, alt;
|
||||
char icao[32], name[256];
|
||||
XPLMGetNavAidInfo(navref, nullptr, &lat, &lon, &alt, nullptr, nullptr, icao, name, nullptr);
|
||||
XPLMGetNavAidInfo(navref.id(), nullptr, &lat, &lon, &alt, nullptr, nullptr, icao, name, nullptr);
|
||||
icaos.push_back(icao);
|
||||
names.push_back(name);
|
||||
lats.push_back(lat);
|
||||
|
||||
Reference in New Issue
Block a user