mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 07:35:48 +08:00
refs #791, adjusted own aircraft context
* function for default model and situation in context (so they can be reused as in login component) * use CDatabaseUtils::consolidateOwnAircraftModelWithDbData for lookup
This commit is contained in:
@@ -7,12 +7,20 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackcore/application.h"
|
||||
#include "blackcore/webdataservices.h"
|
||||
#include "blackcore/context/contextownaircraft.h"
|
||||
#include "blackcore/context/contextownaircraftempty.h"
|
||||
#include "blackcore/context/contextownaircraftimpl.h"
|
||||
#include "blackcore/context/contextownaircraftproxy.h"
|
||||
#include "blackmisc/aviation/aircraftsituation.h"
|
||||
#include "blackmisc/dbusserver.h"
|
||||
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::Simulation;
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
namespace Context
|
||||
@@ -31,5 +39,35 @@ namespace BlackCore
|
||||
return new CContextOwnAircraftEmpty(parent);
|
||||
}
|
||||
}
|
||||
|
||||
const BlackMisc::Aviation::CAircraftSituation &IContextOwnAircraft::getDefaultSituation()
|
||||
{
|
||||
static const CAircraftSituation situation(
|
||||
CCoordinateGeodetic(
|
||||
CLatitude::fromWgs84("N 049° 18' 17"),
|
||||
CLongitude::fromWgs84("E 008° 27' 05"),
|
||||
CLength(0, CLengthUnit::m())),
|
||||
CAltitude(312, CAltitude::MeanSeaLevel, CLengthUnit::ft())
|
||||
);
|
||||
return situation;
|
||||
}
|
||||
|
||||
BlackMisc::Simulation::CAircraftModel IContextOwnAircraft::getDefaultOwnAircraftModel()
|
||||
{
|
||||
// if all fails
|
||||
static const CAircraftModel defaultModel(
|
||||
"", CAircraftModel::TypeOwnSimulatorModel, "default model",
|
||||
CAircraftIcaoCode("C172", "L1P", "Cessna", "172", "L", true, false, false, 0));
|
||||
|
||||
// create one from DB data
|
||||
if (sApp && sApp->hasWebDataServices())
|
||||
{
|
||||
static const CAircraftIcaoCode icao = sApp->getWebDataServices()->getAircraftIcaoCodeForDesignator("C172");
|
||||
static const CLivery livery = sApp->getWebDataServices()->getLiveryForCombinedCode("_CC_WHITE_WHITE");
|
||||
static const CAircraftModel model("", CAircraftModel::TypeOwnSimulatorModel, icao, livery);
|
||||
return model;
|
||||
}
|
||||
return defaultModel;
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user