refs #369, changed interpolation to a working (but still too bad performing) version

* using split by callsign everywhere
* helper function to insert_front
* revised linear interpolator
* renamed to remoteAircraft
* renamed to container() in providers (gettters are usually copies)

Issues why changes did so long:
* insert in list is not adding in front, but same as push_back (that was confusing)
* naming of values before/after in interpolator was ambigious
* QMap keeps values sorted by key, not arbitrarily
This commit is contained in:
Klaus Basan
2015-02-24 01:57:38 +01:00
parent 190e2c3757
commit 420a47e90c
34 changed files with 333 additions and 77 deletions

View File

@@ -113,7 +113,7 @@ namespace BlackSimPlugin
if (m_hashFs9Clients.contains(callsign))
{
// already exists, remove first
this->removeRenderedAircraft(callsign);
this->removeRemoteAircraft(callsign);
}
CFs9Client *client = new CFs9Client(m_interpolator, this, callsign.toQString(), CTime(25, CTimeUnit::ms()));
@@ -127,7 +127,7 @@ namespace BlackSimPlugin
return true;
}
bool CSimulatorFs9::removeRenderedAircraft(const CCallsign &callsign)
bool CSimulatorFs9::removeRemoteAircraft(const CCallsign &callsign)
{
if (!m_hashFs9Clients.contains(callsign)) { return false; }
@@ -298,7 +298,7 @@ namespace BlackSimPlugin
// Stop all FS9 client tasks
for (auto fs9Client : m_hashFs9Clients.keys())
{
removeRenderedAircraft(fs9Client);
removeRemoteAircraft(fs9Client);
}
}
} // namespace

View File

@@ -89,7 +89,7 @@ namespace BlackSimPlugin
virtual bool addRemoteAircraft(const BlackMisc::Simulation::CSimulatedAircraft &newRemoteAircraft) override;
//! \copydoc ISimulator::removeRemoteAircraft()
virtual bool removeRenderedAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
virtual bool removeRemoteAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
//! \copydoc ISimulator::updateOwnSimulatorCockpit()
virtual bool updateOwnSimulatorCockpit(const BlackMisc::Aviation::CAircraft &ownAircraft, const QString &originator) override;

View File

@@ -252,8 +252,12 @@ namespace BlackSimPlugin
this->m_maxRenderedAircraft = maxRenderedAircraft;
}
bool CSimulatorFsCommon::changeRenderedAircraftModel(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const QString &originator)
bool CSimulatorFsCommon::changeRemoteAircraftModel(const CSimulatedAircraft &aircraft, const QString &originator)
{
if (originator == simulatorOriginator()) { return false; }
// remove upfront, and then enable / disable again
this->removeRemoteAircraft(aircraft.getCallsign());
return this->changeAircraftEnabled(aircraft, originator);
}
@@ -266,7 +270,7 @@ namespace BlackSimPlugin
}
else
{
this->removeRenderedAircraft(aircraft.getCallsign());
this->removeRemoteAircraft(aircraft.getCallsign());
}
return true;
}

View File

@@ -74,7 +74,7 @@ namespace BlackSimPlugin
virtual void setMaxRenderedAircraft(int maxRenderedAircraft) override;
//! \copydoc ISimulator::changeRenderedAircraftModel
virtual bool changeRenderedAircraftModel(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const QString &originator) override;
virtual bool changeRemoteAircraftModel(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const QString &originator) override;
//! \copydoc ISimulator::changeAircraftEnabled
virtual bool changeAircraftEnabled(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const QString &originator) override;

View File

@@ -106,8 +106,8 @@ namespace BlackSimPlugin
//! \copydoc ISimulator::addRemoteAircraft()
virtual bool addRemoteAircraft(const BlackMisc::Simulation::CSimulatedAircraft &newRemoteAircraft) override;
//! \copydoc ISimulator::removeRenderedAircraft()
virtual bool removeRenderedAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
//! \copydoc ISimulator::remoteRenderedAircraft()
virtual bool removeRemoteAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
//! \copydoc ISimulator::updateOwnCockpit
virtual bool updateOwnSimulatorCockpit(const BlackMisc::Aviation::CAircraft &ownAircraft, const QString &originator) override;
@@ -154,7 +154,7 @@ namespace BlackSimPlugin
private:
//! Remove a remote aircraft
bool removeRenderedAircraft(const CSimConnectObject &simObject);
bool removeRemoteAircraft(const CSimConnectObject &simObject);
//! Init when connected
HRESULT initWhenConnected();
@@ -166,7 +166,7 @@ namespace BlackSimPlugin
HRESULT initDataDefinitionsWhenConnected();
//! Update other aircrafts
void updateOtherAircraft();
void updateRemoteAircraft();
//! Format conversion
SIMCONNECT_DATA_INITPOSITION aircraftSituationToFsxInitPosition(const BlackMisc::Aviation::CAircraftSituation &situation);

View File

@@ -361,7 +361,7 @@ namespace BlackSimPlugin
// m_traffic->setPlaneTransponder(callsign.asString(), 2000, true, false); // TODO transponder
// }
bool CSimulatorXPlane::removeRenderedAircraft(const BlackMisc::Aviation::CCallsign &callsign)
bool CSimulatorXPlane::removeRemoteAircraft(const BlackMisc::Aviation::CCallsign &callsign)
{
if (! isConnected()) { return false; }
m_traffic->removePlane(callsign.asString());
@@ -370,7 +370,7 @@ namespace BlackSimPlugin
return true;
}
bool CSimulatorXPlane::changeRenderedAircraftModel(const CSimulatedAircraft &aircraft, const QString &originator)
bool CSimulatorXPlane::changeRemoteAircraftModel(const CSimulatedAircraft &aircraft, const QString &originator)
{
return this->changeAircraftEnabled(aircraft, originator);
}
@@ -390,7 +390,7 @@ namespace BlackSimPlugin
}
else
{
this->removeRenderedAircraft(aircraft.getCallsign());
this->removeRemoteAircraft(aircraft.getCallsign());
}
return true;
}

View File

@@ -72,10 +72,10 @@ namespace BlackSimPlugin
virtual bool addRemoteAircraft(const BlackMisc::Simulation::CSimulatedAircraft &newRemoteAircraft) override;
//! \copydoc BlackCore::ISimulator::removeRemoteAircraft
virtual bool removeRenderedAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
virtual bool removeRemoteAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
//! \copydoc ISimulator::changeRenderedAircraftModel
virtual bool changeRenderedAircraftModel(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const QString &originator) override;
virtual bool changeRemoteAircraftModel(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const QString &originator) override;
//! \copydoc ISimulator::changeAircraftEnabled
virtual bool changeAircraftEnabled(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const QString &originator) override;