mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 08:45:36 +08:00
refs #396 move Blackmisc PQ classes into subfolder
This commit is contained in:
committed by
Roland Winklmeier
parent
0ab755d510
commit
2363fab8c1
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "blackmisc/aviation/aircraft.h"
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
#include "blackmisc/pqconstants.h"
|
||||
#include "blackmisc/pq/constants.h"
|
||||
#include "blackmisc/icon.h"
|
||||
#include "blackmisc/propertyindex.h"
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "blackmisc/aviation/altitude.h"
|
||||
#include "blackmisc/aviation/heading.h"
|
||||
#include "blackmisc/aviation/callsign.h"
|
||||
#include "blackmisc/pqspeed.h"
|
||||
#include "blackmisc/pq/speed.h"
|
||||
#include "blackmisc/valueobject.h"
|
||||
#include <QDateTime>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "blackmisc/aviation/altitude.h"
|
||||
#include "blackmisc/pqstring.h"
|
||||
#include "blackmisc/pq/pqstring.h"
|
||||
#include "blackmisc/iconlist.h"
|
||||
|
||||
using BlackMisc::PhysicalQuantities::CLength;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#ifndef BLACKMISC_AVIATION_ALTITUDE_H
|
||||
#define BLACKMISC_AVIATION_ALTITUDE_H
|
||||
|
||||
#include "blackmisc/pqlength.h"
|
||||
#include "blackmisc/pq/length.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
#include "blackmisc/aviation/callsign.h"
|
||||
#include "blackmisc/nwuser.h"
|
||||
#include "blackmisc/geo/coordinategeodetic.h"
|
||||
#include "blackmisc/pqfrequency.h"
|
||||
#include "blackmisc/pqlength.h"
|
||||
#include "blackmisc/pqtime.h"
|
||||
#include "blackmisc/pq/frequency.h"
|
||||
#include "blackmisc/pq/length.h"
|
||||
#include "blackmisc/pq/time.h"
|
||||
#include <QDateTime>
|
||||
#include <QMap>
|
||||
#include <functional>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
//! \file
|
||||
|
||||
#include "blackmisc/valueobject.h"
|
||||
#include "blackmisc/pqconstants.h"
|
||||
#include "blackmisc/pq/constants.h"
|
||||
#include <QtGlobal>
|
||||
|
||||
namespace BlackMisc
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
#include "blackmisc/valueobject.h"
|
||||
#include "blackmisc/aviation/altitude.h"
|
||||
#include "blackmisc/aviation/airporticao.h"
|
||||
#include "blackmisc/pqtime.h"
|
||||
#include "blackmisc/pqspeed.h"
|
||||
#include "blackmisc/pq/time.h"
|
||||
#include "blackmisc/pq/speed.h"
|
||||
#include <QDateTime>
|
||||
|
||||
namespace BlackMisc
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#ifndef BLACKMISC_AVIATION_HEADING_H
|
||||
#define BLACKMISC_AVIATION_HEADING_H
|
||||
|
||||
#include "blackmisc/pqangle.h"
|
||||
#include "blackmisc/pq/angle.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#ifndef BLACKMISC_AVIATION_SELCAL_H
|
||||
#define BLACKMISC_AVIATION_SELCAL_H
|
||||
|
||||
#include "blackmisc/pqfrequency.h"
|
||||
#include "blackmisc/pq/frequency.h"
|
||||
#include "blackmisc/valueobject.h"
|
||||
|
||||
namespace BlackMisc
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#ifndef BLACKMISC_AVIATION_TRACK_H
|
||||
#define BLACKMISC_AVIATION_TRACK_H
|
||||
|
||||
#include "blackmisc/pqangle.h"
|
||||
#include "blackmisc/pq/angle.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
@@ -23,11 +23,6 @@
|
||||
* \brief Position handling as geo locations and coordinates systems.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \namespace BlackMisc::PhysicalQuantities
|
||||
* \brief Classes for physical quantities and units such as length, mass, speed.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \namespace BlackMisc::Network
|
||||
* \brief Classes related to the traffic network such as VATSIM user etc.
|
||||
|
||||
@@ -24,6 +24,7 @@ TRANSLATIONS += translations/blackmisc_i18n_de.ts \
|
||||
translations/blackmisc_i18n_en.ts
|
||||
|
||||
HEADERS += *.h \
|
||||
$$PWD/pq/*.h \
|
||||
$$PWD/aviation/*.h \
|
||||
$$PWD/math/*.h \
|
||||
$$PWD/geo/*.h \
|
||||
@@ -33,6 +34,7 @@ HEADERS += *.h \
|
||||
$$PWD/simulation/fsx\*.h
|
||||
|
||||
SOURCES += *.cpp \
|
||||
$$PWD/pq/*.cpp \
|
||||
$$PWD/aviation/*.cpp \
|
||||
$$PWD/math/*.cpp \
|
||||
$$PWD/geo/*.cpp \
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "blackmiscfreefunctions.h"
|
||||
#include "blackmisc/aviation/aviation.h"
|
||||
#include "pqallquantities.h"
|
||||
#include "blackmisc/pq/pq.h"
|
||||
#include "math/math.h"
|
||||
#include "geo/geo.h"
|
||||
#include "networkallclasses.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "blackmiscfreefunctions.h"
|
||||
#include "pqallquantities.h"
|
||||
#include "blackmisc/pq/pq.h"
|
||||
|
||||
/*
|
||||
* Metadata for PQs
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "blackmisc/geo/latitude.h"
|
||||
#include "blackmisc/geo/longitude.h"
|
||||
#include "blackmisc/pqlength.h"
|
||||
#include "blackmisc/pq/length.h"
|
||||
#include "blackmisc/propertyindex.h"
|
||||
|
||||
namespace BlackMisc
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#ifndef BLACKMISC_GEO_EARTHANGLE_H
|
||||
#define BLACKMISC_GEO_EARTHANGLE_H
|
||||
|
||||
#include "blackmisc/pqangle.h"
|
||||
#include "blackmisc/pq/angle.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "icon.h"
|
||||
#include "pqangle.h"
|
||||
#include "blackmisc/pq/angle.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "nwtextmessage.h"
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
#include "blackmisc/pqconstants.h"
|
||||
#include "blackmisc/pq/constants.h"
|
||||
#include "blackmisc/aviation/comsystem.h"
|
||||
#include "blackmisc/aviation/callsign.h"
|
||||
#include "blackmisc/aviation/selcal.h"
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#define BLACKMISC_TEXTMESSAGE_H
|
||||
|
||||
#include "blackmisc/timestampbased.h"
|
||||
#include "pqfrequency.h"
|
||||
#include "blackmisc/pq/frequency.h"
|
||||
#include "blackmisc/aviation/callsign.h"
|
||||
#include "statusmessage.h"
|
||||
#include "valueobject.h"
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_PQACCELERATION_H
|
||||
#define BLACKMISC_PQACCELERATION_H
|
||||
#ifndef BLACKMISC_PQ_ACCELERATION_H
|
||||
#define BLACKMISC_PQ_ACCELERATION_H
|
||||
|
||||
#include "blackmisc/pqphysicalquantity.h"
|
||||
#include "blackmisc/pq/physicalquantity.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -7,8 +7,8 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "iconlist.h"
|
||||
#include "pqangle.h"
|
||||
#include "blackmisc/iconlist.h"
|
||||
#include "blackmisc/pq/angle.h"
|
||||
#include "blackmisc/aviation/heading.h"
|
||||
|
||||
namespace BlackMisc
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_PQANGLE_H
|
||||
#define BLACKMISC_PQANGLE_H
|
||||
#ifndef BLACKMISC_PQ_ANGLE_H
|
||||
#define BLACKMISC_PQ_ANGLE_H
|
||||
|
||||
#include "blackmisc/pqphysicalquantity.h"
|
||||
#include "blackmisc/pq/physicalquantity.h"
|
||||
#include "blackmisc/math/mathutils.h"
|
||||
|
||||
namespace BlackMisc
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_PQCONSTANTS_H
|
||||
#define BLACKMISC_PQCONSTANTS_H
|
||||
#ifndef BLACKMISC_PQ_CONSTANTS_H
|
||||
#define BLACKMISC_PQ_CONSTANTS_H
|
||||
|
||||
#include "blackmisc/pqallquantities.h"
|
||||
#include "blackmisc/pq/pq.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_PQFREQUENCY_H
|
||||
#define BLACKMISC_PQFREQUENCY_H
|
||||
#ifndef BLACKMISC_PQ_FREQUENCY_H
|
||||
#define BLACKMISC_PQ_FREQUENCY_H
|
||||
|
||||
#include "pqphysicalquantity.h"
|
||||
#include "blackmisc/pq/physicalquantity.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_PQLENGTH_H
|
||||
#define BLACKMISC_PQLENGTH_H
|
||||
#ifndef BLACKMISC_PQ_LENGTH_H
|
||||
#define BLACKMISC_PQ_LENGTH_H
|
||||
|
||||
#include "blackmisc/pqphysicalquantity.h"
|
||||
#include "blackmisc/pq/physicalquantity.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_PQMASS_H
|
||||
#define BLACKMISC_PQMASS_H
|
||||
#ifndef BLACKMISC_PQ_MASS_H
|
||||
#define BLACKMISC_PQ_MASS_H
|
||||
|
||||
#include "blackmisc/pqphysicalquantity.h"
|
||||
#include "blackmisc/pq/physicalquantity.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#include "blackmisc/pqbase.h"
|
||||
#include "blackmisc/pq/measurementunit.h"
|
||||
#include "blackmisc/math/mathutils.h"
|
||||
|
||||
using namespace BlackMisc::Math;
|
||||
@@ -18,26 +18,18 @@ namespace BlackMisc
|
||||
{
|
||||
namespace PhysicalQuantities
|
||||
{
|
||||
/*
|
||||
* Equal operator
|
||||
*/
|
||||
|
||||
bool CMeasurementUnit::operator ==(const CMeasurementUnit &other) const
|
||||
{
|
||||
if (this == &other) return true;
|
||||
return this->m_name == other.m_name;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unequal operator
|
||||
*/
|
||||
bool CMeasurementUnit::operator !=(const CMeasurementUnit &other) const
|
||||
{
|
||||
return !(other == *this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Conversion
|
||||
*/
|
||||
double CMeasurementUnit::convertFrom(double value, const CMeasurementUnit &unit) const
|
||||
{
|
||||
if (this->isNull() || unit.isNull()) return 0;
|
||||
@@ -45,27 +37,17 @@ namespace BlackMisc
|
||||
return this->m_converter->fromDefault(unit.m_converter->toDefault(value));
|
||||
}
|
||||
|
||||
/*
|
||||
* Value to QString with unit, e.g. "5.00m"
|
||||
* @return
|
||||
*/
|
||||
QString CMeasurementUnit::makeRoundedQStringWithUnit(double value, int digits, bool i18n) const
|
||||
{
|
||||
return this->makeRoundedQString(value, digits).append(this->getSymbol(i18n));
|
||||
}
|
||||
|
||||
/*
|
||||
* Value rounded
|
||||
*/
|
||||
double CMeasurementUnit::roundValue(double value, int digits) const
|
||||
{
|
||||
if (digits < 0) digits = this->m_displayDigits;
|
||||
return CMathUtils::round(value, digits);
|
||||
}
|
||||
|
||||
/*
|
||||
* Rounded to QString
|
||||
*/
|
||||
QString CMeasurementUnit::makeRoundedQString(double value, int digits, bool /* i18n */) const
|
||||
{
|
||||
if (digits < 0) digits = this->m_displayDigits;
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_PQBASE_H
|
||||
#define BLACKMISC_PQBASE_H
|
||||
#ifndef BLACKMISC_PQ_MEASUREMENTUNIT_H
|
||||
#define BLACKMISC_PQ_MEASUREMENTUNIT_H
|
||||
|
||||
#include "blackmisc/valueobject.h"
|
||||
#include "blackmisc/math/mathutils.h"
|
||||
@@ -7,8 +7,8 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackmisc/pqallquantities.h"
|
||||
#include "blackmiscfreefunctions.h"
|
||||
#include "blackmisc/pq/pq.h"
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
#include <QCoreApplication>
|
||||
|
||||
namespace BlackMisc
|
||||
@@ -16,18 +16,10 @@ namespace BlackMisc
|
||||
namespace PhysicalQuantities
|
||||
{
|
||||
|
||||
/*
|
||||
* Constructor by double
|
||||
*/
|
||||
template <class MU, class PQ> CPhysicalQuantity<MU, PQ>::CPhysicalQuantity(double value, const MU &unit) :
|
||||
m_value(unit.isNull() ? 0.0 : value), m_unit(unit)
|
||||
{
|
||||
// void
|
||||
}
|
||||
{ }
|
||||
|
||||
/*
|
||||
* Equal operator ==
|
||||
*/
|
||||
template <class MU, class PQ> bool CPhysicalQuantity<MU, PQ>::operator ==(const CPhysicalQuantity<MU, PQ> &other) const
|
||||
{
|
||||
if (this == &other) return true;
|
||||
@@ -39,26 +31,17 @@ namespace BlackMisc
|
||||
return diff <= this->m_unit.getEpsilon();
|
||||
}
|
||||
|
||||
/*
|
||||
* Not equal
|
||||
*/
|
||||
template <class MU, class PQ> bool CPhysicalQuantity<MU, PQ>::operator !=(const CPhysicalQuantity<MU, PQ> &other) const
|
||||
{
|
||||
return !((*this) == other);
|
||||
}
|
||||
|
||||
/*
|
||||
* Plus operator
|
||||
*/
|
||||
template <class MU, class PQ> CPhysicalQuantity<MU, PQ> &CPhysicalQuantity<MU, PQ>::operator +=(const CPhysicalQuantity<MU, PQ> &other)
|
||||
{
|
||||
this->m_value += other.value(this->m_unit);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*
|
||||
* Plus operator
|
||||
*/
|
||||
template <class MU, class PQ> PQ CPhysicalQuantity<MU, PQ>::operator +(const PQ &other) const
|
||||
{
|
||||
PQ copy(other);
|
||||
@@ -66,34 +49,22 @@ namespace BlackMisc
|
||||
return copy;
|
||||
}
|
||||
|
||||
/*
|
||||
* Explicit plus
|
||||
*/
|
||||
template <class MU, class PQ> void CPhysicalQuantity<MU, PQ>::addValueSameUnit(double value)
|
||||
{
|
||||
this->m_value += value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Explicit minus
|
||||
*/
|
||||
template <class MU, class PQ> void CPhysicalQuantity<MU, PQ>::substractValueSameUnit(double value)
|
||||
{
|
||||
this->m_value -= value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Minus operator
|
||||
*/
|
||||
template <class MU, class PQ> CPhysicalQuantity<MU, PQ> &CPhysicalQuantity<MU, PQ>::operator -=(const CPhysicalQuantity<MU, PQ> &other)
|
||||
{
|
||||
this->m_value -= other.value(this->m_unit);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*
|
||||
* Minus operator
|
||||
*/
|
||||
template <class MU, class PQ> PQ CPhysicalQuantity<MU, PQ>::operator -(const PQ &other) const
|
||||
{
|
||||
PQ copy = *derived();
|
||||
@@ -101,9 +72,6 @@ namespace BlackMisc
|
||||
return copy;
|
||||
}
|
||||
|
||||
/*
|
||||
* Marshall
|
||||
*/
|
||||
template <class MU, class PQ> void CPhysicalQuantity<MU, PQ>::marshallToDbus(QDBusArgument &argument) const
|
||||
{
|
||||
argument << this->value(UnitClass::defaultUnit());
|
||||
@@ -111,9 +79,6 @@ namespace BlackMisc
|
||||
argument << this->m_unit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unmarshall
|
||||
*/
|
||||
template <class MU, class PQ> void CPhysicalQuantity<MU, PQ>::unmarshallFromDbus(const QDBusArgument &argument)
|
||||
{
|
||||
double ignore;
|
||||
@@ -122,18 +87,12 @@ namespace BlackMisc
|
||||
argument >> this->m_unit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Multiply operator
|
||||
*/
|
||||
template <class MU, class PQ> CPhysicalQuantity<MU, PQ> &CPhysicalQuantity<MU, PQ>::operator *=(double factor)
|
||||
{
|
||||
this->m_value *= factor;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*
|
||||
* Multiply operator
|
||||
*/
|
||||
template <class MU, class PQ> PQ CPhysicalQuantity<MU, PQ>::operator *(double factor) const
|
||||
{
|
||||
PQ copy = *derived();
|
||||
@@ -141,18 +100,12 @@ namespace BlackMisc
|
||||
return copy;
|
||||
}
|
||||
|
||||
/*
|
||||
* Divide operator /=
|
||||
*/
|
||||
template <class MU, class PQ> CPhysicalQuantity<MU, PQ> &CPhysicalQuantity<MU, PQ>::operator /=(double divisor)
|
||||
{
|
||||
this->m_value /= divisor;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*
|
||||
* Divide operator /
|
||||
*/
|
||||
template <class MU, class PQ> PQ CPhysicalQuantity<MU, PQ>::operator /(double divisor) const
|
||||
{
|
||||
PQ copy = *derived();
|
||||
@@ -160,9 +113,6 @@ namespace BlackMisc
|
||||
return copy;
|
||||
}
|
||||
|
||||
/*
|
||||
* Less operator <
|
||||
*/
|
||||
template <class MU, class PQ> bool CPhysicalQuantity<MU, PQ>::operator <(const CPhysicalQuantity<MU, PQ> &other) const
|
||||
{
|
||||
if (*this == other) return false;
|
||||
@@ -171,35 +121,23 @@ namespace BlackMisc
|
||||
return (this->m_value < other.value(this->m_unit));
|
||||
}
|
||||
|
||||
/*
|
||||
* Greater than
|
||||
*/
|
||||
template <class MU, class PQ> bool CPhysicalQuantity<MU, PQ>::operator >(const CPhysicalQuantity<MU, PQ> &other) const
|
||||
{
|
||||
return other < *this;
|
||||
}
|
||||
|
||||
/*
|
||||
* Greater / Equal
|
||||
*/
|
||||
template <class MU, class PQ> bool CPhysicalQuantity<MU, PQ>::operator >=(const CPhysicalQuantity<MU, PQ> &other) const
|
||||
{
|
||||
if (*this == other) return true;
|
||||
return *this > other;
|
||||
}
|
||||
|
||||
/*
|
||||
* Less equal
|
||||
*/
|
||||
template <class MU, class PQ> bool CPhysicalQuantity<MU, PQ>::operator <=(const CPhysicalQuantity<MU, PQ> &other) const
|
||||
{
|
||||
if (*this == other) return true;
|
||||
return *this < other;
|
||||
}
|
||||
|
||||
/*
|
||||
* Switch to another unit
|
||||
*/
|
||||
template <class MU, class PQ> PQ &CPhysicalQuantity<MU, PQ>::switchUnit(const MU &newUnit)
|
||||
{
|
||||
if (this->m_unit != newUnit)
|
||||
@@ -210,33 +148,21 @@ namespace BlackMisc
|
||||
return *derived();
|
||||
}
|
||||
|
||||
/*
|
||||
* Init by double
|
||||
*/
|
||||
template <class MU, class PQ> void CPhysicalQuantity<MU, PQ>::setValueSameUnit(double baseValue)
|
||||
{
|
||||
this->m_value = baseValue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Value rounded in unit
|
||||
*/
|
||||
template <class MU, class PQ> QString CPhysicalQuantity<MU, PQ>::valueRoundedWithUnit(const MU &unit, int digits, bool i18n) const
|
||||
{
|
||||
return unit.makeRoundedQStringWithUnit(this->value(unit), digits, i18n);
|
||||
}
|
||||
|
||||
/*
|
||||
* Value rounded in unit
|
||||
*/
|
||||
template <class MU, class PQ> double CPhysicalQuantity<MU, PQ>::valueRounded(const MU &unit, int digits) const
|
||||
{
|
||||
return unit.roundValue(this->value(unit), digits);
|
||||
}
|
||||
|
||||
/*
|
||||
* Value rounded as integer
|
||||
*/
|
||||
template <class MU, class PQ> int CPhysicalQuantity<MU, PQ>::valueInteger(const MU &unit) const
|
||||
{
|
||||
double v = unit.roundValue(this->value(unit), 0);
|
||||
@@ -248,17 +174,11 @@ namespace BlackMisc
|
||||
return this->valueRounded(this->m_unit, digits);
|
||||
}
|
||||
|
||||
/*
|
||||
* Value in unit
|
||||
*/
|
||||
template <class MU, class PQ> double CPhysicalQuantity<MU, PQ>::value(const MU &unit) const
|
||||
{
|
||||
return unit.convertFrom(this->m_value, this->m_unit);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert to string
|
||||
*/
|
||||
template <class MU, class PQ> QString CPhysicalQuantity<MU, PQ>::convertToQString(bool i18n) const
|
||||
{
|
||||
if (this->isNull())
|
||||
@@ -268,9 +188,6 @@ namespace BlackMisc
|
||||
return this->valueRoundedWithUnit(this->getUnit(), -1, i18n);
|
||||
}
|
||||
|
||||
/*
|
||||
* Hash
|
||||
*/
|
||||
template <class MU, class PQ> uint CPhysicalQuantity<MU, PQ>::getValueHash() const
|
||||
{
|
||||
QList<uint> hashs;
|
||||
@@ -280,9 +197,6 @@ namespace BlackMisc
|
||||
return BlackMisc::calculateHash(hashs, "PQ");
|
||||
}
|
||||
|
||||
/*
|
||||
* JSON Object
|
||||
*/
|
||||
template <class MU, class PQ> QJsonObject CPhysicalQuantity<MU, PQ>::toJson() const
|
||||
{
|
||||
QJsonObject json;
|
||||
@@ -291,9 +205,6 @@ namespace BlackMisc
|
||||
return json;
|
||||
}
|
||||
|
||||
/*
|
||||
* JSON Object
|
||||
*/
|
||||
template <class MU, class PQ> void CPhysicalQuantity<MU, PQ>::convertFromJson(const QJsonObject &json)
|
||||
{
|
||||
const QString unitSymbol = json.value("unit").toString();
|
||||
@@ -301,9 +212,6 @@ namespace BlackMisc
|
||||
this->m_value = json.value("value").toDouble();
|
||||
}
|
||||
|
||||
/*
|
||||
* Property
|
||||
*/
|
||||
template <class MU, class PQ> CVariant CPhysicalQuantity<MU, PQ>::propertyByIndex(const CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
@@ -329,9 +237,6 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Property
|
||||
*/
|
||||
template <class MU, class PQ> void CPhysicalQuantity<MU, PQ>::setPropertyByIndex(const CVariant &variant, const CPropertyIndex &index)
|
||||
{
|
||||
if (index.isMyself())
|
||||
@@ -361,9 +266,6 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Compare
|
||||
*/
|
||||
template <class MU, class PQ> int CPhysicalQuantity<MU, PQ>::compareImpl(const PQ &a, const PQ &b)
|
||||
{
|
||||
if (a.isNull() > b.isNull()) { return -1; }
|
||||
@@ -9,14 +9,14 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_PQPHYSICALQUANTITY_H
|
||||
#define BLACKMISC_PQPHYSICALQUANTITY_H
|
||||
#ifndef BLACKMISC_PQ_PHYSICALQUANTITY_H
|
||||
#define BLACKMISC_PQ_PHYSICALQUANTITY_H
|
||||
|
||||
#include "blackmisc/pqbase.h"
|
||||
#include "blackmisc/pqunits.h"
|
||||
#include "blackmisc/pq/measurementunit.h"
|
||||
#include "blackmisc/pq/units.h"
|
||||
#include "blackmisc/propertyindex.h"
|
||||
#include "blackmisc/math/mathutils.h"
|
||||
#include "blackmisc/pqstring.h"
|
||||
#include "blackmisc/pq/pqstring.h"
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
#include <QtDBus/QDBusMetaType>
|
||||
#include <QtGlobal>
|
||||
34
src/blackmisc/pq/pq.h
Normal file
34
src/blackmisc/pq/pq.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/* Copyright (C) 2013
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef BLACKMISC_PQ_PQ_H
|
||||
#define BLACKMISC_PQ_PQ_H
|
||||
|
||||
/*!
|
||||
* \namespace BlackMisc::PhysicalQuantities
|
||||
* \brief Classes for physical quantities and units such as length, mass, speed.
|
||||
*/
|
||||
|
||||
// All units / quantities, required for the instantiations of the template
|
||||
// especially as CRTP (Curiously recurring template pattern) is used.
|
||||
// http://www.parashift.com/c++-faq-lite/separate-template-fn-defn-from-decl.html
|
||||
// http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern
|
||||
|
||||
#include "blackmisc/pq/length.h"
|
||||
#include "blackmisc/pq/frequency.h"
|
||||
#include "blackmisc/pq/pressure.h"
|
||||
#include "blackmisc/pq/mass.h"
|
||||
#include "blackmisc/pq/speed.h"
|
||||
#include "blackmisc/pq/temperature.h"
|
||||
#include "blackmisc/pq/angle.h"
|
||||
#include "blackmisc/pq/time.h"
|
||||
#include "blackmisc/pq/acceleration.h"
|
||||
#include "blackmisc/pq/pqstring.h"
|
||||
|
||||
#endif // guard
|
||||
@@ -7,26 +7,21 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "pqstring.h"
|
||||
#include "tuple.h"
|
||||
#include "pqallquantities.h"
|
||||
#include "blackmisc/pq/pqstring.h"
|
||||
#include "blackmisc/tuple.h"
|
||||
#include "blackmisc/pq/pq.h"
|
||||
#include <QThreadStorage>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace PhysicalQuantities
|
||||
{
|
||||
/*
|
||||
* Convert to string
|
||||
*/
|
||||
|
||||
QString CPqString::convertToQString(bool /** i18n **/) const
|
||||
{
|
||||
return this->m_string;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse
|
||||
*/
|
||||
CVariant CPqString::parseToVariant(const QString &value, SeparatorMode mode)
|
||||
{
|
||||
CVariant v;
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_PQSTRING_H
|
||||
#define BLACKMISC_PQSTRING_H
|
||||
#ifndef BLACKMISC_PQ_PQSTRING_H
|
||||
#define BLACKMISC_PQ_PQSTRING_H
|
||||
|
||||
#include "blackmisc/valueobject.h"
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_PQPRESSURE_H
|
||||
#define BLACKMISC_PQPRESSURE_H
|
||||
#ifndef BLACKMISC_PQ_PRESSURE_H
|
||||
#define BLACKMISC_PQ_PRESSURE_H
|
||||
|
||||
#include "pqphysicalquantity.h"
|
||||
#include "blackmisc/pq/physicalquantity.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_CSPEED_H
|
||||
#define BLACKMISC_CSPEED_H
|
||||
#ifndef BLACKMISC_PQ_SPEED_H
|
||||
#define BLACKMISC_PQ_SPEED_H
|
||||
|
||||
#include "pqphysicalquantity.h"
|
||||
#include "blackmisc/pq/physicalquantity.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_CTEMPERATURE_H
|
||||
#define BLACKMISC_CTEMPERATURE_H
|
||||
#ifndef BLACKMISC_PQ_TEMPERATURE_H
|
||||
#define BLACKMISC_PQ_TEMPERATURE_H
|
||||
|
||||
#include "pqphysicalquantity.h"
|
||||
#include "blackmisc/pq/physicalquantity.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -7,7 +7,7 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "pqtime.h"
|
||||
#include "blackmisc/pq/time.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_PQTIME_H
|
||||
#define BLACKMISC_PQTIME_H
|
||||
#ifndef BLACKMISC_PQ_TIME_H
|
||||
#define BLACKMISC_PQ_TIME_H
|
||||
|
||||
#include "pqphysicalquantity.h"
|
||||
#include "blackmisc/pq/physicalquantity.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -7,7 +7,7 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackmisc/pqunits.h"
|
||||
#include "blackmisc/pq/units.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -15,9 +15,6 @@ namespace BlackMisc
|
||||
{
|
||||
using BlackMisc::Math::CMathUtils;
|
||||
|
||||
/*
|
||||
* Rounded to QString
|
||||
*/
|
||||
QString CAngleUnit::makeRoundedQStringWithUnit(double value, int digits, bool i18n) const
|
||||
{
|
||||
if (digits < 0) digits = this->getDisplayDigits();
|
||||
@@ -50,9 +47,6 @@ namespace BlackMisc
|
||||
return s;
|
||||
}
|
||||
|
||||
/*
|
||||
* Rounded to QString
|
||||
*/
|
||||
QString CTimeUnit::makeRoundedQStringWithUnit(double value, int digits, bool i18n) const
|
||||
{
|
||||
if (digits < 0) digits = this->getDisplayDigits();
|
||||
@@ -1,21 +1,21 @@
|
||||
/* Copyright (C) 2013
|
||||
//! swift project Community / Contributors
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
//! This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
//! directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
//! including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
//! contained in the LICENSE file.
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_PQUNITS_H
|
||||
#define BLACKMISC_PQUNITS_H
|
||||
#ifndef BLACKMISC_PQ_UNITS_H
|
||||
#define BLACKMISC_PQ_UNITS_H
|
||||
|
||||
#pragma push_macro("min")
|
||||
#undef min
|
||||
|
||||
#include "blackmisc/pqbase.h"
|
||||
#include "blackmisc/pq/measurementunit.h"
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
#include <QtDBus/QDBusArgument>
|
||||
#include <QList>
|
||||
@@ -1,26 +0,0 @@
|
||||
/* 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_PQUNITSALL_H
|
||||
#define BLACKMISC_PQUNITSALL_H
|
||||
|
||||
// All units / quantities, required for the instantiations of the template
|
||||
// especially as CRTP (Curiously recurring template pattern) is used.
|
||||
// http://www.parashift.com/c++-faq-lite/separate-template-fn-defn-from-decl.html
|
||||
// http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern
|
||||
|
||||
#include "blackmisc/pqlength.h"
|
||||
#include "blackmisc/pqfrequency.h"
|
||||
#include "blackmisc/pqpressure.h"
|
||||
#include "blackmisc/pqmass.h"
|
||||
#include "blackmisc/pqspeed.h"
|
||||
#include "blackmisc/pqtemperature.h"
|
||||
#include "blackmisc/pqangle.h"
|
||||
#include "blackmisc/pqtime.h"
|
||||
#include "blackmisc/pqacceleration.h"
|
||||
#include "blackmisc/pqunits.h"
|
||||
#include "blackmisc/pqstring.h"
|
||||
|
||||
#endif // guard
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "simplecommandparser.h"
|
||||
#include "pqstring.h"
|
||||
#include "blackmisc/pq/pqstring.h"
|
||||
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#ifndef BLACKMISC_SIMULATION_FSCOMMON_BCDCONVERSIONS_H
|
||||
#define BLACKMISC_SIMULATION_FSCOMMON_BCDCONVERSIONS_H
|
||||
|
||||
#include "blackmisc/pqfrequency.h"
|
||||
#include "blackmisc/pq/frequency.h"
|
||||
#include "blackmisc/aviation/transponder.h"
|
||||
#include <QtGlobal>
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "blackmisc/valueobject.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
#include "blackmisc/settingutilities.h"
|
||||
#include "blackmisc/pqtime.h"
|
||||
#include "blackmisc/pq/time.h"
|
||||
#include "simulatorplugininfo.h"
|
||||
|
||||
namespace BlackMisc
|
||||
|
||||
Reference in New Issue
Block a user