mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
* get struct CAngle::DegMinSecFractionalSec to obtain parts * round to epsilon utility functions and fix (qint64)
71 lines
2.3 KiB
C++
71 lines
2.3 KiB
C++
/* 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_LONGITUDE_H
|
||
#define BLACKMISC_GEO_LONGITUDE_H
|
||
|
||
#include "blackmisc/blackmiscexport.h"
|
||
#include "blackmisc/geo/earthangle.h"
|
||
|
||
namespace BlackMisc
|
||
{
|
||
namespace Geo
|
||
{
|
||
//! Longitude
|
||
class BLACKMISC_EXPORT CLongitude :
|
||
public CEarthAngle<CLongitude>,
|
||
public Mixin::MetaType<CLongitude>,
|
||
public Mixin::String<CLongitude>,
|
||
public Mixin::DBusOperators<CLongitude>,
|
||
public Mixin::Index<CLongitude>
|
||
{
|
||
public:
|
||
//! Base type
|
||
using base_type = CEarthAngle<CLongitude>;
|
||
|
||
BLACKMISC_DECLARE_USING_MIXIN_METATYPE(CLongitude)
|
||
BLACKMISC_DECLARE_USING_MIXIN_STRING(CLongitude)
|
||
BLACKMISC_DECLARE_USING_MIXIN_INDEX(CLongitude)
|
||
|
||
//! To WGS84 string
|
||
QString toWgs84(int withFragmentSecDigits = 3) const
|
||
{
|
||
return CEarthAngle<CLongitude>::toWgs84('E', 'W', withFragmentSecDigits);
|
||
}
|
||
|
||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||
QString convertToQString(bool i18n = false) const
|
||
{
|
||
QString s(CEarthAngle::convertToQString(i18n));
|
||
if (!this->isZeroEpsilonConsidered())
|
||
{
|
||
s.append(this->isNegativeWithEpsilonConsidered() ? " W" : " E");
|
||
}
|
||
return s;
|
||
}
|
||
|
||
//! Default constructor
|
||
CLongitude() = default;
|
||
|
||
//! Constructor
|
||
explicit CLongitude(const BlackMisc::PhysicalQuantities::CAngle &angle) : CEarthAngle(angle) {}
|
||
|
||
//! Init by double value
|
||
//! Longitude measurements range from 0° to (+/–)180°.
|
||
CLongitude(double value, const BlackMisc::PhysicalQuantities::CAngleUnit &unit) : CEarthAngle(value, unit) {}
|
||
};
|
||
} // ns
|
||
} // ns
|
||
|
||
Q_DECLARE_METATYPE(BlackMisc::Geo::CLongitude)
|
||
|
||
#endif // guard
|