Formatting, renaming

This commit is contained in:
Klaus Basan
2018-04-18 04:57:33 +02:00
committed by Roland Winklmeier
parent eb0fa92e7e
commit d021e2dcce
9 changed files with 45 additions and 35 deletions

View File

@@ -932,7 +932,7 @@ namespace BlackCore
}
// do we already have ground details?
if (situation.getOnGroundDetails() == CAircraftSituation::NotSet)
if (situation.getOnGroundDetails() == CAircraftSituation::NotSetGroundDetails)
{
const CClient client = this->getClientOrDefaultForCallsign(callsign);
if (client.hasCapability(CClient::FsdWithGroundFlag))

View File

@@ -351,7 +351,8 @@ namespace BlackCore
};
} // namespace
Q_DECLARE_INTERFACE(BlackCore::ISimulatorFactory, "org.swift-project.blackcore.simulatorinterface")
Q_DECLARE_INTERFACE(BlackCore::ISimulator, "org.swift-project.blackcore.simulator")
Q_DECLARE_INTERFACE(BlackCore::ISimulatorFactory, "org.swift-project.blackcore.simulatorfactory")
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackCore::ISimulator::SimulatorStatus)
#endif // guard

View File

@@ -92,7 +92,7 @@ namespace BlackMisc
}
else
{
if (!situation.hasInboundGroundInformation())
if (!situation.hasInboundGroundDetails())
{
// the ground flag is not reliable and we have no ground elevation
if (situation.getOnGroundDetails() == CAircraftSituation::OnGroundByGuessing)

View File

@@ -50,15 +50,15 @@ namespace BlackMisc
QString CAircraftSituation::convertToQString(bool i18n) const
{
return QStringLiteral("ts: ") % this->getFormattedTimestampAndOffset(true) %
QStringLiteral(" ") % m_position.toQString(i18n) %
QStringLiteral(" bank: ") % (m_bank.toQString(i18n)) %
QStringLiteral(" pitch: ") % (m_pitch.toQString(i18n)) %
QStringLiteral(" heading: ") % (m_heading.toQString(i18n)) %
QStringLiteral(" og: ") % this->getOnGroundInfo() %
QStringLiteral(" factor: ") % QString::number(m_onGroundFactor, 'f', 2) %
QStringLiteral(" gs: ") % m_groundSpeed.valueRoundedWithUnit(CSpeedUnit::kts(), 1, true) %
QStringLiteral(" | ") % m_position.toQString(i18n) %
QStringLiteral(" | bank: ") % (m_bank.toQString(i18n)) %
QStringLiteral(" | pitch: ") % (m_pitch.toQString(i18n)) %
QStringLiteral(" | heading: ") % (m_heading.toQString(i18n)) %
QStringLiteral(" | og: ") % this->getOnGroundInfo() %
QStringLiteral(" | factor: ") % QString::number(m_onGroundFactor, 'f', 2) %
QStringLiteral(" | gs: ") % m_groundSpeed.valueRoundedWithUnit(CSpeedUnit::kts(), 1, true) %
QStringLiteral(" ") % m_groundSpeed.valueRoundedWithUnit(CSpeedUnit::m_s(), 1, true) %
QStringLiteral(" elevation: ") % (m_groundElevationPlane.toQString(i18n));
QStringLiteral(" | elevation: ") % (m_groundElevationPlane.toQString(i18n));
}
const QString &CAircraftSituation::isOnGroundToString(CAircraftSituation::IsOnGround onGround)
@@ -98,7 +98,7 @@ namespace BlackMisc
case CAircraftSituation::InFromNetwork: return inNetwork;
case CAircraftSituation::InFromParts: return inFromParts;
case CAircraftSituation::InNoGroundInfo: return InNoGroundInfo;
case CAircraftSituation::NotSet:
case CAircraftSituation::NotSetGroundDetails:
default: return unknown;
}
}
@@ -229,7 +229,7 @@ namespace BlackMisc
m_bank.setNull();
m_groundElevationPlane.setNull();
m_groundSpeed.setNull();
m_onGroundDetails = CAircraftSituation::NotSet;
m_onGroundDetails = CAircraftSituation::NotSetGroundDetails;
}
const QString &CAircraftSituation::onGroundAsString() const
@@ -239,8 +239,9 @@ namespace BlackMisc
bool CAircraftSituation::isOnGroundInfoAvailable() const
{
if (this->hasInboundGroundDetails()) { return true; }
return this->getOnGround() != CAircraftSituation::OnGroundSituationUnknown &&
this->getOnGroundDetails() != CAircraftSituation::NotSet;
this->getOnGroundDetails() != CAircraftSituation::NotSetGroundDetails;
}
void CAircraftSituation::setOnGround(bool onGround)
@@ -326,7 +327,7 @@ namespace BlackMisc
this->setOnGroundDetails(OnGroundByInterpolation);
if (this->getOnGroundFactor() < 0.0)
{
this->setOnGround(NotSet);
this->setOnGround(NotSetGroundDetails);
return false;
}

View File

