Ref T778, some smaller style fixes/improvements

for the "underground" airplanes as reported by AK

This does NOT fix the issue, but minor shortcomings
found during the investigation

* style
* checks for "developer" env.
This commit is contained in:
Klaus Basan
2020-04-03 20:17:08 +02:00
committed by Mat Sutcliffe
parent cb814583f6
commit 373e45e958
9 changed files with 74 additions and 23 deletions

View File

@@ -426,9 +426,9 @@ namespace BlackMisc
if (!situationNew.hasGroundElevation()) { continue; }
newPosTs = situationNew.getMSecsSinceEpoch();
kml += CKmlUtils::asPlacemark(
QStringLiteral("%1: %2 %3 %4 alt.cor: %5").arg(n++).arg(
QStringLiteral("%1: %2 %3 info: %4 alt.cor: %5").arg(n++).arg(
situationNew.getFormattedUtcTimestampHmsz(),
situationNew.getGroundElevationPlane().getAltitude().toQString(true),
situationNew.getGroundElevationAndInfo(),
log.elevationInfo, log.altCorrection),
situationNew.getGroundElevationPlane().toQString(true),
situationNew.getGroundElevationPlane(), s) % u"\n";

View File

@@ -145,6 +145,16 @@ namespace BlackMisc
BLACK_VERIFY_X(details, Q_FUNC_INFO, "Once gnd.from parts -> always gnd. from parts");
}
if (CBuildConfig::isLocalDeveloperDebugBuild())
{
for (const CAircraftSituation &s : situations)
{
if (!s.hasGroundElevation()) { continue; }
BLACK_VERIFY_X(!s.getGroundElevation().isZeroEpsilonConsidered(), Q_FUNC_INFO, "Suspicous 0 gnd. value");
}
}
// result
return sorted && details;
}

View File

@@ -98,7 +98,7 @@ namespace BlackMisc
if (CBuildConfig::isLocalDeveloperDebugBuild())
{
BLACK_VERIFY_X(t >= 0, Q_FUNC_INFO, "Expect t >= 0");
BLACK_VERIFY_X(t >= 0, Q_FUNC_INFO, "Expect t >= 0");
BLACK_VERIFY_X(t <= 1.0, Q_FUNC_INFO, "Expect t <= 1");
}
return y;
@@ -225,9 +225,9 @@ namespace BlackMisc
const double a0 = m_s[0].getCorrectedAltitude(cg).value(altUnit); // oldest
const double a1 = m_s[1].getCorrectedAltitude(cg).value(altUnit);
const double a2 = m_s[2].getCorrectedAltitude(cg).value(altUnit); // latest
pa.a = {{ a0, a1, a2 }};
pa.gnd = {{ m_s[0].getOnGroundFactor(), m_s[1].getOnGroundFactor(), m_s[2].getOnGroundFactor() }};
pa.da = getDerivatives(pa.t, pa.a);
pa.a = {{ a0, a1, a2 }};
pa.gnd = {{ m_s[0].getOnGroundFactor(), m_s[1].getOnGroundFactor(), m_s[2].getOnGroundFactor() }};
pa.da = getDerivatives(pa.t, pa.a);
pa.dgnd = getDerivatives(pa.t, pa.gnd);
m_prevSampleAdjustedTime = m_s[1].getAdjustedMSecsSinceEpoch();
@@ -257,7 +257,7 @@ namespace BlackMisc
if (CBuildConfig::isLocalDeveloperDebugBuild())
{
BLACK_VERIFY_X(dt1 >= 0, Q_FUNC_INFO, "Expect postive dt1");
BLACK_VERIFY_X(dt2 > 0, Q_FUNC_INFO, "Expect postive dt2");
BLACK_VERIFY_X(dt2 > 0, Q_FUNC_INFO, "Expect postive dt2");
BLACK_VERIFY_X(isAcceptableTimeFraction(timeFraction), Q_FUNC_INFO, "Expect fraction 0-1");
}
timeFraction = clampValidTimeFraction(timeFraction);
@@ -334,7 +334,7 @@ namespace BlackMisc
{
Q_ASSERT_X(t1 < t2, Q_FUNC_INFO, "Expect sorted times, latest first"); // that means a bug in our code init the values
BLACK_VERIFY_X(m_currentTimeMsSinceEpoc >= t1, Q_FUNC_INFO, "invalid timestamp t1");
BLACK_VERIFY_X(m_currentTimeMsSinceEpoc < t2, Q_FUNC_INFO, "invalid timestamp t2"); // t1==t2 results in div/0
BLACK_VERIFY_X(m_currentTimeMsSinceEpoc < t2, Q_FUNC_INFO, "invalid timestamp t2"); // t1==t2 results in div/0
}
if (!valid) { return CAircraftSituation::null(); }

View File

@@ -9,9 +9,12 @@
#include "simulationenvironmentprovider.h"
#include "blackmisc/aviation/aircraftsituationchange.h"
#include "verify.h"
#include "blackmisc/verify.h"
#include "blackconfig/buildconfig.h"
#include <QStringBuilder>
using namespace BlackConfig;
using namespace BlackMisc::Aviation;
using namespace BlackMisc::Geo;
using namespace BlackMisc::PhysicalQuantities;
@@ -50,6 +53,12 @@ namespace BlackMisc
{
if (m_elvCoordinatesGnd.size() > m_maxElevationsGnd) { m_elvCoordinatesGnd.pop_back(); }
m_elvCoordinatesGnd.push_front(elevationCoordinate);
if (CBuildConfig::isLocalDeveloperDebugBuild())
{
BLACK_VERIFY_X(!elevationCoordinate.geodeticHeight().isNull(), Q_FUNC_INFO, "NULL value");
BLACK_VERIFY_X(!elevationCoordinate.geodeticHeight().isZeroEpsilonConsidered(), Q_FUNC_INFO, "Suspicous 0 value");
}
}
else
{