Revert previous commit, as the corresponding changes have not yet been merged in FG

This commit is contained in:
Mat Sutcliffe
2020-06-13 14:37:05 +01:00
parent a222d09f21
commit 68cb177d96
3 changed files with 17 additions and 66 deletions

View File

@@ -62,7 +62,7 @@
#include <QPointer>
#include <math.h>
#define FGSWIFTBUS_API_VERSION 2
#define FGSWIFTBUS_API_VERSION 1
using namespace BlackConfig;
using namespace BlackMisc;
@@ -170,7 +170,8 @@ namespace BlackSimPlugin
{
PlanesSurfaces surfaces;
surfaces.push_back(callsign, parts);
m_trafficProxy->setPlanesSurfaces(surfaces);
//! \todo KB 2091-09 FG parts sending missing
// m_trafficProxy->setPlanesSurfaces(surfaces);
u++;
}
return u > 0;
@@ -532,15 +533,6 @@ namespace BlackSimPlugin
newRemoteAircraft.getAircraftIcaoCode().getDesignator(),
newRemoteAircraft.getAirlineIcaoCode().getDesignator(),
livery);
PlanesPositions pos;
pos.push_back(newRemoteAircraft.getSituation());
m_trafficProxy->setPlanesPositions(pos);
PlanesSurfaces surfaces;
surfaces.push_back(newRemoteAircraft.getCallsign(), newRemoteAircraft.getParts());
m_trafficProxy->setPlanesSurfaces(surfaces);
}
else
{
@@ -631,25 +623,23 @@ namespace BlackSimPlugin
// interpolation for all remote aircraft
PlanesPositions planesPositions;
PlanesSurfaces planesSurfaces;
PlanesTransponders planesTransponders;
int aircraftNumber = 0;
const bool updateAllAircraft = this->isUpdateAllRemoteAircraft(currentTimestamp);
const CCallsignSet callsignsInRange = this->getAircraftInRangeCallsigns();
const CCallsignSet callsingsInRange = this->getAircraftInRangeCallsigns();
for (const CFlightgearMPAircraft &flightgearAircraft : m_flightgearAircraftObjects)
{
const CCallsign callsign(flightgearAircraft.getCallsign());
const bool hasCallsign = !callsign.isEmpty();
if (!hasCallsign)
{
// does not make sense to continue here
BLACK_VERIFY_X(false, Q_FUNC_INFO, "missing callsign");
continue;
}
// skip no longer in range
if (!callsignsInRange.contains(callsign)) { continue; }
if (!callsingsInRange.contains(callsign)) { continue; }
planesTransponders.callsigns.push_back(callsign.asString());
planesTransponders.codes.push_back(flightgearAircraft.getAircraft().getTransponderCode());
@@ -670,7 +660,15 @@ namespace BlackSimPlugin
if (updateAllAircraft || !this->isEqualLastSent(interpolatedSituation))
{
this->rememberLastSent(interpolatedSituation);
planesPositions.push_back(interpolatedSituation);
planesPositions.callsigns.push_back(interpolatedSituation.getCallsign().asString());
planesPositions.latitudesDeg.push_back(interpolatedSituation.latitude().value(CAngleUnit::deg()));
planesPositions.longitudesDeg.push_back(interpolatedSituation.longitude().value(CAngleUnit::deg()));
planesPositions.altitudesFt.push_back(interpolatedSituation.getAltitude().value(CLengthUnit::ft()));
planesPositions.pitchesDeg.push_back(interpolatedSituation.getPitch().value(CAngleUnit::deg()));
planesPositions.rollsDeg.push_back(interpolatedSituation.getBank().value(CAngleUnit::deg()));
planesPositions.headingsDeg.push_back(interpolatedSituation.getHeading().value(CAngleUnit::deg()));
planesPositions.groundSpeedKts.push_back(interpolatedSituation.getGroundSpeed().value(CSpeedUnit::kts()));
planesPositions.onGrounds.push_back(interpolatedSituation.getOnGround() == CAircraftSituation::OnGround);
}
}
else
@@ -678,37 +676,17 @@ namespace BlackSimPlugin
CLogMessage(this).warning(this->getInvalidSituationLogMessage(callsign, result.getInterpolationStatus()));
}
const CAircraftParts parts(result);
if (result.getPartsStatus().isSupportingParts() || parts.getPartsDetails() == CAircraftParts::GuessedParts)
{
if (updateAllAircraft || !this->isEqualLastSent(parts, callsign))
{
this->rememberLastSent(parts, callsign);
planesSurfaces.push_back(flightgearAircraft.getCallsign(), parts);
}
}
} // all callsigns
if (!planesTransponders.isEmpty())
{
m_trafficProxy->setPlanesTransponders(planesTransponders);
}
if (!planesPositions.isEmpty())
{
if (CBuildConfig::isLocalDeveloperDebugBuild())
{
BLACK_VERIFY_X(planesPositions.hasSameSizes(), Q_FUNC_INFO, "Mismatching sizes");
Q_ASSERT_X(planesPositions.hasSameSizes(), Q_FUNC_INFO, "Mismatching sizes");
}
m_trafficProxy->setPlanesPositions(planesPositions);
}
if (! planesSurfaces.isEmpty())
{
m_trafficProxy->setPlanesSurfaces(planesSurfaces);
}
// stats
this->finishUpdateRemoteAircraftAndSetStatistics(currentTimestamp);
}