@@ -79,7 +79,7 @@ namespace BlackMisc
//! Reliability of on ground information
enum OnGroundDetails
{
NotSet,
NotSetGroundDetails,
// interpolated situation
OnGroundByInterpolation, //!< strongest for remote aircraft
OnGroundByElevationAndCG,
@@ -229,8 +229,8 @@ namespace BlackMisc
//! Is ground elevation value available
bool hasGroundElevation() const;
//! Has inbound ground information
bool hasInboundGroundInformation() const;
//! Has inbound ground details
bool hasInboundGroundDetails() const;
//! Elevation of the ground directly beneath at the given situation
void setGroundElevation(const Aviation::CAltitude &altitude);
@@ -261,7 +261,7 @@ namespace BlackMisc
const PhysicalQuantities::CLengthUnit &getAltitudeUnit() const { return m_position.geodeticHeight().getUnit(); }
//! Get altitude under consideration of ground elevation and ground flag
//! \remark with dragToGround it will also compensate overflows, otherwise ony underflow
//! \remark with dragToGround it will also compensate overflows, otherwise only underflow
CAltitude getCorrectedAltitude(const PhysicalQuantities::CLength &centerOfGravity = PhysicalQuantities::CLength::null(), bool enableDragToGround = true, AltitudeCorrection *correctetion = nullptr) const;
//! Set the corrected altitude from CAircraftSituation::getCorrectedAltitude
@@ -364,7 +364,7 @@ namespace BlackMisc
bool m_isInterim = false;
Geo::CElevationPlane m_groundElevationPlane; //!< NULL elevation as default
int m_onGround = static_cast<int>(CAircraftSituation::OnGroundSituationUnknown);
int m_onGroundDetails = static_cast<int>(CAircraftSituation::NotSet);
int m_onGroundDetails = static_cast<int>(CAircraftSituation::NotSetGroundDetails);
double m_onGroundFactor = -1; //!< interpolated ground flag, 1..on ground, 0..not on ground, -1 no info
BLACK_METACLASS(

View File

@@ -146,8 +146,8 @@ namespace BlackMisc
{
Q_UNUSED(i18n);
return this->latitudeAsString() % QLatin1Char(' ') %
this->longitudeAsString() % QLatin1Char(' ') %
this->geodeticHeightAsString();
QStringLiteral(" | ") % this->longitudeAsString() % QLatin1Char(' ') %
QStringLiteral(" | ") % this->geodeticHeightAsString();
}
CVariant CCoordinateGeodetic::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
@@ -305,12 +305,8 @@ namespace BlackMisc
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexRelativeBearing:
m_relativeBearing.setPropertyByIndex(index.copyFrontRemoved(), variant);
break;
case IndexRelativeDistance:
m_relativeDistance.setPropertyByIndex(index.copyFrontRemoved(), variant);
break;
case IndexRelativeBearing: m_relativeBearing.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
case IndexRelativeDistance: m_relativeDistance.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
default:
const QString m = QString("no property, index ").append(index.toQString());
BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m));

View File

@@ -121,8 +121,20 @@ namespace BlackMisc
}
// locked members
{ QWriteLocker l(&m_lockParts); m_partsByCallsign.clear(); m_aircraftWithParts.clear(); m_partsAdded = 0; m_partsLastModified.clear(); }
{ QWriteLocker l(&m_lockSituations); m_situationsByCallsign.clear(); m_situationsAdded = 0; m_situationsLastModified.clear(); }
{
QWriteLocker l(&m_lockParts);
m_partsByCallsign.clear();
m_aircraftWithParts.clear();
m_partsAdded = 0;
m_partsLastModified.clear();
}
{
QWriteLocker l(&m_lockSituations);
m_situationsByCallsign.clear();
m_situationsAdded = 0;
m_situationsLastModified.clear();
m_testOffset.clear();
}
{ QWriteLocker l(&m_lockPartsHistory); m_aircraftPartsHistory.clear(); }
{ QWriteLocker l(&m_lockMessages); m_reverseLookupMessages.clear(); }
{ QWriteLocker l(&m_lockAircraft); m_aircraftInRange.clear(); }
@@ -187,7 +199,7 @@ namespace BlackMisc
}
// unify all inbound ground information
if (situation.hasInboundGroundInformation())
if (situation.hasInboundGroundDetails())
{
situationList.setOnGroundDetails(situation.getOnGroundDetails());
}

View File

@@ -145,7 +145,7 @@ namespace BlackMisc
//! \threadsafe
virtual bool updateFastPositionEnabled(const Aviation::CCallsign &callsign, bool enableFastPositonUpdates) = 0;
//! Ground elevation of aircraft
//! Update the ground elevation
//! \threadsafe
virtual int updateAircraftGroundElevation(const Aviation::CCallsign &callsign, const Geo::CElevationPlane &elevation) = 0;
@@ -360,7 +360,7 @@ namespace BlackMisc
//! \remark latest parts are kept first
//! \threadsafe
//! @{
void storeAircraftParts(const Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftParts &parts, bool removeOutdated);
void storeAircraftParts(const Aviation::CCallsign &callsign, const Aviation::CAircraftParts &parts, bool removeOutdated);
void storeAircraftParts(const Aviation::CCallsign &callsign, const QJsonObject &jsonObject, int currentOffset);
//! @}

View File

@@ -108,7 +108,7 @@ namespace BlackMiscTest
for (int i = 0; i < number; i++)
{
CAircraftSituation s = createTestSituation(cs, i, ts, deltaT, 0);
s.setOnGround(CAircraftSituation::OnGroundSituationUnknown, CAircraftSituation::NotSet);
s.setOnGround(CAircraftSituation::OnGroundSituationUnknown, CAircraftSituation::NotSetGroundDetails);
situations.push_back(s);
}
@@ -124,7 +124,7 @@ namespace BlackMiscTest
const qint64 Offset = 33;
partsOnGround.addMsecsToOffset(Offset);
CAircraftSituation s1 = situations[1];
s1.setOnGroundDetails(CAircraftSituation::NotSet);
s1.setOnGroundDetails(CAircraftSituation::NotSetGroundDetails);
s1.adjustGroundFlag(partsOnGround, true, 0.1, &distanceMs);
QVERIFY2(s1.getOnGround(), "Supposed to be on ground");
QVERIFY2(distanceMs == deltaT - Offset, "Offset time wrong");