mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 23:45:35 +08:00
refs #452, interface for a model loader.
This will allow to load aircraft models in the mapping tool independent from a driver
This commit is contained in:
committed by
Mathew Sutcliffe
parent
fce5fd4515
commit
ee3a4d7a2e
60
src/blackmisc/simulation/aircraftmodelloader.cpp
Normal file
60
src/blackmisc/simulation/aircraftmodelloader.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "aircraftmodelloader.h"
|
||||
#include "blackmisc/simulation/fscommon/aircraftcfgparser.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Simulation
|
||||
{
|
||||
IAircraftModelLoader::IAircraftModelLoader(const CSimulatorInfo &info) :
|
||||
m_simulatorInfo(info)
|
||||
{ }
|
||||
|
||||
IAircraftModelLoader::~IAircraftModelLoader()
|
||||
{
|
||||
this->gracefulShutdown();
|
||||
}
|
||||
|
||||
const CSimulatorInfo &IAircraftModelLoader::supportedSimulators() const
|
||||
{
|
||||
return m_simulatorInfo;
|
||||
}
|
||||
|
||||
QString IAircraftModelLoader::supportedSimulatorsAsString() const
|
||||
{
|
||||
return m_simulatorInfo.toQString();
|
||||
}
|
||||
|
||||
bool IAircraftModelLoader::supportsSimulator(const CSimulatorInfo &info)
|
||||
{
|
||||
return supportedSimulators().matchesAny(info);
|
||||
}
|
||||
|
||||
void IAircraftModelLoader::cancelLoading()
|
||||
{
|
||||
m_cancelLoading = true;
|
||||
}
|
||||
|
||||
void IAircraftModelLoader::gracefulShutdown()
|
||||
{
|
||||
this->cancelLoading();
|
||||
}
|
||||
|
||||
IAircraftModelLoader *IAircraftModelLoader::createModelLoader(const CSimulatorInfo &info)
|
||||
{
|
||||
//! \todo hack, remove later and replace by factory
|
||||
IAircraftModelLoader *ml = BlackMisc::Simulation::FsCommon::CAircraftCfgParser::createModelLoader(info);
|
||||
if (ml) { return ml; }
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "No model model loader for simulator");
|
||||
return nullptr;
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
Reference in New Issue
Block a user