Files
pilotclient/src/blackmisc/geo/longitude.h

71 lines
2.5 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:
//! Base type
using base_type = CEarthAngle<CLongitude>;
using Mixin::MetaType<CLongitude>::registerMetadata;
using Mixin::MetaType<CLongitude>::getMetaTypeId;
using Mixin::MetaType<CLongitude>::isA;
using Mixin::MetaType<CLongitude>::toCVariant;
using Mixin::MetaType<CLongitude>::toQVariant;
using Mixin::MetaType<CLongitude>::convertFromCVariant;
using Mixin::MetaType<CLongitude>::convertFromQVariant;
using Mixin::String<CLongitude>::toQString;
using Mixin::String<CLongitude>::toFormattedQString;
using Mixin::String<CLongitude>::toStdString;
using Mixin::String<CLongitude>::stringForStreaming;
//! \copydoc CValueObject::convertToQString
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
CLongitude(double value, const BlackMisc::PhysicalQuantities::CAngleUnit &unit) : CEarthAngle(value, unit) {}
};
}
}
Q_DECLARE_METATYPE(BlackMisc::Geo::CLongitude)
#endif // guard