mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-05 01:35:45 +08:00
refs #369, reverse ICAO lookup
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Simulation;
|
using namespace BlackMisc::Simulation;
|
||||||
using namespace BlackMisc::Network;
|
using namespace BlackMisc::Network;
|
||||||
|
using namespace BlackMisc::Aviation;
|
||||||
|
|
||||||
namespace BlackSim
|
namespace BlackSim
|
||||||
{
|
{
|
||||||
@@ -72,6 +73,14 @@ namespace BlackSim
|
|||||||
return m_init;
|
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)
|
bool CAircraftMapper::containsModelWithTitle(const QString &title, Qt::CaseSensitivity caseSensitivity)
|
||||||
{
|
{
|
||||||
return this->m_entries.containsModelWithTitle(title, caseSensitivity);
|
return this->m_entries.containsModelWithTitle(title, caseSensitivity);
|
||||||
@@ -81,7 +90,10 @@ namespace BlackSim
|
|||||||
{
|
{
|
||||||
CAircraftCfgEntriesList el = this->m_entries.findByTitle(title, caseSensitivity);
|
CAircraftCfgEntriesList el = this->m_entries.findByTitle(title, caseSensitivity);
|
||||||
if (el.isEmpty()) { return CAircraftModel(); }
|
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()
|
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)
|
bool CAircraftMapper::initCompletely(QString simObjectDir)
|
||||||
{
|
{
|
||||||
if (this->m_init) { return true; }
|
if (this->m_init) { return true; }
|
||||||
|
|||||||
@@ -79,6 +79,9 @@ namespace BlackSim
|
|||||||
//! Get all mappings
|
//! Get all mappings
|
||||||
const BlackMisc::Network::CAircraftMappingList &getAircraftMappingList() const { return m_mappings->getMappingList(); }
|
const BlackMisc::Network::CAircraftMappingList &getAircraftMappingList() const { return m_mappings->getMappingList(); }
|
||||||
|
|
||||||
|
//! Inverse lookup
|
||||||
|
BlackMisc::Aviation::CAircraftIcao getIcaoForModelString(const QString &modelString) const;
|
||||||
|
|
||||||
//! Number of aircraft entries
|
//! Number of aircraft entries
|
||||||
int countAircraftCfgEntries() const { return m_entries.size(); }
|
int countAircraftCfgEntries() const { return m_entries.size(); }
|
||||||
|
|
||||||
@@ -101,6 +104,9 @@ namespace BlackSim
|
|||||||
//! Shutdown
|
//! Shutdown
|
||||||
void gracefulShutdown();
|
void gracefulShutdown();
|
||||||
|
|
||||||
|
//! default model
|
||||||
|
static const BlackMisc::Simulation::CAircraftModel &getDefaultModel();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<BlackSim::ISimulatorModelMappings> m_mappings; //!< all mapping definitions
|
QScopedPointer<BlackSim::ISimulatorModelMappings> m_mappings; //!< all mapping definitions
|
||||||
CAircraftCfgEntriesList m_entries; //!< all entries
|
CAircraftCfgEntriesList m_entries; //!< all entries
|
||||||
|
|||||||
Reference in New Issue
Block a user