6 #include <QStringBuilder>
10 using namespace swift::misc::physical_quantities;
14 namespace swift::misc::aviation
21 CAircraftVelocity::CAircraftVelocity() =
default;
23 CAircraftVelocity::CAircraftVelocity(
double x,
double y,
double z,
CSpeedUnit xyzUnit,
double pitch,
double roll,
26 setLinearVelocity(x, y, z, xyzUnit);
27 setAngularVelocity(pitch, roll, heading, pbhAngleUnit, pbhTimeUnit);
30 void CAircraftVelocity::setLinearVelocity(
double x,
double y,
double z,
CSpeedUnit xyzUnit)
32 m_x = c_xyzSpeedUnit.convertFrom(x, xyzUnit);
33 m_y = c_xyzSpeedUnit.convertFrom(y, xyzUnit);
34 m_z = c_xyzSpeedUnit.convertFrom(z, xyzUnit);
37 void CAircraftVelocity::setAngularVelocity(
double pitch,
double roll,
double heading,
CAngleUnit pbhAngleUnit,
40 m_pitch = pbhTimeUnit.
convertFrom(c_pbhAngleUnit.convertFrom(pitch, pbhAngleUnit), c_timeUnit);
41 m_roll = pbhTimeUnit.
convertFrom(c_pbhAngleUnit.convertFrom(roll, pbhAngleUnit), c_timeUnit);
42 m_heading = pbhTimeUnit.
convertFrom(c_pbhAngleUnit.convertFrom(heading, pbhAngleUnit), c_timeUnit);
53 return c_timeUnit.convertFrom(angleUnit.
convertFrom(m_pitch, c_pbhAngleUnit), timeUnit);
58 return c_timeUnit.convertFrom(angleUnit.
convertFrom(m_roll, c_pbhAngleUnit), timeUnit);
63 return c_timeUnit.convertFrom(angleUnit.
convertFrom(m_heading, c_pbhAngleUnit), timeUnit);
66 QString CAircraftVelocity::convertToQString(
bool i18n)
const
68 return u
"Velocity: " % QStringLiteral(
"%1 %2 %3 ").arg(m_x).arg(m_y).arg(m_z) %
69 c_xyzSpeedUnit.convertToQString(i18n) % u
" | Rotation: " %
70 QStringLiteral(
"%1 %2 %3 ").arg(m_pitch).arg(m_roll).arg(m_heading) %
71 c_pbhAngleUnit.convertToQString(i18n) % u
"/" % c_timeUnit.convertToQString(i18n);
77 return QVariant::fromValue(*
this);
80 void CAircraftVelocity::setPropertyByIndex(
CPropertyIndexRef index,
const QVariant &variant)
89 return compare(*
this, compareValue);
Non-owning reference to a CPropertyIndex with a subset of its features.
bool isMyself() const
Myself index, used with nesting.
Velocity and angular velocity for 6DOF bodies.
Specialized class for angles (degrees, radian).
static CAngleUnit rad()
Radians.
Specialized class for distance units (meter, foot, nautical miles).
static CLengthUnit m()
Meter m.
double convertFrom(double value, const CMeasurementUnit &unit) const
Convert from other unit to this unit.
Specialized class for speed units (m/s, ft/s, NM/h).
static CSpeedUnit m_s()
Meter/second m/s.
Specialized class for time units (ms, hour, min).
static CTimeUnit s()
Second s.
#define SWIFT_DEFINE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template definition of mixins for a CValueObject subclass.
#define SWIFT_VERIFY(COND)
A weaker kind of assert.