00001 // CLASSIFICATION: UNCLASSIFIED 00002 00003 #ifndef NZMG_H 00004 #define NZMG_H 00005 00006 /***************************************************************************/ 00007 /* RSC IDENTIFIER: NEW ZEALAND MAP GRID 00008 * 00009 * ABSTRACT 00010 * 00011 * This component provides conversions between Geodetic coordinates 00012 * (latitude and longitude) and New Zealand Map Grid coordinates 00013 * (easting and northing). 00014 * 00015 * ERROR HANDLING 00016 * 00017 * This component checks parameters for valid values. If an invalid value 00018 * is found the error code is combined with the current error code using 00019 * the bitwise or. This combining allows multiple error codes to be 00020 * returned. The possible error codes are: 00021 * 00022 * NZMG_NO_ERROR : No errors occurred in function 00023 * NZMG_LAT_ERROR : Latitude outside of valid range 00024 * (-33.5 to -48.5 degrees) 00025 * NZMG_LON_ERROR : Longitude outside of valid range 00026 * (165.5 to 180.0 degrees) 00027 * NZMG_EASTING_ERROR : Easting outside of valid range 00028 * (depending on ellipsoid and 00029 * projection parameters) 00030 * NZMG_NORTHING_ERROR : Northing outside of valid range 00031 * (depending on ellipsoid and 00032 * projection parameters) 00033 * NZMG_ELLIPSOID_ERROR : Invalid ellipsoid - must be International 00034 * 00035 * REUSE NOTES 00036 * 00037 * NEW ZEALAND MAP GRID is intended for reuse by any application that 00038 * performs a New Zealand Map Grid projection or its inverse. 00039 * 00040 * REFERENCES 00041 * 00042 * Further information on NEW ZEALAND MAP GRID can be found in the 00043 * Reuse Manual. 00044 * 00045 * NEW ZEALAND MAP GRID originated from : 00046 * U.S. Army Topographic Engineering Center 00047 * Geospatial Information Division 00048 * 7701 Telegraph Road 00049 * Alexandria, VA 22310-3864 00050 * 00051 * LICENSES 00052 * 00053 * None apply to this component. 00054 * 00055 * RESTRICTIONS 00056 * 00057 * NEW ZEALAND MAP GRID has no restrictions. 00058 * 00059 * ENVIRONMENT 00060 * 00061 * NEW ZEALAND MAP GRID was tested and certified in the following 00062 * environments: 00063 * 00064 * 1. Solaris 2.5 with GCC, version 2.8.1 00065 * 2. Windows 95 with MS Visual C++, version 6 00066 * 00067 * MODIFICATIONS 00068 * 00069 * Date Description 00070 * ---- ----------- 00071 * 09-14-00 Original Code 00072 * 03-2-07 Original C++ Code 00073 * 00074 * 00075 */ 00076 00077 #include "CoordinateSystem.h" 00078 00079 00080 namespace MSP 00081 { 00082 namespace CCS 00083 { 00084 class EllipsoidParameters; 00085 class MapProjectionCoordinates; 00086 class GeodeticCoordinates; 00087 00088 00089 /***************************************************************************/ 00090 /* 00091 * DEFINES 00092 */ 00093 00094 class NZMG : public CoordinateSystem 00095 { 00096 public: 00097 00098 /* 00099 * The constructor receives the ellipsoid code and sets 00100 * the corresponding state variables. If any errors occur, an exception is 00101 * thrown with a description of the error. 00102 * 00103 * ellipsoidCode : 2-letter code for ellipsoid (input) 00104 */ 00105 00106 NZMG( char* ellipsoidCode ); 00107 00108 00109 NZMG( const NZMG &n ); 00110 00111 00112 ~NZMG( void ); 00113 00114 00115 NZMG& operator=( const NZMG &n ); 00116 00117 00118 /* 00119 * The function getParameters returns the current ellipsoid 00120 * code. 00121 * 00122 * ellipsoidCode : 2-letter code for ellipsoid (output) 00123 */ 00124 00125 EllipsoidParameters* getParameters() const; 00126 00127 00128 /* 00129 * The function convertFromGeodetic converts geodetic (latitude and 00130 * longitude) coordinates to New Zealand Map Grid projection (easting and northing) 00131 * coordinates, according to the current ellipsoid and New Zealand Map Grid 00132 * projection parameters. If any errors occur, an exception is thrown with a description 00133 * of the error. 00134 * 00135 * longitude : Longitude (lambda), in radians (input) 00136 * latitude : Latitude (phi), in radians (input) 00137 * easting : Easting (X), in meters (output) 00138 * northing : Northing (Y), in meters (output) 00139 */ 00140 00141 MSP::CCS::MapProjectionCoordinates* convertFromGeodetic( MSP::CCS::GeodeticCoordinates* geodeticCoordinates ); 00142 00143 00144 /* 00145 * The function convertToGeodetic converts New Zealand Map Grid projection 00146 * (easting and northing) coordinates to geodetic (latitude and longitude) 00147 * coordinates, according to the current ellipsoid and New Zealand Map Grid projection 00148 * coordinates. If any errors occur, an exception is thrown with a description 00149 * of the error. 00150 * 00151 * easting : Easting (X), in meters (input) 00152 * northing : Northing (Y), in meters (input) 00153 * longitude : Longitude (lambda), in radians (output) 00154 * latitude : Latitude (phi), in radians (output) 00155 */ 00156 00157 MSP::CCS::GeodeticCoordinates* convertToGeodetic( MSP::CCS::MapProjectionCoordinates* mapProjectionCoordinates ); 00158 00159 private: 00160 00161 /* Ellipsoid Parameters, must be International */ 00162 char NZMGEllipsoidCode[3]; 00163 00164 }; 00165 } 00166 } 00167 00168 #endif 00169 00170 00171 // CLASSIFICATION: UNCLASSIFIED