mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-16 18:35:35 +08:00
refs #780, fixed property index compare issues found in the client
This commit is contained in:
@@ -64,7 +64,7 @@ namespace BlackGui
|
|||||||
this->m_columns.addColumn(CColumn::standardString("realname", "pilot's real name", { CSimulatedAircraft::IndexPilot, CUser::IndexRealName }));
|
this->m_columns.addColumn(CColumn::standardString("realname", "pilot's real name", { CSimulatedAircraft::IndexPilot, CUser::IndexRealName }));
|
||||||
this->m_columns.addColumn(CColumn("dist.", "distance", CSimulatedAircraft::IndexRelativeDistance, new CAirspaceDistanceFormatter()));
|
this->m_columns.addColumn(CColumn("dist.", "distance", CSimulatedAircraft::IndexRelativeDistance, new CAirspaceDistanceFormatter()));
|
||||||
this->m_columns.addColumn(CColumn("altitude", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexAltitude }, new CAltitudeFormatter()));
|
this->m_columns.addColumn(CColumn("altitude", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexAltitude }, new CAltitudeFormatter()));
|
||||||
this->m_columns.addColumn(CColumn("gs.", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexGroundspeed }, new CAircraftSpeedFormatter()));
|
this->m_columns.addColumn(CColumn("gs.", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexGroundSpeed }, new CAircraftSpeedFormatter()));
|
||||||
this->m_columns.addColumn(CColumn::standardString("icao", "icao and livery info", { CSimulatedAircraft::IndexCombinedIcaoLiveryStringNetworkModel}));
|
this->m_columns.addColumn(CColumn::standardString("icao", "icao and livery info", { CSimulatedAircraft::IndexCombinedIcaoLiveryStringNetworkModel}));
|
||||||
|
|
||||||
// icon column for airline
|
// icon column for airline
|
||||||
@@ -90,7 +90,7 @@ namespace BlackGui
|
|||||||
this->m_columns.addColumn(CColumn::standardValueObject("cs.", "callsign", { CSimulatedAircraft::IndexCallsign, CCallsign::IndexCallsignString }));
|
this->m_columns.addColumn(CColumn::standardValueObject("cs.", "callsign", { CSimulatedAircraft::IndexCallsign, CCallsign::IndexCallsignString }));
|
||||||
this->m_columns.addColumn(CColumn("dist.", "distance", CSimulatedAircraft::IndexRelativeDistance, new CAirspaceDistanceFormatter()));
|
this->m_columns.addColumn(CColumn("dist.", "distance", CSimulatedAircraft::IndexRelativeDistance, new CAirspaceDistanceFormatter()));
|
||||||
this->m_columns.addColumn(CColumn("altitude", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexAltitude }, new CAltitudeFormatter()));
|
this->m_columns.addColumn(CColumn("altitude", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexAltitude }, new CAltitudeFormatter()));
|
||||||
this->m_columns.addColumn(CColumn("gs.", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexGroundspeed }, new CAircraftSpeedFormatter()));
|
this->m_columns.addColumn(CColumn("gs.", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexGroundSpeed }, new CAircraftSpeedFormatter()));
|
||||||
this->m_columns.addColumn(CColumn("p.", "parts", CSimulatedAircraft::IndexPartsSynchronized, new CBoolIconFormatter("parts", "no parts"), true));
|
this->m_columns.addColumn(CColumn("p.", "parts", CSimulatedAircraft::IndexPartsSynchronized, new CBoolIconFormatter("parts", "no parts"), true));
|
||||||
this->m_columns.addColumn(CColumn("fp.", "fast position updates", CSimulatedAircraft::IndexFastPositionUpdates, new CBoolIconFormatter("enabled", "disabled"), true));
|
this->m_columns.addColumn(CColumn("fp.", "fast position updates", CSimulatedAircraft::IndexFastPositionUpdates, new CBoolIconFormatter("enabled", "disabled"), true));
|
||||||
this->m_columns.addColumn(CColumn::standardString("realname", "pilot's real name", { CSimulatedAircraft::IndexPilot, CUser::IndexRealName }));
|
this->m_columns.addColumn(CColumn::standardString("realname", "pilot's real name", { CSimulatedAircraft::IndexPilot, CUser::IndexRealName }));
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
namespace Aviation
|
namespace Aviation
|
||||||
{
|
{
|
||||||
|
|
||||||
CAircraftSituation::CAircraftSituation(const CCoordinateGeodetic &position, const CAltitude &altitude, const CHeading &heading, const CAngle &pitch, const CAngle &bank, const CSpeed &gs)
|
CAircraftSituation::CAircraftSituation(const CCoordinateGeodetic &position, const CAltitude &altitude, const CHeading &heading, const CAngle &pitch, const CAngle &bank, const CSpeed &gs)
|
||||||
: m_position(position), m_altitude(altitude), m_heading(heading), m_pitch(pitch),
|
: m_position(position), m_altitude(altitude), m_heading(heading), m_pitch(pitch),
|
||||||
m_bank(bank), m_groundSpeed(gs) {}
|
m_bank(bank), m_groundSpeed(gs) {}
|
||||||
@@ -55,6 +54,10 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
return ITimestampBased::propertyByIndex(index);
|
return ITimestampBased::propertyByIndex(index);
|
||||||
}
|
}
|
||||||
|
if (ICoordinateGeodetic::canHandleIndex(index))
|
||||||
|
{
|
||||||
|
return ICoordinateGeodetic::propertyByIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
@@ -73,7 +76,7 @@ namespace BlackMisc
|
|||||||
return this->m_pitch.propertyByIndex(index.copyFrontRemoved());
|
return this->m_pitch.propertyByIndex(index.copyFrontRemoved());
|
||||||
case IndexBank:
|
case IndexBank:
|
||||||
return this->m_bank.propertyByIndex(index.copyFrontRemoved());
|
return this->m_bank.propertyByIndex(index.copyFrontRemoved());
|
||||||
case IndexGroundspeed:
|
case IndexGroundSpeed:
|
||||||
return this->m_groundSpeed.propertyByIndex(index.copyFrontRemoved());
|
return this->m_groundSpeed.propertyByIndex(index.copyFrontRemoved());
|
||||||
case IndexCallsign:
|
case IndexCallsign:
|
||||||
return this->m_correspondingCallsign.propertyByIndex(index.copyFrontRemoved());
|
return this->m_correspondingCallsign.propertyByIndex(index.copyFrontRemoved());
|
||||||
@@ -106,7 +109,7 @@ namespace BlackMisc
|
|||||||
case IndexBank:
|
case IndexBank:
|
||||||
this->m_bank.setPropertyByIndex(index.copyFrontRemoved(), variant);
|
this->m_bank.setPropertyByIndex(index.copyFrontRemoved(), variant);
|
||||||
break;
|
break;
|
||||||
case IndexGroundspeed:
|
case IndexGroundSpeed:
|
||||||
this->m_groundSpeed.setPropertyByIndex(index.copyFrontRemoved(), variant);
|
this->m_groundSpeed.setPropertyByIndex(index.copyFrontRemoved(), variant);
|
||||||
break;
|
break;
|
||||||
case IndexCallsign:
|
case IndexCallsign:
|
||||||
@@ -118,6 +121,45 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CAircraftSituation::comparePropertyByIndex(const CPropertyIndex &index, const CAircraftSituation &compareValue) const
|
||||||
|
{
|
||||||
|
if (ITimestampBased::canHandleIndex(index))
|
||||||
|
{
|
||||||
|
return ITimestampBased::comparePropertyByIndex(index, compareValue);
|
||||||
|
}
|
||||||
|
if (ICoordinateGeodetic::canHandleIndex(index))
|
||||||
|
{
|
||||||
|
return ICoordinateGeodetic::comparePropertyByIndex(index, compareValue);
|
||||||
|
}
|
||||||
|
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
|
switch (i)
|
||||||
|
{
|
||||||
|
case IndexPosition:
|
||||||
|
return this->m_position.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getPosition());
|
||||||
|
break;
|
||||||
|
case IndexAltitude:
|
||||||
|
return this->m_altitude.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getAltitude());
|
||||||
|
break;
|
||||||
|
case IndexPitch:
|
||||||
|
return this->m_pitch.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getPitch());
|
||||||
|
break;
|
||||||
|
case IndexBank:
|
||||||
|
return this->m_bank.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getBank());
|
||||||
|
break;
|
||||||
|
case IndexGroundSpeed:
|
||||||
|
return this->m_groundSpeed.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getGroundSpeed());
|
||||||
|
break;
|
||||||
|
case IndexCallsign:
|
||||||
|
return this->m_correspondingCallsign.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getCallsign());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const QString assertMsg("No comparison for index " + index.toQString());
|
||||||
|
Q_ASSERT_X(false, Q_FUNC_INFO, assertMsg.toLocal8Bit().constData());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool CAircraftSituation::isOnGroundGuessed() const
|
bool CAircraftSituation::isOnGroundGuessed() const
|
||||||
{
|
{
|
||||||
CLength heightAboveGround(this->getHeightAboveGround());
|
CLength heightAboveGround(this->getHeightAboveGround());
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace BlackMisc
|
|||||||
IndexHeading,
|
IndexHeading,
|
||||||
IndexBank,
|
IndexBank,
|
||||||
IndexPitch,
|
IndexPitch,
|
||||||
IndexGroundspeed,
|
IndexGroundSpeed,
|
||||||
IndexCallsign
|
IndexCallsign
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -81,6 +81,9 @@ namespace BlackMisc
|
|||||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
|
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
|
||||||
|
|
||||||
|
//! Compare by index
|
||||||
|
int comparePropertyByIndex(const CPropertyIndex &index, const CAircraftSituation &compareValue) const;
|
||||||
|
|
||||||
//! Get position
|
//! Get position
|
||||||
const BlackMisc::Geo::CCoordinateGeodetic &getPosition() const { return this->m_position; }
|
const BlackMisc::Geo::CCoordinateGeodetic &getPosition() const { return this->m_position; }
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
namespace Aviation
|
namespace Aviation
|
||||||
{
|
{
|
||||||
|
|
||||||
template <class AVIO>
|
template <class AVIO>
|
||||||
bool CModulator<AVIO>::isDefaultValue() const
|
bool CModulator<AVIO>::isDefaultValue() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "blackmisc/propertyindex.h"
|
#include "blackmisc/propertyindex.h"
|
||||||
#include "blackmisc/propertyindexvariantmap.h"
|
#include "blackmisc/propertyindexvariantmap.h"
|
||||||
#include "blackmisc/variant.h"
|
#include "blackmisc/variant.h"
|
||||||
|
#include "blackmisc/verify.h"
|
||||||
#include "blackmisc/pq/length.h"
|
#include "blackmisc/pq/length.h"
|
||||||
#include "blackmisc/pq/pressure.h"
|
#include "blackmisc/pq/pressure.h"
|
||||||
#include "blackmisc/pq/frequency.h"
|
#include "blackmisc/pq/frequency.h"
|
||||||
@@ -428,7 +429,7 @@ namespace BlackMisc
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Q_ASSERT_X(false, Q_FUNC_INFO, "No comparison");
|
BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable("No comparison for index " + index.toQString()));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "blackmisc/comparefunctions.h"
|
#include "blackmisc/comparefunctions.h"
|
||||||
#include "blackmisc/metaclassprivate.h"
|
#include "blackmisc/metaclassprivate.h"
|
||||||
#include "blackmisc/pq/constants.h"
|
#include "blackmisc/pq/constants.h"
|
||||||
|
#include "blackmisc/verify.h"
|
||||||
#include "blackmisc/propertyindex.h"
|
#include "blackmisc/propertyindex.h"
|
||||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||||
#include "blackmisc/stringutils.h"
|
#include "blackmisc/stringutils.h"
|
||||||
@@ -396,12 +397,13 @@ namespace BlackMisc
|
|||||||
case IndexPilot:
|
case IndexPilot:
|
||||||
return this->m_pilot.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getPilot());
|
return this->m_pilot.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getPilot());
|
||||||
case IndexSituation:
|
case IndexSituation:
|
||||||
|
return this->m_situation.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getSituation());
|
||||||
case IndexRelativeDistance:
|
case IndexRelativeDistance:
|
||||||
return this->m_relativeDistance.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getRelativeDistance());
|
return this->m_relativeDistance.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getRelativeDistance());
|
||||||
case IndexCom1System:
|
case IndexCom1System:
|
||||||
return m_com1system.getFrequencyActive().comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getCom1System().getFrequencyActive());
|
return m_com1system.getFrequencyActive().comparePropertyByIndex(CPropertyIndex(), compareValue.getCom1System().getFrequencyActive());
|
||||||
case IndexCom2System:
|
case IndexCom2System:
|
||||||
return m_com2system.getFrequencyActive().comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getCom2System().getFrequencyActive());
|
return m_com2system.getFrequencyActive().comparePropertyByIndex(CPropertyIndex(), compareValue.getCom2System().getFrequencyActive());
|
||||||
case IndexTransponder:
|
case IndexTransponder:
|
||||||
return Compare::compare(m_transponder.getTransponderCode(), compareValue.getTransponder().getTransponderCode());
|
return Compare::compare(m_transponder.getTransponderCode(), compareValue.getTransponder().getTransponderCode());
|
||||||
case IndexLivery:
|
case IndexLivery:
|
||||||
@@ -412,12 +414,22 @@ namespace BlackMisc
|
|||||||
return m_model.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getModel());
|
return m_model.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getModel());
|
||||||
case IndexNetworkModel:
|
case IndexNetworkModel:
|
||||||
return m_networkModel.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getModel());
|
return m_networkModel.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getModel());
|
||||||
|
case IndexNetworkModelAircraftIcaoDifference:
|
||||||
|
return this->getNetworkModelAircraftIcaoDifference().compare(compareValue.getNetworkModelAircraftIcaoDifference());
|
||||||
|
case IndexNetworkModelAirlineIcaoDifference:
|
||||||
|
return this->getNetworkModelAirlineIcaoDifference().compare(compareValue.getNetworkModelAirlineIcaoDifference());
|
||||||
|
case IndexNetworkModelLiveryDifference:
|
||||||
|
return this->getNetworkModelLiveryDifference().compare(compareValue.getNetworkModelLiveryDifference());
|
||||||
case IndexRendered:
|
case IndexRendered:
|
||||||
return Compare::compare(this->m_rendered, compareValue.isRendered());
|
return Compare::compare(this->m_rendered, compareValue.isRendered());
|
||||||
case IndexPartsSynchronized:
|
case IndexPartsSynchronized:
|
||||||
return Compare::compare(this->m_partsSynchronized, compareValue.isPartsSynchronized());
|
return Compare::compare(this->m_partsSynchronized, compareValue.isPartsSynchronized());
|
||||||
case IndexFastPositionUpdates:
|
case IndexFastPositionUpdates:
|
||||||
return Compare::compare(this->m_fastPositionUpdates, compareValue.fastPositionUpdates());
|
return Compare::compare(this->m_fastPositionUpdates, compareValue.fastPositionUpdates());
|
||||||
|
case IndexCombinedIcaoLiveryString:
|
||||||
|
return this->getCombinedIcaoLiveryString(false).compare(compareValue.getCombinedIcaoLiveryString(false));
|
||||||
|
case IndexCombinedIcaoLiveryStringNetworkModel:
|
||||||
|
return this->getCombinedIcaoLiveryString(true).compare(compareValue.getCombinedIcaoLiveryString(true));
|
||||||
default:
|
default:
|
||||||
if (ICoordinateWithRelativePosition::canHandleIndex(index))
|
if (ICoordinateWithRelativePosition::canHandleIndex(index))
|
||||||
{
|
{
|
||||||
@@ -425,7 +437,7 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Q_ASSERT_X(false, Q_FUNC_INFO, "Comapre failed");
|
BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable("No comparison for index " + index.toQString()));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,9 @@ namespace BlackMisc
|
|||||||
IndexCombinedIcaoLiveryStringNetworkModel,
|
IndexCombinedIcaoLiveryStringNetworkModel,
|
||||||
IndexModel,
|
IndexModel,
|
||||||
IndexNetworkModel,
|
IndexNetworkModel,
|
||||||
|
IndexNetworkModelAircraftIcaoDifference,
|
||||||
|
IndexNetworkModelAirlineIcaoDifference,
|
||||||
|
IndexNetworkModelLiveryDifference,
|
||||||
IndexEnabled,
|
IndexEnabled,
|
||||||
IndexRendered,
|
IndexRendered,
|
||||||
IndexPartsSynchronized,
|
IndexPartsSynchronized,
|
||||||
|
|||||||
Reference in New Issue
Block a user