mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-28 11:45:40 +08:00
refs #396 subfolders and renamed callsign list to callsign set
* subfolder audio * subfolder geo * adjusted samples, tests ....
This commit is contained in:
committed by
Roland Winklmeier
parent
32f60722c8
commit
0ab755d510
132
src/blackmisc/geo/earthangle.h
Normal file
132
src/blackmisc/geo/earthangle.h
Normal file
@@ -0,0 +1,132 @@
|
||||
/* 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_GEO_EARTHANGLE_H
|
||||
#define BLACKMISC_GEO_EARTHANGLE_H
|
||||
|
||||
#include "blackmisc/pqangle.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Geo
|
||||
{
|
||||
/*!
|
||||
* Base class for latitude / longitude
|
||||
*/
|
||||
template <class LATorLON> class CEarthAngle : public CValueObject<CEarthAngle<LATorLON>, PhysicalQuantities::CAngle>
|
||||
{
|
||||
public:
|
||||
//! Plus operator +=
|
||||
CEarthAngle &operator +=(const CEarthAngle &latOrLon)
|
||||
{
|
||||
this->PhysicalQuantities::CAngle::operator +=(latOrLon);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Minus operator-=
|
||||
CEarthAngle &operator -=(const CEarthAngle &latOrLon)
|
||||
{
|
||||
this->PhysicalQuantities::CAngle::operator -=(latOrLon);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Multiply operator *=
|
||||
CEarthAngle operator *=(double multiply)
|
||||
{
|
||||
this->PhysicalQuantities::CAngle::operator *=(multiply);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Greater operator >
|
||||
bool operator >(const CEarthAngle &latOrLon) const
|
||||
{
|
||||
return this->PhysicalQuantities::CAngle::operator >(latOrLon);
|
||||
}
|
||||
|
||||
//! Less operator <
|
||||
bool operator <(const CEarthAngle &latOrLon) const
|
||||
{
|
||||
return this->PhysicalQuantities::CAngle::operator >(latOrLon);
|
||||
}
|
||||
|
||||
//! Less equal operator <=
|
||||
bool operator <=(const CEarthAngle &latOrLon) const
|
||||
{
|
||||
return this->PhysicalQuantities::CAngle::operator <=(latOrLon);
|
||||
}
|
||||
|
||||
//! Greater equal operator >=
|
||||
bool operator >=(const CEarthAngle &latOrLon) const
|
||||
{
|
||||
return this->PhysicalQuantities::CAngle::operator >=(latOrLon);
|
||||
}
|
||||
|
||||
//! Plus operator +
|
||||
LATorLON operator +(const CEarthAngle &latOrLon) const
|
||||
{
|
||||
LATorLON l(*this);
|
||||
l += latOrLon;
|
||||
return l;
|
||||
}
|
||||
|
||||
//! Minus operator -
|
||||
LATorLON operator -(const CEarthAngle &latOrLon) const
|
||||
{
|
||||
LATorLON l(*this);
|
||||
l -= latOrLon;
|
||||
return l;
|
||||
}
|
||||
|
||||
//! Multiply operator *
|
||||
LATorLON operator *(double multiply) const
|
||||
{
|
||||
LATorLON l(*this);
|
||||
l *= multiply;
|
||||
return l;
|
||||
}
|
||||
|
||||
//! \copydoc CValueObject::toIcon
|
||||
CIcon toIcon() const override;
|
||||
|
||||
/*!
|
||||
* Latitude / Longitude from a WGS string such as
|
||||
* \param wgsCoordinate 50° 2′ 0″ N / 8° 34′ 14″ E
|
||||
* \return
|
||||
*/
|
||||
static LATorLON fromWgs84(const QString &wgsCoordinate);
|
||||
|
||||
protected:
|
||||
//! Default constructor
|
||||
CEarthAngle() : CEarthAngle::CValueObject(0.0, BlackMisc::PhysicalQuantities::CAngleUnit::deg()) {}
|
||||
|
||||
//! Init by double value
|
||||
CEarthAngle(double value, const BlackMisc::PhysicalQuantities::CAngleUnit &unit) : CEarthAngle::CValueObject(value, unit) {}
|
||||
|
||||
//! Init by CAngle value
|
||||
CEarthAngle(const BlackMisc::PhysicalQuantities::CAngle &angle) : CEarthAngle::CValueObject(angle) {}
|
||||
|
||||
//! \copydoc CValueObject::convertToQString
|
||||
virtual QString convertToQString(bool i18n = false) const override
|
||||
{
|
||||
return this->valueRoundedWithUnit(BlackMisc::PhysicalQuantities::CAngleUnit::deg(), 6, i18n);
|
||||
}
|
||||
|
||||
private:
|
||||
//! Easy access to derived class (CRTP template parameter)
|
||||
LATorLON const *derived() const { return static_cast<LATorLON const *>(this); }
|
||||
|
||||
//! Easy access to derived class (CRTP template parameter)
|
||||
LATorLON *derived() { return static_cast<LATorLON *>(this); }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user