mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 12:55:31 +08:00
Added PQ acceleration and units for mile / statute mile
This commit is contained in:
@@ -15,7 +15,8 @@ precompile_header:!isEmpty(PRECOMPILED_HEADER) {
|
|||||||
|
|
||||||
DEFINES += LOG_IN_FILE
|
DEFINES += LOG_IN_FILE
|
||||||
|
|
||||||
HEADERS += *.h
|
HEADERS += *.h \
|
||||||
|
pqacceleration.h
|
||||||
|
|
||||||
SOURCES += *.cpp
|
SOURCES += *.cpp
|
||||||
|
|
||||||
|
|||||||
54
src/blackmisc/pqacceleration.h
Normal file
54
src/blackmisc/pqacceleration.h
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/* Copyright (C) 2013 VATSIM Community / contributors
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#ifndef BLACKMISC_PQACCELERATION_H
|
||||||
|
#define BLACKMISC_PQACCELERATION_H
|
||||||
|
#include "blackmisc/pqphysicalquantity.h"
|
||||||
|
|
||||||
|
namespace BlackMisc
|
||||||
|
{
|
||||||
|
namespace PhysicalQuantities
|
||||||
|
{
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Acceleration
|
||||||
|
*/
|
||||||
|
class CAcceleration : public CPhysicalQuantity<CAccelerationUnit, CAcceleration>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/*!
|
||||||
|
* \brief Default constructor
|
||||||
|
*/
|
||||||
|
CAcceleration() : CPhysicalQuantity(0, CAccelerationUnit::m_s2(), CAccelerationUnit::m_s2()) {}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Init by int value
|
||||||
|
* \param value
|
||||||
|
* \param unit
|
||||||
|
*/
|
||||||
|
CAcceleration(qint32 value, const CAccelerationUnit &unit) : CPhysicalQuantity(value, unit, CAccelerationUnit::m_s2()) {}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Init by double value
|
||||||
|
* \param value
|
||||||
|
* \param unit
|
||||||
|
*/
|
||||||
|
CAcceleration(double value, const CAccelerationUnit &unit) : CPhysicalQuantity(value, unit, CAccelerationUnit::m_s2()) {}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Copy constructor
|
||||||
|
* \param acceleration
|
||||||
|
*/
|
||||||
|
CAcceleration(const CPhysicalQuantity &acceleration) : CPhysicalQuantity(acceleration) {}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Virtual destructor
|
||||||
|
*/
|
||||||
|
virtual ~CAcceleration() {}
|
||||||
|
};
|
||||||
|
} // namespace
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#endif // guard
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2013 VATSIM Community
|
/* Copyright (C) 2013 VATSIM Community / contributors
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
@@ -14,7 +14,6 @@ namespace PhysicalQuantities
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Mass
|
* \brief Mass
|
||||||
* \author KWB
|
|
||||||
*/
|
*/
|
||||||
class CMass : public CPhysicalQuantity<CMassUnit, CMass>
|
class CMass : public CPhysicalQuantity<CMassUnit, CMass>
|
||||||
{
|
{
|
||||||
@@ -23,23 +22,27 @@ public:
|
|||||||
* \brief Default constructor
|
* \brief Default constructor
|
||||||
*/
|
*/
|
||||||
CMass() : CPhysicalQuantity(0, CMassUnit::kg(), CMassUnit::kg()) {}
|
CMass() : CPhysicalQuantity(0, CMassUnit::kg(), CMassUnit::kg()) {}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Init by int value
|
* \brief Init by int value
|
||||||
* \param value
|
* \param value
|
||||||
* \param unit
|
* \param unit
|
||||||
*/
|
*/
|
||||||
CMass(qint32 value, const CMassUnit &unit) : CPhysicalQuantity(value, unit, CMassUnit::kg()) {}
|
CMass(qint32 value, const CMassUnit &unit) : CPhysicalQuantity(value, unit, CMassUnit::kg()) {}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Init by double value
|
* \brief Init by double value
|
||||||
* \param value
|
* \param value
|
||||||
* \param unit
|
* \param unit
|
||||||
*/
|
*/
|
||||||
CMass(double value, const CMassUnit &unit) : CPhysicalQuantity(value, unit, CMassUnit::kg()) {}
|
CMass(double value, const CMassUnit &unit) : CPhysicalQuantity(value, unit, CMassUnit::kg()) {}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Copy constructor
|
* \brief Copy constructor
|
||||||
* \param mass
|
* \param mass
|
||||||
*/
|
*/
|
||||||
CMass(const CPhysicalQuantity &mass) : CPhysicalQuantity(mass) {}
|
CMass(const CPhysicalQuantity &mass) : CPhysicalQuantity(mass) {}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Virtual destructor
|
* \brief Virtual destructor
|
||||||
*/
|
*/
|
||||||
@@ -48,4 +51,4 @@ public:
|
|||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#endif // BLACKMISC_PQMASS_H
|
#endif // guard
|
||||||
|
|||||||
@@ -98,11 +98,31 @@ public:
|
|||||||
static CLengthUnit cm("centimeter", "cm", true, false, CMeasurementPrefix::c().getFactor(), CMeasurementPrefix::c(), 1);
|
static CLengthUnit cm("centimeter", "cm", true, false, CMeasurementPrefix::c().getFactor(), CMeasurementPrefix::c(), 1);
|
||||||
return cm;
|
return cm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief International mile
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
static const CLengthUnit &mi()
|
||||||
|
{
|
||||||
|
static CLengthUnit mi("mile", "mi", false, false, 1609.344, CMeasurementPrefix::None(), 3);
|
||||||
|
return mi;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Statute mile
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
static const CLengthUnit &miStatute()
|
||||||
|
{
|
||||||
|
static CLengthUnit mi("mile(statute)", "mi(statute)", false, false, 1609.3472, CMeasurementPrefix::None(), 3);
|
||||||
|
return mi;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Specialized class for angles (degrees, radian).
|
* \brief Specialized class for angles (degrees, radian).
|
||||||
* \author KWB, MS
|
|
||||||
*/
|
*/
|
||||||
class CAngleUnit : public CMeasurementUnit
|
class CAngleUnit : public CMeasurementUnit
|
||||||
{
|
{
|
||||||
@@ -144,6 +164,7 @@ public:
|
|||||||
* \param otherUnit
|
* \param otherUnit
|
||||||
*/
|
*/
|
||||||
CAngleUnit(const CAngleUnit &otherUnit) : CMeasurementUnit(otherUnit) { }
|
CAngleUnit(const CAngleUnit &otherUnit) : CMeasurementUnit(otherUnit) { }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Special conversion to QString for sexagesimal degrees.
|
* \brief Special conversion to QString for sexagesimal degrees.
|
||||||
* \param value
|
* \param value
|
||||||
@@ -151,6 +172,7 @@ public:
|
|||||||
* \return
|
* \return
|
||||||
*/
|
*/
|
||||||
virtual QString toQStringRounded(double value, int digits) const;
|
virtual QString toQStringRounded(double value, int digits) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Radians
|
* \brief Radians
|
||||||
* \return
|
* \return
|
||||||
@@ -160,6 +182,7 @@ public:
|
|||||||
static CAngleUnit rad("radian", "rad", true);
|
static CAngleUnit rad("radian", "rad", true);
|
||||||
return rad;
|
return rad;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Degrees
|
* \brief Degrees
|
||||||
* \return
|
* \return
|
||||||
@@ -169,6 +192,7 @@ public:
|
|||||||
static CAngleUnit deg("degree", "°", false, M_PI / 180);
|
static CAngleUnit deg("degree", "°", false, M_PI / 180);
|
||||||
return deg;
|
return deg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Sexagesimal degree (degree, minute, seconds)
|
* \brief Sexagesimal degree (degree, minute, seconds)
|
||||||
* \return
|
* \return
|
||||||
@@ -182,7 +206,6 @@ public:
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Specialized class for frequency (hertz, mega hertz, kilo hertz).
|
* \brief Specialized class for frequency (hertz, mega hertz, kilo hertz).
|
||||||
* \author KWB, MS
|
|
||||||
*/
|
*/
|
||||||
class CFrequencyUnit : public CMeasurementUnit
|
class CFrequencyUnit : public CMeasurementUnit
|
||||||
{
|
{
|
||||||
@@ -209,6 +232,7 @@ public:
|
|||||||
{
|
{
|
||||||
// void
|
// void
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Hertz
|
* \brief Hertz
|
||||||
* \return
|
* \return
|
||||||
@@ -218,6 +242,7 @@ public:
|
|||||||
static CFrequencyUnit Hz("hertz", "Hz", true);
|
static CFrequencyUnit Hz("hertz", "Hz", true);
|
||||||
return Hz;
|
return Hz;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Kilohertz
|
* \brief Kilohertz
|
||||||
* \return
|
* \return
|
||||||
@@ -227,6 +252,7 @@ public:
|
|||||||
static CFrequencyUnit kHz("kilohertz", "kHz", true, CMeasurementPrefix::k().getFactor(), CMeasurementPrefix::k(), 1);
|
static CFrequencyUnit kHz("kilohertz", "kHz", true, CMeasurementPrefix::k().getFactor(), CMeasurementPrefix::k(), 1);
|
||||||
return kHz;
|
return kHz;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Megahertz
|
* \brief Megahertz
|
||||||
* \return
|
* \return
|
||||||
@@ -236,6 +262,7 @@ public:
|
|||||||
static CFrequencyUnit MHz("megahertz", "MHz", false, CMeasurementPrefix::M().getFactor(), CMeasurementPrefix::M(), 2);
|
static CFrequencyUnit MHz("megahertz", "MHz", false, CMeasurementPrefix::M().getFactor(), CMeasurementPrefix::M(), 2);
|
||||||
return MHz;
|
return MHz;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Gigahertz
|
* \brief Gigahertz
|
||||||
* \return
|
* \return
|
||||||
@@ -249,7 +276,6 @@ public:
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Specialized class for mass units (kg, lbs).
|
* \brief Specialized class for mass units (kg, lbs).
|
||||||
* \author KWB, MS
|
|
||||||
*/
|
*/
|
||||||
class CMassUnit : public CMeasurementUnit
|
class CMassUnit : public CMeasurementUnit
|
||||||
{
|
{
|
||||||
@@ -276,6 +302,7 @@ public:
|
|||||||
{
|
{
|
||||||
// void
|
// void
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Kilogram, SI base unit
|
* \brief Kilogram, SI base unit
|
||||||
* \return
|
* \return
|
||||||
@@ -285,6 +312,7 @@ public:
|
|||||||
static CMassUnit kg("kilogram", "kg", true, true, 1.0, CMeasurementPrefix::k(), 1);
|
static CMassUnit kg("kilogram", "kg", true, true, 1.0, CMeasurementPrefix::k(), 1);
|
||||||
return kg;
|
return kg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Gram, SI unit
|
* \brief Gram, SI unit
|
||||||
* \return
|
* \return
|
||||||
@@ -294,6 +322,7 @@ public:
|
|||||||
static CMassUnit g("gram", "g", true, false, 1.0 / 1000.0, CMeasurementPrefix::One(), 0);
|
static CMassUnit g("gram", "g", true, false, 1.0 / 1000.0, CMeasurementPrefix::One(), 0);
|
||||||
return g;
|
return g;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Tonne, aka metric tonne (1000kg)
|
* \brief Tonne, aka metric tonne (1000kg)
|
||||||
* \return
|
* \return
|
||||||
@@ -303,6 +332,7 @@ public:
|
|||||||
static CMassUnit t("tonne", "t", false, false, 1000.0, CMeasurementPrefix::One(), 3);
|
static CMassUnit t("tonne", "t", false, false, 1000.0, CMeasurementPrefix::One(), 3);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Pound, aka mass pound
|
* \brief Pound, aka mass pound
|
||||||
* \return
|
* \return
|
||||||
@@ -316,7 +346,6 @@ public:
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Specialized class for pressure (psi, hPa, bar).
|
* \brief Specialized class for pressure (psi, hPa, bar).
|
||||||
* \author KWB, MS
|
|
||||||
*/
|
*/
|
||||||
class CPressureUnit : public CMeasurementUnit
|
class CPressureUnit : public CMeasurementUnit
|
||||||
{
|
{
|
||||||
@@ -343,6 +372,7 @@ public:
|
|||||||
{
|
{
|
||||||
// void
|
// void
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Pascal
|
* \brief Pascal
|
||||||
* \return
|
* \return
|
||||||
@@ -352,6 +382,7 @@ public:
|
|||||||
static CPressureUnit Pa("pascal", "Pa", true);
|
static CPressureUnit Pa("pascal", "Pa", true);
|
||||||
return Pa;
|
return Pa;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Hectopascal
|
* \brief Hectopascal
|
||||||
* \return
|
* \return
|
||||||
@@ -361,6 +392,7 @@ public:
|
|||||||
static CPressureUnit hPa("hectopascal", "hPa", true, CMeasurementPrefix::h().getFactor(), CMeasurementPrefix::h());
|
static CPressureUnit hPa("hectopascal", "hPa", true, CMeasurementPrefix::h().getFactor(), CMeasurementPrefix::h());
|
||||||
return hPa;
|
return hPa;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Pounds per square inch
|
* \brief Pounds per square inch
|
||||||
* \return
|
* \return
|
||||||
@@ -370,6 +402,7 @@ public:
|
|||||||
static CPressureUnit psi("pounds per square inch", "psi", false, 6894.8, CMeasurementPrefix::One(), 2);
|
static CPressureUnit psi("pounds per square inch", "psi", false, 6894.8, CMeasurementPrefix::One(), 2);
|
||||||
return psi;
|
return psi;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Bar
|
* \brief Bar
|
||||||
* \return
|
* \return
|
||||||
@@ -379,6 +412,7 @@ public:
|
|||||||
static CPressureUnit bar("bar", "bar", false, 1E5);
|
static CPressureUnit bar("bar", "bar", false, 1E5);
|
||||||
return bar;
|
return bar;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Millibar, actually the same as hPa
|
* \brief Millibar, actually the same as hPa
|
||||||
* \return
|
* \return
|
||||||
@@ -388,6 +422,7 @@ public:
|
|||||||
static CPressureUnit bar("bar", "bar", false, 1E2);
|
static CPressureUnit bar("bar", "bar", false, 1E2);
|
||||||
return bar;
|
return bar;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Inch of mercury at 0°C
|
* \brief Inch of mercury at 0°C
|
||||||
* \return
|
* \return
|
||||||
@@ -397,6 +432,7 @@ public:
|
|||||||
static CPressureUnit inhg("Inch of mercury 0°C", "inHg", false, 3386.389);
|
static CPressureUnit inhg("Inch of mercury 0°C", "inHg", false, 3386.389);
|
||||||
return inhg;
|
return inhg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Inch of mercury for flight level 29,92inHg = 1013,25mbar = 1013,25hPa
|
* \brief Inch of mercury for flight level 29,92inHg = 1013,25mbar = 1013,25hPa
|
||||||
* \return
|
* \return
|
||||||
@@ -410,7 +446,6 @@ public:
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Specialized class for temperatur units (kelvin, centidegree).
|
* \brief Specialized class for temperatur units (kelvin, centidegree).
|
||||||
* \author KWB
|
|
||||||
*/
|
*/
|
||||||
class CTemperatureUnit : public CMeasurementUnit
|
class CTemperatureUnit : public CMeasurementUnit
|
||||||
{
|
{
|
||||||
@@ -438,18 +473,21 @@ protected:
|
|||||||
* \return
|
* \return
|
||||||
*/
|
*/
|
||||||
virtual double CTemperatureUnit::conversionToSiConversionUnit(double value) const;
|
virtual double CTemperatureUnit::conversionToSiConversionUnit(double value) const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Convert from SI conversion unit, specific for temperature
|
* \brief Convert from SI conversion unit, specific for temperature
|
||||||
* \param value
|
* \param value
|
||||||
* \return
|
* \return
|
||||||
*/
|
*/
|
||||||
virtual double CTemperatureUnit::conversionFromSiConversionUnit(double value) const;
|
virtual double CTemperatureUnit::conversionFromSiConversionUnit(double value) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
* \brief Copy constructor
|
* \brief Copy constructor
|
||||||
* \param otherUnit
|
* \param otherUnit
|
||||||
*/
|
*/
|
||||||
CTemperatureUnit(const CTemperatureUnit &otherUnit) : CMeasurementUnit(otherUnit), m_conversionOffsetToSi(otherUnit.m_conversionOffsetToSi) {}
|
CTemperatureUnit(const CTemperatureUnit &otherUnit) : CMeasurementUnit(otherUnit), m_conversionOffsetToSi(otherUnit.m_conversionOffsetToSi) {}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Assigment operator
|
* Assigment operator
|
||||||
*/
|
*/
|
||||||
@@ -460,6 +498,7 @@ public:
|
|||||||
this->m_conversionOffsetToSi = otherUnit.m_conversionOffsetToSi;
|
this->m_conversionOffsetToSi = otherUnit.m_conversionOffsetToSi;
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Kelvin
|
* \brief Kelvin
|
||||||
* \return
|
* \return
|
||||||
@@ -469,6 +508,7 @@ public:
|
|||||||
static CTemperatureUnit K("Kelvin", "K", true, true);
|
static CTemperatureUnit K("Kelvin", "K", true, true);
|
||||||
return K;
|
return K;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Centigrade C
|
* \brief Centigrade C
|
||||||
* \return
|
* \return
|
||||||
@@ -478,6 +518,7 @@ public:
|
|||||||
static CTemperatureUnit C("centigrade", "°C", false, false, 1.0, 273.15);
|
static CTemperatureUnit C("centigrade", "°C", false, false, 1.0, 273.15);
|
||||||
return C;
|
return C;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Fahrenheit F
|
* \brief Fahrenheit F
|
||||||
* \return
|
* \return
|
||||||
@@ -491,7 +532,6 @@ public:
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Specialized class for speed units (m/s, ft/s, NM/h).
|
* \brief Specialized class for speed units (m/s, ft/s, NM/h).
|
||||||
* \author KWB
|
|
||||||
*/
|
*/
|
||||||
class CSpeedUnit : public CMeasurementUnit
|
class CSpeedUnit : public CMeasurementUnit
|
||||||
{
|
{
|
||||||
@@ -516,6 +556,7 @@ public:
|
|||||||
* \param otherUnit
|
* \param otherUnit
|
||||||
*/
|
*/
|
||||||
CSpeedUnit(const CSpeedUnit &otherUnit) : CMeasurementUnit(otherUnit) {}
|
CSpeedUnit(const CSpeedUnit &otherUnit) : CMeasurementUnit(otherUnit) {}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Meter/second m/s
|
* \brief Meter/second m/s
|
||||||
* \return
|
* \return
|
||||||
@@ -525,6 +566,7 @@ public:
|
|||||||
static CSpeedUnit ms("meters/second", "m/s", true, false);
|
static CSpeedUnit ms("meters/second", "m/s", true, false);
|
||||||
return ms;
|
return ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Knots
|
* \brief Knots
|
||||||
* \return
|
* \return
|
||||||
@@ -534,6 +576,7 @@ public:
|
|||||||
static CSpeedUnit kts("knot", "kts", false, false, 1852.0 / 3600.0, CMeasurementPrefix::One(), 1);
|
static CSpeedUnit kts("knot", "kts", false, false, 1852.0 / 3600.0, CMeasurementPrefix::One(), 1);
|
||||||
return kts;
|
return kts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Nautical miles per hour NM/h (same as kts)
|
* \brief Nautical miles per hour NM/h (same as kts)
|
||||||
* \return
|
* \return
|
||||||
@@ -543,6 +586,7 @@ public:
|
|||||||
static CSpeedUnit NMh("nautical miles/hour", "NM/h", false, false, 1852.0 / 3600.0, CMeasurementPrefix::One(), 1);
|
static CSpeedUnit NMh("nautical miles/hour", "NM/h", false, false, 1852.0 / 3600.0, CMeasurementPrefix::One(), 1);
|
||||||
return NMh;
|
return NMh;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Feet/second ft/s
|
* \brief Feet/second ft/s
|
||||||
* \return
|
* \return
|
||||||
@@ -552,6 +596,7 @@ public:
|
|||||||
static CSpeedUnit fts("feet/seconds", "ft/s", false, false, 0.3048, CMeasurementPrefix::One(), 0);
|
static CSpeedUnit fts("feet/seconds", "ft/s", false, false, 0.3048, CMeasurementPrefix::One(), 0);
|
||||||
return fts;
|
return fts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Feet/min ft/min
|
* \brief Feet/min ft/min
|
||||||
* \return
|
* \return
|
||||||
@@ -561,6 +606,7 @@ public:
|
|||||||
static CSpeedUnit ftmin("feet/minute", "ft/min", false, false, 0.3048 / 60.0, CMeasurementPrefix::One(), 0);
|
static CSpeedUnit ftmin("feet/minute", "ft/min", false, false, 0.3048 / 60.0, CMeasurementPrefix::One(), 0);
|
||||||
return ftmin;
|
return ftmin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Kilometer/hour km/h
|
* \brief Kilometer/hour km/h
|
||||||
* \return
|
* \return
|
||||||
@@ -574,7 +620,6 @@ public:
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Specialized class for time units (ms, hour, min).
|
* \brief Specialized class for time units (ms, hour, min).
|
||||||
* \author KWB
|
|
||||||
*/
|
*/
|
||||||
class CTimeUnit : public CMeasurementUnit
|
class CTimeUnit : public CMeasurementUnit
|
||||||
{
|
{
|
||||||
@@ -594,11 +639,13 @@ private:
|
|||||||
CTimeUnit(const QString &name, const QString &unitName, bool isSiUnit, bool isSIBaseUnit, double conversionFactorToSI = 1.0, const CMeasurementPrefix &mulitplier = CMeasurementPrefix::One(), qint32 displayDigits = 2, double epsilon = 1E-9) :
|
CTimeUnit(const QString &name, const QString &unitName, bool isSiUnit, bool isSIBaseUnit, double conversionFactorToSI = 1.0, const CMeasurementPrefix &mulitplier = CMeasurementPrefix::One(), qint32 displayDigits = 2, double epsilon = 1E-9) :
|
||||||
CMeasurementUnit(name, unitName, "time", isSiUnit, isSIBaseUnit, conversionFactorToSI, mulitplier, displayDigits, epsilon) {}
|
CMeasurementUnit(name, unitName, "time", isSiUnit, isSIBaseUnit, conversionFactorToSI, mulitplier, displayDigits, epsilon) {}
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Constructor, allows to implement methods in base class
|
* Constructor, allows to implement methods in base class
|
||||||
* \param otherUnit
|
* \param otherUnit
|
||||||
*/
|
*/
|
||||||
CTimeUnit(const CTimeUnit &otherUnit) : CMeasurementUnit(otherUnit) {}
|
CTimeUnit(const CTimeUnit &otherUnit) : CMeasurementUnit(otherUnit) {}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Second s
|
* \brief Second s
|
||||||
* \return
|
* \return
|
||||||
@@ -608,6 +655,7 @@ public:
|
|||||||
static CTimeUnit s("second", "s", true, true, 1, CMeasurementPrefix::None(), 1);
|
static CTimeUnit s("second", "s", true, true, 1, CMeasurementPrefix::None(), 1);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Millisecond ms
|
* \brief Millisecond ms
|
||||||
* \return
|
* \return
|
||||||
@@ -617,6 +665,7 @@ public:
|
|||||||
static CTimeUnit ms("millisecond", "ms", true, false, 1E-03, CMeasurementPrefix::m(), 0);
|
static CTimeUnit ms("millisecond", "ms", true, false, 1E-03, CMeasurementPrefix::m(), 0);
|
||||||
return ms;
|
return ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Hour
|
* \brief Hour
|
||||||
* \return
|
* \return
|
||||||
@@ -626,6 +675,7 @@ public:
|
|||||||
static CTimeUnit h("hour", "h", false, false, 3600, CMeasurementPrefix::None(), 1);
|
static CTimeUnit h("hour", "h", false, false, 3600, CMeasurementPrefix::None(), 1);
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Minute
|
* \brief Minute
|
||||||
* \return
|
* \return
|
||||||
@@ -635,6 +685,7 @@ public:
|
|||||||
static CTimeUnit min("minute", "min", false, false, 60, CMeasurementPrefix::None(), 2);
|
static CTimeUnit min("minute", "min", false, false, 60, CMeasurementPrefix::None(), 2);
|
||||||
return min;
|
return min;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Day
|
* \brief Day
|
||||||
* \return
|
* \return
|
||||||
@@ -647,6 +698,56 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Specialized class for acceleration units (m/s2, ft/s2).
|
||||||
|
*/
|
||||||
|
class CAccelerationUnit : public CMeasurementUnit
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/*!
|
||||||
|
* Constructor
|
||||||
|
* \brief Acceleration unit constructor
|
||||||
|
* \param name
|
||||||
|
* \param unitName
|
||||||
|
* \param isSiUnit
|
||||||
|
* \param isSIBaseUnit
|
||||||
|
* \param conversionFactorToSI
|
||||||
|
* \param mulitplier
|
||||||
|
* \param displayDigits
|
||||||
|
* \param epsilon
|
||||||
|
*/
|
||||||
|
CAccelerationUnit(const QString &name, const QString &unitName, bool isSiUnit, bool isSIBaseUnit, double conversionFactorToSI = 1.0, const CMeasurementPrefix &mulitplier = CMeasurementPrefix::One(), qint32 displayDigits = 2, double epsilon = 1E-9) :
|
||||||
|
CMeasurementUnit(name, unitName, "time", isSiUnit, isSIBaseUnit, conversionFactorToSI, mulitplier, displayDigits, epsilon) {}
|
||||||
|
public:
|
||||||
|
/*!
|
||||||
|
* Constructor, allows to implement methods in base class
|
||||||
|
* \param otherUnit
|
||||||
|
*/
|
||||||
|
CAccelerationUnit(const CAccelerationUnit &otherUnit) : CMeasurementUnit(otherUnit) {}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Meter/second^2 (m/s^2)
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
static const CAccelerationUnit &m_s2()
|
||||||
|
{
|
||||||
|
static CAccelerationUnit ms2("meter/second^2", "m/s^2", true, false, 1, CMeasurementPrefix::None(), 1);
|
||||||
|
return ms2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Feet/second^2
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
static const CAccelerationUnit &ft_s2()
|
||||||
|
{
|
||||||
|
static CAccelerationUnit fts2("feet/seconds^s", "ft/s^2", true, false, 3.28084, CMeasurementPrefix::m(), 0);
|
||||||
|
return fts2;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
Reference in New Issue
Block a user