11 #include <fwk/CentralConfig.h>
12 #include <fwk/CoordinateSystemRegistry.h>
13 #include <utl/CoordinateSystem.h>
14 #include <utl/AugerException.h>
15 #include <utl/ReferenceEllipsoid.h>
16 #include <utl/UTMPoint.h>
17 #include <utl/Point.h>
18 #include <utl/AugerUnits.h>
21 #include <tst/Verify.h>
22 #include <cppunit/extensions/HelperMacros.h>
32 CPPUNIT_TEST(testFactory);
33 CPPUNIT_TEST(testPampaAmarilla);
34 CPPUNIT_TEST_EXCEPTION(testInvalidCoordinateSystemException,
37 CPPUNIT_TEST_SUITE_END();
66 const Point pampaAmarillaOrigin(0, 0, 0, pampaAmarillaCS);
67 const UTMPoint po(pampaAmarillaOrigin, wgs84);
69 CPPUNIT_ASSERT(Verify<CloseTo>(po.
GetNorthing(), 6099203.68*
m));
70 CPPUNIT_ASSERT(Verify<CloseTo>(po.
GetEasting(), 477256.66*
m));
71 CPPUNIT_ASSERT(Verify<CloseTo>(po.
GetHeight(), 1400*
m));
72 CPPUNIT_ASSERT(Verify<Equal>(po.
GetZone(), 19));
73 CPPUNIT_ASSERT(Verify<Equal>(po.
GetBand(),
'H'));
77 const int fdUTM[][3] = {
78 { 6071872, 459208, 1416 },
79 { 6094570, 498902, 1415 },
80 { 6134066, 480747, 1455 },
81 { 6114142, 445346, 1714 }
84 const double fdXYZ[][3] = {
85 { -18127.757064, -27301.999633, -68.24021981845 },
86 { 21647.377378, -4690.341619, -23.48079981265 },
87 { 3580.959833, 34875.225069, -41.4046727005 },
88 { -31891.59545, 15028.421417, 216.51114439687 }
92 for (
int i = 0; i < 4; ++i) {
93 const UTMPoint fdUTMPos(fdUTM[i][0]*
meter, fdUTM[i][1]*meter, fdUTM[i][2]*meter, 19,
'H', wgs84);
95 const double xDiff = fdPos.
GetX(pampaAmarillaCS) - fdXYZ[i][0]*
meter;
96 const double yDiff = fdPos.GetY(pampaAmarillaCS) - fdXYZ[i][1]*
meter;
97 const double zDiff = fdPos.GetZ(pampaAmarillaCS) - fdXYZ[i][2]*
meter;
98 std::cout << i <<
". diff X: " << xDiff <<
" Y: " << yDiff <<
" Z: " << zDiff << std::endl;
99 CPPUNIT_ASSERT(Verify<CloseTo>(fdPos.GetX(pampaAmarillaCS), fdXYZ[i][0]*
meter, absTolerance[0]));
100 CPPUNIT_ASSERT(Verify<CloseTo>(fdPos.GetY(pampaAmarillaCS), fdXYZ[i][1]*
meter, absTolerance[1]));
101 CPPUNIT_ASSERT(Verify<CloseTo>(fdPos.GetZ(pampaAmarillaCS), fdXYZ[i][2]*
meter, absTolerance[2]));
109 std::cout <<
"The coordinate system 'XYZ' should not exist and produce an expected error:" << std::endl;
116 std::cout <<
"Since initialization was already done, we expect an error that ReferenceEllipsoidRegistry is already initialized." << std::endl;
constexpr double centimeter
Class to hold and convert a point in geodetic coordinates.
int GetZone() const
Get the zone.
char GetBand() const
Get the band.
void Init()
Initialise the registry.
double GetNorthing() const
Get the northing.
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
Exception to use if sequence of initialisations violated.
void testInitSequenceException()
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
Reference ellipsoids for UTM transformations.
double GetHeight() const
Get the height.
double GetX(const CoordinateSystemPtr &coordinateSystem) const
Base class for exceptions in the CoordinateSystemRegistry.
double GetEasting() const
Get the easting.
static CentralConfig * GetInstance()
Use this the first time you get an instance of central configuration.
utl::CoordinateSystemPtr Get(const std::string &id)
Get a well-known Coordinate System.
void testInvalidCoordinateSystemException()
Point GetPoint(const CoordinateSystemPtr &theCS=CoordinateSystemPtr()) const
Get a cartesian point from an UTMPoint.