mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 01:45:38 +08:00
Ref T226, airport completer
* a bigger one with name * same as dialog * smaller one, using the dialog
This commit is contained in:
@@ -58,6 +58,11 @@ namespace BlackMisc
|
||||
if (this->m_descriptiveName.isEmpty()) { this->m_descriptiveName = airport.getDescriptiveName(); }
|
||||
}
|
||||
|
||||
bool CAirport::isNull() const
|
||||
{
|
||||
return (m_icao.isEmpty() && m_descriptiveName.isEmpty());
|
||||
}
|
||||
|
||||
QString CAirport::convertToQString(bool i18n) const
|
||||
{
|
||||
QString s = i18n ? QCoreApplication::translate("Aviation", "Airport") : "Airport";
|
||||
|
||||
@@ -127,6 +127,9 @@ namespace BlackMisc
|
||||
//! Valid ICAO code
|
||||
bool hasValidIcaoCode() const { return !this->getIcao().isEmpty(); }
|
||||
|
||||
//! NULL airport?
|
||||
virtual bool isNull() const override;
|
||||
|
||||
//! \copydoc Geo::ICoordinateGeodetic::latitude
|
||||
virtual BlackMisc::Geo::CLatitude latitude() const override
|
||||
{
|
||||
|
||||
@@ -83,18 +83,37 @@ namespace BlackMisc
|
||||
QStringList icaos;
|
||||
for (const CAirport &airport : *this)
|
||||
{
|
||||
if (!airport.getIcaoAsString().isEmpty())
|
||||
{
|
||||
icaos.push_back(airport.getIcaoAsString());
|
||||
}
|
||||
}
|
||||
if (sorted)
|
||||
{
|
||||
icaos.sort();
|
||||
if (airport.getIcaoAsString().isEmpty()) { continue; }
|
||||
icaos.push_back(airport.getIcaoAsString());
|
||||
}
|
||||
if (sorted) { icaos.sort(); }
|
||||
return icaos;
|
||||
}
|
||||
|
||||
QStringList CAirportList::allDescriptivesNames(bool sorted) const
|
||||
{
|
||||
QStringList names;
|
||||
for (const CAirport &airport : *this)
|
||||
{
|
||||
if (airport.getDescriptiveName().isEmpty()) { continue; }
|
||||
names.push_back(airport.getDescriptiveName());
|
||||
}
|
||||
if (sorted) { names.sort(); }
|
||||
return names;
|
||||
}
|
||||
|
||||
QStringList CAirportList::allLocations(bool sorted) const
|
||||
{
|
||||
QStringList locations;
|
||||
for (const CAirport &airport : *this)
|
||||
{
|
||||
if (airport.getLocation().isEmpty()) { continue; }
|
||||
locations.push_back(airport.getLocation());
|
||||
}
|
||||
if (sorted) { locations.sort(); }
|
||||
return locations;
|
||||
}
|
||||
|
||||
CAirportList CAirportList::fromDatabaseJson(const QJsonArray &array, CAirportList *inconsistent)
|
||||
{
|
||||
CAirportList airports;
|
||||
|
||||
@@ -64,6 +64,12 @@ namespace BlackMisc
|
||||
//! All ICAO codes
|
||||
QStringList allIcaoCodes(bool sorted) const;
|
||||
|
||||
//! All names
|
||||
QStringList allDescriptivesNames(bool sorted) const;
|
||||
|
||||
//! All names
|
||||
QStringList allLocations(bool sorted) const;
|
||||
|
||||
//! From our DB JSON
|
||||
static CAirportList fromDatabaseJson(const QJsonArray &array, CAirportList *inconsistent = nullptr);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user