mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-19 20:25:29 +08:00
refs #396 move Blackmisc PQ classes into subfolder
This commit is contained in:
committed by
Roland Winklmeier
parent
0ab755d510
commit
2363fab8c1
67
src/blackmisc/pq/angle.h
Normal file
67
src/blackmisc/pq/angle.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_PQ_ANGLE_H
|
||||
#define BLACKMISC_PQ_ANGLE_H
|
||||
|
||||
#include "blackmisc/pq/physicalquantity.h"
|
||||
#include "blackmisc/math/mathutils.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace PhysicalQuantities
|
||||
{
|
||||
//! Physical unit angle (radians, degrees)
|
||||
class CAngle : public CValueObject<CAngle, CPhysicalQuantity<CAngleUnit, CAngle>>
|
||||
{
|
||||
public:
|
||||
//! Default constructor
|
||||
CAngle() : CValueObject(0, CAngleUnit::defaultUnit()) {}
|
||||
|
||||
//! Init by double value
|
||||
CAngle(double value, const CAngleUnit &unit): CValueObject(value, unit) {}
|
||||
|
||||
//! \copydoc CPhysicalQuantity(const QString &unitString)
|
||||
CAngle(const QString &unitString) : CValueObject(unitString) {}
|
||||
|
||||
/*!
|
||||
* \brief Init as sexagesimal degrees, minutes, seconds
|
||||
* The sign of all parameters must be the same, either all positive or all negative.
|
||||
*/
|
||||
CAngle(int degrees, int minutes, double seconds) :
|
||||
CValueObject(
|
||||
degrees + minutes / 100.0 + seconds / 10000.0,
|
||||
CAngleUnit::sexagesimalDeg()) {}
|
||||
|
||||
/*!
|
||||
* \brief Init as sexagesimal degrees, minutes
|
||||
* The sign of both parameters must be the same, either both positive or both negative.
|
||||
*/
|
||||
CAngle(int degrees, double minutes) :
|
||||
CValueObject(
|
||||
degrees + minutes / 100.0,
|
||||
CAngleUnit::sexagesimalDegMin()) {}
|
||||
|
||||
//! \copydoc CValueObject::toIcon
|
||||
virtual BlackMisc::CIcon toIcon() const override;
|
||||
|
||||
//! Value as factor of PI (e.g. 0.5PI)
|
||||
double piFactor() const;
|
||||
|
||||
//! PI as convenience method
|
||||
static const double &PI();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(BlackMisc::PhysicalQuantities::CAngle)
|
||||
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user