mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
Ref T261, aircraft ICAO/parts guessing
This commit is contained in:
committed by
Roland Winklmeier
parent
bed79237bf
commit
3f7b229e66
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "blackmisc/simulation/matchingutils.h"
|
||||
#include "blackmisc/aviation/aircraftsituationchange.h"
|
||||
#include "blackmisc/aviation/aircrafticaocode.h"
|
||||
#include "blackmisc/db/datastoreutility.h"
|
||||
#include "blackmisc/comparefunctions.h"
|
||||
@@ -28,6 +29,7 @@
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Db;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Simulation;
|
||||
|
||||
namespace BlackMisc
|
||||
@@ -196,6 +198,45 @@ namespace BlackMisc
|
||||
return score;
|
||||
}
|
||||
|
||||
void CAircraftIcaoCode::guessModelParameters(CLength &guessedCG, CSpeed &guessedLiftOffGs) const
|
||||
{
|
||||
// init to defaults
|
||||
CLength guessedCG_ = CLength(1.5, CLengthUnit::m());
|
||||
CSpeed guessedLiftOffGs_ = this->isVtol() ? CSpeed::null() : CSpeed(70, CSpeedUnit::km_h());
|
||||
|
||||
const int engines = this->getEnginesCount();
|
||||
const QChar engineType = this->getEngineType()[0].toUpper();
|
||||
do
|
||||
{
|
||||
if (engines == 1)
|
||||
{
|
||||
if (engineType == 'T') { guessedCG_ = CLength(2.0, CLengthUnit::m()); break; }
|
||||
}
|
||||
else if (engines == 2)
|
||||
{
|
||||
guessedCG_ = CLength(2.0, CLengthUnit::m());
|
||||
guessedLiftOffGs_ = CSpeed(80, CSpeedUnit::kts());
|
||||
if (engineType == 'T') { guessedCG_ = CLength(2.0, CLengthUnit::m()); break; }
|
||||
if (engineType == 'J') { guessedCG_ = CLength(2.5, CLengthUnit::m()); break; }
|
||||
}
|
||||
else if (engines > 2)
|
||||
{
|
||||
guessedCG_ = CLength(4.0, CLengthUnit::m());
|
||||
guessedLiftOffGs_ = CSpeed(70, CSpeedUnit::kts());
|
||||
if (engineType == 'J')
|
||||
{
|
||||
guessedCG_ = CLength(6.0, CLengthUnit::m());
|
||||
guessedLiftOffGs_ = CSpeed(100, CSpeedUnit::kts());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (false);
|
||||
|
||||
if (!guessedCG_.isNull()) { guessedCG = guessedCG_; }
|
||||
if (!guessedLiftOffGs_.isNull()) { guessedLiftOffGs = guessedLiftOffGs_; }
|
||||
}
|
||||
|
||||
bool CAircraftIcaoCode::isNull() const
|
||||
{
|
||||
return m_designator.isEmpty() && m_manufacturer.isEmpty() && m_modelDescription.isEmpty();
|
||||
|
||||
Reference in New Issue
Block a user