Files
pilotclient/tests/blackmisc/testgeo.cpp
Mathew Sutcliffe da8ba9aac3 First major wave of PQ refactoring, including but not limited to:
* Default unit is more clearly stated in one place, not restated in many different places, and is not always the SI unit
* Converter strategy pattern in CMeasurementUnit, covering linear, affine, and different kinds of sexagesimal units
* General reorganization of CMeasurementUnit construction and CPhysicalQuantity methods, not removing any behvaiour
* Move duplicated method unitFromSymbol from derived classes into base class CMeasurementUnit
* For DBus, CPhysicalQuantity marshals both in its own unit and in the default unit
2013-08-19 03:05:08 +01:00

35 lines
1.2 KiB
C++

#include "testgeo.h"
using namespace BlackMisc::Geo;
using namespace BlackMisc::PhysicalQuantities;
namespace BlackMiscTest
{
/*
* Geo classes tests
*/
void CTestGeo::geoBasics()
{
CLatitude lati(10, CAngleUnit::deg());
QVERIFY2(lati * 2 == lati + lati, "Latitude addition should be equal");
lati += CLatitude(20, CAngleUnit::deg());
QVERIFY2(lati.valueRounded() == 30.0, "Latitude should be 30 degrees");
double lat = 27.999999, lon = 86.999999, h = 8820.999999; // Mt Everest
CCoordinateGeodetic startGeoVec(lat, lon, h);
CCoordinateEcef mediumEcefVec = CCoordinateTransformation::toEcef(startGeoVec);
CCoordinateGeodetic endGeoVec = CCoordinateTransformation::toGeodetic(mediumEcefVec);
// this == contains some implicit rounding, since it is based on PQs
QVERIFY2(startGeoVec == endGeoVec, "Reconverted geo vector should be equal ");
CCoordinateNed nedVec = CCoordinateTransformation::toNed(mediumEcefVec, startGeoVec);
CCoordinateEcef ecefReconvert = CCoordinateTransformation::toEcef(nedVec);
// check against rounded reconvert
QVERIFY2(mediumEcefVec.rounded() == ecefReconvert.rounded(), "Reconverted geo vector should be equal");
}
} // namespace