8 #include "QStringBuilder"
22 using namespace swift::misc::geo;
23 using namespace swift::misc::physical_quantities;
24 using namespace swift::config;
28 namespace swift::misc::aviation
30 const CLength &CAircraftSituation::allowedAltitudeDeviation()
33 static const CLength allowedStdDev(3, CLengthUnit::ft());
39 const bool isOnGround = this->isOnGround();
40 const double gsKts = getGroundSpeed().value(CSpeedUnit::kts());
78 lights.
setLandingOn(getAltitude().value(CLengthUnit::ft()) < 10000);
83 void CAircraftSituation::registerMetadata()
86 qRegisterMetaType<CAircraftSituation::AltitudeCorrection>();
87 qRegisterMetaType<CAircraftSituation::GndElevationInfo>();
90 CAircraftSituation::CAircraftSituation() {}
92 CAircraftSituation::CAircraftSituation(
const CCallsign &correspondingCallsign)
93 : m_correspondingCallsign(correspondingCallsign)
99 : m_position(position), m_groundElevationPlane(groundElevation),
100 m_heading(heading.normalizedToPlusMinus180Degrees()), m_pitch(pitch.normalizedToPlusMinus180Degrees()),
101 m_bank(bank.normalizedToPlusMinus180Degrees()), m_groundSpeed(gs)
109 : m_correspondingCallsign(correspondingCallsign), m_position(position), m_groundElevationPlane(groundElevation),
110 m_heading(heading.normalizedToPlusMinus180Degrees()), m_pitch(pitch.normalizedToPlusMinus180Degrees()),
111 m_bank(bank.normalizedToPlusMinus180Degrees()), m_groundSpeed(gs)
113 m_correspondingCallsign.
setTypeHint(CCallsign::Aircraft);
123 (m_cg.
isNull() ? QStringLiteral(
"null") :
135 static const QString under(
"underflow");
136 static const QString dragged(
"dragged to gnd");
137 static const QString no(
"no correction");
138 static const QString noElv(
"no elv.");
139 static const QString unknown(
"unknown");
140 static const QString agl(
"AGL");
146 case NoCorrection:
return no;
147 case AGL:
return agl;
169 static const QString noDetails(
"no details");
170 static const QString unknown(
"unknown");
171 static const QString provider(
"provider");
172 static const QString change(
"situation change");
173 static const QString cache(
"cached");
174 static const QString test(
"test");
175 static const QString interpolated(
"interpolated");
176 static const QString extrapolated(
"extrapolated");
177 static const QString avg(
"average");
181 case NoElevationInfo:
return noDetails;
185 case Test:
return test;
196 static const CLength small(0.5, CLengthUnit::m());
208 static const CLength cg(2.5, CLengthUnit::m());
217 if (oldSituation.
isNull() || newSituation.
isNull()) {
return CElevationPlane::null(); }
220 return CElevationPlane::null();
226 const double deltaElvFt = newElvFt - oldElvFt;
229 return CElevationPlane::null();
234 if (CBuildConfig::isLocalDeveloperDebugBuild())
241 const double distanceSituationNewM =
245 const double distanceOldNewM =
247 .value(CLengthUnit::m());
250 const double distRatio = distanceSituationNewM / distanceOldNewM;
256 const double situationElvFt = newElvFt - distRatio * deltaElvFt;
257 return CElevationPlane(situation, situationElvFt, CElevationPlane::singlePointRadius());
261 const double elvSumFt = oldElvFt + newElvFt;
262 const double elvFt = 0.5 * elvSumFt;
263 return CElevationPlane(newSituation, elvFt, CElevationPlane::singlePointRadius());
269 if (index.
isMyself()) {
return QVariant::fromValue(*
this); }
274 if (ICoordinateGeodetic::canHandleIndex(index)) {
return ICoordinateGeodetic::propertyByIndex(index); }
285 case IndexPBHInfo:
return QVariant::fromValue(this->
getPBHInfo());
286 case IndexVelocity:
return QVariant::fromValue(this->
getVelocity());
297 case IndexCanLikelySkipNearGroundInterpolation:
325 case IndexGroundElevationPlane:
330 case IndexGroundElevationInfo: m_elvInfo = variant.toInt();
break;
331 case IndexGroundElevationInfoTransferred: m_isElvInfoTransferred = variant.toBool();
break;
332 case IndexGroundElevationPlusInfo:
break;
333 case IndexCanLikelySkipNearGroundInterpolation:
break;
345 if (ICoordinateGeodetic::canHandleIndex(index))
347 return ICoordinateGeodetic::comparePropertyByIndex(index, compareValue);
362 case IndexGroundSpeed:
364 case IndexGroundElevationPlane:
365 case IndexGroundElevationPlusInfo:
369 if (c != 0 || i == IndexGroundElevationPlane) {
return c; }
374 case IndexIsOnGroundInfo:
376 case IndexGroundElevationInfo:
377 case IndexGroundElevationInfoString:
380 if (c != 0) {
return c; }
383 case IndexGroundElevationInfoTransferred:
384 return Compare::compare(m_isElvInfoTransferred, compareValue.m_isElvInfoTransferred);
385 case IndexCanLikelySkipNearGroundInterpolation:
390 const QString assertMsg(
"No comparison for index " + index.
toQString());
398 bool transferred)
const
400 if (otherInfo == NoElevationInfo || otherInfo ==
Test) {
return false; }
401 const int otherInfoInt =
static_cast<int>(otherInfo);
402 if (otherInfoInt > m_elvInfo) {
return true; }
403 if (otherInfoInt == m_elvInfo)
405 if (m_isElvInfoTransferred == transferred) {
return false; }
444 m_groundElevationPlane.
setNull();
447 m_elvInfo = NoElevationInfo;
448 m_isElvInfoTransferred =
false;
465 return m_onGroundInfo.
getOnGround() != COnGroundInfo::OnGroundSituationUnknown &&
473 if (centerOfGravity.
isNull() || !this->hasGroundElevation()) {
return CLength::null(); }
476 return groundDistance;
507 static const QString n(
"null");
508 if (m_groundElevationPlane.
isNull()) {
return n; }
530 const bool transferable = (distance <= radius);
558 if (ep.
isNull()) {
return false; }
576 m_groundElevationPlane = CElevationPlane::null();
577 m_isElvInfoTransferred =
false;
584 m_isElvInfoTransferred = transferred;
596 if (elevationPlane.
isNull())
598 m_groundElevationPlane = CElevationPlane::null();
599 m_isElvInfoTransferred =
false;
604 m_groundElevationPlane = elevationPlane;
606 m_isElvInfoTransferred = transferred;
608 Q_ASSERT_X(!m_groundElevationPlane.
getRadius().
isNull(), Q_FUNC_INFO,
"Null radius");
619 if (elevationPlane.
isNull()) {
return false; }
622 if (m_groundElevationPlane.
isNull() || this->isOtherElevationInfoBetter(info, transferred))
634 m_groundElevationPlane = CElevationPlane::null();
648 if (gh.
isNull()) {
return CLength::null(); }
651 if (std::isnan(gh.
value()))
654 return CLength::null();
659 return CLength::null();
686 if (correction) { *correction = UnknownCorrection; }
697 if (correction) { *correction = AGL; }
704 if (groundPlusCG.
isNull())
713 if (correction) { *correction =
Underflow; }
719 if (correction) { *correction = NoCorrection; }
722 const bool forceDragToGround = (enableDragToGround &&
isOnGround()) &&
725 if (forceDragToGround)
731 if (correction) { *correction = NoCorrection; }
742 bool enableDragToGround)
746 this->
setCG(centerOfGravity);
747 return altitudeCorrection;
765 if (offset.
isNull()) {
return *
this; }
774 m_pressureAltitude = altitude;
783 static const CAngle za(0, CAngleUnit::deg());
798 return QStringLiteral(
"P: %1 %2 B: %3 %4 H: %5 %6")
799 .arg(this->
getPitch().valueRoundedWithUnit(CAngleUnit::deg(), 1,
true),
800 this->
getPitch().valueRoundedWithUnit(CAngleUnit::rad(), 5,
true),
801 this->
getBank().valueRoundedWithUnit(CAngleUnit::deg(), 1,
true),
802 this->
getBank().valueRoundedWithUnit(CAngleUnit::rad(), 5,
true),
803 this->
getHeading().valueRoundedWithUnit(CAngleUnit::deg(), 1,
true),
804 this->
getHeading().valueRoundedWithUnit(CAngleUnit::rad(), 5,
true));
815 if (this->
isNull()) {
return true; }
823 if (this->
getGroundSpeed().value(CSpeedUnit::kts()) > 225.0) {
return true; }
827 static const CLength threshold(400, CLengthUnit::m());
829 if (!aboveGround.
isNull() && aboveGround >= threshold) {
return true; }
838 if (!min.
isNull()) {
return min; }
839 return CLength(0, CLengthUnit::nullUnit());
841 const double seconds = ms.count() / 1000.0;
843 const CLength d(seconds * gsMeterSecond, CLengthUnit::m());
844 if (!min.
isNull() && d < min) {
return min; }
850 using namespace std::chrono_literals;
856 m_correspondingCallsign = callsign;
857 m_correspondingCallsign.
setTypeHint(CCallsign::Aircraft);
863 double timeDeviationFactor, qint64 *differenceMs)
865 Q_ASSERT_X(timeDeviationFactor >= 0 && timeDeviationFactor <= 1.0, Q_FUNC_INFO,
"Expect 0..1");
866 static const qint64 Max = std::numeric_limits<qint64>::max();
867 if (differenceMs) { *differenceMs = Max; }
872 const bool adjust = (d >= 0) || qAbs(d) < (timeDeviationFactor *
874 if (!adjust) {
return false; }
876 if (differenceMs) { *differenceMs = d; }
883 double timeDeviationFactor, qint64 *differenceMs)
885 Q_ASSERT_X(timeDeviationFactor >= 0 && timeDeviationFactor <= 1.0, Q_FUNC_INFO,
"Expect 0..1");
886 static const qint64 Max = std::numeric_limits<qint64>::max();
887 if (differenceMs) { *differenceMs = Max; }
891 if (partsList.
isEmpty()) {
return false; }
895 qint64 bestDistance = Max;
899 const qint64 posD = qAbs(d);
900 const bool candidate =
902 posD < (timeDeviationFactor * parts.getTimeOffsetMs());
903 if (!candidate || bestDistance <= posD) {
continue; }
905 if (differenceMs) { *differenceMs = d; }
908 if (bestDistance == 0) {
break; }
910 if (!adjust) {
return false; }
913 bestParts.
isOnGround() ? COnGroundInfo::OnGround : COnGroundInfo::NotOnGround;
Non-owning reference to a CPropertyIndex with a subset of its features.
Q_REQUIRED_RESULT CPropertyIndexRef copyFrontRemoved() const
Copy with first element removed.
QString toQString(bool i18n=false) const
Cast as QString.
CastType frontCasted() const
First element casted to given type, usually the PropertIndex enum.
bool isMyself() const
Myself index, used with nesting.
bool isEmpty() const
Synonym for empty.
qint64 getAdjustedMSecsSinceEpoch() const
Timestamp with offset added for interpolation.
static bool canHandleIndex(CPropertyIndexRef index)
Can given index be handled.
QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const
Property by index.
qint64 getTimeOffsetMs() const
Milliseconds to add to timestamp for interpolation.
int comparePropertyByIndex(CPropertyIndexRef index, const ITimestampWithOffsetBased &compareValue) const
Compare for index.
void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant)
Set property by index.
qint64 getAdjustedTimeDifferenceMs(qint64 compareTime) const
Time difference in ms (this -> compare)
QString getFormattedTimestampAndOffset(bool includeRawTimestamp) const
Timestamp and offset.
Value object encapsulating information about aircraft's lights.
void setBeaconOn(bool on)
Set beacon lights.
void setTaxiOn(bool on)
Set taxi lights.
void setCabinOn(bool on)
Set cabin lights.
void setNavOn(bool on)
Set nav lights.
void setRecognitionOn(bool on)
Set recognition lights.
void setLandingOn(bool on)
Set landing lights.
Value object encapsulating information of aircraft's parts.
bool isOnGround() const
Is aircraft on ground?
Value object encapsulating a list of aircraft parts.
Value object encapsulating information of an aircraft's situation.
QString getGroundElevationAndInfo() const
Ground elevation plus info.
AltitudeCorrection correctAltitude(bool enableDragToGround=true)
Set the corrected altitude from CAircraftSituation::getCorrectedAltitude.
void setCallsign(const CCallsign &callsign)
Corresponding callsign.
void setPressureAltitude(const CAltitude &altitude)
Set pressure altitude.
const CAltitude & getGroundElevation() const
Elevation of the ground directly beneath.
void resetGroundElevation()
Reset ground elevation.
bool hasGroundElevation() const
Is ground elevation value available.
bool equalPbhVectorAltitudeElevation(const CAircraftSituation &other) const
Equal PBH and vecto, plus altitude/elevation.
void setCG(const physical_quantities::CLength &cg)
Set CG.
void setGroundSpeed(const physical_quantities::CSpeed &groundspeed)
Set ground speed.
physical_quantities::CLength getDistancePerTime250ms(const physical_quantities::CLength &min=physical_quantities::CLength::null()) const
Distance per milliseconds (250ms)
bool setGroundElevation(const aviation::CAltitude &altitude, GndElevationInfo info, bool transferred=false)
Elevation of the ground directly beneath at the given situation.
const CHeading & getHeading() const
Get heading.
static constexpr double MaxDeltaElevationFt
Threshold until we interpolate elevations.
CAltitude addAltitudeOffset(const physical_quantities::CLength &offset)
Add offset to altitude.
bool transferGroundElevationFromMe(CAircraftSituation &transferToSituation, const physical_quantities::CLength &radius=geo::CElevationPlane::singlePointRadius()) const
Transfer from "this" situation to otherSituation.
physical_quantities::CLengthUnit getAltitudeOrDefaultUnit() const
Get altitude unit.
void setBank(const physical_quantities::CAngle &bank)
Set bank (angle)
bool canTransferGroundElevation(const CAircraftSituation &transferToSituation, const physical_quantities::CLength &radius=geo::CElevationPlane::singlePointRadius()) const
Can the elevation be transferred to another situation?
QString getGroundElevationInfoAsString() const
How did we get gnd.elevation?
void setHeading(const CHeading &heading)
Set heading.
QString convertToQString(bool i18n=false) const
Cast as QString.
aviation::COnGroundInfo getOnGroundInfo() const
On ground info.
QString getPBHInfo() const
Get PBH info (all together)
static const QString & altitudeCorrectionToString(AltitudeCorrection correction)
Enum to string.
GndElevationInfo getGroundElevationInfo() const
How did we get gnd.elevation?
AltitudeCorrection
How was altitude corrected?
@ NoElevation
no correction as there is no elevation
@ Underflow
aircraft too low
@ DraggedToGround
other scenery too high, but on ground
bool shouldGuessOnGround() const
Should we guess on ground?
bool transferGroundElevationToMe(const CAircraftSituation &fromSituation, const physical_quantities::CLength &radius, bool transferred)
Transfer ground elevation from given situation (to me)
CAircraftSituation withAltitudeOffset(const physical_quantities::CLength &offset) const
Situation with altitude offset.
bool hasGroundDetailsForGndInterpolation() const
Do the ground details permit ground interpolation?
GndElevationInfo
Where did we get elevation from?
@ Extrapolated
extrapolated ("guessing")
@ SituationChange
from swift::misc::aviation::CAircraftSituationChange
@ FromProvider
from swift::misc::simulation::ISimulationEnvironmentProvider
@ Average
average value of "nearby" situation CAircraftSituationList::averageElevationOfNonMovingAircraft
@ Interpolated
interpolated between 2 elevations
bool isOnGroundInfoAvailable() const
On ground info available?
static const physical_quantities::CLength & defaultCG()
A default CG if not other value is available.
bool setGroundElevationChecked(const geo::CElevationPlane &elevationPlane, GndElevationInfo info, bool transferred=false)
Set elevation of the ground directly beneath, but checked.
void setAltitude(const CAltitude &altitude)
Set altitude.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
bool isPositionNull() const
Position null?
static const CAircraftSituation & null()
Null situation.
bool isOtherElevationInfoBetter(GndElevationInfo otherInfo, bool transferred) const
Is given info better (more accurate)?
physical_quantities::CLength getGroundDistance(const physical_quantities::CLength ¢erOfGravity) const
Distance to ground, null if impossible to calculate.
void setGroundElevationInfo(GndElevationInfo details)
How we did get gnd.elevation.
bool isOnGround() const
Is on ground?
static bool isCorrectedAltitude(AltitudeCorrection correction)
Means corrected altitude?
CAltitude getCorrectedAltitude(bool enableDragToGround=true, AltitudeCorrection *correction=nullptr) const
Get altitude under consideration of ground elevation and ground flag.
bool canLikelySkipNearGroundInterpolation() const
Situation looks like an aircraft not near ground.
const CCallsign & getCallsign() const
Corresponding callsign.
virtual geo::CLatitude latitude() const
Latitude.
const physical_quantities::CSpeed & getGroundSpeed() const
Get ground speed.
virtual std::array< double, 3 > normalVectorDouble() const
Normal vector with double precision.
void setOnGroundInfo(const aviation::COnGroundInfo &info)
Set the on ground info.
const CAltitude & getAltitude() const
Get altitude.
const CAircraftVelocity & getVelocity() const
Get 6DOF velocity.
void setPitch(const physical_quantities::CAngle &pitch)
Set pitch.
bool equalPbhAndVector(const CAircraftSituation &other) const
Equal PBH and vector.
physical_quantities::CLength getDistancePerTime(std::chrono::milliseconds, const physical_quantities::CLength &min=physical_quantities::CLength::null()) const
Distance per milliseconds.
const physical_quantities::CAngle & getBank() const
Get bank (angle)
bool equalPbh(const CAircraftSituation &other) const
Equal pitch, bank heading.
virtual bool isNull() const
Null situation.
int comparePropertyByIndex(CPropertyIndexRef index, const CAircraftSituation &compareValue) const
Compare for index.
bool isGroundElevationInfoTransferred() const
Is the elv.info transferred?
void setZeroPBHandGs()
Set PBH and GS values to 0 (zero)
static const QString & gndElevationInfoToString(GndElevationInfo details)
Enum to string.
const physical_quantities::CAngle & getPitch() const
Get pitch.
static const physical_quantities::CLength & deltaNearGround()
Delta distance, near to ground.
bool interpolateElevation(const aviation::CAircraftSituation &oldSituation, const aviation::CAircraftSituation &newSituation)
Interpolate "this" elevation from the two adjacent positions.
bool isMoving() const
Is moving? Means ground speed > epsilon.
const physical_quantities::CLength & getCG() const
Get CG if any.
const geo::CCoordinateGeodetic & getPosition() const
Get position.
bool isOnGroundFromNetwork() const
On ground by network flag?
const geo::CElevationPlane & getGroundElevationPlane() const
Elevation of the ground directly beneath.
static geo::CElevationPlane interpolatedElevation(const CAircraftSituation &situation, const CAircraftSituation &oldSituation, const CAircraftSituation &newSituation, const physical_quantities::CLength &distance=physical_quantities::CLength::null())
Interpolate between the 2 situations for situation.
void setOnGroundDetails(COnGroundInfo::OnGroundDetails details)
On ground details.
void setNull()
Set to null.
virtual geo::CLongitude longitude() const
Longitude.
bool equalPbhVectorAltitude(const CAircraftSituation &other) const
Equal PBH and vecto, plus altitude.
bool isOnGroundFromParts() const
On ground by parts?
ColumnIndex
Properties by index.
bool hasInboundGroundDetails() const
Has inbound ground details.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
CAircraftSituation()
Default constructor.
physical_quantities::CLength getHeightAboveGround() const
Height above ground.
void setZeroPBH()
Set PBH values to 0 (zero)
bool adjustGroundFlag(const CAircraftParts &parts, bool alwaysSetDetails, double timeDeviationFactor=0.1, qint64 *differenceMs=nullptr)
Transfer ground flag from parts.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
int comparePropertyByIndex(CPropertyIndexRef index, const CAircraftVelocity &compareValue) const
Compare for index.
Altitude as used in aviation, can be AGL or MSL altitude.
CAltitude switchedUnit(const physical_quantities::CLengthUnit &newUnit) const
Value in switched unit.
static physical_quantities::CLengthUnit defaultUnit()
Default unit for calculations.
int comparePropertyByIndex(CPropertyIndexRef index, const CAltitude &compareValue) const
Set property by index.
CAltitude withOffset(const CLength &offset) const
Altitude with offset.
int compare(const CAltitude &otherAltitude) const
Return negative, zero, or positive if a is less than, equal to, or greater than b.
@ PressureAltitude
Altitude above the standard datum plane.
AltitudeType getAltitudeType() const
Current altitude type.
CAltitude toPressureAltitude(const physical_quantities::CPressure &seaLevelPressure) const
Returns the altitude converted to pressure altitude. Requires the current barometric pressure at MSL.
Value object encapsulating information of a callsign.
int comparePropertyByIndex(CPropertyIndexRef index, const CCallsign &compareValue) const
Compare for index.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
void setTypeHint(TypeHint hint)
Type hint.
Heading as used in aviation, can be true or magnetic heading.
CHeading normalizedToPlusMinus180Degrees() const
As [-179.99, 180.0] normalized heading.
Information about the ground status.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
OnGroundDetails
Reliability of on ground information.
@ InFromParts
set from aircraft parts
@ InFromNetwork
received from network
@ OnGroundByGuessing
weakest
@ NotSetGroundDetails
not set or unknown if correct (e.g.
void setOnGroundDetails(OnGroundDetails details)
When source of knowledge changes.
IsOnGround getOnGround() const
Is on ground?
OnGroundDetails getGroundDetails() const
Get ground details.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
int comparePropertyByIndex(CPropertyIndexRef index, const CCoordinateGeodetic &compareValue) const
Set property by index.
void setNull()
Set to null.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
CCoordinateGeodetic & switchUnit(const physical_quantities::CLengthUnit &unit)
Switch unit of height.
virtual const aviation::CAltitude & geodeticHeight() const
Height, ellipsoidal or geodetic height (used in GPS)
void setGeodeticHeight(const aviation::CAltitude &height)
Set height (ellipsoidal or geodetic height)
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
Plane of same elevation, can be a single point or larger area (e.g. airport)
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
const aviation::CAltitude & getAltitude() const
Altitude (synonym for geodetic height)
virtual bool isNull() const
Existing value?
const physical_quantities::CLength & getRadius() const
Radius.
void setRadiusOrMinimumRadius(const physical_quantities::CLength &radius)
Radius or minimum CElevationPlane::singlePointRadius.
void fixRadius()
Set minimum radius if not having radius.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
const physical_quantities::CLength & getRadiusOrMinimumRadius() const
Radius or minimum radius.
int comparePropertyByIndex(CPropertyIndexRef index, const CElevationPlane &elevationPlane) const
Compare for index.
void setSinglePointRadius()
Treat as single point as obtained from simulator.
physical_quantities::CLength calculateGreatCircleDistance(const ICoordinateGeodetic &otherCoordinate) const
Great circle distance.
bool isValidVectorRange() const
Check values.
bool equalNormalVectorDouble(const std::array< double, 3 > &otherVector) const
Is equal? Epsilon considered.
int comparePropertyByIndex(CPropertyIndexRef index, const Derived &compareValue) const
Compare for index.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
QString toQString(bool i18n=false) const
Cast as QString.
Physical unit angle (radians, degrees)
CAngle normalizedToPlusMinus180Degrees() const
As [-179.99, 180.0] normalized angle.
Physical unit length (length)
Specialized class for distance units (meter, foot, nautical miles).
bool isNegativeWithEpsilonConsidered() const
Value <= 0 epsilon considered.
PQ switchedUnit(const MU &newUnit) const
Return copy with switched unit.
const MU & getUnit() const
Unit.
bool isNull() const
Is quantity null?
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
int comparePropertyByIndex(CPropertyIndexRef index, const PQ &pq) const
Compare for index.
double value(MU unit) const
Value in given unit.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
QString valueRoundedWithUnit(const MU &unit, int digits=-1, bool withGroupSeparator=false, bool i18n=false) const
Value to QString with the given unit, e.g. "5.00m".
PQ abs() const
Absolute value (always >=0)
SWIFT_MISC_EXPORT const QString & boolToYesNo(bool v)
Bool to yes/no.
#define SWIFT_DEFINE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template definition of mixins for a CValueObject subclass.
#define SWIFT_VERIFY_X(COND, WHERE, WHAT)
A weaker kind of assert.