Ref T773, also log. middle position (2nd) - useful for spline

This commit is contained in:
Klaus Basan
2020-02-16 00:09:10 +01:00
committed by Mat Sutcliffe
parent 5604cff6bf
commit ee421fe33c
2 changed files with 21 additions and 9 deletions

View File

@@ -302,8 +302,8 @@ namespace BlackMisc
u"<th>Interpolation ts.</th><th>Sample &Delta;t</th><th>fraction</th>"
u"<th>lat.old</th><th>lat.new</th><th>lat.cur</th>"
u"<th>lng.old</th><th>lng.new</th><th>lng.cur</th>"
u"<th>alt.old</th><th>alt.new</th><th>alt.cur</th>"
u"<th>elv.old</th><th>elv.new</th><th>elv.cur</th>"
u"<th>alt.old</th><th>alt.2nd</th><th>alt.new</th><th>alt.cur</th>"
u"<th>elv.old</th><th>elv.2nd</th><th>elv.new</th><th>elv.cur</th>"
u"<th>gnd.factor</th>"
u"<th>onGnd.old</th><th>onGnd.new</th><th>onGnd.cur</th>"
u"<th>CG</th>"
@@ -320,6 +320,7 @@ namespace BlackMisc
{
const CAircraftSituation situationOld = log.oldestInterpolationSituation();
const CAircraftSituation situationNew = log.newestInterpolationSituation();
const CAircraftSituation situation2nd = log.secondInterpolationSituation();
const bool changedNewPosition = (newPosTs != situationNew.getMSecsSinceEpoch());
const bool changedParts = (lastParts != log.parts);
newPosTs = situationNew.getMSecsSinceEpoch();
@@ -341,7 +342,7 @@ namespace BlackMisc
u"<td class=\"new\">" % situationNew.getTimestampAndOffset(true) % u"</td>" %
u"<td class=\"cur\">" % log.situationCurrent.getTimestampAndOffset(true) % u"</td>" %
u"<td>" % msSinceEpochToTime(log.tsInterpolated) % u"</td>" %
u"<td>" % msSinceEpochToTime(log.tsInterpolated) % u"</td>" %
u"<td>" % QString::number(log.deltaSampleTimesMs) % u"ms</td>" %
u"<td>" % QString::number(log.simTimeFraction) % u"</td>" %
@@ -356,10 +357,12 @@ namespace BlackMisc
// tableRows +=
u"<td class=\"old\">" % situationOld.getAltitude().valueRoundedWithUnit(ft, 1) % u"</td>" %
u"<td class=\"old\">" % situation2nd.getAltitude().valueRoundedWithUnit(ft, 1) % u"</td>" %
u"<td class=\"new\">" % situationNew.getAltitude().valueRoundedWithUnit(ft, 1) % u"</td>" %
u"<td class=\"cur\">" % log.situationCurrent.getAltitude().valueRoundedWithUnit(ft, 1) % u"</td>" %
u"<td class=\"old\">" % situationOld.getGroundElevation().valueRoundedWithUnit(ft, 1) % u" " % situationOld.getGroundElevationInfoAsString() % u"</td>" %
u"<td class=\"old\">" % situation2nd.getGroundElevation().valueRoundedWithUnit(ft, 1) % u" " % situation2nd.getGroundElevationInfoAsString() % u"</td>" %
u"<td class=\"new\">" % situationNew.getGroundElevation().valueRoundedWithUnit(ft, 1) % u" " % situationNew.getGroundElevationInfoAsString() % u"</td>" %
u"<td class=\"cur\">" % log.situationCurrent.getGroundElevation().valueRoundedWithUnit(ft, 1) % u" " % log.situationCurrent.getGroundElevationInfoAsString() % u"</td>" %

View File

@@ -17,6 +17,7 @@
#include "blackmisc/aviation/aircraftpartslist.h"
#include "blackmisc/aviation/aircraftsituationchange.h"
#include "blackmisc/logcategorylist.h"
#include <QObject>
#include <QStringList>
#include <QtGlobal>
@@ -30,13 +31,13 @@ namespace BlackMisc
struct BLACKMISC_EXPORT SituationLog
{
QChar interpolator; //!< what interpolator is used
qint64 tsCurrent = -1; //!< current timestamp
qint64 tsInterpolated = -1; //!< timestamp interpolated
double groundFactor = -1; //!< current ground factor
double simTimeFraction = -1; //!< time fraction, expected 0..1
qint64 tsCurrent = -1; //!< current timestamp
qint64 tsInterpolated = -1; //!< timestamp interpolated
double groundFactor = -1; //!< current ground factor
double simTimeFraction = -1; //!< time fraction, expected 0..1
double deltaSampleTimesMs = -1; //!< delta time between samples (i.e. 2 situations)
bool useParts = false; //!< supporting aircraft parts
bool vtolAircraft = false; //!< VTOL aircraft
bool useParts = false; //!< supporting aircraft parts
bool vtolAircraft = false; //!< VTOL aircraft
bool interpolantRecalc = false; //!< interpolant recalculated
int noNetworkSituations = 0; //!< available network situations
int noInvalidSituations = 0; //!< invalid situations, missing situations for timestampd
@@ -72,6 +73,14 @@ namespace BlackMisc
return interpolationSituations.backOrDefault();
}
//! The second latest situation (spline)
const Aviation::CAircraftSituation &secondInterpolationSituation() const
{
if (interpolationSituations.size() < 2) { return Aviation::CAircraftSituation::null(); }
const Aviation::CAircraftSituationList::size_type i = interpolationSituations.size() - 2; // 2nd latest, latest at end
return interpolationSituations[i];
}
//! To string
QString toQString(bool withSetup,
bool withCurrentSituation, bool withElevation,