Ref T111, lat/lng/angle changes

* get struct CAngle::DegMinSecFractionalSec to obtain parts
* round to epsilon utility functions and fix (qint64)
This commit is contained in:
Klaus Basan
2017-07-26 14:38:49 +02:00
committed by Mathew Sutcliffe
parent 77546a46b1
commit e55480737e
15 changed files with 328 additions and 102 deletions

View File

@@ -31,10 +31,25 @@ namespace BlackMiscTest
{
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");
CLatitude lat(10, CAngleUnit::deg());
QVERIFY2(lat * 2 == lat + lat, "Latitude addition should be equal");
lat += CLatitude(20, CAngleUnit::deg());
QVERIFY2(lat.valueRounded() == 30.0, "Latitude should be 30 degrees");
CAngle a(20, 0);
lat = CLatitude(a);
double v = lat.valueRounded(CAngleUnit::deg());
QVERIFY2(v == 20.0, "Values shall be the same");
a = CAngle(28, 0);
lat = CLatitude(a);
v = lat.valueRounded(CAngleUnit::deg());
QVERIFY2(v == 28.0, "Values shall be the same");
a = CAngle(30, 0, 0);
lat = CLatitude(a);
v = lat.valueRounded(CAngleUnit::deg());
QVERIFY2(v == 30.0, "Values shall be the same");
}
void CTestGeo::coordinateGeodetic()
@@ -44,7 +59,17 @@ namespace BlackMiscTest
QCOMPARE(calculateEuclideanDistance(northPole, southPole), 2.0);
CCoordinateGeodetic equator = { 0.0, 70.354683 };
QCOMPARE(calculateEuclideanDistance(northPole, equator), std::sqrt(2.0f));
CCoordinateGeodetic testCoordinate = northPole;
double latValue = testCoordinate.latitude().value(CAngleUnit::deg());
double lngValue = testCoordinate.longitude().value(CAngleUnit::deg());
QVERIFY2(latValue == 90.0, "Latitude value supposed to be 90");
QVERIFY2(lngValue == 0.0, "Longitude value supposed to be 0");
CLatitude newLat(90.0, CAngleUnit::deg());
testCoordinate.setLatitude(newLat);
latValue = testCoordinate.latitude().value(CAngleUnit::deg());
QVERIFY2(latValue == newLat.value(CAngleUnit::deg()), "Latitude value supposed to be equal");
}
} // namespace
} // ns
//! \endcond