mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 11:05:33 +08:00
Changed interpolator (preliminary) to work with PQs and new classes, added stubs for unit tests in BlackCore
This commit is contained in:
@@ -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
|
||||
* 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/. */
|
||||
@@ -32,12 +32,14 @@ public:
|
||||
* \brief Default constructor: 0 heading true
|
||||
*/
|
||||
CHeading() : CAngle(0, BlackMisc::PhysicalQuantities::CAngleUnit::rad()), m_magnetic(true) {}
|
||||
|
||||
/*!
|
||||
* \brief Constructor
|
||||
* \param value
|
||||
* \param magnetic
|
||||
* \param unit
|
||||
*/
|
||||
|
||||
CHeading(double value, bool magnetic, const BlackMisc::PhysicalQuantities::CAngleUnit &unit) : CAngle(value, unit), m_magnetic(magnetic) {}
|
||||
/*!
|
||||
* \brief Constructor
|
||||
@@ -46,53 +48,68 @@ public:
|
||||
* \param unit
|
||||
*/
|
||||
CHeading(int value, bool magnetic, const BlackMisc::PhysicalQuantities::CAngleUnit &unit) : CAngle(value, unit), m_magnetic(magnetic) {}
|
||||
|
||||
/*!
|
||||
* \brief Constructor by CAngle
|
||||
* \param heading
|
||||
* \param magnetic
|
||||
*/
|
||||
CHeading(CAngle heading, bool magnetic) : CAngle(), m_magnetic(magnetic) {
|
||||
CHeading(CAngle heading, bool magnetic) : CAngle(), m_magnetic(magnetic)
|
||||
{
|
||||
CAngle::operator =(heading);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Copy constructor
|
||||
* \param otherHeading
|
||||
*/
|
||||
CHeading(const CHeading &otherHeading) : CAngle(otherHeading), m_magnetic(otherHeading.m_magnetic) {}
|
||||
|
||||
/*!
|
||||
* \brief Assignment operator =
|
||||
* \param otherHeading
|
||||
* @return
|
||||
*/
|
||||
CHeading &operator =(const CHeading &otherHeading);
|
||||
|
||||
/*!
|
||||
* \brief Equal operator ==
|
||||
* \param otherHeading
|
||||
* @return
|
||||
*/
|
||||
bool operator ==(const CHeading &otherHeading);
|
||||
|
||||
/*!
|
||||
* \brief Unequal operator ==
|
||||
* \param otherHeading
|
||||
* @return
|
||||
*/
|
||||
bool operator !=(const CHeading &otherHeading);
|
||||
|
||||
/*!
|
||||
* \brief Magnetic heading?
|
||||
* \return
|
||||
*/
|
||||
bool isMagneticHeading() const {
|
||||
return this->m_magnetic;
|
||||
}
|
||||
bool isMagneticHeading() const { return this->m_magnetic; }
|
||||
|
||||
/*!
|
||||
* \brief True heading?
|
||||
* \return
|
||||
*/
|
||||
bool isTrueHeading() const {
|
||||
return !this->m_magnetic;
|
||||
bool isTrueHeading() const { return !this->m_magnetic; }
|
||||
|
||||
/*!
|
||||
* \brief Switch heading unit
|
||||
* \param newUnit
|
||||
* \return
|
||||
*/
|
||||
CHeading &switchUnit(const BlackMisc::PhysicalQuantities::CAngleUnit &newUnit)
|
||||
{
|
||||
CAngle::switchUnit(newUnit);
|
||||
return (*this);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
#endif // BLACKMISC_AVHEADING_H
|
||||
#endif // guard
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#ifndef AVIATION_H
|
||||
#define AVIATION_H
|
||||
|
||||
#endif // AVIATION_H
|
||||
@@ -9,8 +9,8 @@ INCLUDEPATH += ..
|
||||
|
||||
# PRECOMPILED_HEADER = stdpch.h
|
||||
precompile_header:!isEmpty(PRECOMPILED_HEADER) {
|
||||
DEFINES += USING_PCH
|
||||
}
|
||||
DEFINES += USING_PCH
|
||||
}
|
||||
|
||||
DEFINES += LOG_IN_FILE
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2013 VATSIM Community / authors
|
||||
/* 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/. */
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
* \brief Constructor by math vector
|
||||
* \param vector
|
||||
*/
|
||||
CCoordinateEcef(const BlackMisc::Math::CVector3D vector) : CVector3DBase(vector.i(), vector.j(), vector.k()) {}
|
||||
explicit CCoordinateEcef(const BlackMisc::Math::CVector3D vector) : CVector3DBase(vector.i(), vector.j(), vector.k()) {}
|
||||
|
||||
/*!
|
||||
* \brief x
|
||||
|
||||
@@ -14,10 +14,31 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Geo
|
||||
{
|
||||
|
||||
/*!
|
||||
* \brief Interface for geodetic ccordinates
|
||||
*/
|
||||
class ICoordinateGeodetic
|
||||
{
|
||||
/*!
|
||||
* \brief Latitude
|
||||
* \return
|
||||
*/
|
||||
virtual CLatitude latitude() const = 0;
|
||||
|
||||
/*!
|
||||
* \brief Longitude
|
||||
* \return
|
||||
*/
|
||||
virtual CLongitude longitude() const = 0;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Geodetic coordinate
|
||||
*/
|
||||
class CCoordinateGeodetic : public CBaseStreamStringifier<CCoordinateGeodetic>
|
||||
class CCoordinateGeodetic :
|
||||
public CBaseStreamStringifier<CCoordinateGeodetic>,
|
||||
public ICoordinateGeodetic
|
||||
{
|
||||
|
||||
private:
|
||||
@@ -97,20 +118,24 @@ public:
|
||||
/*!
|
||||
* \brief Switch unit of latitude / longitude
|
||||
* \param unit
|
||||
* \return
|
||||
*/
|
||||
void switchUnit(const BlackMisc::PhysicalQuantities::CAngleUnit &unit)
|
||||
CCoordinateGeodetic &switchUnit(const BlackMisc::PhysicalQuantities::CAngleUnit &unit)
|
||||
{
|
||||
this->m_latitude.switchUnit(unit);
|
||||
this->m_longitude.switchUnit(unit);
|
||||
return (*this);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Switch unit of height
|
||||
* \param unit
|
||||
* \return
|
||||
*/
|
||||
void switchUnit(const BlackMisc::PhysicalQuantities::CLengthUnit &unit)
|
||||
CCoordinateGeodetic &switchUnit(const BlackMisc::PhysicalQuantities::CLengthUnit &unit)
|
||||
{
|
||||
this->m_height.switchUnit(unit);
|
||||
return (*this);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
* \brief Constructor by math vector
|
||||
* \param vector
|
||||
*/
|
||||
CCoordinateNed(const BlackMisc::Math::CVector3D vector) : CVector3DBase(vector.i(), vector.j(), vector.k()), m_referencePosition(), m_hasReferencePosition(false) {}
|
||||
explicit CCoordinateNed(const BlackMisc::Math::CVector3D vector) : CVector3DBase(vector.i(), vector.j(), vector.k()), m_referencePosition(), m_hasReferencePosition(false) {}
|
||||
|
||||
/*!
|
||||
* \brief Constructor by math vector and reference position
|
||||
|
||||
@@ -237,7 +237,7 @@ CCoordinateGeodetic CCoordinateTransformation::toGeodetic(const CCoordinateEcef
|
||||
}
|
||||
|
||||
double latRad = atan2(sphi, cphi);
|
||||
double lonRad = -atan2(-slam, clam); // Negative signs return lon in [-180, 180)
|
||||
double lonRad = -atan2(-slam, clam); // Negative signs return lon degrees [-180, 180)
|
||||
CCoordinateGeodetic result(
|
||||
CLatitude(latRad, CAngleUnit::rad()),
|
||||
CLongitude(lonRad, CAngleUnit::rad()),
|
||||
|
||||
Reference in New Issue
Block a user