mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-05 17:55:45 +08:00
Ref T268, check in XPlane driver
This commit is contained in:
@@ -52,6 +52,7 @@
|
|||||||
#include "blackmisc/dbusserver.h"
|
#include "blackmisc/dbusserver.h"
|
||||||
#include "blackmisc/iterator.h"
|
#include "blackmisc/iterator.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
|
#include "blackconfig/buildconfig.h"
|
||||||
|
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QDBusServiceWatcher>
|
#include <QDBusServiceWatcher>
|
||||||
@@ -60,6 +61,7 @@
|
|||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
|
using namespace BlackConfig;
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
using namespace BlackMisc::Network;
|
using namespace BlackMisc::Network;
|
||||||
@@ -558,7 +560,11 @@ namespace BlackSimPlugin
|
|||||||
if (callsign.isEmpty()) { return false; } // can happen if an object is not an aircraft
|
if (callsign.isEmpty()) { return false; } // can happen if an object is not an aircraft
|
||||||
|
|
||||||
// really remove from simulator
|
// really remove from simulator
|
||||||
if (!m_xplaneAircraftObjects.contains(callsign) && !m_pendingToBeAddedAircraft.containsCallsign(callsign)) { return false; } // already fully removed or not yet added
|
if (!m_xplaneAircraftObjects.contains(callsign) && !m_pendingToBeAddedAircraft.containsCallsign(callsign) && !m_addingInProgressAircraft.contains(callsign))
|
||||||
|
{
|
||||||
|
// not existing aircraft
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// mark in provider
|
// mark in provider
|
||||||
const bool updated = this->updateAircraftRendered(callsign, false);
|
const bool updated = this->updateAircraftRendered(callsign, false);
|
||||||
@@ -577,6 +583,17 @@ namespace BlackSimPlugin
|
|||||||
aircraft.setRendered(false);
|
aircraft.setRendered(false);
|
||||||
emit this->aircraftRenderingChanged(aircraft);
|
emit this->aircraftRenderingChanged(aircraft);
|
||||||
}
|
}
|
||||||
|
else if (m_addingInProgressAircraft.contains(callsign))
|
||||||
|
{
|
||||||
|
// we are just about to add that aircraft
|
||||||
|
QPointer<CSimulatorXPlane> myself(this);
|
||||||
|
QTimer::singleShot(TimeoutAdding, this, [ = ]
|
||||||
|
{
|
||||||
|
if (!myself) { return; }
|
||||||
|
m_addingInProgressAircraft.remove(callsign); // remove as "in progress"
|
||||||
|
this->physicallyRemoveRemoteAircraft(callsign); // and remove from sim. if it was added in the mean time
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_trafficProxy->removePlane(callsign.asString());
|
m_trafficProxy->removePlane(callsign.asString());
|
||||||
@@ -777,6 +794,10 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
if (!planesPositions.isEmpty())
|
if (!planesPositions.isEmpty())
|
||||||
{
|
{
|
||||||
|
if (CBuildConfig::isLocalDeveloperDebugBuild())
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(planesPositions.hasSameSizes(), Q_FUNC_INFO, "Mismatching sizes");
|
||||||
|
}
|
||||||
m_trafficProxy->setPlanesPositions(planesPositions);
|
m_trafficProxy->setPlanesPositions(planesPositions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ TARGET = simulatorxplane
|
|||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
|
|
||||||
CONFIG += plugin shared
|
CONFIG += plugin shared
|
||||||
CONFIG += blackmisc blackcore blackgui
|
CONFIG += blackmisc blackcore blackgui blackconfig
|
||||||
|
|
||||||
DEPENDPATH += . $$SourceRoot/src
|
DEPENDPATH += . $$SourceRoot/src
|
||||||
INCLUDEPATH += . $$SourceRoot/src
|
INCLUDEPATH += . $$SourceRoot/src
|
||||||
|
|||||||
@@ -40,6 +40,19 @@ namespace BlackSimPlugin
|
|||||||
//! Is empty?
|
//! Is empty?
|
||||||
bool isEmpty() const { return callsigns.isEmpty(); }
|
bool isEmpty() const { return callsigns.isEmpty(); }
|
||||||
|
|
||||||
|
//! Check function
|
||||||
|
bool hasSameSizes() const
|
||||||
|
{
|
||||||
|
const int s = callsigns.size();
|
||||||
|
if (s != latitudes.size()) { return false; }
|
||||||
|
if (s != longitudes.size()) { return false; }
|
||||||
|
if (s != altitudes.size()) { return false; }
|
||||||
|
if (s != pitches.size()) { return false; }
|
||||||
|
if (s != rolls.size()) { return false; }
|
||||||
|
if (s != headings.size()) { return false; }
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList callsigns; //!< List of callsigns
|
QStringList callsigns; //!< List of callsigns
|
||||||
QList<double> latitudes; //!< List of latitudes
|
QList<double> latitudes; //!< List of latitudes
|
||||||
QList<double> longitudes; //!< List of longitudes
|
QList<double> longitudes; //!< List of longitudes
|
||||||
|
|||||||
Reference in New Issue
Block a user