11 #include <utl/UTMPoint.h>
12 #include <utl/Point.h>
13 #include <utl/ReferenceEllipsoid.h>
15 #include <tst/Verify.h>
16 #include <utl/Triple.h>
18 #include <cppunit/extensions/HelperMacros.h>
25 #define TEST_CLOSETO3(n1_, n2_, e1_, e2_, h1_, h2_) \
26 CPPUNIT_ASSERT(Verify<CloseTo>(n1_, n2_)); \
27 CPPUNIT_ASSERT(Verify<CloseTo>(e1_, e2_)); \
28 CPPUNIT_ASSERT(Verify<CloseTo>(h1_, h2_))
37 CPPUNIT_TEST(testConstructors);
38 CPPUNIT_TEST(testAssignement);
39 CPPUNIT_TEST(testLatLongConversions);
40 CPPUNIT_TEST(testUTMConversions);
41 CPPUNIT_TEST_SUITE_END();
46 const double h,
const int z,
const char b)
49 CPPUNIT_ASSERT(Verify<CloseTo>(
51 CPPUNIT_ASSERT(p.
GetZone() == z);
56 CPPUNIT_ASSERT(Verify<CloseTo>(
60 CPPUNIT_ASSERT(Verify<CloseTo>(
62 CPPUNIT_ASSERT(q.
GetZone() == z);
67 CPPUNIT_ASSERT(Verify<CloseTo>(
73 const double h,
const int z,
const char b)
79 CPPUNIT_ASSERT(Verify<CloseTo>(
81 CPPUNIT_ASSERT(up.
GetZone() == uq.GetZone());
82 CPPUNIT_ASSERT(up.
GetBand() == uq.GetBand());
96 const UTMPoint p1(10000, 500000, 0, 10,
'I', e);
100 CPPUNIT_ASSERT(p1.
GetZone() == 10);
101 CPPUNIT_ASSERT(p1.
GetBand() ==
'I');
104 boost::make_tuple(10000, 500000, 0, 10.,
'I'));
106 boost::make_tuple(10000, 500000, 0, 10));
108 Triple(10000, 500000, 0));
111 CPPUNIT_ASSERT(p2.GetCoordinates() ==
112 boost::make_tuple(9345711., 821935., 1432., 7,
'L'));
113 CPPUNIT_ASSERT(p2.GetEllipsoid() == e);
116 CPPUNIT_ASSERT(p2 == p3);
123 const UTMPoint p0(10000, 500000, 0, 10,
'I', e);
126 CPPUNIT_ASSERT(p1 != p0);
129 CPPUNIT_ASSERT(p1 == p0);
133 CPPUNIT_ASSERT(p1.
GetZone() == 10);
134 CPPUNIT_ASSERT(p1.
GetBand() ==
'I');
137 boost::make_tuple(10000, 500000, 0, 10.,
'I'));
139 boost::make_tuple(10000, 500000, 0, 10));
141 Triple(10000, 500000, 0));
148 for (LatLongNorthEast*
p = llneData;
149 p < llneData +
sizeof(llneData)/
sizeof(LatLongNorthEast);
151 oneLatLongConversion(
p->fLat,
p->fLong,
p->fNorth,
p->fEast,
152 testHeight, testZone, testBand);
169 CPPUNIT_ASSERT(up1.
GetZone() == 31);
170 CPPUNIT_ASSERT(up1.
GetBand() ==
'N');
175 CPPUNIT_ASSERT(Verify<CloseTo>(
177 CPPUNIT_ASSERT(Verify<CloseTo>(
180 CPPUNIT_ASSERT(Verify<CloseTo>(
185 CPPUNIT_ASSERT(up2.GetZone() == 46);
186 CPPUNIT_ASSERT(up2.GetBand() ==
'N');
187 CPPUNIT_ASSERT(Verify<CloseTo>(
188 up2.GetCoordinates3(),
Triple(0*
m, 166021.44*
m, 0*
m)));
189 CPPUNIT_ASSERT(Verify<CloseTo>(
190 up2.GetGeodeticCoordinates(),
Triple(0.*
deg, 90.*
deg, 0.*
m)));
191 const Point p2(up2.GetPoint());
192 CPPUNIT_ASSERT(Verify<CloseTo>(
196 CPPUNIT_ASSERT(up3.
GetZone() == 45);
197 CPPUNIT_ASSERT(up3.
GetBand() ==
'N');
198 CPPUNIT_ASSERT(Verify<CloseTo>(
202 CPPUNIT_ASSERT(up4.
GetZone() == 45);
203 CPPUNIT_ASSERT(up4.
GetBand() ==
'M');
204 CPPUNIT_ASSERT(Verify<CloseTo>(
208 CPPUNIT_ASSERT(up5.
GetZone() == 46);
209 CPPUNIT_ASSERT(up5.
GetBand() ==
'N');
210 CPPUNIT_ASSERT(Verify<CloseTo>(
213 for (LatLongNorthEast*
p = llneData;
214 p < llneData +
sizeof(llneData)/
sizeof(LatLongNorthEast);
216 oneUTMConversion(
p->fLat,
p->fLong,
p->fNorth,
p->fEast,
217 testHeight, testZone, testBand);
void testLatLongConversions()
void testUTMConversions()
boost::tuple< double, double, double, int, char > GetCoordinates() const
Get norting, easting, height, zone, and band.
Class to hold and convert a point in geodetic coordinates.
int GetZone() const
Get the zone.
char GetBand() const
Get the band.
void oneUTMConversion(const double, const double, const double n, const double e, const double h, const int z, const char b)
static const ReferenceEllipsoid & Get(const EllipsoidID theID)
Get known ellipsoid by registered ID.
double GetNorthing() const
Get the northing.
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
boost::tuple< double, double, double > Triple
Coordinate triple for easy getting or setting of coordinates.
Reference ellipsoids for UTM transformations.
double GetHeight() const
Get the height.
double GetEquatorialRadius() const
Get equatorial radius ( )
double GetEasting() const
Get the easting.
boost::tuple< double, double, double, int > GetCoordinates4() const
Get norting, easting, height, and zone.
boost::tuple< double, double, double > GetCoordinates3() const
Get norting, easting, and height.
const ReferenceEllipsoid & GetEllipsoid() const
Get the reference ellipsoid.
Point GetPoint(const CoordinateSystemPtr &theCS=CoordinateSystemPtr()) const
Get a cartesian point from an UTMPoint.
void oneLatLongConversion(const double la, const double lo, const double n, const double e, const double h, const int z, const char b)
boost::tuple< double, double, double > GetGeodeticCoordinates() const
Get geodetic latitude, longitude, height.