mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 15:25:35 +08:00
Ref T773, added "hasMeanSeaLevelValue" and consistently use it
This commit is contained in:
committed by
Mat Sutcliffe
parent
9f911b7e55
commit
287d96afea
@@ -873,7 +873,7 @@ namespace BlackCore
|
||||
void ISimulator::rememberElevationAndSimulatorCG(const CCallsign &callsign, const CAircraftModel &model, const CElevationPlane &elevation, const CLength &simulatorCG)
|
||||
{
|
||||
if (callsign.isEmpty()) { return; }
|
||||
if (!elevation.isNull())
|
||||
if (elevation.hasMSLGeodeticHeight())
|
||||
{
|
||||
const int aircraftCount = this->getAircraftInRangeCount();
|
||||
this->setMaxElevationsRemembered(aircraftCount * 3); // at least 3 elevations per aircraft, even better as not all are requesting elevations
|
||||
@@ -1187,7 +1187,7 @@ namespace BlackCore
|
||||
elevation = (cg.isNull() || situation.getAltitude().isNull()) ? CAltitude::null() : (situation.getAltitude().withOffset(cg * -1.0));
|
||||
}
|
||||
|
||||
if (!elevation.isNull())
|
||||
if (elevation.hasMeanSeaLevelValue())
|
||||
{
|
||||
const CCallsign cs = situation.hasCallsign() ? situation.getCallsign() : ownAircraft.getCallsign();
|
||||
const CLength radius = settings.getRecordedGndRadius().isNull() ? CElevationPlane::singlePointRadius() : settings.getRecordedGndRadius();
|
||||
|
||||
@@ -144,6 +144,9 @@ namespace BlackMisc
|
||||
//! Flightlevel to MSL
|
||||
bool toMeanSeaLevel();
|
||||
|
||||
//! Non-NULL MSL value?
|
||||
bool hasMeanSeaLevelValue() const { return this->isMeanSeaLevel() && !this->isNull(); }
|
||||
|
||||
//! Current altitude type
|
||||
AltitudeType getAltitudeType() const { return m_altitudeType; }
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace BlackMisc
|
||||
bool isGeodeticHeightNull() const { return this->geodeticHeight().isNull(); }
|
||||
|
||||
//! Geodetic height not null and Aviation::CAltitude::MeanSeaLevel
|
||||
bool hasMSLGeodeticHeight() const { return !this->geodeticHeight().isNull() && this->geodeticHeight().getReferenceDatum() == Aviation::CAltitude::MeanSeaLevel; }
|
||||
bool hasMSLGeodeticHeight() const { return this->geodeticHeight().hasMeanSeaLevelValue(); }
|
||||
|
||||
//! Is null, means vector x, y, z == 0
|
||||
//! \remark this is a default implementation, concrete implementations of ICoordinateGeodetic might override it
|
||||
|
||||
@@ -7,12 +7,13 @@
|
||||
*/
|
||||
|
||||
#include "simulationenvironmentprovider.h"
|
||||
#include "verify.h"
|
||||
#include <QStringBuilder>
|
||||
|
||||
using namespace BlackMisc::Simulation::Settings;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Simulation::Settings;
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -20,6 +21,12 @@ namespace BlackMisc
|
||||
{
|
||||
bool ISimulationEnvironmentProvider::rememberGroundElevation(const CCallsign &requestedForCallsign, const ICoordinateGeodetic &elevationCoordinate, const CLength &epsilon)
|
||||
{
|
||||
if (!elevationCoordinate.hasMSLGeodeticHeight())
|
||||
{
|
||||
BLACK_AUDIT_X(false, Q_FUNC_INFO, "Elevation needs to be MSL NON NULL");
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
// no 2nd elevation nearby?
|
||||
QReadLocker l(&m_lockElvCoordinates);
|
||||
|
||||
Reference in New Issue
Block a user