mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-19 12:15:29 +08:00
Ref T185 Enable spline interpolation with only one position update,
by just copying it three times, so planes can be rendered without waiting for more updates.
This commit is contained in:
@@ -22,5 +22,9 @@ namespace BlackMisc
|
|||||||
CSequence<CAircraftParts>(other)
|
CSequence<CAircraftParts>(other)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
CAircraftPartsList::CAircraftPartsList(std::initializer_list<CAircraftParts> il) :
|
||||||
|
CSequence<CAircraftParts>(il)
|
||||||
|
{ }
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ namespace BlackMisc
|
|||||||
|
|
||||||
//! Construct from a base class object.
|
//! Construct from a base class object.
|
||||||
CAircraftPartsList(const CSequence<CAircraftParts> &other);
|
CAircraftPartsList(const CSequence<CAircraftParts> &other);
|
||||||
|
|
||||||
|
//! Construct from initializer list.
|
||||||
|
CAircraftPartsList(std::initializer_list<CAircraftParts> il);
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace
|
} //namespace
|
||||||
|
|||||||
@@ -27,5 +27,9 @@ namespace BlackMisc
|
|||||||
CSequence<CAircraftSituation>(other)
|
CSequence<CAircraftSituation>(other)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
CAircraftSituationList::CAircraftSituationList(std::initializer_list<CAircraftSituation> il) :
|
||||||
|
CSequence<CAircraftSituation>(il)
|
||||||
|
{ }
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ namespace BlackMisc
|
|||||||
//! Construct from a base class object.
|
//! Construct from a base class object.
|
||||||
CAircraftSituationList(const CSequence<CAircraftSituation> &other);
|
CAircraftSituationList(const CSequence<CAircraftSituation> &other);
|
||||||
|
|
||||||
|
//! Construct from initializer list.
|
||||||
|
CAircraftSituationList(std::initializer_list<CAircraftSituation> il);
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -265,12 +265,26 @@ namespace BlackMisc
|
|||||||
template <typename Derived>
|
template <typename Derived>
|
||||||
void CInterpolator<Derived>::addAircraftSituation(const CAircraftSituation &situation)
|
void CInterpolator<Derived>::addAircraftSituation(const CAircraftSituation &situation)
|
||||||
{
|
{
|
||||||
|
if (m_aircraftSituations.isEmpty())
|
||||||
|
{
|
||||||
|
// make sure we have enough situations to do start interpolating immediately without waiting for more updates
|
||||||
|
m_aircraftSituations = { situation, situation };
|
||||||
|
m_aircraftSituations.back().addMsecs(-10000); // number here does
|
||||||
|
m_aircraftSituations.front().addMsecs(-5000); // not really matter
|
||||||
|
}
|
||||||
m_aircraftSituations.push_frontMaxElements(situation, IRemoteAircraftProvider::MaxSituationsPerCallsign);
|
m_aircraftSituations.push_frontMaxElements(situation, IRemoteAircraftProvider::MaxSituationsPerCallsign);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Derived>
|
template <typename Derived>
|
||||||
void CInterpolator<Derived>::addAircraftParts(const CAircraftParts &parts)
|
void CInterpolator<Derived>::addAircraftParts(const CAircraftParts &parts)
|
||||||
{
|
{
|
||||||
|
if (m_aircraftParts.isEmpty())
|
||||||
|
{
|
||||||
|
// make sure we have enough parts to do start interpolating immediately without waiting for more updates
|
||||||
|
m_aircraftParts = { parts, parts };
|
||||||
|
m_aircraftParts.back().addMsecs(-10000); // number here does
|
||||||
|
m_aircraftParts.front().addMsecs(-5000); // not really matter
|
||||||
|
}
|
||||||
m_aircraftParts.push_front(parts);
|
m_aircraftParts.push_front(parts);
|
||||||
IRemoteAircraftProvider::removeOutdatedParts(m_aircraftParts);
|
IRemoteAircraftProvider::removeOutdatedParts(m_aircraftParts);
|
||||||
|
|
||||||
|
|||||||
@@ -137,6 +137,11 @@ namespace BlackMisc
|
|||||||
this->m_timestampMSecsSinceEpoch = QDateTime::currentMSecsSinceEpoch();
|
this->m_timestampMSecsSinceEpoch = QDateTime::currentMSecsSinceEpoch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ITimestampBased::addMsecs(qint64 ms)
|
||||||
|
{
|
||||||
|
this->m_timestampMSecsSinceEpoch += ms;
|
||||||
|
}
|
||||||
|
|
||||||
QString ITimestampBased::getFormattedUtcTimestampDhms() const
|
QString ITimestampBased::getFormattedUtcTimestampDhms() const
|
||||||
{
|
{
|
||||||
return this->hasValidTimestamp() ?
|
return this->hasValidTimestamp() ?
|
||||||
|
|||||||
@@ -86,6 +86,9 @@ namespace BlackMisc
|
|||||||
//! Set the current time as timestamp
|
//! Set the current time as timestamp
|
||||||
void setCurrentUtcTime();
|
void setCurrentUtcTime();
|
||||||
|
|
||||||
|
//! Add the given number of milliseconds to the timestamp.
|
||||||
|
void addMsecs(qint64 ms);
|
||||||
|
|
||||||
//! Formatted timestamp
|
//! Formatted timestamp
|
||||||
QString getFormattedUtcTimestampDhms() const;
|
QString getFormattedUtcTimestampDhms() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user