mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
Ref T259, Ref T243 formatting
This commit is contained in:
@@ -1278,7 +1278,7 @@ namespace BlackCore
|
||||
{
|
||||
const QJsonDocument doc(jsonObject);
|
||||
const QString partsAsString = doc.toJson(QJsonDocument::Compact);
|
||||
const CStatusMessage message(getLogCategories(), BlackMisc::CStatusMessage::SeverityInfo, callsign.isEmpty() ? callsign.toQString() + ": " + partsAsString.trimmed() : partsAsString.trimmed());
|
||||
const CStatusMessage message(getLogCategories(), CStatusMessage::SeverityInfo, callsign.isEmpty() ? callsign.toQString() + ": " + partsAsString.trimmed() : partsAsString.trimmed());
|
||||
if (m_aircraftPartsHistory.contains(callsign))
|
||||
{
|
||||
CStatusMessageList &msgs = m_aircraftPartsHistory[callsign];
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
BlackMisc::CSequence<QString> CPluginManagerSimulator::acceptedIids() const
|
||||
CSequence<QString> CPluginManagerSimulator::acceptedIids() const
|
||||
{
|
||||
return
|
||||
{
|
||||
|
||||
@@ -48,9 +48,9 @@ using namespace BlackCore::Db;
|
||||
namespace BlackCore
|
||||
{
|
||||
CSimulatorCommon::CSimulatorCommon(const CSimulatorPluginInfo &info,
|
||||
IOwnAircraftProvider *ownAircraftProvider,
|
||||
IOwnAircraftProvider *ownAircraftProvider,
|
||||
IRemoteAircraftProvider *remoteAircraftProvider,
|
||||
IWeatherGridProvider *weatherGridProvider,
|
||||
IWeatherGridProvider *weatherGridProvider,
|
||||
QObject *parent)
|
||||
: ISimulator(parent),
|
||||
COwnAircraftAware(ownAircraftProvider),
|
||||
|
||||
@@ -898,7 +898,7 @@ namespace BlackCore
|
||||
|
||||
//! we set a dynamically updating offset time here
|
||||
situation.setCurrentUtcTime();
|
||||
int offsetMs = self->markReceivedPositionAndGetOffsetTime(situation.getCallsign(), situation.getMSecsSinceEpoch());
|
||||
const int offsetMs = self->markReceivedPositionAndGetOffsetTime(situation.getCallsign(), situation.getMSecsSinceEpoch());
|
||||
situation.setTimeOffsetMs(offsetMs);
|
||||
|
||||
CTransponder::TransponderMode mode = CTransponder::StateStandby;
|
||||
|
||||
@@ -27,10 +27,10 @@ namespace BlackMisc
|
||||
namespace Aviation
|
||||
{
|
||||
CAircraftSituation::CAircraftSituation()
|
||||
: m_groundElevation( { 0, nullptr }, CAltitude::MeanSeaLevel) {}
|
||||
: m_groundElevation({ 0, nullptr }, CAltitude::MeanSeaLevel) {}
|
||||
|
||||
CAircraftSituation::CAircraftSituation(const CCallsign &correspondingCallsign)
|
||||
: m_correspondingCallsign(correspondingCallsign), m_groundElevation( { 0, nullptr }, CAltitude::MeanSeaLevel)
|
||||
: m_correspondingCallsign(correspondingCallsign), m_groundElevation({ 0, nullptr }, CAltitude::MeanSeaLevel)
|
||||
{}
|
||||
|
||||
CAircraftSituation::CAircraftSituation(const CCoordinateGeodetic &position, const CHeading &heading, const CAngle &pitch, const CAngle &bank, const CSpeed &gs, const CAltitude &groundElevation)
|
||||
|
||||
@@ -222,10 +222,11 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
template <typename Derived>
|
||||
CAircraftParts CInterpolator<Derived>::getInterpolatedParts(qint64 currentTimeMsSinceEpoch,
|
||||
const CInterpolationAndRenderingSetup &setup, CPartsStatus &partsStatus, bool log) const
|
||||
CAircraftParts CInterpolator<Derived>::getInterpolatedParts(
|
||||
qint64 currentTimeMsSinceEpoch,
|
||||
const CInterpolationAndRenderingSetup &setup, CPartsStatus &partsStatus, bool log) const
|
||||
{
|
||||
// this code is used by linear and spline interpolator
|
||||
// (!) this code is used by linear and spline interpolator
|
||||
Q_UNUSED(setup);
|
||||
partsStatus.reset();
|
||||
if (currentTimeMsSinceEpoch < 0) { currentTimeMsSinceEpoch = QDateTime::currentMSecsSinceEpoch(); }
|
||||
@@ -246,8 +247,8 @@ namespace BlackMisc
|
||||
|
||||
// stop if we don't have any parts
|
||||
if (validParts.isEmpty()) { return {}; }
|
||||
partsStatus.setSupportsParts(true);
|
||||
|
||||
partsStatus.setSupportsParts(true);
|
||||
CAircraftParts currentParts;
|
||||
do
|
||||
{
|
||||
@@ -343,9 +344,9 @@ namespace BlackMisc
|
||||
hasOffset ?
|
||||
parts.getTimeOffsetMs() :
|
||||
m_aircraftSituations.isEmpty() ? IRemoteAircraftProvider::DefaultOffsetTimeMs : m_aircraftSituations.front().getTimeOffsetMs();
|
||||
CAircraftParts copy(parts);
|
||||
copy.setTimeOffsetMs(offset);
|
||||
CInterpolator<Derived>::addAircraftParts(copy);
|
||||
CAircraftParts partsCopy(parts);
|
||||
partsCopy.setTimeOffsetMs(offset); // we set the offset of the situation
|
||||
CInterpolator<Derived>::addAircraftParts(partsCopy);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -69,9 +69,10 @@ using namespace BlackMisc::Weather;
|
||||
|
||||
namespace
|
||||
{
|
||||
inline QString xswiftbusServiceName()
|
||||
inline const QString &xswiftbusServiceName()
|
||||
{
|
||||
return QStringLiteral("org.swift-project.xswiftbus");
|
||||
static const QString name("org.swift-project.xswiftbus");
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,7 +304,7 @@ namespace BlackSimPlugin
|
||||
this->reverseLookupAndUpdateOwnAircraftModel(model);
|
||||
}
|
||||
|
||||
void CSimulatorXPlane::displayStatusMessage(const BlackMisc::CStatusMessage &message) const
|
||||
void CSimulatorXPlane::displayStatusMessage(const CStatusMessage &message) const
|
||||
{
|
||||
// No assert here as status message may come because of network problems
|
||||
if (!isConnected()) { return; }
|
||||
@@ -586,7 +587,7 @@ namespace BlackSimPlugin
|
||||
if (! isRemoteAircraftSupportingParts(situation.getCallsign()))
|
||||
{
|
||||
// if aircraft not supporting parts then guess the basics (onGround, gear, lights)
|
||||
//! \todo not working for vtol
|
||||
//! \todo not working for VTOL
|
||||
BlackMisc::Aviation::CAircraftParts parts;
|
||||
parts.setMSecsSinceEpoch(situation.getMSecsSinceEpoch());
|
||||
parts.setTimeOffsetMs(situation.getTimeOffsetMs());
|
||||
@@ -1009,23 +1010,23 @@ namespace BlackSimPlugin
|
||||
m_trafficProxy->requestRemoteAircraftData();
|
||||
}
|
||||
|
||||
void CSimulatorXPlane::updateRemoteAircraftFromSimulator(const QString &callsign_, double latitude, double longitude, double groundElevation, double modelVerticalOffset)
|
||||
void CSimulatorXPlane::updateRemoteAircraftFromSimulator(const QString &callsign, double latitudeDeg, double longitudeDeg, double elevationMeters, double modelVerticalOffsetMeters)
|
||||
{
|
||||
CCallsign callsign(callsign_);
|
||||
if (!m_xplaneAircraftObjects.contains(callsign)) { return; }
|
||||
const CCallsign cs(callsign);
|
||||
if (!m_xplaneAircraftObjects.contains(cs)) { return; }
|
||||
|
||||
CElevationPlane elevation(CLatitude(latitude, CAngleUnit::deg()), CLongitude(longitude, CAngleUnit::deg()), CAltitude(groundElevation, CLengthUnit::m()));
|
||||
CElevationPlane elevation(CLatitude(latitudeDeg, CAngleUnit::deg()), CLongitude(longitudeDeg, CAngleUnit::deg()), CAltitude(elevationMeters, CLengthUnit::m()));
|
||||
elevation.setSinglePointRadius();
|
||||
|
||||
CInterpolationHints &hints = m_hints[callsign];
|
||||
hints.setElevationPlane(elevation); // update elevation
|
||||
// The entire vertical offset (CG offset) is still very experimental in X-Plane. Libxplanemp simply calculates the lowest Y
|
||||
// value from all the OpenGL model vertices. I assume its in meters.
|
||||
// The unit of modelVerticalOffset is still very unknown. This needs to be confirmed.
|
||||
hints.setCGAboveGround({ modelVerticalOffset, CLengthUnit::m() });
|
||||
CInterpolationHints &hints = m_hints[cs];
|
||||
hints.setElevationPlane(elevation); // update elevation
|
||||
hints.setCGAboveGround({ modelVerticalOffsetMeters, CLengthUnit::m() });
|
||||
|
||||
// set it in the remote aircraft provider
|
||||
this->updateAircraftGroundElevation(callsign, elevation);
|
||||
this->updateAircraftGroundElevation(cs, elevation);
|
||||
}
|
||||
|
||||
BlackCore::ISimulator *CSimulatorXPlaneFactory::create(const CSimulatorPluginInfo &info,
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace BlackSimPlugin
|
||||
bool sendRemoteAircraftPartsToSimulator(const CXPlaneMPAircraft &xplaneAircraft, const BlackMisc::Aviation::CAircraftParts &parts);
|
||||
|
||||
void requestRemoteAircraftDataFromXPlane();
|
||||
void updateRemoteAircraftFromSimulator(const QString &callsign, double latitude, double longitude, double elevation, double modelVerticalOffset);
|
||||
void updateRemoteAircraftFromSimulator(const QString &callsign, double latitudeDeg, double longitudeDeg, double elevationMeters, double modelVerticalOffsetMeters);
|
||||
|
||||
static constexpr bool c_driverInterpolation = true;
|
||||
static constexpr int GuessRemoteAircraftPartsCycle = 20; //!< guess every n-th cycle
|
||||
@@ -237,7 +237,7 @@ namespace BlackSimPlugin
|
||||
virtual void stopImpl() override;
|
||||
|
||||
private:
|
||||
//! \brief Check if XSwiftBus service is already registered
|
||||
//! Check if XSwiftBus service is already registered
|
||||
bool isXSwiftBusRunning() const;
|
||||
|
||||
void serviceRegistered(const QString &serviceName);
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace BlackSimPlugin
|
||||
|
||||
//! \copydoc XSwiftBus::CTraffic::remoteAircraftData
|
||||
//! \remark from simulator to driver for elevation and CG
|
||||
void remoteAircraftData(const QString &callsign, double latitude, double longitude, double elevation, double modelVerticalOffset);
|
||||
void remoteAircraftData(const QString &callsign, double latitudeDeg, double longitudeDeg, double elevationMeters, double modelVerticalOffsetMeters);
|
||||
|
||||
public slots:
|
||||
//! \copydoc XSwiftBus::CTraffic::initialize
|
||||
|
||||
Reference in New Issue
Block a user