mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-24 07:55:35 +08:00
Ref T111, allow to search for location in coordinate form
This commit is contained in:
committed by
Mathew Sutcliffe
parent
bb4f0e7a13
commit
ccdfa8e12f
@@ -36,7 +36,12 @@ namespace BlackCore
|
||||
|
||||
CAirport CAirportDataReader::getAirportForIcaoDesignator(const QString &designator) const
|
||||
{
|
||||
return getAirports().findByIcao(CAirportIcaoCode(designator)).frontOrDefault();
|
||||
return getAirports().findFirstByIcao(CAirportIcaoCode(designator));
|
||||
}
|
||||
|
||||
CAirport CAirportDataReader::getAirportForNameOrLocation(const QString &nameOrLocation) const
|
||||
{
|
||||
return getAirports().findFirstByNameOrLocation(nameOrLocation);
|
||||
}
|
||||
|
||||
int CAirportDataReader::getAirportsCount() const
|
||||
|
||||
@@ -42,6 +42,10 @@ namespace BlackCore
|
||||
//! \threadsafe
|
||||
BlackMisc::Aviation::CAirport getAirportForIcaoDesignator(const QString &designator) const;
|
||||
|
||||
//! Get airports for location
|
||||
//! \threadsafe
|
||||
BlackMisc::Aviation::CAirport getAirportForNameOrLocation(const QString &location) const;
|
||||
|
||||
//! Returns a list of all airports in the database.
|
||||
//! \threadsafe
|
||||
int getAirportsCount() const;
|
||||
|
||||
@@ -672,6 +672,12 @@ namespace BlackCore
|
||||
return CAirport();
|
||||
}
|
||||
|
||||
CAirport CWebDataServices::getAirportForNameOrLocation(const QString &nameOrLocation) const
|
||||
{
|
||||
if (m_airportDataReader) { return m_airportDataReader->getAirportForNameOrLocation(nameOrLocation); }
|
||||
return CAirport();
|
||||
}
|
||||
|
||||
CCountry CWebDataServices::getCountryForIsoCode(const QString &iso) const
|
||||
{
|
||||
if (m_icaoDataReader) { return m_icaoDataReader->getCountryForIsoCode(iso); }
|
||||
|
||||
@@ -317,6 +317,10 @@ namespace BlackCore
|
||||
//! \threadsafe
|
||||
BlackMisc::Aviation::CAirport getAirportForIcaoDesignator(const QString &icao) const;
|
||||
|
||||
//! Get airport for name of location
|
||||
//! \threadsafe
|
||||
BlackMisc::Aviation::CAirport getAirportForNameOrLocation(const QString &nameOrLocation) const;
|
||||
|
||||
//! Get METARs
|
||||
//! \threadsafe
|
||||
BlackMisc::Weather::CMetarList getMetars() const;
|
||||
|
||||
@@ -157,16 +157,25 @@ namespace BlackGui
|
||||
// location based on swift data
|
||||
if (sApp && sApp->hasWebDataServices())
|
||||
{
|
||||
CAirport airport;
|
||||
|
||||
// airport ICAO
|
||||
if (l.length() == 4 && sApp->getWebDataServices()->getAirportsCount() > 0)
|
||||
{
|
||||
const CAirport airport = sApp->getWebDataServices()->getAirportForIcaoDesignator(l);
|
||||
airport = sApp->getWebDataServices()->getAirportForIcaoDesignator(l);
|
||||
if (airport.hasValidDbKey())
|
||||
{
|
||||
this->setCoordinate(airport);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
airport = sApp->getWebDataServices()->getAirportForNameOrLocation(l);
|
||||
if (airport.hasValidDbKey())
|
||||
{
|
||||
this->setCoordinate(airport);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user