mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 18:25:37 +08:00
Move aircraft matching out of simulator plugins
All model matching will be done simulator independent in CContextSimulator. The simulator specific part is kept in the model set. This also caused the signal modelMatchingCompleted to be renamed to aircraftRenderingChanged, since the name wasn't accurate anymore. Both getInstalledModels(), getInstalledModelsCount() and iconForModel() were removed from the ISimulator interface. refs #765
This commit is contained in:
@@ -102,12 +102,12 @@ namespace BlackSimPlugin
|
||||
m_fastTimer->start(100);
|
||||
m_slowTimer->start(1000);
|
||||
|
||||
m_modelMatcher.setDefaultModel(CAircraftModel(
|
||||
"Jets A320_a A320_a_Austrian_Airlines A320_a_Austrian_Airlines",
|
||||
CAircraftModel::TypeModelMatchingDefaultModel,
|
||||
"A320 AUA",
|
||||
CAircraftIcaoCode("A320", "L2J")
|
||||
));
|
||||
m_defaultModel = {
|
||||
"Jets A320_a A320_a_Austrian_Airlines A320_a_Austrian_Airlines",
|
||||
CAircraftModel::TypeModelMatchingDefaultModel,
|
||||
"A320 AUA",
|
||||
CAircraftIcaoCode("A320", "L2J")
|
||||
};
|
||||
|
||||
resetData();
|
||||
}
|
||||
@@ -351,12 +351,6 @@ namespace BlackSimPlugin
|
||||
m_service->addTextMessage(message.getSenderCallsign().toQString() + ": " + message.getMessage(), color.redF(), color.greenF(), color.blueF());
|
||||
}
|
||||
|
||||
CAircraftModelList CSimulatorXPlane::getInstalledModels() const
|
||||
{
|
||||
Q_ASSERT(isConnected());
|
||||
return m_installedModels;
|
||||
}
|
||||
|
||||
void CSimulatorXPlane::ps_setAirportsInRange(const QStringList &icaos, const QStringList &names, const BlackMisc::CSequence<double> &lats, const BlackMisc::CSequence<double> &lons, const BlackMisc::CSequence<double> &alts)
|
||||
{
|
||||
m_airportsInRange.clear();
|
||||
@@ -390,12 +384,6 @@ namespace BlackSimPlugin
|
||||
return false;
|
||||
}
|
||||
|
||||
CPixmap CSimulatorXPlane::iconForModel(const QString &modelString) const
|
||||
{
|
||||
Q_UNUSED(modelString);
|
||||
return CPixmap();
|
||||
}
|
||||
|
||||
QDBusConnection CSimulatorXPlane::connectionFromString(const QString &str)
|
||||
{
|
||||
if (str == BlackMisc::CDBusServer::sessionBusAddress())
|
||||
@@ -452,26 +440,23 @@ namespace BlackSimPlugin
|
||||
//! \todo XPlane driver check if already exists, how?
|
||||
//! \todo XPlane driver set correct return value
|
||||
|
||||
// matched models
|
||||
CAircraftModel aircraftModel = m_modelMatcher.getClosestMatch(newRemoteAircraft);
|
||||
Q_ASSERT_X(newRemoteAircraft.getCallsign() == aircraftModel.getCallsign(), Q_FUNC_INFO, "mismatching callsigns");
|
||||
|
||||
CCallsign callsign(newRemoteAircraft.getCallsign());
|
||||
this->updateAircraftModel(callsign, aircraftModel);
|
||||
CSimulatedAircraft aircraftAfterModelApplied(getAircraftInRangeForCallsign(newRemoteAircraft.getCallsign()));
|
||||
CAircraftModel aircraftModel = newRemoteAircraft.getModel();
|
||||
|
||||
QString livery = aircraftModel.getLivery().getCombinedCode(); //! \todo livery resolution for XP
|
||||
m_traffic->addPlane(newRemoteAircraft.getCallsign().asString(), aircraftModel.getModelString(),
|
||||
newRemoteAircraft.getAircraftIcaoCode().getDesignator(),
|
||||
newRemoteAircraft.getAirlineIcaoCode().getDesignator(),
|
||||
livery);
|
||||
updateAircraftRendered(newRemoteAircraft.getCallsign(), true);
|
||||
|
||||
CLogMessage(this).info("XP: Added aircraft %1") << newRemoteAircraft.getCallsign().toQString();
|
||||
|
||||
bool rendered = true;
|
||||
aircraftAfterModelApplied.setRendered(rendered);
|
||||
this->updateAircraftRendered(callsign, rendered);
|
||||
emit modelMatchingCompleted(aircraftAfterModelApplied);
|
||||
updateAircraftRendered(newRemoteAircraft.getCallsign(), rendered);
|
||||
|
||||
CSimulatedAircraft remoteAircraftCopy(newRemoteAircraft);
|
||||
remoteAircraftCopy.setRendered(rendered);
|
||||
emit aircraftRenderingChanged(remoteAircraftCopy);
|
||||
|
||||
return rendered;
|
||||
}
|
||||
|
||||
@@ -93,11 +93,9 @@ namespace BlackSimPlugin
|
||||
virtual bool updateOwnSimulatorCockpit(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator) override;
|
||||
virtual void displayStatusMessage(const BlackMisc::CStatusMessage &message) const override;
|
||||
virtual void displayTextMessage(const BlackMisc::Network::CTextMessage &message) const override;
|
||||
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModels() const override;
|
||||
virtual BlackMisc::Aviation::CAirportList getAirportsInRange() const override;
|
||||
virtual bool setTimeSynchronization(bool enable, const BlackMisc::PhysicalQuantities::CTime &offset) override;
|
||||
virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const override { return BlackMisc::PhysicalQuantities::CTime(0, BlackMisc::PhysicalQuantities::CTimeUnit::hrmin()); }
|
||||
virtual BlackMisc::CPixmap iconForModel(const QString &modelString) const override;
|
||||
//! @}
|
||||
|
||||
//! Creates an appropriate dbus connection from the string describing it
|
||||
|
||||
Reference in New Issue
Block a user