Ref T275, Ref T280, airspace monitor improvements

* improved when when we add aircraft by waiting for at least 2 positions
* reset rendered flag
* check ecosysstem
This commit is contained in:
Klaus Basan
2018-06-27 01:41:03 +02:00
parent 8898bf6be5
commit b551aaf874

View File

@@ -472,18 +472,20 @@ namespace BlackCore
Q_ASSERT_X(!callsign.isEmpty(), Q_FUNC_INFO, "missing callsign");
if (!this->isConnected()) { return; }
// checking for min. situations ensures the aircraft is stable, can be interpolated ...
const CSimulatedAircraft remoteAircraft = this->getAircraftInRangeForCallsign(callsign);
const bool validCs = remoteAircraft.hasValidCallsign();
const bool complete = validCs && (
const bool minSituations = validCs && this->remoteAircraftSituationsCount(callsign) > 1;
const bool complete = minSituations && (
(remoteAircraft.getModel().getModelType() == CAircraftModel::TypeFSInnData) || // here we know we have all data
(remoteAircraft.hasModelString()) // we cannot expect more info
);
if (trial < 2 && !complete)
if (trial < 5 && !complete)
{
this->addReverseLookupMessage(callsign, "Wait for further data");
const QPointer<CAirspaceMonitor> myself(this);
QTimer::singleShot(1500 * trial, this, [ = ]()
QTimer::singleShot(1500, this, [ = ]()
{
if (myself.isNull() || !sApp || sApp->isShuttingDown()) { return; }
if (!this->isAircraftInRange(callsign))
@@ -756,11 +758,14 @@ namespace BlackCore
if (!sApp || sApp->isShuttingDown()) { return false; }
CSimulatedAircraft newAircraft(aircraft);
newAircraft.setRendered(false); // reset rendering
newAircraft.calculcateAndUpdateRelativeDistanceAndBearing(this->getOwnAircraftPosition()); // distance from myself
Q_ASSERT_X(sApp->hasWebDataServices(), Q_FUNC_INFO, "No web services");
sApp->getWebDataServices()->updateWithVatsimDataFileData(newAircraft);
if (this->getConnectedServer().getEcosystem() == CEcosystem::vatsim())
{
sApp->getWebDataServices()->updateWithVatsimDataFileData(newAircraft);
}
return CRemoteAircraftProvider::addNewAircraftInRange(newAircraft);
}