mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
refs #570 Each CAircraftSituation can have its own time offset, instead of a hardcoded 6 seconds.
This commit is contained in:
@@ -1113,6 +1113,12 @@ namespace BlackCore
|
||||
|
||||
// check sort order
|
||||
Q_ASSERT_X(l.size() < 2 || l[0].getMSecsSinceEpoch() >= l[1].getMSecsSinceEpoch(), Q_FUNC_INFO, "wrong sort order");
|
||||
|
||||
// a full position update received after an interim position update should use the time offset of the interim position
|
||||
if (l.size() >= 2 && (l[0].isInterim() || l[1].isInterim()))
|
||||
{
|
||||
l[0].setTimeOffsetMs(std::min(l[0].getTimeOffsetMs(), l[1].getTimeOffsetMs()));
|
||||
}
|
||||
}
|
||||
|
||||
void CAirspaceMonitor::storeAircraftParts(const CCallsign &callsign, const CAircraftParts &parts)
|
||||
|
||||
@@ -745,7 +745,7 @@ namespace BlackCore
|
||||
void CNetworkVatlib::onPilotPositionUpdate(VatSessionID, const char *callsignChar , const VatPilotPosition *position, void *cbvar)
|
||||
{
|
||||
const CCallsign callsign(callsignChar, CCallsign::Aircraft);
|
||||
const CAircraftSituation situation(
|
||||
CAircraftSituation situation(
|
||||
callsign,
|
||||
CCoordinateGeodetic(position->latitude, position->longitude, 0.0),
|
||||
CAltitude(position->altitudeTrue, CAltitude::MeanSeaLevel, CLengthUnit::ft()),
|
||||
@@ -754,6 +754,7 @@ namespace BlackCore
|
||||
CAngle(position->bank, CAngleUnit::deg()),
|
||||
CSpeed(position->groundSpeed, CSpeedUnit::kts())
|
||||
);
|
||||
situation.setTimeOffsetMs(6000);
|
||||
|
||||
QString transponderName("transponder ");
|
||||
transponderName.append(callsign.asString());
|
||||
@@ -820,9 +821,8 @@ namespace BlackCore
|
||||
|
||||
void CNetworkVatlib::onInterimPilotPositionUpdate(VatSessionID, const char *sender, const VatInterimPilotPosition *position, void *cbvar)
|
||||
{
|
||||
const CCallsign callsign(sender);
|
||||
const CAircraftSituation situation(
|
||||
callsign,
|
||||
CAircraftSituation situation(
|
||||
CCallsign(sender),
|
||||
CCoordinateGeodetic(position->latitude, position->longitude, 0.0),
|
||||
CAltitude(position->altitudeTrue, CAltitude::MeanSeaLevel, CLengthUnit::ft()),
|
||||
CHeading(position->heading, CHeading::True, CAngleUnit::deg()),
|
||||
@@ -831,6 +831,8 @@ namespace BlackCore
|
||||
// There is no speed information in a interim packet
|
||||
CSpeed(0.0, CSpeedUnit::kts())
|
||||
);
|
||||
situation.setTimeOffsetMs(2000);
|
||||
situation.setInterimFlag(true);
|
||||
|
||||
emit cbvar_cast(cbvar)->aircraftInterimPositionUpdate(situation);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user