mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 11:25:33 +08:00
Ref T681, renamed to rememberElevationAndSimulatorCG and style
This commit is contained in:
committed by
Mat Sutcliffe
parent
30609ef7ad
commit
71e09b008f
@@ -116,6 +116,7 @@ namespace BlackCore
|
|||||||
signals:
|
signals:
|
||||||
//! Changed aircraft model
|
//! Changed aircraft model
|
||||||
//! \private Use ISimulatorContext::ownAircraftModelChanged
|
//! \private Use ISimulatorContext::ownAircraftModelChanged
|
||||||
|
//! \remark used for cross context updates
|
||||||
void ps_changedModel(const BlackMisc::Simulation::CAircraftModel &model, const BlackMisc::CIdentifier &identifier);
|
void ps_changedModel(const BlackMisc::Simulation::CAircraftModel &model, const BlackMisc::CIdentifier &identifier);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
if (simulator.isSingleSimulator())
|
if (simulator.isSingleSimulator())
|
||||||
{
|
{
|
||||||
const QString simDir = m_simulatorSettings.getSimulatorDirectoryOrDefault(simulator);
|
const QString simDir = m_multiSimulatorSettings.getSimulatorDirectoryOrDefault(simulator);
|
||||||
m_validator->setCurrentSimulator(simulator, simDir);
|
m_validator->setCurrentSimulator(simulator, simDir);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -149,15 +149,15 @@ namespace BlackCore
|
|||||||
if (!p.isValid()) { return {}; }
|
if (!p.isValid()) { return {}; }
|
||||||
const CSimulatorInfo sim = p.getSimulatorInfo();
|
const CSimulatorInfo sim = p.getSimulatorInfo();
|
||||||
if (!sim.isSingleSimulator()) { return {}; }
|
if (!sim.isSingleSimulator()) { return {}; }
|
||||||
return m_simulatorSettings.getSettings(sim);
|
return m_multiSimulatorSettings.getSettings(sim);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CContextSimulator::setSimulatorSettings(const CSimulatorSettings &settings, const CSimulatorInfo &simulator)
|
bool CContextSimulator::setSimulatorSettings(const CSimulatorSettings &settings, const CSimulatorInfo &simulator)
|
||||||
{
|
{
|
||||||
if (!simulator.isSingleSimulator()) { return false; }
|
if (!simulator.isSingleSimulator()) { return false; }
|
||||||
CSimulatorSettings simSettings = m_simulatorSettings.getSettings(simulator);
|
CSimulatorSettings simSettings = m_multiSimulatorSettings.getSettings(simulator);
|
||||||
if (simSettings == settings) { return false; }
|
if (simSettings == settings) { return false; }
|
||||||
const CStatusMessage msg = m_simulatorSettings.setSettings(settings, simulator);
|
const CStatusMessage msg = m_multiSimulatorSettings.setSettings(settings, simulator);
|
||||||
CLogMessage::preformatted(msg);
|
CLogMessage::preformatted(msg);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -323,7 +323,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||||
if (!m_validator) { return false; }
|
if (!m_validator) { return false; }
|
||||||
const QString simDir = simulator.isSingleSimulator() ? m_simulatorSettings.getSimulatorDirectoryOrDefault(simulator) : "";
|
const QString simDir = simulator.isSingleSimulator() ? m_multiSimulatorSettings.getSimulatorDirectoryOrDefault(simulator) : "";
|
||||||
return m_validator->triggerValidation(simulator, simDir);
|
return m_validator->triggerValidation(simulator, simDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -933,7 +933,7 @@ namespace BlackCore
|
|||||||
return msgs;
|
return msgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList modelDirs = m_simulatorSettings.getModelDirectoriesOrDefault(simulator);
|
const QStringList modelDirs = m_multiSimulatorSettings.getModelDirectoriesOrDefault(simulator);
|
||||||
if (modelDirs.isEmpty() || modelDirs.front().isEmpty())
|
if (modelDirs.isEmpty() || modelDirs.front().isEmpty())
|
||||||
{
|
{
|
||||||
msgs.push_back(CStatusMessage(this, CStatusMessage::SeverityError, u"No model directory"));
|
msgs.push_back(CStatusMessage(this, CStatusMessage::SeverityError, u"No model directory"));
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ namespace BlackCore
|
|||||||
BlackMisc::CSettingReadOnly<Application::TEnabledSimulators> m_enabledSimulators { this, &CContextSimulator::changeEnabledSimulators };
|
BlackMisc::CSettingReadOnly<Application::TEnabledSimulators> m_enabledSimulators { this, &CContextSimulator::changeEnabledSimulators };
|
||||||
BlackMisc::CSetting<BlackMisc::Simulation::Settings::TModelMatching> m_matchingSettings { this }; //!< matching settings (all simulators)
|
BlackMisc::CSetting<BlackMisc::Simulation::Settings::TModelMatching> m_matchingSettings { this }; //!< matching settings (all simulators)
|
||||||
BlackMisc::CData<BlackMisc::Simulation::Data::TSimulatorLastSelection> m_modelSetSimulator { this }; //!< current simulator used for model set
|
BlackMisc::CData<BlackMisc::Simulation::Data::TSimulatorLastSelection> m_modelSetSimulator { this }; //!< current simulator used for model set
|
||||||
BlackMisc::Simulation::Settings::CMultiSimulatorSettings m_simulatorSettings { this }; //!< individual for simulator, for validation of models
|
BlackMisc::Simulation::Settings::CMultiSimulatorSettings m_multiSimulatorSettings { this }; //!< individual for simulator, for validation of models
|
||||||
BlackMisc::CSetting<BlackMisc::Simulation::Settings::TInterpolationAndRenderingSetupGlobal> m_renderSettings { this }; //!< rendering/interpolation settings (all simulators)
|
BlackMisc::CSetting<BlackMisc::Simulation::Settings::TInterpolationAndRenderingSetupGlobal> m_renderSettings { this }; //!< rendering/interpolation settings (all simulators)
|
||||||
BlackMisc::CSettingReadOnly<BlackMisc::Simulation::Settings::TSimulatorMessages> m_messageSettings { this }; //!< settings for messages (all simulators)
|
BlackMisc::CSettingReadOnly<BlackMisc::Simulation::Settings::TSimulatorMessages> m_messageSettings { this }; //!< settings for messages (all simulators)
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
// this is used if the value in own aircraft is changed, to callback simulator
|
// this is used if the value in own aircraft is changed, to callback simulator
|
||||||
c = connect(this->getCContextOwnAircraft(), &CContextOwnAircraft::ps_changedModel,
|
c = connect(this->getCContextOwnAircraft(), &CContextOwnAircraft::ps_changedModel,
|
||||||
this->getCContextSimulator(), &CContextSimulator::xCtxChangedOwnAircraftModel);
|
this->getCContextSimulator(), &CContextSimulator::xCtxChangedOwnAircraftModel);
|
||||||
Q_ASSERT(c);
|
Q_ASSERT(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -835,7 +835,7 @@ namespace BlackCore
|
|||||||
m_simulatorInternals.setSimulatorInstallationDirectory(s.getSimulatorDirectoryOrDefault());
|
m_simulatorInternals.setSimulatorInstallationDirectory(s.getSimulatorDirectoryOrDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ISimulator::rememberElevationAndCG(const CCallsign &callsign, const QString &modelString, const CElevationPlane &elevation, const CLength &cg)
|
void ISimulator::rememberElevationAndSimulatorCG(const CCallsign &callsign, const QString &modelString, const CElevationPlane &elevation, const CLength &simulatorCG)
|
||||||
{
|
{
|
||||||
if (callsign.isEmpty()) { return; }
|
if (callsign.isEmpty()) { return; }
|
||||||
if (!elevation.isNull())
|
if (!elevation.isNull())
|
||||||
@@ -845,13 +845,13 @@ namespace BlackCore
|
|||||||
this->rememberGroundElevation(callsign, elevation);
|
this->rememberGroundElevation(callsign, elevation);
|
||||||
}
|
}
|
||||||
|
|
||||||
const CLength cgO = this->overriddenCGorDefault(cg, modelString);
|
const CLength cgO = this->overriddenCGorDefault(simulatorCG, modelString);
|
||||||
if (!cgO.isNull() && !this->hasSameSimulatorCG(cgO, callsign))
|
if (!cgO.isNull() && !this->hasSameSimulatorCG(cgO, callsign))
|
||||||
{
|
{
|
||||||
this->insertCG(cgO, modelString, callsign); // per model string and CG
|
this->insertCG(cgO, modelString, callsign); // per model string and CG
|
||||||
|
|
||||||
// here we know we have a valid model and CG
|
// here we know we have a valid model and CG
|
||||||
m_autoPublishing.insert(modelString, cg); // still using CG here, not the overridden value
|
m_autoPublishing.insert(modelString, simulatorCG); // still using CG here, not the overridden value
|
||||||
m_autoPublishing.insert(modelString, this->getSimulatorInfo());
|
m_autoPublishing.insert(modelString, this->getSimulatorInfo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -431,7 +431,7 @@ namespace BlackCore
|
|||||||
virtual int physicallyRemoveAllRemoteAircraft();
|
virtual int physicallyRemoveAllRemoteAircraft();
|
||||||
|
|
||||||
//! Set elevation and CG in the providers and for auto publishing
|
//! Set elevation and CG in the providers and for auto publishing
|
||||||
void rememberElevationAndCG(const BlackMisc::Aviation::CCallsign &callsign, const QString &modelString, const BlackMisc::Geo::CElevationPlane &elevation, const BlackMisc::PhysicalQuantities::CLength &cg);
|
void rememberElevationAndSimulatorCG(const BlackMisc::Aviation::CCallsign &callsign, const QString &modelString, const BlackMisc::Geo::CElevationPlane &elevation, const BlackMisc::PhysicalQuantities::CLength &simulatorCG);
|
||||||
|
|
||||||
//! Emit the combined status
|
//! Emit the combined status
|
||||||
//! \param oldStatus optionally one can capture and provide the old status for comparison. In case of equal status values no signal will be sent
|
//! \param oldStatus optionally one can capture and provide the old status for comparison. In case of equal status values no signal will be sent
|
||||||
|
|||||||
@@ -565,19 +565,19 @@ namespace BlackMisc
|
|||||||
CCallsign m_correspondingCallsign;
|
CCallsign m_correspondingCallsign;
|
||||||
Geo::CCoordinateGeodetic m_position; //!< NULL position as default
|
Geo::CCoordinateGeodetic m_position; //!< NULL position as default
|
||||||
Geo::CElevationPlane m_groundElevationPlane; //!< NULL elevation as default
|
Geo::CElevationPlane m_groundElevationPlane; //!< NULL elevation as default
|
||||||
Aviation::CAltitude m_pressureAltitude { 0, nullptr };
|
Aviation::CAltitude m_pressureAltitude { 0, nullptr };
|
||||||
CHeading m_heading { 0, nullptr };
|
CHeading m_heading { 0, nullptr };
|
||||||
PhysicalQuantities::CAngle m_pitch { 0, nullptr };
|
PhysicalQuantities::CAngle m_pitch { 0, nullptr };
|
||||||
PhysicalQuantities::CAngle m_bank { 0, nullptr };
|
PhysicalQuantities::CAngle m_bank { 0, nullptr };
|
||||||
PhysicalQuantities::CSpeed m_groundSpeed { 0, nullptr };
|
PhysicalQuantities::CSpeed m_groundSpeed { 0, nullptr };
|
||||||
PhysicalQuantities::CLength m_cg { 0, nullptr };
|
PhysicalQuantities::CLength m_cg { 0, nullptr };
|
||||||
PhysicalQuantities::CLength m_sceneryOffset { 0, nullptr };
|
PhysicalQuantities::CLength m_sceneryOffset { 0, nullptr };
|
||||||
bool m_isInterim = false; //!< interim situation?
|
bool m_isInterim = false; //!< interim situation?
|
||||||
bool m_isElvInfoTransferred = false; //!< the gnd.elevation has been transferred
|
bool m_isElvInfoTransferred = false; //!< the gnd.elevation has been transferred
|
||||||
int m_onGround = static_cast<int>(CAircraftSituation::OnGroundSituationUnknown);
|
int m_onGround = static_cast<int>(CAircraftSituation::OnGroundSituationUnknown);
|
||||||
int m_onGroundDetails = static_cast<int>(CAircraftSituation::NotSetGroundDetails);
|
int m_onGroundDetails = static_cast<int>(CAircraftSituation::NotSetGroundDetails);
|
||||||
int m_elvInfo = static_cast<int>(CAircraftSituation::NoElevationInfo); //!< where did we gnd.elevation from?
|
int m_elvInfo = static_cast<int>(CAircraftSituation::NoElevationInfo); //!< where did we gnd.elevation from?
|
||||||
double m_onGroundFactor = -1; //!< interpolated ground flag, 1..on ground, 0..not on ground, -1 no info
|
double m_onGroundFactor = -1; //!< interpolated ground flag, 1..on ground, 0..not on ground, -1 no info
|
||||||
QString m_onGroundGuessingDetails; //!< only for debugging, not transferred via DBus etc.
|
QString m_onGroundGuessingDetails; //!< only for debugging, not transferred via DBus etc.
|
||||||
|
|
||||||
//! Equal double values?
|
//! Equal double values?
|
||||||
|
|||||||
@@ -732,7 +732,7 @@ namespace BlackSimPlugin
|
|||||||
const CLength cg = std::isnan(cgValue) ?
|
const CLength cg = std::isnan(cgValue) ?
|
||||||
CLength::null() :
|
CLength::null() :
|
||||||
CLength(cgValue, CLengthUnit::m(), CLengthUnit::ft());
|
CLength(cgValue, CLengthUnit::m(), CLengthUnit::ft());
|
||||||
this->rememberElevationAndCG(cs, fgAircraft.getAircraftModelString(), elevation, cg);
|
this->rememberElevationAndSimulatorCG(cs, fgAircraft.getAircraftModelString(), elevation, cg);
|
||||||
|
|
||||||
// loopback
|
// loopback
|
||||||
if (logCallsigns.contains(cs))
|
if (logCallsigns.contains(cs))
|
||||||
|
|||||||
@@ -809,7 +809,7 @@ namespace BlackSimPlugin
|
|||||||
if (remoteAircraftData.aboveGroundFt() < 250)
|
if (remoteAircraftData.aboveGroundFt() < 250)
|
||||||
{
|
{
|
||||||
const CLength cg(remoteAircraftData.cgToGroundFt, CLengthUnit::ft());
|
const CLength cg(remoteAircraftData.cgToGroundFt, CLengthUnit::ft());
|
||||||
this->rememberElevationAndCG(cs, simObject.getAircraftModelString(), elevation, cg);
|
this->rememberElevationAndSimulatorCG(cs, simObject.getAircraftModelString(), elevation, cg);
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool log = this->isLogCallsign(cs);
|
const bool log = this->isLogCallsign(cs);
|
||||||
@@ -859,7 +859,7 @@ namespace BlackSimPlugin
|
|||||||
so.setAircraftModelString(modelString);
|
so.setAircraftModelString(modelString);
|
||||||
|
|
||||||
// update in 2 providers
|
// update in 2 providers
|
||||||
this->rememberElevationAndCG(cs, modelString, CElevationPlane::null(), cg); // env. provider
|
this->rememberElevationAndSimulatorCG(cs, modelString, CElevationPlane::null(), cg); // env. provider
|
||||||
this->updateCGAndModelString(cs, cg, modelString); // remote aircraft provider
|
this->updateCGAndModelString(cs, cg, modelString); // remote aircraft provider
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -993,7 +993,7 @@ namespace BlackSimPlugin
|
|||||||
const CLength cg = std::isnan(cgValue) ?
|
const CLength cg = std::isnan(cgValue) ?
|
||||||
CLength::null() :
|
CLength::null() :
|
||||||
CLength(cgValue, CLengthUnit::m(), CLengthUnit::ft());
|
CLength(cgValue, CLengthUnit::m(), CLengthUnit::ft());
|
||||||
this->rememberElevationAndCG(cs, xpAircraft.getAircraftModelString(), elevation, cg);
|
this->rememberElevationAndSimulatorCG(cs, xpAircraft.getAircraftModelString(), elevation, cg);
|
||||||
|
|
||||||
// loopback
|
// loopback
|
||||||
if (logCallsigns.contains(cs))
|
if (logCallsigns.contains(cs))
|
||||||
|
|||||||
Reference in New Issue
Block a user