AugerCoordinateSystem.cc
Go to the documentation of this file.
1 
9 #include <utl/AugerCoordinateSystem.h>
10 #include <utl/ReferenceEllipsoid.h>
11 #include <utl/CoordinateSystem.h>
12 #include <utl/Point.h>
13 #include <utl/UTMPoint.h>
14 
15 #include <boost/tuple/tuple_io.hpp>
16 
17 using namespace utl;
18 
19 
20 template<typename Policy>
21 typename Policy::type
23  const ReferenceEllipsoid& theEllipsoid,
24  const CoordinateSystemPtr& theReferenceCS)
25 {
28  boost::tie(trans, rot) = theEllipsoid.TransformECEFToLocalSystem(theOrigin);
29 
30  const CoordinateSystemPtr ecef = theEllipsoid.GetECEF();
31 
32  const CoordinateSystemPtr baseCSToUse = theReferenceCS->GetReferenceSystem();
33  const TransformationMatrix ecefToReferenceCS = ecef->GetTransformationTo(baseCSToUse);
34 
35  // NB the order of the transformation and rotation has to be the
36  // oposite of the natural order to account for the way the
37  // transformations have to be reversed when going from active to
38  // passive transformations. This is related to the appearance of
39  // contra-gredient transformations in usual linear algebra. For the
40  // same reaseon, we have to put the inverse transformation from the
41  // reference CS to the ECEF in front.
42  return Policy::FromTransformation(ecefToReferenceCS * trans * rot, baseCSToUse);
43 }
44 
45 
46 template<typename Policy>
47 typename Policy::type
49  const ReferenceEllipsoid::EllipsoidID& theEllipsoidID,
50  const CoordinateSystemPtr& theReferenceCS)
51 {
52  return Create(theOrigin, ReferenceEllipsoid::Get(theEllipsoidID), theReferenceCS);
53 }
54 
55 
56 template<typename Policy>
57 typename Policy::type
59  const CoordinateSystemPtr& theReferenceCS)
60 {
61  const ReferenceEllipsoid& e = theOrigin.GetEllipsoid();
62  const Point p(theOrigin.GetPoint());
63 
64  return Create(p, e, theReferenceCS);
65 }
66 
67 
68 // instantiations
69 namespace utl {
72 }
static Policy::type Create(const Point &theOrigin, const ReferenceEllipsoid &theEllipsoid, const CoordinateSystemPtr &theReferenceCS)
Point object.
Definition: Point.h:32
Class to hold and convert a point in geodetic coordinates.
Definition: UTMPoint.h:40
static const ReferenceEllipsoid & Get(const EllipsoidID theID)
Get known ellipsoid by registered ID.
boost::tuple< TransformationMatrix, TransformationMatrix > TransformECEFToLocalSystem(const Point &theOrigin) const
Translation and rotation to go to local coordinate system.
Transformations matrices for afine transformations.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
Reference ellipsoids for UTM transformations.
const CoordinateSystemPtr GetECEF() const
Get the ECEF.
const ReferenceEllipsoid & GetEllipsoid() const
Get the reference ellipsoid.
Definition: UTMPoint.h:221
EllipsoidID
ID&#39;s of known reference ellipsoid&#39;s.
Point GetPoint(const CoordinateSystemPtr &theCS=CoordinateSystemPtr()) const
Get a cartesian point from an UTMPoint.
Definition: UTMPoint.cc:45

, generated on Tue Sep 26 2023.