Ref T260, changed elevation handling in provider, simulator and FSX common driver

* split functions, added findClosestElevationWithinRangeOrRequest
* obtain elevation ids (separate ids are easier to track)
* also added experimental "physicallyAddAITerrainProbe" (FSX) for the FSX elevation probing
* callback / signal when requested elevation is received (async)
This commit is contained in:
Klaus Basan
2018-04-07 04:41:22 +02:00
committed by Roland Winklmeier
parent dcc348c9d9
commit 6061a61d50
12 changed files with 268 additions and 48 deletions

View File

@@ -922,7 +922,7 @@ namespace BlackCore
CAircraftSituation correctedSituation(situation);
if (!correctedSituation.hasGroundElevation() && !correctedSituation.canLikelySkipNearGroundInterpolation())
{
const CElevationPlane ep = this->findClosestElevationWithinRange(correctedSituation, correctedSituation.getDistancePerTime(1000), true);
const CElevationPlane ep = this->findClosestElevationWithinRangeOrRequest(correctedSituation, correctedSituation.getDistancePerTime(1000), callsign);
correctedSituation.setGroundElevation(ep);
}

View File

@@ -9,6 +9,7 @@
#include "blackcore/simulator.h"
#include "blackcore/application.h"
#include "blackmisc/logmessage.h"
#include <QFlag>
#include <Qt>
@@ -42,14 +43,24 @@ namespace BlackCore
return setup;
}
bool ISimulator::requestElevation(const Geo::ICoordinateGeodetic &reference) const
bool ISimulator::requestElevation(const Geo::ICoordinateGeodetic &reference, const CCallsign &callsign)
{
if (this->isShuttingDown()) { return false; }
if (reference.isNull()) { return false; }
Q_UNUSED(reference);
Q_UNUSED(callsign);
return false;
}
void ISimulator::callbackReceivedRequestedElevation(const Geo::CElevationPlane &plane, const CCallsign &callsign)
{
if (this->isShuttingDown()) { return; }
// CLogMessage(this).info("'%1' Received req. elevation") << callsign.asString();
this->rememberGroundElevation(plane);
const int updated = this->updateAircraftGroundElevation(callsign, plane);
if (updated < 1) { return; }
emit this->receivedRequestedElevation(plane, callsign);
}
void ISimulator::registerHelp()
{
if (CSimpleCommandParser::registered("BlackCore::ISimulator")) { return; }

View File

@@ -182,7 +182,7 @@ namespace BlackCore
//! \copydoc BlackMisc::Simulation::ISimulationEnvironmentProvider::requestElevation
//! \remark needs to be overridden if the concrete driver supports such an option
virtual bool requestElevation(const BlackMisc::Geo::ICoordinateGeodetic &reference) const override;
virtual bool requestElevation(const BlackMisc::Geo::ICoordinateGeodetic &reference, const BlackMisc::Aviation::CCallsign &callsign) override;
//! \copydoc BlackMisc::IProvider::asQObject
virtual QObject *asQObject() override { return this; }
@@ -235,6 +235,9 @@ namespace BlackCore
//! Request a console message (whatever the console maybe)
void requestUiConsoleMessage(const QString &driverMessage, bool clear);
//! A requested elevation has been received
void receivedRequestedElevation(const BlackMisc::Geo::CElevationPlane &plane, const BlackMisc::Aviation::CCallsign &callsign);
protected:
//! Default constructor
ISimulator(const BlackMisc::Simulation::CSimulatorPluginInfo &pluginInfo,
@@ -268,6 +271,9 @@ namespace BlackCore
//! Set elevation and CG in the providers
void rememberElevationAndCG(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Geo::CElevationPlane &elevation, const BlackMisc::PhysicalQuantities::CLength &cg);
//! A requested elevation has been received
virtual void callbackReceivedRequestedElevation(const BlackMisc::Geo::CElevationPlane &plane, const BlackMisc::Aviation::CCallsign &callsign);
//! 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
//! \sa simulatorStatusChanged;