mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
Ref T259, Ref T243 improved utility functions so parts can be guessed in interpolator
* engine count * aligned naming to "getEnginesCount" * formatting
This commit is contained in:
committed by
Roland Winklmeier
parent
c3f05ea1cd
commit
e3d17859a0
@@ -762,7 +762,7 @@ namespace BlackGui
|
|||||||
const CAircraftIcaoCode icao = this->getAircraftIcaoCode();
|
const CAircraftIcaoCode icao = this->getAircraftIcaoCode();
|
||||||
if (icao.isLoadedFromDb())
|
if (icao.isLoadedFromDb())
|
||||||
{
|
{
|
||||||
if (icao.getEngineCount() >= 2 && icao.getEngineType() == "J")
|
if (icao.getEnginesCount() >= 2 && icao.getEngineType() == "J")
|
||||||
{
|
{
|
||||||
// jet with >=2 engines
|
// jet with >=2 engines
|
||||||
msgs.push_back(CStatusMessage(this).validationInfo("Jet >=2 engines"));
|
msgs.push_back(CStatusMessage(this).validationInfo("Jet >=2 engines"));
|
||||||
|
|||||||
@@ -57,6 +57,17 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CAircraftEngineList::setEngines(const CAircraftEngine &engine, int engineNumber)
|
||||||
|
{
|
||||||
|
this->clear();
|
||||||
|
for (int e = 0; e < engineNumber; e++)
|
||||||
|
{
|
||||||
|
CAircraftEngine copy(engine);
|
||||||
|
copy.setNumber(e + 1); // 1 based
|
||||||
|
this->push_back(engine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CAircraftEngineList::initEngines(int engineNumber, bool on)
|
void CAircraftEngineList::initEngines(int engineNumber, bool on)
|
||||||
{
|
{
|
||||||
this->clear();
|
this->clear();
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ namespace BlackMisc
|
|||||||
//! \remark 1 based, not 0 based
|
//! \remark 1 based, not 0 based
|
||||||
void setEngineOn(int engineNumber, bool on);
|
void setEngineOn(int engineNumber, bool on);
|
||||||
|
|
||||||
|
//! Copy one engine multiple times (number) and set the number of engines to number
|
||||||
|
void setEngines(const CAircraftEngine &engine, int engineNumber);
|
||||||
|
|
||||||
//! Init some engines
|
//! Init some engines
|
||||||
void initEngines(int engineNumber, bool on);
|
void initEngines(int engineNumber, bool on);
|
||||||
|
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
else if (this->hasValidCombinedType())
|
else if (this->hasValidCombinedType())
|
||||||
{
|
{
|
||||||
if (this->getEngineCount() == otherCode.getEngineCount()) { score += 2; }
|
if (this->getEnginesCount() == otherCode.getEnginesCount()) { score += 2; }
|
||||||
if (this->getEngineType() == otherCode.getEngineType()) { score += 2; }
|
if (this->getEngineType() == otherCode.getEngineType()) { score += 2; }
|
||||||
if (this->getAircraftType() == otherCode.getAircraftType()) { score += 2; }
|
if (this->getAircraftType() == otherCode.getAircraftType()) { score += 2; }
|
||||||
CMatchingUtils::addLogDetailsToList(log, *this, QString("Added combined code parts: %1").arg(score));
|
CMatchingUtils::addLogDetailsToList(log, *this, QString("Added combined code parts: %1").arg(score));
|
||||||
@@ -249,7 +249,7 @@ namespace BlackMisc
|
|||||||
return m_combinedType.right(1);
|
return m_combinedType.right(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CAircraftIcaoCode::getEngineCount() const
|
int CAircraftIcaoCode::getEnginesCount() const
|
||||||
{
|
{
|
||||||
if (m_combinedType.length() < 2) { return -1; }
|
if (m_combinedType.length() < 2) { return -1; }
|
||||||
const QString c(m_combinedType.mid(1, 1));
|
const QString c(m_combinedType.mid(1, 1));
|
||||||
@@ -321,7 +321,7 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
if (c != '*')
|
if (c != '*')
|
||||||
{
|
{
|
||||||
if (getEngineCount() != c.digitValue()) { return false; }
|
if (getEnginesCount() != c.digitValue()) { return false; }
|
||||||
}
|
}
|
||||||
if (et == '*') { return true; }
|
if (et == '*') { return true; }
|
||||||
const QString cet = this->getEngineType();
|
const QString cet = this->getEngineType();
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ namespace BlackMisc
|
|||||||
QString getEngineType() const;
|
QString getEngineType() const;
|
||||||
|
|
||||||
//! Engine count if any, -1 if no value is set
|
//! Engine count if any, -1 if no value is set
|
||||||
int getEngineCount() const;
|
int getEnginesCount() const;
|
||||||
|
|
||||||
//! Engine count as string, if not available ""
|
//! Engine count as string, if not available ""
|
||||||
QString getEngineCountString() const;
|
QString getEngineCountString() const;
|
||||||
|
|||||||
@@ -22,6 +22,13 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
namespace Aviation
|
namespace Aviation
|
||||||
{
|
{
|
||||||
|
CAircraftParts::CAircraftParts(int flapsPercent) : m_flapsPercentage(flapsPercent) {}
|
||||||
|
|
||||||
|
CAircraftParts::CAircraftParts(const CAircraftLights &lights, bool gearDown, int flapsPercent, bool spoilersOut, const CAircraftEngineList &engines, bool onGround)
|
||||||
|
: m_lights(lights), m_engines(engines), m_flapsPercentage(flapsPercent), m_gearDown(gearDown),
|
||||||
|
m_spoilersOut(spoilersOut), m_isOnGround(onGround)
|
||||||
|
{}
|
||||||
|
|
||||||
QString CAircraftParts::convertToQString(bool i18n) const
|
QString CAircraftParts::convertToQString(bool i18n) const
|
||||||
{
|
{
|
||||||
return QStringLiteral("ts: ") % this->getFormattedTimestampAndOffset(true) %
|
return QStringLiteral("ts: ") % this->getFormattedTimestampAndOffset(true) %
|
||||||
@@ -42,6 +49,17 @@ namespace BlackMisc
|
|||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CAircraftParts::isNull() const
|
||||||
|
{
|
||||||
|
return this->getPartsDetails() == NotSet && m_flapsPercentage < 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const CAircraftParts &CAircraftParts::null()
|
||||||
|
{
|
||||||
|
static const CAircraftParts null(-1);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
CAircraftParts CAircraftParts::guessedParts(const CAircraftSituation &situation, bool vtol, int engineNumber)
|
CAircraftParts CAircraftParts::guessedParts(const CAircraftSituation &situation, bool vtol, int engineNumber)
|
||||||
{
|
{
|
||||||
CAircraftParts parts;
|
CAircraftParts parts;
|
||||||
@@ -185,9 +203,16 @@ namespace BlackMisc
|
|||||||
return m_engines.isAnyEngineOn();
|
return m_engines.isAnyEngineOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAircraftParts::guessParts(const CAircraftSituation &situation)
|
void CAircraftParts::setEngines(const CAircraftEngine &engine, int engineNumber)
|
||||||
{
|
{
|
||||||
*this = guessedParts(situation);
|
CAircraftEngineList engines;
|
||||||
|
engines.setEngines(engine, engineNumber);
|
||||||
|
m_engines = engines;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAircraftParts::guessParts(const CAircraftSituation &situation, bool vtol, int engineNumber)
|
||||||
|
{
|
||||||
|
*this = guessedParts(situation, vtol, engineNumber);
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -59,12 +59,12 @@ namespace BlackMisc
|
|||||||
//! Default constructor
|
//! Default constructor
|
||||||
CAircraftParts() {}
|
CAircraftParts() {}
|
||||||
|
|
||||||
|
//! Default constructor
|
||||||
|
CAircraftParts(int flapsPercent);
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CAircraftParts(const CAircraftLights &lights, bool gearDown, int flapsPercent, bool spoilersOut,
|
CAircraftParts(const CAircraftLights &lights, bool gearDown, int flapsPercent, bool spoilersOut,
|
||||||
const CAircraftEngineList &engines, bool onGround)
|
const CAircraftEngineList &engines, bool onGround);
|
||||||
: m_lights(lights), m_engines(engines), m_flapsPercentage(flapsPercent), m_gearDown(gearDown),
|
|
||||||
m_spoilersOut(spoilersOut), m_isOnGround(onGround)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||||
@@ -132,6 +132,9 @@ namespace BlackMisc
|
|||||||
//! Set engines
|
//! Set engines
|
||||||
void setEngines(const CAircraftEngineList &engines) { m_engines = engines; }
|
void setEngines(const CAircraftEngineList &engines) { m_engines = engines; }
|
||||||
|
|
||||||
|
//! \copydoc CAircraftEngineList::setEngines
|
||||||
|
void setEngines(const CAircraftEngine &engine, int engineNumber);
|
||||||
|
|
||||||
//! Is aircraft on ground?
|
//! Is aircraft on ground?
|
||||||
bool isOnGround() const { return m_isOnGround; }
|
bool isOnGround() const { return m_isOnGround; }
|
||||||
|
|
||||||
@@ -148,7 +151,7 @@ namespace BlackMisc
|
|||||||
void setPartsDetails(PartsDetails details) { m_partsDetails = static_cast<int>(details); }
|
void setPartsDetails(PartsDetails details) { m_partsDetails = static_cast<int>(details); }
|
||||||
|
|
||||||
//! Guess the parts
|
//! Guess the parts
|
||||||
void guessParts(const CAircraftSituation &situation);
|
void guessParts(const CAircraftSituation &situation, bool vtol = false, int engineNumber = 2);
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||||
QString convertToQString(bool i18n = false) const;
|
QString convertToQString(bool i18n = false) const;
|
||||||
@@ -156,8 +159,14 @@ namespace BlackMisc
|
|||||||
//! Incremental JSON object
|
//! Incremental JSON object
|
||||||
QJsonObject toIncrementalJson() const;
|
QJsonObject toIncrementalJson() const;
|
||||||
|
|
||||||
|
//! NULL parts object?
|
||||||
|
bool isNull() const;
|
||||||
|
|
||||||
|
//! NULL parts object
|
||||||
|
static const CAircraftParts &null();
|
||||||
|
|
||||||
//! Guessed parts
|
//! Guessed parts
|
||||||
static CAircraftParts guessedParts(const CAircraftSituation &situation, bool vtol = false, int engineNumber = 4);
|
static CAircraftParts guessedParts(const CAircraftSituation &situation, bool vtol = false, int engineNumber = 2);
|
||||||
|
|
||||||
//! Convert to QString
|
//! Convert to QString
|
||||||
static const QString &partsDetailsToString(PartsDetails details);
|
static const QString &partsDetailsToString(PartsDetails details);
|
||||||
|
|||||||
@@ -169,6 +169,9 @@ namespace BlackMisc
|
|||||||
//! Aircraft ICAO code
|
//! Aircraft ICAO code
|
||||||
const Aviation::CAircraftIcaoCode &getAircraftIcaoCode() const { return m_aircraftIcao; }
|
const Aviation::CAircraftIcaoCode &getAircraftIcaoCode() const { return m_aircraftIcao; }
|
||||||
|
|
||||||
|
//! \copydoc BlackMisc::Aviation::CAircraftIcaoCode::getEngineCount
|
||||||
|
int getEngineCount() const { return m_aircraftIcao.getEnginesCount(); }
|
||||||
|
|
||||||
//! Aircraft ICAO code designator
|
//! Aircraft ICAO code designator
|
||||||
const QString &getAircraftIcaoCodeDesignator() const { return m_aircraftIcao.getDesignator(); }
|
const QString &getAircraftIcaoCodeDesignator() const { return m_aircraftIcao.getDesignator(); }
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace BlackMisc
|
|||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
CSimulatedAircraft::CSimulatedAircraft(const CAircraftModel &model) : m_models( {model, model})
|
CSimulatedAircraft::CSimulatedAircraft(const CAircraftModel &model) : m_models({model, model})
|
||||||
{
|
{
|
||||||
this->setCallsign(model.getCallsign());
|
this->setCallsign(model.getCallsign());
|
||||||
init();
|
init();
|
||||||
@@ -226,10 +226,16 @@ namespace BlackMisc
|
|||||||
|
|
||||||
void CSimulatedAircraft::initTransponder()
|
void CSimulatedAircraft::initTransponder()
|
||||||
{
|
{
|
||||||
CTransponder xpdr(7000, CTransponder::StateStandby);
|
const CTransponder xpdr(7000, CTransponder::StateStandby);
|
||||||
this->setTransponder(xpdr);
|
this->setTransponder(xpdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CSimulatedAircraft::getEnginesCount() const
|
||||||
|
{
|
||||||
|
const int engines = this->getModel().getAircraftIcaoCode().getEnginesCount();
|
||||||
|
return engines >= 0 ? engines : m_parts.getEnginesCount();
|
||||||
|
}
|
||||||
|
|
||||||
CAircraftLights CSimulatedAircraft::getLights() const
|
CAircraftLights CSimulatedAircraft::getLights() const
|
||||||
{
|
{
|
||||||
return m_parts.getLights();
|
return m_parts.getLights();
|
||||||
|
|||||||
@@ -61,13 +61,13 @@ namespace BlackMisc
|
|||||||
//! Comprehensive information of an aircraft
|
//! Comprehensive information of an aircraft
|
||||||
class BLACKMISC_EXPORT CSimulatedAircraft :
|
class BLACKMISC_EXPORT CSimulatedAircraft :
|
||||||
public CValueObject<CSimulatedAircraft>,
|
public CValueObject<CSimulatedAircraft>,
|
||||||
public BlackMisc::Geo::ICoordinateWithRelativePosition
|
public Geo::ICoordinateWithRelativePosition
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Properties by index
|
//! Properties by index
|
||||||
enum ColumnIndex
|
enum ColumnIndex
|
||||||
{
|
{
|
||||||
IndexCallsign = BlackMisc::CPropertyIndex::GlobalIndexCSimulatedAircraft,
|
IndexCallsign = CPropertyIndex::GlobalIndexCSimulatedAircraft,
|
||||||
IndexPilot,
|
IndexPilot,
|
||||||
IndexRelativeDistance,
|
IndexRelativeDistance,
|
||||||
IndexCom1System,
|
IndexCom1System,
|
||||||
@@ -95,28 +95,28 @@ namespace BlackMisc
|
|||||||
CSimulatedAircraft();
|
CSimulatedAircraft();
|
||||||
|
|
||||||
//! Constructor.
|
//! Constructor.
|
||||||
explicit CSimulatedAircraft(const BlackMisc::Simulation::CAircraftModel &model);
|
explicit CSimulatedAircraft(const CAircraftModel &model);
|
||||||
|
|
||||||
//! Constructor.
|
//! Constructor.
|
||||||
CSimulatedAircraft(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Network::CUser &user, const BlackMisc::Aviation::CAircraftSituation &situation);
|
CSimulatedAircraft(const Aviation::CCallsign &callsign, const Network::CUser &user, const Aviation::CAircraftSituation &situation);
|
||||||
|
|
||||||
//! Constructor.
|
//! Constructor.
|
||||||
CSimulatedAircraft(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Simulation::CAircraftModel &model, const BlackMisc::Network::CUser &user, const BlackMisc::Aviation::CAircraftSituation &situation);
|
CSimulatedAircraft(const Aviation::CCallsign &callsign, const CAircraftModel &model, const Network::CUser &user, const Aviation::CAircraftSituation &situation);
|
||||||
|
|
||||||
//! Get callsign.
|
//! Get callsign.
|
||||||
const BlackMisc::Aviation::CCallsign &getCallsign() const { return m_callsign; }
|
const Aviation::CCallsign &getCallsign() const { return m_callsign; }
|
||||||
|
|
||||||
//! Get callsign.
|
//! Get callsign.
|
||||||
QString getCallsignAsString() const { return m_callsign.asString(); }
|
QString getCallsignAsString() const { return m_callsign.asString(); }
|
||||||
|
|
||||||
//! Get situation.
|
//! Get situation.
|
||||||
const BlackMisc::Aviation::CAircraftSituation &getSituation() const { return m_situation; }
|
const Aviation::CAircraftSituation &getSituation() const { return m_situation; }
|
||||||
|
|
||||||
//! Set situation.
|
//! Set situation.
|
||||||
void setSituation(const BlackMisc::Aviation::CAircraftSituation &situation);
|
void setSituation(const Aviation::CAircraftSituation &situation);
|
||||||
|
|
||||||
//! Get user
|
//! Get user
|
||||||
const BlackMisc::Network::CUser &getPilot() const { return m_pilot; }
|
const Network::CUser &getPilot() const { return m_pilot; }
|
||||||
|
|
||||||
//! Get user's real name
|
//! Get user's real name
|
||||||
QString getPilotRealName() const { return m_pilot.getRealName(); }
|
QString getPilotRealName() const { return m_pilot.getRealName(); }
|
||||||
@@ -125,7 +125,7 @@ namespace BlackMisc
|
|||||||
QString getPilotId() { return m_pilot.getId(); }
|
QString getPilotId() { return m_pilot.getId(); }
|
||||||
|
|
||||||
//! Get aircraft ICAO info
|
//! Get aircraft ICAO info
|
||||||
const BlackMisc::Aviation::CAircraftIcaoCode &getAircraftIcaoCode() const;
|
const Aviation::CAircraftIcaoCode &getAircraftIcaoCode() const;
|
||||||
|
|
||||||
//! Aircraft ICAO code designator
|
//! Aircraft ICAO code designator
|
||||||
const QString &getAircraftIcaoCodeDesignator() const;
|
const QString &getAircraftIcaoCodeDesignator() const;
|
||||||
@@ -134,17 +134,17 @@ namespace BlackMisc
|
|||||||
const QString &getAircraftIcaoCombinedType() const;
|
const QString &getAircraftIcaoCombinedType() const;
|
||||||
|
|
||||||
//! Set aicraft ICAO code
|
//! Set aicraft ICAO code
|
||||||
bool setAircraftIcaoCode(const BlackMisc::Aviation::CAircraftIcaoCode &aircraftIcaoCode) { return m_models[CurrentModel].setAircraftIcaoCode(aircraftIcaoCode);}
|
bool setAircraftIcaoCode(const Aviation::CAircraftIcaoCode &aircraftIcaoCode) { return m_models[CurrentModel].setAircraftIcaoCode(aircraftIcaoCode);}
|
||||||
|
|
||||||
//! Set ICAO info
|
//! Set ICAO info
|
||||||
//! \note to be compatible with old version I still allow to set airline here, but I should actually set a livery
|
//! \note to be compatible with old version I still allow to set airline here, but I should actually set a livery
|
||||||
bool setIcaoCodes(const BlackMisc::Aviation::CAircraftIcaoCode &aircraftIcaoCode, const BlackMisc::Aviation::CAirlineIcaoCode &airlineIcaoCode);
|
bool setIcaoCodes(const Aviation::CAircraftIcaoCode &aircraftIcaoCode, const Aviation::CAirlineIcaoCode &airlineIcaoCode);
|
||||||
|
|
||||||
//! Get livery
|
//! Get livery
|
||||||
const BlackMisc::Aviation::CLivery &getLivery() const { return m_models[CurrentModel].getLivery(); }
|
const Aviation::CLivery &getLivery() const { return m_models[CurrentModel].getLivery(); }
|
||||||
|
|
||||||
//! Airline ICAO code if any
|
//! Airline ICAO code if any
|
||||||
const BlackMisc::Aviation::CAirlineIcaoCode &getAirlineIcaoCode() const;
|
const Aviation::CAirlineIcaoCode &getAirlineIcaoCode() const;
|
||||||
|
|
||||||
//! Airline ICAO code designator
|
//! Airline ICAO code designator
|
||||||
const QString &getAirlineIcaoCodeDesignator() const;
|
const QString &getAirlineIcaoCodeDesignator() const;
|
||||||
@@ -168,40 +168,40 @@ namespace BlackMisc
|
|||||||
bool hasAircraftAndAirlineDesignator() const;
|
bool hasAircraftAndAirlineDesignator() const;
|
||||||
|
|
||||||
//! Valid callsign?
|
//! Valid callsign?
|
||||||
bool hasValidCallsign() const { return BlackMisc::Aviation::CCallsign::isValidAircraftCallsign(this->getCallsign().asString()); }
|
bool hasValidCallsign() const { return Aviation::CCallsign::isValidAircraftCallsign(this->getCallsign().asString()); }
|
||||||
|
|
||||||
//! Callsign not empty, no further checks
|
//! Callsign not empty, no further checks
|
||||||
bool hasCallsign() const { return !getCallsign().isEmpty(); }
|
bool hasCallsign() const { return !getCallsign().isEmpty(); }
|
||||||
|
|
||||||
//! Get position
|
//! Get position
|
||||||
BlackMisc::Geo::CCoordinateGeodetic getPosition() const { return m_situation.getPosition(); }
|
Geo::CCoordinateGeodetic getPosition() const { return m_situation.getPosition(); }
|
||||||
|
|
||||||
//! Set position
|
//! Set position
|
||||||
void setPosition(const BlackMisc::Geo::CCoordinateGeodetic &position) { m_situation.setPosition(position); }
|
void setPosition(const Geo::CCoordinateGeodetic &position) { m_situation.setPosition(position); }
|
||||||
|
|
||||||
//! Get altitude
|
//! Get altitude
|
||||||
const BlackMisc::Aviation::CAltitude &getAltitude() const { return m_situation.getAltitude(); }
|
const Aviation::CAltitude &getAltitude() const { return m_situation.getAltitude(); }
|
||||||
|
|
||||||
//! Set altitude
|
//! Set altitude
|
||||||
void setAltitude(const BlackMisc::Aviation::CAltitude &altitude) { m_situation.setAltitude(altitude); }
|
void setAltitude(const Aviation::CAltitude &altitude) { m_situation.setAltitude(altitude); }
|
||||||
|
|
||||||
//! Get pressure altitude
|
//! Get pressure altitude
|
||||||
const BlackMisc::Aviation::CAltitude &getPressureAltitude() const { return m_situation.getPressureAltitude(); }
|
const Aviation::CAltitude &getPressureAltitude() const { return m_situation.getPressureAltitude(); }
|
||||||
|
|
||||||
//! Set pressure altitude
|
//! Set pressure altitude
|
||||||
void setPressureAltitude(const BlackMisc::Aviation::CAltitude &altitude) { m_situation.setPressureAltitude(altitude); }
|
void setPressureAltitude(const Aviation::CAltitude &altitude) { m_situation.setPressureAltitude(altitude); }
|
||||||
|
|
||||||
//! Get groundspeed
|
//! Get groundspeed
|
||||||
const BlackMisc::PhysicalQuantities::CSpeed &getGroundSpeed() const { return m_situation.getGroundSpeed(); }
|
const PhysicalQuantities::CSpeed &getGroundSpeed() const { return m_situation.getGroundSpeed(); }
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Geo::ICoordinateGeodetic::latitude
|
//! \copydoc BlackMisc::Geo::ICoordinateGeodetic::latitude
|
||||||
virtual BlackMisc::Geo::CLatitude latitude() const override { return m_situation.latitude(); }
|
virtual Geo::CLatitude latitude() const override { return m_situation.latitude(); }
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Geo::ICoordinateGeodetic::longitude
|
//! \copydoc BlackMisc::Geo::ICoordinateGeodetic::longitude
|
||||||
virtual BlackMisc::Geo::CLongitude longitude() const override { return m_situation.longitude(); }
|
virtual Geo::CLongitude longitude() const override { return m_situation.longitude(); }
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Geo::ICoordinateGeodetic::geodeticHeight
|
//! \copydoc BlackMisc::Geo::ICoordinateGeodetic::geodeticHeight
|
||||||
const BlackMisc::Aviation::CAltitude &geodeticHeight() const override { return m_situation.geodeticHeight(); }
|
const Aviation::CAltitude &geodeticHeight() const override { return m_situation.geodeticHeight(); }
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Geo::ICoordinateGeodetic::normalVector
|
//! \copydoc BlackMisc::Geo::ICoordinateGeodetic::normalVector
|
||||||
virtual QVector3D normalVector() const override { return m_situation.normalVector(); }
|
virtual QVector3D normalVector() const override { return m_situation.normalVector(); }
|
||||||
@@ -210,7 +210,7 @@ namespace BlackMisc
|
|||||||
virtual std::array<double, 3> normalVectorDouble() const override { return m_situation.normalVectorDouble(); }
|
virtual std::array<double, 3> normalVectorDouble() const override { return m_situation.normalVectorDouble(); }
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Aviation::CAircraftSituation::getGroundElevation
|
//! \copydoc BlackMisc::Aviation::CAircraftSituation::getGroundElevation
|
||||||
const BlackMisc::Aviation::CAltitude &getGroundElevation() const { return m_situation.getGroundElevation(); }
|
const Aviation::CAltitude &getGroundElevation() const { return m_situation.getGroundElevation(); }
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Aviation::CAircraftSituation::setGroundElevation
|
//! \copydoc BlackMisc::Aviation::CAircraftSituation::setGroundElevation
|
||||||
void setGroundElevation(const Geo::CElevationPlane &elevation) { m_situation.setGroundElevation(elevation); }
|
void setGroundElevation(const Geo::CElevationPlane &elevation) { m_situation.setGroundElevation(elevation); }
|
||||||
@@ -219,82 +219,82 @@ namespace BlackMisc
|
|||||||
void setGroundElevationChecked(const Geo::CElevationPlane &elevation) { m_situation.setGroundElevationChecked(elevation); }
|
void setGroundElevationChecked(const Geo::CElevationPlane &elevation) { m_situation.setGroundElevationChecked(elevation); }
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Aviation::CAircraftSituation::getHeading
|
//! \copydoc BlackMisc::Aviation::CAircraftSituation::getHeading
|
||||||
const BlackMisc::Aviation::CHeading &getHeading() const { return m_situation.getHeading(); }
|
const Aviation::CHeading &getHeading() const { return m_situation.getHeading(); }
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Aviation::CAircraftSituation::getPitch
|
//! \copydoc BlackMisc::Aviation::CAircraftSituation::getPitch
|
||||||
const BlackMisc::PhysicalQuantities::CAngle &getPitch() const { return m_situation.getPitch(); }
|
const PhysicalQuantities::CAngle &getPitch() const { return m_situation.getPitch(); }
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Aviation::CAircraftSituation::getBank
|
//! \copydoc BlackMisc::Aviation::CAircraftSituation::getBank
|
||||||
const BlackMisc::PhysicalQuantities::CAngle &getBank() const { return m_situation.getBank(); }
|
const PhysicalQuantities::CAngle &getBank() const { return m_situation.getBank(); }
|
||||||
|
|
||||||
//! Get COM1 system
|
//! Get COM1 system
|
||||||
const BlackMisc::Aviation::CComSystem &getCom1System() const { return m_com1system; }
|
const Aviation::CComSystem &getCom1System() const { return m_com1system; }
|
||||||
|
|
||||||
//! Get COM2 system
|
//! Get COM2 system
|
||||||
const BlackMisc::Aviation::CComSystem &getCom2System() const { return m_com2system; }
|
const Aviation::CComSystem &getCom2System() const { return m_com2system; }
|
||||||
|
|
||||||
//! Get COM unit
|
//! Get COM unit
|
||||||
const BlackMisc::Aviation::CComSystem getComSystem(BlackMisc::Aviation::CComSystem::ComUnit unit) const;
|
const Aviation::CComSystem getComSystem(Aviation::CComSystem::ComUnit unit) const;
|
||||||
|
|
||||||
//! Set COM unit
|
//! Set COM unit
|
||||||
void setComSystem(const BlackMisc::Aviation::CComSystem &com, BlackMisc::Aviation::CComSystem::ComUnit unit);
|
void setComSystem(const Aviation::CComSystem &com, Aviation::CComSystem::ComUnit unit);
|
||||||
|
|
||||||
//! Set COM1 system
|
//! Set COM1 system
|
||||||
void setCom1System(const BlackMisc::Aviation::CComSystem &comSystem) { m_com1system = comSystem; }
|
void setCom1System(const Aviation::CComSystem &comSystem) { m_com1system = comSystem; }
|
||||||
|
|
||||||
//! Set COM2 system
|
//! Set COM2 system
|
||||||
void setCom2System(const BlackMisc::Aviation::CComSystem &comSystem) { m_com2system = comSystem; }
|
void setCom2System(const Aviation::CComSystem &comSystem) { m_com2system = comSystem; }
|
||||||
|
|
||||||
//! Set COM1 frequency
|
//! Set COM1 frequency
|
||||||
bool setCom1ActiveFrequency(const BlackMisc::PhysicalQuantities::CFrequency &frequency);
|
bool setCom1ActiveFrequency(const PhysicalQuantities::CFrequency &frequency);
|
||||||
|
|
||||||
//! Set COM2 frequency
|
//! Set COM2 frequency
|
||||||
bool setCom2ActiveFrequency(const BlackMisc::PhysicalQuantities::CFrequency &frequency);
|
bool setCom2ActiveFrequency(const PhysicalQuantities::CFrequency &frequency);
|
||||||
|
|
||||||
//! Set COM frequency
|
//! Set COM frequency
|
||||||
bool setComActiveFrequency(const BlackMisc::PhysicalQuantities::CFrequency &frequency, BlackMisc::Aviation::CComSystem::ComUnit unit);
|
bool setComActiveFrequency(const PhysicalQuantities::CFrequency &frequency, Aviation::CComSystem::ComUnit unit);
|
||||||
|
|
||||||
//! Given SELCAL selected?
|
//! Given SELCAL selected?
|
||||||
bool isSelcalSelected(const BlackMisc::Aviation::CSelcal &selcal) const { return m_selcal == selcal; }
|
bool isSelcalSelected(const Aviation::CSelcal &selcal) const { return m_selcal == selcal; }
|
||||||
|
|
||||||
//! Valid SELCAL?
|
//! Valid SELCAL?
|
||||||
bool hasValidSelcal() const { return m_selcal.isValid(); }
|
bool hasValidSelcal() const { return m_selcal.isValid(); }
|
||||||
|
|
||||||
//! SELCAL
|
//! SELCAL
|
||||||
const BlackMisc::Aviation::CSelcal getSelcal() const { return m_selcal; }
|
const Aviation::CSelcal getSelcal() const { return m_selcal; }
|
||||||
|
|
||||||
//! Set COM unit (all values + transponder and SELCAL)
|
//! Set COM unit (all values + transponder and SELCAL)
|
||||||
void setCockpit(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
void setCockpit(const CSimulatedAircraft &aircraft);
|
||||||
|
|
||||||
//! Cockpit data
|
//! Cockpit data
|
||||||
void setCockpit(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2, const BlackMisc::Aviation::CTransponder &transponder);
|
void setCockpit(const Aviation::CComSystem &com1, const Aviation::CComSystem &com2, const Aviation::CTransponder &transponder);
|
||||||
|
|
||||||
//! Cockpit data
|
//! Cockpit data
|
||||||
void setCockpit(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2, int transponderCode, BlackMisc::Aviation::CTransponder::TransponderMode mode);
|
void setCockpit(const Aviation::CComSystem &com1, const Aviation::CComSystem &com2, int transponderCode, Aviation::CTransponder::TransponderMode mode);
|
||||||
|
|
||||||
//! Own SELCAL code
|
//! Own SELCAL code
|
||||||
void setSelcal(const BlackMisc::Aviation::CSelcal &selcal) { m_selcal = selcal; }
|
void setSelcal(const Aviation::CSelcal &selcal) { m_selcal = selcal; }
|
||||||
|
|
||||||
//! Changed cockpit data?
|
//! Changed cockpit data?
|
||||||
bool hasChangedCockpitData(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2, const BlackMisc::Aviation::CTransponder &transponder) const;
|
bool hasChangedCockpitData(const Aviation::CComSystem &com1, const Aviation::CComSystem &com2, const Aviation::CTransponder &transponder) const;
|
||||||
|
|
||||||
//! Identical COM system?
|
//! Identical COM system?
|
||||||
bool hasSameComData(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2, const BlackMisc::Aviation::CTransponder &transponder);
|
bool hasSameComData(const Aviation::CComSystem &com1, const Aviation::CComSystem &com2, const Aviation::CTransponder &transponder);
|
||||||
|
|
||||||
//! Is any (COM1/2) active frequency within 8.3383kHz channel?
|
//! Is any (COM1/2) active frequency within 8.3383kHz channel?
|
||||||
bool isActiveFrequencyWithin8_33kHzChannel(const BlackMisc::PhysicalQuantities::CFrequency &comFrequency) const;
|
bool isActiveFrequencyWithin8_33kHzChannel(const PhysicalQuantities::CFrequency &comFrequency) const;
|
||||||
|
|
||||||
//! Is any (COM1/2) active frequency within 25kHz channel?
|
//! Is any (COM1/2) active frequency within 25kHz channel?
|
||||||
bool isActiveFrequencyWithin25kHzChannel(const BlackMisc::PhysicalQuantities::CFrequency &comFrequency) const;
|
bool isActiveFrequencyWithin25kHzChannel(const PhysicalQuantities::CFrequency &comFrequency) const;
|
||||||
|
|
||||||
//! Get transponder
|
//! Get transponder
|
||||||
const BlackMisc::Aviation::CTransponder &getTransponder() const { return m_transponder; }
|
const Aviation::CTransponder &getTransponder() const { return m_transponder; }
|
||||||
|
|
||||||
//! Set transponder
|
//! Set transponder
|
||||||
void setTransponder(const BlackMisc::Aviation::CTransponder &transponder) { m_transponder = transponder; }
|
void setTransponder(const Aviation::CTransponder &transponder) { m_transponder = transponder; }
|
||||||
|
|
||||||
//! Set transponder mode
|
//! Set transponder mode
|
||||||
void setTransponderMode(BlackMisc::Aviation::CTransponder::TransponderMode mode) { m_transponder.setTransponderMode(mode); }
|
void setTransponderMode(Aviation::CTransponder::TransponderMode mode) { m_transponder.setTransponderMode(mode); }
|
||||||
|
|
||||||
//! Set transponder code
|
//! Set transponder code
|
||||||
void setTransponderCode(int code) { m_transponder.setTransponderCode(code); }
|
void setTransponderCode(int code) { m_transponder.setTransponderCode(code); }
|
||||||
@@ -306,7 +306,7 @@ namespace BlackMisc
|
|||||||
qint32 getTransponderCode() const { return m_transponder.getTransponderCode(); }
|
qint32 getTransponderCode() const { return m_transponder.getTransponderCode(); }
|
||||||
|
|
||||||
//! Get transponder mode
|
//! Get transponder mode
|
||||||
BlackMisc::Aviation::CTransponder::TransponderMode getTransponderMode() const { return m_transponder.getTransponderMode(); }
|
Aviation::CTransponder::TransponderMode getTransponderMode() const { return m_transponder.getTransponderMode(); }
|
||||||
|
|
||||||
//! Is valid for login?
|
//! Is valid for login?
|
||||||
bool isValidForLogin() const;
|
bool isValidForLogin() const;
|
||||||
@@ -318,16 +318,19 @@ namespace BlackMisc
|
|||||||
void initTransponder();
|
void initTransponder();
|
||||||
|
|
||||||
//! Get aircraft parts
|
//! Get aircraft parts
|
||||||
const BlackMisc::Aviation::CAircraftParts &getParts() const { return m_parts; }
|
const Aviation::CAircraftParts &getParts() const { return m_parts; }
|
||||||
|
|
||||||
|
//! Number of engines
|
||||||
|
int getEnginesCount() const;
|
||||||
|
|
||||||
//! Get aircraft parts
|
//! Get aircraft parts
|
||||||
BlackMisc::Aviation::CAircraftLights getLights() const;
|
Aviation::CAircraftLights getLights() const;
|
||||||
|
|
||||||
//! Set aircraft parts
|
//! Set aircraft parts
|
||||||
void setParts(const BlackMisc::Aviation::CAircraftParts &parts);
|
void setParts(const Aviation::CAircraftParts &parts);
|
||||||
|
|
||||||
//! Set aircraft lights
|
//! Set aircraft lights
|
||||||
void setLights(BlackMisc::Aviation::CAircraftLights &lights);
|
void setLights(Aviation::CAircraftLights &lights);
|
||||||
|
|
||||||
//! Set aircraft lights on
|
//! Set aircraft lights on
|
||||||
void setAllLightsOn();
|
void setAllLightsOn();
|
||||||
@@ -345,13 +348,13 @@ namespace BlackMisc
|
|||||||
int comparePropertyByIndex(const CPropertyIndex &index, const CSimulatedAircraft &compareValue) const;
|
int comparePropertyByIndex(const CPropertyIndex &index, const CSimulatedAircraft &compareValue) const;
|
||||||
|
|
||||||
//! Get model (model used for mapping)
|
//! Get model (model used for mapping)
|
||||||
const BlackMisc::Simulation::CAircraftModel &getModel() const { return m_models[CurrentModel]; }
|
const Simulation::CAircraftModel &getModel() const { return m_models[CurrentModel]; }
|
||||||
|
|
||||||
//! Get network model
|
//! Get network model
|
||||||
const BlackMisc::Simulation::CAircraftModel &getNetworkModel() const { return m_models[NetworkModel]; }
|
const Simulation::CAircraftModel &getNetworkModel() const { return m_models[NetworkModel]; }
|
||||||
|
|
||||||
//! Get network model or (if not existing) model
|
//! Get network model or (if not existing) model
|
||||||
const BlackMisc::Simulation::CAircraftModel &getNetworkModelOrModel() const;
|
const Simulation::CAircraftModel &getNetworkModelOrModel() const;
|
||||||
|
|
||||||
//! Has a network model been set?
|
//! Has a network model been set?
|
||||||
bool hasNetworkModel() const;
|
bool hasNetworkModel() const;
|
||||||
@@ -378,16 +381,16 @@ namespace BlackMisc
|
|||||||
bool hasModelString() const { return m_models[CurrentModel].hasModelString(); }
|
bool hasModelString() const { return m_models[CurrentModel].hasModelString(); }
|
||||||
|
|
||||||
//! Set model
|
//! Set model
|
||||||
void setModel(const BlackMisc::Simulation::CAircraftModel &model);
|
void setModel(const CAircraftModel &model);
|
||||||
|
|
||||||
//! Set network model
|
//! Set network model
|
||||||
void setNetworkModel(const BlackMisc::Simulation::CAircraftModel &model);
|
void setNetworkModel(const CAircraftModel &model);
|
||||||
|
|
||||||
//! Set callsign
|
//! Set callsign
|
||||||
void setCallsign(const BlackMisc::Aviation::CCallsign &callsign);
|
void setCallsign(const Aviation::CCallsign &callsign);
|
||||||
|
|
||||||
//! Set pilot
|
//! Set pilot
|
||||||
void setPilot(const BlackMisc::Network::CUser &user);
|
void setPilot(const Network::CUser &user);
|
||||||
|
|
||||||
//! Enabled? Enable means it shall be displayed in the simulator
|
//! Enabled? Enable means it shall be displayed in the simulator
|
||||||
bool isEnabled() const;
|
bool isEnabled() const;
|
||||||
@@ -414,29 +417,29 @@ namespace BlackMisc
|
|||||||
void setPartsSynchronized(bool synchronized) { m_partsSynchronized = synchronized; }
|
void setPartsSynchronized(bool synchronized) { m_partsSynchronized = synchronized; }
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
CVariant propertyByIndex(const CPropertyIndex &index) const;
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
|
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::String::toQString()
|
//! \copydoc BlackMisc::Mixin::String::toQString()
|
||||||
QString convertToQString(bool i18n = false) const;
|
QString convertToQString(bool i18n = false) const;
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::Icon::toIcon()
|
//! \copydoc BlackMisc::Mixin::Icon::toIcon()
|
||||||
BlackMisc::CIcon toIcon() const { return m_callsign.toIcon(); }
|
CIcon toIcon() const { return m_callsign.toIcon(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr int CurrentModel = 0; //!< m_models
|
static constexpr int CurrentModel = 0; //!< m_models
|
||||||
static constexpr int NetworkModel = 1; //!< m_models
|
static constexpr int NetworkModel = 1; //!< m_models
|
||||||
BlackMisc::Aviation::CCallsign m_callsign;
|
Aviation::CCallsign m_callsign;
|
||||||
BlackMisc::Network::CUser m_pilot;
|
Network::CUser m_pilot;
|
||||||
BlackMisc::Aviation::CAircraftSituation m_situation;
|
Aviation::CAircraftSituation m_situation;
|
||||||
BlackMisc::Aviation::CComSystem m_com1system;
|
Aviation::CComSystem m_com1system;
|
||||||
BlackMisc::Aviation::CComSystem m_com2system;
|
Aviation::CComSystem m_com2system;
|
||||||
BlackMisc::Aviation::CTransponder m_transponder;
|
Aviation::CTransponder m_transponder;
|
||||||
BlackMisc::Aviation::CAircraftParts m_parts;
|
Aviation::CAircraftParts m_parts;
|
||||||
BlackMisc::Aviation::CSelcal m_selcal;
|
Aviation::CSelcal m_selcal;
|
||||||
BlackMisc::Simulation::CAircraftModelList m_models = { { CAircraftModel(), CAircraftModel() } }; //!< Shorter DBus signature: current model, and model received from network
|
CAircraftModelList m_models = { { CAircraftModel(), CAircraftModel() } }; //!< Shorter DBus signature: current model, and model received from network
|
||||||
bool m_enabled = true; //!< to be displayed in simulator
|
bool m_enabled = true; //!< to be displayed in simulator
|
||||||
bool m_rendered = false; //!< really shown in simulator
|
bool m_rendered = false; //!< really shown in simulator
|
||||||
bool m_partsSynchronized = false; //!< synchronize parts
|
bool m_partsSynchronized = false; //!< synchronize parts
|
||||||
|
|||||||
Reference in New Issue
Block a user