mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 19:35:32 +08:00
refs #369, reverse ICAO lookup
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Aviation;
|
||||
|
||||
namespace BlackSim
|
||||
{
|
||||
@@ -72,6 +73,14 @@ namespace BlackSim
|
||||
return m_init;
|
||||
}
|
||||
|
||||
CAircraftIcao CAircraftMapper::getIcaoForModelString(const QString &modelString) const
|
||||
{
|
||||
if (modelString.isEmpty() || !this->isInitialized()) { return CAircraftIcao(); }
|
||||
CAircraftMappingList mappings = this->m_mappings->getMappingList().findByModelString(modelString);
|
||||
if (mappings.isEmpty()) { return CAircraftIcao(); }
|
||||
return mappings.front().getIcao();
|
||||
}
|
||||
|
||||
bool CAircraftMapper::containsModelWithTitle(const QString &title, Qt::CaseSensitivity caseSensitivity)
|
||||
{
|
||||
return this->m_entries.containsModelWithTitle(title, caseSensitivity);
|
||||
@@ -81,7 +90,10 @@ namespace BlackSim
|
||||
{
|
||||
CAircraftCfgEntriesList el = this->m_entries.findByTitle(title, caseSensitivity);
|
||||
if (el.isEmpty()) { return CAircraftModel(); }
|
||||
return el.front().toAircraftModel();
|
||||
CAircraftModel model = el.front().toAircraftModel();
|
||||
CAircraftIcao icao = this->getIcaoForModelString(model.getModelString());
|
||||
model.setIcao(icao);
|
||||
return model;
|
||||
}
|
||||
|
||||
int CAircraftMapper::synchronize()
|
||||
@@ -103,6 +115,17 @@ namespace BlackSim
|
||||
}
|
||||
}
|
||||
|
||||
const CAircraftModel &CAircraftMapper::getDefaultModel()
|
||||
{
|
||||
static const CAircraftModel aircraftModel(
|
||||
"Boeing 737-800 Paint1",
|
||||
CAircraftModel::TypeModelMatchingDefaultModel,
|
||||
"B737-800 default model",
|
||||
CAircraftIcao("B738", "L2J", "", "", "FFFFFF")
|
||||
);
|
||||
return aircraftModel;
|
||||
}
|
||||
|
||||
bool CAircraftMapper::initCompletely(QString simObjectDir)
|
||||
{
|
||||
if (this->m_init) { return true; }
|
||||
|
||||
@@ -79,6 +79,9 @@ namespace BlackSim
|
||||
//! Get all mappings
|
||||
const BlackMisc::Network::CAircraftMappingList &getAircraftMappingList() const { return m_mappings->getMappingList(); }
|
||||
|
||||
//! Inverse lookup
|
||||
BlackMisc::Aviation::CAircraftIcao getIcaoForModelString(const QString &modelString) const;
|
||||
|
||||
//! Number of aircraft entries
|
||||
int countAircraftCfgEntries() const { return m_entries.size(); }
|
||||
|
||||
@@ -101,6 +104,9 @@ namespace BlackSim
|
||||
//! Shutdown
|
||||
void gracefulShutdown();
|
||||
|
||||
//! default model
|
||||
static const BlackMisc::Simulation::CAircraftModel &getDefaultModel();
|
||||
|
||||
private:
|
||||
QScopedPointer<BlackSim::ISimulatorModelMappings> m_mappings; //!< all mapping definitions
|
||||
CAircraftCfgEntriesList m_entries; //!< all entries
|
||||
|
||||
Reference in New Issue
Block a user