1 //******************************************************************* 2 // 3 // License: See top level LICENSE.txt file. 4 // 5 // Author: Garrett Potts (gpotts@imagelinks.com) 6 // 7 // Description: 8 // 9 // Contains class declaration for OssimDatum. This is a class wrapper 10 // for Geotrans datum. For more thorough description of each function 11 // look at the datum.h file. 12 //******************************************************************* 13 // $Id: ossimDatum.h 19793 2011-06-30 13:26:56Z gpotts $ 14 #ifndef ossimDatum_HEADER 15 #define ossimDatum_HEADER 16 #include <ossim/base/ossimConstants.h> 17 #include <ossim/base/ossimString.h> 18 #include <ossim/base/ossimGpt.h> 19 #include <ossim/base/ossimEllipsoid.h> 20 #include <ossim/base/ossimObject.h> 21 22 class OSSIMDLLEXPORT ossimDatum : public ossimObject 23 { 24 friend class ossimDatumFactory; 25 26 public: 27 /** 28 * @param alpha_code new OSSIM/Geotrans datum code. (input) 29 * @param name Name of the new datum (input) 30 * @param SigmaX Standard error in X in meters (input) 31 * @param SigmaY Standard error in Y in meters (input) 32 * @param SigmaZ Standard error in Z in meters (input) 33 * @param southLatitude Southern edge of validity rectangle in radians(input) 34 * @param northLatitude Northern edge of validity rectangle in radians(input) 35 * @param westLongitude Western edge of validity rectangle in radians (input) 36 * @param eastLongitude Eastern edge of validity rectangle in radians (input) 37 */ 38 ossimDatum(const ossimString &alpha_code, const ossimString &name, 39 const ossimEllipsoid* anEllipsoid, 40 ossim_float64 sigmaX, ossim_float64 sigmaY, ossim_float64 sigmaZ, 41 ossim_float64 westLongitude, ossim_float64 eastLongitude, 42 ossim_float64 southLatitude, ossim_float64 northLatitude); 43 44 // Argument holds the source point and datum. Returns another 45 // point with this datum. 46 // 47 virtual ossimGpt shift(const ossimGpt &aPt)const=0; 48 //utility functions to shift to and from the standard coordinates. 49 //Users should use the shift instead!!! 50 // 51 virtual ossimGpt shiftToWgs84(const ossimGpt &aPt)const = 0; 52 virtual ossimGpt shiftFromWgs84(const ossimGpt &aPt)const = 0; 53 54 55 virtual bool isTheSameAs(const ossimDatum *aDatum)const 56 {return this == aDatum;} 57 virtual const ossimString& code()const{return theCode;} 58 virtual const ossimString& name()const{return theName;} 59 virtual ossim_uint32 epsgCode()const{return theEpsgCode;} 60 virtual const ossimEllipsoid* ellipsoid()const{return theEllipsoid;} 61 virtual ossim_float64 sigmaX()const{return theSigmaX;} 62 virtual ossim_float64 sigmaY()const{return theSigmaY;} 63 virtual ossim_float64 sigmaZ()const{return theSigmaZ;} 64 65 virtual ossim_float64 westLongitude()const{return theWestLongitude;} 66 virtual ossim_float64 eastLongitude()const{return theEastLongitude;} 67 virtual ossim_float64 southLatitude()const{return theSouthLatitude;} 68 virtual ossim_float64 northLatitude()const{return theNorthLatitude;} 69 70 virtual ossim_float64 param1()const=0; 71 virtual ossim_float64 param2()const=0; 72 virtual ossim_float64 param3()const=0; 73 virtual ossim_float64 param4()const=0; 74 virtual ossim_float64 param5()const=0; 75 virtual ossim_float64 param6()const=0; 76 virtual ossim_float64 param7()const=0; 77 78 virtual bool isInside(ossim_float64 latitude, ossim_float64 longitude)const 79 { 80 return ((theSouthLatitude <= latitude) && 81 (latitude <= theNorthLatitude) && 82 (theWestLongitude <= longitude) && 83 (longitude <= theEastLongitude)); 84 } 85 86 bool operator==(const ossimDatum& rhs) const; 87 88 bool operator!=(const ossimDatum& rhs)const 89 { 90 return (!(*this == rhs)); 91 } 92 virtual bool isEqualTo(const ossimObject& obj, ossimCompareType compareType=OSSIM_COMPARE_FULL)const; 93 94 protected: 95 //! Only friend ossimDatumFactory is permitted to delete 96 virtual ~ossimDatum(){}; 97 98 /*! 99 * This is directly from Geotrans: 100 * Begin Molodensky_Shift 101 * This function shifts geodetic coordinates using the Molodensky method. 102 * 103 * a : Semi-major axis of source ellipsoid in meters (input) 104 * da : Destination a minus source a (input) 105 * f : Flattening of source ellipsoid (input) 106 * df : Destination f minus source f (input) 107 * dx : X coordinate shift in meters (input) 108 * dy : Y coordinate shift in meters (input) 109 * dz : Z coordinate shift in meters (input) 110 */ 111 virtual void molodenskyShift( double a, 112 double da, 113 double f, 114 double df, 115 double dx, 116 double dy, 117 double dz, 118 double Lat_in, 119 double Lon_in, 120 double Hgt_in, 121 double &Lat_out, 122 double &Lon_out, 123 double &Hgt_out)const; 124 bool withinMolodenskyRange(const ossimGpt& pt)const 125 { 126 double lat = pt.latd(); 127 128 return ((lat < 89.75) && (lat > -89.75)); 129 } 130 131 132 protected: 133 ossimString theCode; 134 ossim_uint32 theEpsgCode; 135 ossimString theName; 136 const ossimEllipsoid *theEllipsoid; 137 138 ossim_float64 theSigmaX; 139 ossim_float64 theSigmaY; 140 ossim_float64 theSigmaZ; 141 142 ossim_float64 theWestLongitude; 143 ossim_float64 theEastLongitude; 144 ossim_float64 theSouthLatitude; 145 ossim_float64 theNorthLatitude; 146 147 TYPE_DATA; 148 }; 149 150 #endif 151