mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Enabled coordinate classes for DBus, added generation method for lat/lng by WGS84 strings
This commit is contained in:
@@ -23,12 +23,16 @@
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="BlackMisc::Aviation::CAltitude"/>
|
||||
</method>
|
||||
<method name="receiveMatrix">
|
||||
<arg name="matrix" type="(ad)" direction="in"/>
|
||||
<arg name="matrix" type="(ddddddddd)" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="BlackMisc::Math::CMatrix3x3"/>
|
||||
</method>
|
||||
<method name="receiveList">
|
||||
<arg name="list" type="ad" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QList<double>"/>
|
||||
</method>
|
||||
<method name="receiveGeoPosition">
|
||||
<arg name="geo" type="((didb(s)(s))(didb(s)(s))(didb(s)(s)))" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="BlackMisc::Geo::CCoordinateGeodetic"/>
|
||||
</method>
|
||||
</interface>
|
||||
</node>
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Math;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMiscTest;
|
||||
|
||||
/*!
|
||||
@@ -100,9 +101,6 @@ int main(int argc, char *argv[])
|
||||
list << 1.0 << 2.0 << 3.0;
|
||||
testserviceInterface.receiveList(list);
|
||||
qDebug() << "Send list via interface" << list;
|
||||
qDebug() << "Key .......";
|
||||
getchar();
|
||||
|
||||
|
||||
// PQs
|
||||
CSpeed speed(speedValue++, BlackMisc::PhysicalQuantities::CSpeedUnit::km_h());
|
||||
@@ -132,6 +130,15 @@ int main(int argc, char *argv[])
|
||||
testserviceInterface.receiveMatrix(m33);
|
||||
qDebug() << "Send matrix" << m33;
|
||||
|
||||
// Geo
|
||||
// EDDF: 50° 2′ 0″ N, 8° 34′ 14″ E, 100m MSL
|
||||
CLatitude lat = CLatitude::fromWgs84("50° 2′ 1″ 23 N");
|
||||
CLongitude lon = CLongitude::fromWgs84("8° 34′ 14″ E");
|
||||
CLength height(100, CLengthUnit::m());
|
||||
CCoordinateGeodetic geoPos(lat, lon, height);
|
||||
testserviceInterface.receiveGeoPosition(geoPos);
|
||||
qDebug() << "Send geo position" << geoPos;
|
||||
|
||||
// next round?
|
||||
qDebug() << "Key .......";
|
||||
getchar();
|
||||
|
||||
@@ -70,11 +70,19 @@ void Testservice::receiveMatrix(const BlackMisc::Math::CMatrix3x3 &matrix)
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* Receive a list
|
||||
*/
|
||||
void Testservice::receiveList(const QList<double> &list)
|
||||
{
|
||||
qDebug() << "Pid:" << TestserviceTool::getPid() << "Received list:" << list;
|
||||
}
|
||||
|
||||
/*
|
||||
* Receive a geo position
|
||||
*/
|
||||
void Testservice::receiveGeoPosition(const BlackMisc::Geo::CCoordinateGeodetic &geo)
|
||||
{
|
||||
qDebug() << "Pid:" << TestserviceTool::getPid() << "Received geo data:" << geo;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -88,6 +88,12 @@ public slots:
|
||||
*/
|
||||
void receiveList(const QList<double> &list);
|
||||
|
||||
/*!
|
||||
* \brief Receive a geo position
|
||||
* \param geo
|
||||
*/
|
||||
void receiveGeoPosition(const BlackMisc::Geo::CCoordinateGeodetic &geo);
|
||||
|
||||
public:
|
||||
static const QString ServiceName;
|
||||
static const QString ServicePath;
|
||||
|
||||
@@ -95,7 +95,7 @@ void CMultiPlayer::addPlane(CPlane *plane)
|
||||
|
||||
void CMultiPlayer::removePlane(CPlane *plane)
|
||||
{
|
||||
qint32 id;
|
||||
qint32 id = 0;
|
||||
m_simulator->removePlane(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,13 +67,11 @@ template <class AVIO> bool CModulator<AVIO>::operator !=(const CModulator<AVIO>
|
||||
return !(otherModulator == (*this));
|
||||
}
|
||||
|
||||
|
||||
// see here for the reason of thess forward instantiations
|
||||
// http://www.parashift.com/c++-faq/separate-template-class-defn-from-decl.html
|
||||
template class CModulator<CComSystem>;
|
||||
template class CModulator<CNavSystem>;
|
||||
template class CModulator<CAdfSystem>;
|
||||
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -74,9 +74,9 @@ bool CAviationVerticalPositions::operator !=(const CAviationVerticalPositions &o
|
||||
}
|
||||
|
||||
/*
|
||||
* String representation for streaming
|
||||
* String representation for converter
|
||||
*/
|
||||
QString CAviationVerticalPositions::stringForStreamingOperator() const
|
||||
QString CAviationVerticalPositions::stringForConverter() const
|
||||
{
|
||||
QString s = QString("Altitude: ").
|
||||
append(this->m_altitude.unitValueRoundedWithUnit()).
|
||||
@@ -109,22 +109,34 @@ CAviationVerticalPositions CAviationVerticalPositions::fromAltitudeAndElevationI
|
||||
return CAviationVerticalPositions(a, e, h);
|
||||
}
|
||||
|
||||
/*
|
||||
* Stream for log message
|
||||
|
||||
/*!
|
||||
* \brief Stream to DBus <<
|
||||
* \param argument
|
||||
*/
|
||||
CLogMessage operator <<(CLogMessage log, const CAviationVerticalPositions &positions)
|
||||
{
|
||||
log << positions.stringForStreamingOperator();
|
||||
return log;
|
||||
void CAviationVerticalPositions::marshallToDbus(QDBusArgument &argument) const {
|
||||
argument << this->m_altitude;
|
||||
argument << this->m_elevation;
|
||||
argument << this->m_height;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Stream from DBus >>
|
||||
* \param argument
|
||||
*/
|
||||
void CAviationVerticalPositions::unmarshallFromDbus(const QDBusArgument &argument) {
|
||||
argument >> this->m_altitude;
|
||||
argument >> this->m_elevation;
|
||||
argument >> this->m_height;
|
||||
}
|
||||
|
||||
/*
|
||||
* Stream for qDebug
|
||||
* Register metadata
|
||||
*/
|
||||
QDebug operator <<(QDebug d, const CAviationVerticalPositions &positions)
|
||||
void CAviationVerticalPositions::registerMetadata()
|
||||
{
|
||||
d << positions.stringForStreamingOperator();
|
||||
return d;
|
||||
qRegisterMetaType<CAviationVerticalPositions>(typeid(CAviationVerticalPositions).name());
|
||||
qDBusRegisterMetaType<CAviationVerticalPositions>();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
* 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/. */
|
||||
|
||||
#ifndef BLACKMISC_AVLATERALPOSITION_H
|
||||
#define BLACKMISC_AVLATERALPOSITION_H
|
||||
#ifndef BLACKMISC_AVVERTICALPOSITION_H
|
||||
#define BLACKMISC_AVVERTICALPOSITION_H
|
||||
|
||||
#include "blackmisc/avaltitude.h"
|
||||
#include "blackmisc/pqconstants.h"
|
||||
#include "blackmisc/basestreamstringifier.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -17,25 +18,8 @@ namespace Aviation
|
||||
/*!
|
||||
* \brief Vertical (Z) positions of an aircraft
|
||||
*/
|
||||
class CAviationVerticalPositions
|
||||
class CAviationVerticalPositions : public BlackMisc::CBaseStreamStringifier
|
||||
{
|
||||
/*!
|
||||
* \brief Stream << overload to be used in debugging messages
|
||||
* \param d
|
||||
* \param positions
|
||||
* \return
|
||||
*/
|
||||
friend QDebug operator<<(QDebug d, const CAviationVerticalPositions &positions);
|
||||
|
||||
/*!
|
||||
* Stream operator for log messages
|
||||
* \brief operator <<
|
||||
* \param log
|
||||
* \param positions
|
||||
* \return
|
||||
*/
|
||||
friend CLogMessage operator<<(CLogMessage log, const CAviationVerticalPositions &positions);
|
||||
|
||||
private:
|
||||
BlackMisc::Aviation::CAltitude m_altitude; //!< altitude
|
||||
BlackMisc::PhysicalQuantities::CLength m_elevation; //!< elevation
|
||||
@@ -43,10 +27,22 @@ private:
|
||||
|
||||
protected:
|
||||
/*!
|
||||
* \brief Specific stream operation for heading
|
||||
* \brief String for converter
|
||||
* \return
|
||||
*/
|
||||
virtual QString stringForStreamingOperator() const;
|
||||
virtual QString stringForConverter() const;
|
||||
|
||||
/*!
|
||||
* \brief Unmarshall from Dbus
|
||||
* \param argument
|
||||
*/
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &argument);
|
||||
|
||||
/*!
|
||||
* \brief Unmarshall from Dbus
|
||||
* \param argument
|
||||
*/
|
||||
virtual void marshallToDbus(QDBusArgument &argument) const;
|
||||
|
||||
public:
|
||||
/*!
|
||||
@@ -113,6 +109,7 @@ public:
|
||||
* \param elevationFt
|
||||
* \return
|
||||
*/
|
||||
|
||||
static CAviationVerticalPositions fromAltitudeAndElevationInFt(double altitudeMslFt, double elevationFt);
|
||||
/*!
|
||||
* \brief Factory getting tupel frome levation and altitude values in meters
|
||||
@@ -121,9 +118,15 @@ public:
|
||||
* \return
|
||||
*/
|
||||
static CAviationVerticalPositions fromAltitudeAndElevationInM(double altitudeMslM, double elevationM);
|
||||
|
||||
/*!
|
||||
* \brief Register metadata
|
||||
*/
|
||||
static void registerMetadata();
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
Q_DECLARE_METATYPE(BlackMisc::Aviation::CAviationVerticalPositions)
|
||||
|
||||
#endif // BLACKMISC_AVLATERALPOSITION_H
|
||||
#endif // BLACKMISC_AVVERTICALPOSITION_H
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace BlackMisc
|
||||
/*!
|
||||
* \brief Provides "to QString" and stream operators
|
||||
*/
|
||||
// Virtual operators: http://stackoverflow.com/a/4571634/356726
|
||||
class CBaseStreamStringifier
|
||||
{
|
||||
/*!
|
||||
|
||||
@@ -32,9 +32,9 @@ void BlackMisc::Aviation::registerMetadata()
|
||||
CNavSystem::registerMetadata();
|
||||
CAdfSystem::registerMetadata();
|
||||
CAltitude::registerMetadata();
|
||||
CAviationVerticalPositions::registerMetadata();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Metadata for Math
|
||||
*/
|
||||
|
||||
@@ -54,8 +54,6 @@ void registerMetadata();
|
||||
|
||||
} // Geo
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Register all relevant metadata in BlackMisc
|
||||
*/
|
||||
|
||||
50
src/blackmisc/coordinategeodetic.cpp
Normal file
50
src/blackmisc/coordinategeodetic.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
/* 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/. */
|
||||
|
||||
#include "blackmisc/coordinategeodetic.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Geo
|
||||
{
|
||||
|
||||
/*
|
||||
* String for converter
|
||||
*/
|
||||
QString CCoordinateGeodetic::stringForConverter() const
|
||||
{
|
||||
QString s = "Geodetic: {%1, %2, %3}";
|
||||
return s.arg(this->m_latitude.unitValueRoundedWithUnit(6)).arg(this->m_longitude.unitValueRoundedWithUnit(6)).arg(this->m_height.unitValueRoundedWithUnit());
|
||||
}
|
||||
|
||||
/*
|
||||
* Marshall to Dbus
|
||||
*/
|
||||
void CCoordinateGeodetic::marshallToDbus(QDBusArgument &argument) const {
|
||||
argument << this->m_latitude;
|
||||
argument << this->m_longitude;
|
||||
argument << this->m_height;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unmarshall from Dbus
|
||||
*/
|
||||
void CCoordinateGeodetic::unmarshallFromDbus(const QDBusArgument &argument) {
|
||||
argument >> this->m_latitude;
|
||||
argument >> this->m_longitude;
|
||||
argument >> this->m_height;
|
||||
}
|
||||
|
||||
/*
|
||||
* Register metadata
|
||||
*/
|
||||
void CCoordinateGeodetic::registerMetadata()
|
||||
{
|
||||
qRegisterMetaType<CCoordinateGeodetic>(typeid(CCoordinateGeodetic).name());
|
||||
qDBusRegisterMetaType<CCoordinateGeodetic>();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
@@ -51,30 +51,19 @@ protected:
|
||||
* \brief String for converter
|
||||
* \return
|
||||
*/
|
||||
virtual QString stringForConverter() const
|
||||
{
|
||||
QString s = "Geodetic: {%1, %2, %3}";
|
||||
return s.arg(this->m_latitude.unitValueRoundedWithUnit(6)).arg(this->m_longitude.unitValueRoundedWithUnit(6)).arg(this->m_height.unitValueRoundedWithUnit());
|
||||
}
|
||||
virtual QString stringForConverter() const;
|
||||
|
||||
/*!
|
||||
* \brief Stream to DBus
|
||||
* \param argument
|
||||
*/
|
||||
virtual void marshallToDbus(QDBusArgument &argument) const {
|
||||
argument << this->m_latitude;
|
||||
argument << this->m_longitude;
|
||||
argument << this->m_height;
|
||||
}
|
||||
virtual void marshallToDbus(QDBusArgument &argument) const;
|
||||
|
||||
/*!
|
||||
* \brief Stream from DBus
|
||||
* \param argument
|
||||
*/
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &argument) {
|
||||
argument >> this->m_latitude;
|
||||
argument >> this->m_longitude;
|
||||
argument >> this->m_height;
|
||||
}
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &argument);
|
||||
|
||||
public:
|
||||
/*!
|
||||
|
||||
16
src/blackmisc/geoallclasses.h
Normal file
16
src/blackmisc/geoallclasses.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/* 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/. */
|
||||
|
||||
#ifndef BLACKMISC_GEOALLCLASSES_H
|
||||
#define BLACKMISC_GEOALLCLASSES_H
|
||||
|
||||
#include "blackmisc/geoearthangle.h"
|
||||
#include "blackmisc/geolatitude.h"
|
||||
#include "blackmisc/geolongitude.h"
|
||||
#include "blackmisc/coordinateecef.h"
|
||||
#include "blackmisc/coordinatened.h"
|
||||
#include "blackmisc/coordinategeodetic.h"
|
||||
|
||||
#endif // guard
|
||||
77
src/blackmisc/geoearthangle.cpp
Normal file
77
src/blackmisc/geoearthangle.cpp
Normal file
@@ -0,0 +1,77 @@
|
||||
/* 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/. */
|
||||
|
||||
#include "blackmisc/geoearthangle.h"
|
||||
#include "blackmisc/geolatitude.h"
|
||||
#include "blackmisc/geolongitude.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Geo
|
||||
{
|
||||
|
||||
/*
|
||||
* Register metadata
|
||||
*/
|
||||
template <class LATorLON> void CEarthAngle<LATorLON>::registerMetadata()
|
||||
{
|
||||
qRegisterMetaType<LATorLON>(typeid(LATorLON).name());
|
||||
qDBusRegisterMetaType<LATorLON>();
|
||||
}
|
||||
|
||||
/*
|
||||
* Latitude or Longitude from a WGS string
|
||||
*/
|
||||
template <class LATorLON> LATorLON CEarthAngle<LATorLON>::fromWgs84(const QString &wgsCoordinate)
|
||||
{
|
||||
// http://www.regular-expressions.info/floatingpoint.html
|
||||
QRegExp rx("([-+]?[0-9]*\\.?[0-9]+)");
|
||||
qint32 deg = 0;
|
||||
qint32 min = 0;
|
||||
double sec = 0.0;
|
||||
double secFragment = 0.0;
|
||||
int fragmentLength = 0;
|
||||
int c = 0;
|
||||
int pos= 0;
|
||||
while ((pos = rx.indexIn(wgsCoordinate, pos)) != -1) {
|
||||
QString cap = rx.cap(1);
|
||||
pos += rx.matchedLength();
|
||||
switch(c++) {
|
||||
case 0:
|
||||
deg = cap.toInt();
|
||||
break;
|
||||
case 1:
|
||||
min = cap.toInt();
|
||||
break;
|
||||
case 2:
|
||||
sec = cap.toDouble();
|
||||
break;
|
||||
case 3:
|
||||
secFragment = cap.toDouble();
|
||||
fragmentLength = cap.length();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (fragmentLength > 0) {
|
||||
// we do have given ms
|
||||
sec += secFragment / qPow(10,fragmentLength);
|
||||
}
|
||||
|
||||
if (wgsCoordinate.contains('S', Qt::CaseInsensitive) ||
|
||||
wgsCoordinate.contains('W', Qt::CaseInsensitive)) deg *= -1;
|
||||
|
||||
CAngle a(deg, min, sec);
|
||||
return LATorLON(a);
|
||||
}
|
||||
|
||||
// see here for the reason of thess forward instantiations
|
||||
// http://www.parashift.com/c++-faq/separate-template-class-defn-from-decl.html
|
||||
template class CEarthAngle<CLatitude>;
|
||||
template class CEarthAngle<CLongitude>;
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
@@ -3,8 +3,8 @@
|
||||
* 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/. */
|
||||
|
||||
#ifndef BLACKMISC_GEOLATLONBASE_H
|
||||
#define BLACKMISC_GEOLATLONBASE_H
|
||||
#ifndef BLACKMISC_GEOEARTHANGLE_H
|
||||
#define BLACKMISC_GEOEARTHANGLE_H
|
||||
#include "blackmisc/pqangle.h"
|
||||
|
||||
namespace BlackMisc
|
||||
@@ -62,6 +62,12 @@ protected:
|
||||
*/
|
||||
CEarthAngle(double value, const BlackMisc::PhysicalQuantities::CAngleUnit &unit): CAngle(value, unit) {}
|
||||
|
||||
/*!
|
||||
* \brief Init by double value
|
||||
* \param angle
|
||||
*/
|
||||
CEarthAngle(const BlackMisc::PhysicalQuantities::CAngle &angle): CAngle(angle) {}
|
||||
|
||||
/*!
|
||||
* \brief String for converter and streaming
|
||||
* \return
|
||||
@@ -212,14 +218,18 @@ public:
|
||||
return l;
|
||||
}
|
||||
|
||||
/*
|
||||
/*!
|
||||
* Register metadata
|
||||
*/
|
||||
static void registerMetadata()
|
||||
{
|
||||
qRegisterMetaType<LATorLON>(typeid(LATorLON).name());
|
||||
qDBusRegisterMetaType<LATorLON>();
|
||||
}
|
||||
static void registerMetadata();
|
||||
|
||||
/*!
|
||||
* \brief 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);
|
||||
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#ifndef BLACKMISC_GEOLATITUDE_H
|
||||
#define BLACKMISC_GEOLATITUDE_H
|
||||
|
||||
#include <QtCore/qmath.h>
|
||||
#include "blackmisc/geoearthangle.h"
|
||||
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Geo
|
||||
@@ -34,6 +37,12 @@ public:
|
||||
*/
|
||||
CLatitude(const CLatitude &latitude) : CEarthAngle(latitude) {}
|
||||
|
||||
/*!
|
||||
* \brief Constructor
|
||||
* \param angle
|
||||
*/
|
||||
CLatitude(const BlackMisc::PhysicalQuantities::CAngle &angle) : CEarthAngle(angle) {}
|
||||
|
||||
/*!
|
||||
* \brief Init by double value
|
||||
* \param value
|
||||
@@ -45,6 +54,7 @@ public:
|
||||
* \brief Virtual destructor
|
||||
*/
|
||||
virtual ~CLatitude() {}
|
||||
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -34,6 +34,12 @@ public:
|
||||
*/
|
||||
CLongitude(const CLongitude &Longitude) : CEarthAngle(Longitude) {}
|
||||
|
||||
/*!
|
||||
* \brief Constructor
|
||||
* \param angle
|
||||
*/
|
||||
CLongitude(const BlackMisc::PhysicalQuantities::CAngle &angle) : CEarthAngle(angle) {}
|
||||
|
||||
/*!
|
||||
* \brief Init by double value
|
||||
* \param value
|
||||
|
||||
@@ -42,6 +42,19 @@ public:
|
||||
*/
|
||||
CAngle(double value, const CAngleUnit &unit): CPhysicalQuantity(value, unit, CAngleUnit::rad()) {}
|
||||
|
||||
/*!
|
||||
* \brief Intir as sexagesimal degrees
|
||||
* \param degrees
|
||||
* \param minutes
|
||||
* \param seconds
|
||||
*/
|
||||
CAngle(qint32 degrees, qint32 minutes, double seconds) :
|
||||
CPhysicalQuantity(
|
||||
degrees + minutes / 100.0 + seconds / 10000.0,
|
||||
CAngleUnit::sexagesimalDeg(), CAngleUnit::rad()) {
|
||||
// void
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Virtual destructor
|
||||
*/
|
||||
|
||||
@@ -76,7 +76,7 @@ QString CAngleUnit::toQStringRounded(double value, int digits) const
|
||||
double mi = floor((value - de) * 100.0);
|
||||
double se = floor((value - de - mi / 100.0) * 1000000) / 100.0;
|
||||
QString ses = QLocale::system().toString(se, 'f', 2);
|
||||
s = QString::number(de).append(this->getUnitName()).append(QString::number(mi))
|
||||
s = QString::number(de).append(" ").append(QString::number(mi))
|
||||
.append("'").append(ses).append("\"");
|
||||
}
|
||||
else
|
||||
|
||||
@@ -246,7 +246,7 @@ public:
|
||||
*/
|
||||
static const CAngleUnit °()
|
||||
{
|
||||
static CAngleUnit deg("degree", "°", false, M_PI / 180);
|
||||
static CAngleUnit deg("degree", "deg", false, M_PI / 180);
|
||||
return deg;
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ public:
|
||||
*/
|
||||
static const CAngleUnit &sexagesimalDeg()
|
||||
{
|
||||
static CAngleUnit deg("segadecimal degree", "°", false, M_PI / 180,
|
||||
static CAngleUnit deg("segadecimal degree", "segd", false, M_PI / 180,
|
||||
CMeasurementPrefix::One(), 0, 1E-9, CAngleUnit::conversionSexagesimalToSi, CAngleUnit::conversionSexagesimalFromSi); return deg;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user