- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# Y:/msp/devkits/temp_geotrans/master/geotrans3.1/CCS/src/dtcc/CoordinateSystems/mercator/Mercator.h

Go to the documentation of this file.

    00001 // CLASSIFICATION: UNCLASSIFIED
    00002
    00003 #ifndef Mercator_H
    00004 #define Mercator_H
    00005
    00006 /***************************************************************************/
    00007 /* RSC IDENTIFIER: MERCATOR
    00008  *
    00009  * ABSTRACT
    00010  *
    00011  *    This component provides conversions between Geodetic coordinates
    00012  *    (latitude and longitude in radians) and Mercator projection coordinates
    00013  *    (easting and northing in meters).
    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  *          MERC_NO_ERROR                  : No errors occurred in function
    00023  *          MERC_LAT_ERROR                 : Latitude outside of valid range
    00024  *                                           (-89.5 to 89.5 degrees)
    00025  *          MERC_LON_ERROR                 : Longitude outside of valid range
    00026  *                                           (-180 to 360 degrees)
    00027  *          MERC_EASTING_ERROR             : Easting outside of valid range
    00028  *                                           (False_Easting +/- ~20,500,000 m,
    00029  *                                           depending on ellipsoid parameters
    00030  *                                           and Origin_Latitude)
    00031  *          MERC_NORTHING_ERROR            : Northing outside of valid range
    00032  *                                           (False_Northing +/- ~23,500,000 m,
    00033  *                                           depending on ellipsoid parameters
    00034  *                                           and Origin_Latitude)
    00035  *          MERC_LAT_OF_TRUE_SCALE_ERROR   : Latitude of true scale outside of valid range
    00036  *                                           (-89.5 to 89.5 degrees)
    00037  *          MERC_CENT_MER_ERROR            : Central meridian outside of valid range
    00038  *                                           (-180 to 360 degrees)
    00039  *          MERC_A_ERROR                   : Semi-major axis less than or equal to zero
    00040  *          MERC_INV_F_ERROR               : Inverse flattening outside of valid range
    00041  *                                                                                               (250 to 350)
    00042  *
    00043  * REUSE NOTES
    00044  *
    00045  *    MERCATOR is intended for reuse by any application that performs a
    00046  *    Mercator projection or its inverse.
    00047  *
    00048  * REFERENCES
    00049  *
    00050  *    Further information on MERCATOR can be found in the Reuse Manual.
    00051  *
    00052  *    MERCATOR originated from :  U.S. Army Topographic Engineering Center
    00053  *                                Geospatial Information Division
    00054  *                                7701 Telegraph Road
    00055  *                                Alexandria, VA  22310-3864
    00056  *
    00057  * LICENSES
    00058  *
    00059  *    None apply to this component.
    00060  *
    00061  * RESTRICTIONS
    00062  *
    00063  *    MERCATOR has no restrictions.
    00064  *
    00065  * ENVIRONMENT
    00066  *
    00067  *    MERCATOR was tested and certified in the following environments:
    00068  *
    00069  *    1. Solaris 2.5 with GCC, version 2.8.1
    00070  *    2. Windows 95 with MS Visual C++, version 6
    00071  *
    00072  * MODIFICATIONS
    00073  *
    00074  *    Date              Description
    00075  *    ----              -----------
    00076  *    10-02-97          Original Code
    00077  *    03-06-07          Original C++ Code
    00078  *
    00079  */
    00080
    00081
    00082 #include "CoordinateSystem.h"
    00083 #include "CoordinateType.h"
    00084
    00085
    00086 namespace MSP
    00087 {
    00088   namespace CCS
    00089   {
    00090     class MercatorStandardParallelParameters;
    00091     class MercatorScaleFactorParameters;
    00092     class MapProjectionCoordinates;
    00093     class GeodeticCoordinates;
    00094
    00095
    00096     /***************************************************************************/
    00097     /*
    00098      *                              DEFINES
    00099      */
    00100
    00101     class Mercator : public CoordinateSystem
    00102     {
    00103     public:
    00104
    00105       /*
    00106        * The constructor receives the ellipsoid parameters and
    00107        * Mercator projection parameters as inputs, and sets the corresponding state
    00108        * variables.  It calculates and returns the scale factor. If any errors occur,
    00109        * an exception is thrown with a description of the error.
    00110        *
    00111        *    ellipsoidSemiMajorAxis  : Semi-major axis of ellipsoid, in meters   (input)
    00112        *    ellipsoidFlattening     : Flattening of ellipsoid                                                   (input)
    00113        *    centralMeridian         : Longitude in radians at the center of     (input)
    00114        *                              the projection
    00115        *    standardParallel        : Latitude in radians at which the          (input)
    00116        *                              point scale factor is 1.0
    00117        *    falseEasting            : A coordinate value in meters assigned to the
    00118        *                              central meridian of the projection.       (input)
    00119        *    falseNorthing           : A coordinate value in meters assigned to the
    00120        *                              origin latitude of the projection         (input)
    00121        *    scaleFactor             : Multiplier which reduces distances in the
    00122        *                              projection to the actual distance on the
    00123        *                              ellipsoid                                 (output)
    00124        */
    00125
    00126             Mercator( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double standardParallel, double falseEasting, double falseNorthing, double* scaleFactor );
    00127
    00128
    00129       /*
    00130        * The constructor receives the ellipsoid parameters and
    00131        * Mercator projection parameters as inputs, and sets the corresponding state
    00132        * variables.  It receives the scale factor as input.  If any errors occur,
    00133        * an exception is thrown with a description of the error.
    00134        *
    00135        *    ellipsoidSemiMajorAxis  : Semi-major axis of ellipsoid, in meters   (input)
    00136        *    ellipsoidFlattening     : Flattening of ellipsoid                                                   (input)
    00137        *    centralMeridian         : Longitude in radians at the center of     (input)
    00138        *                              the projection
    00139        *    falseEasting            : A coordinate value in meters assigned to the
    00140        *                              central meridian of the projection.       (input)
    00141        *    falseNorthing           : A coordinate value in meters assigned to the
    00142        *                              origin latitude of the projection         (input)
    00143        *    scaleFactor             : Multiplier which reduces distances in the
    00144        *                              projection to the actual distance on the
    00145        *                              ellipsoid                                 (input)
    00146        */
    00147
    00148       Mercator::Mercator( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double falseEasting, double falseNorthing, double scaleFactor );
    00149
    00150
    00151       Mercator( const Mercator &m );
    00152
    00153
    00154             ~Mercator( void );
    00155
    00156
    00157       Mercator& operator=( const Mercator &m );
    00158
    00159
    00160       /*
    00161        * The function getStandardParallelParameters returns the current ellipsoid
    00162        * parameters and Mercator (Standard Parallel) projection parameters.
    00163        *
    00164        *    ellipsoidSemiMajorAxis  : Semi-major axis of ellipsoid, in meters   (output)
    00165        *    ellipsoidFlattening     : Flattening of ellipsoid                                                   (output)
    00166        *    centralMeridian         : Longitude in radians at the center of     (output)
    00167        *                              the projection
    00168        *    standardParallel        : Latitude in radians at which the          (output)
    00169        *                              point scale factor is 1.0
    00170        *    falseEasting            : A coordinate value in meters assigned to the
    00171        *                              central meridian of the projection.       (output)
    00172        *    falseNorthing           : A coordinate value in meters assigned to the
    00173        *                              origin latitude of the projection         (output)
    00174        */
    00175
    00176       MercatorStandardParallelParameters* getStandardParallelParameters() const;
    00177
    00178
    00179       /*
    00180        * The function getScaleFactorParameters returns the current ellipsoid
    00181        * parameters and Mercator (Scale Factor) projection parameters.
    00182        *
    00183        *    ellipsoidSemiMajorAxis  : Semi-major axis of ellipsoid, in meters   (output)
    00184        *    ellipsoidFlattening     : Flattening of ellipsoid                                                   (output)
    00185        *    centralMeridian         : Longitude in radians at the center of     (output)
    00186        *                              the projection
    00187        *    falseEasting            : A coordinate value in meters assigned to the
    00188        *                              central meridian of the projection.       (output)
    00189        *    falseNorthing           : A coordinate value in meters assigned to the
    00190        *                              origin latitude of the projection         (output)
    00191        *    scaleFactor             : Multiplier which reduces distances in the
    00192        *                              projection to the actual distance on the
    00193        *                              ellipsoid                                 (output)
    00194        */
    00195
    00196       MercatorScaleFactorParameters* getScaleFactorParameters() const;
    00197
    00198
    00199       /*
    00200        * The function convertFromGeodetic converts geodetic (latitude and
    00201        * longitude) coordinates to Mercator projection (easting and northing)
    00202        * coordinates, according to the current ellipsoid and Mercator projection
    00203        * parameters.  If any errors occur, an exception is thrown with a description
    00204        * of the error.
    00205        *
    00206        *    longitude         : Longitude (lambda) in radians       (input)
    00207        *    latitude          : Latitude (phi) in radians           (input)
    00208        *    easting           : Easting (X) in meters               (output)
    00209        *    northing          : Northing (Y) in meters              (output)
    00210        */
    00211
    00212       MSP::CCS::MapProjectionCoordinates* convertFromGeodetic( MSP::CCS::GeodeticCoordinates* geodeticCoordinates );
    00213
    00214
    00215       /*
    00216        * The function convertToGeodetic converts Mercator projection
    00217        * (easting and northing) coordinates to geodetic (latitude and longitude)
    00218        * coordinates, according to the current ellipsoid and Mercator projection
    00219        * coordinates.  If any errors occur, an exception is thrown with a description
    00220        * of the error.
    00221        *
    00222        *    easting           : Easting (X) in meters                  (input)
    00223        *    northing          : Northing (Y) in meters                 (input)
    00224        *    longitude         : Longitude (lambda) in radians          (output)
    00225        *    latitude          : Latitude (phi) in radians              (output)
    00226        */
    00227
    00228       MSP::CCS::GeodeticCoordinates* convertToGeodetic( MSP::CCS::MapProjectionCoordinates* mapProjectionCoordinates );
    00229
    00230     private:
    00231
    00232       CoordinateType::Enum coordinateType;
    00233
    00234       /* Ellipsoid Parameters, default to WGS 84 */
    00235       double Merc_e;               /* Eccentricity of ellipsoid    */
    00236       double Merc_es;              /* Eccentricity squared         */
    00237
    00238       /* Mercator projection Parameters */
    00239       double Merc_Standard_Parallel;      /* Latitude of true scale in radians     */
    00240       double Merc_Cent_Mer;               /* Central meridian in radians    */
    00241       double Merc_False_Northing;         /* False northing in meters          */
    00242       double Merc_False_Easting;          /* False easting in meters           */
    00243       double Merc_Scale_Factor;           /* Scale factor                      */
    00244
    00245       /* Isometric to geodetic latitude parameters, default to WGS 84 */
    00246       double Merc_ab;
    00247       double Merc_bb;
    00248       double Merc_cb;
    00249       double Merc_db;
    00250
    00251       /* Maximum variance for easting and northing values for WGS 84.*/
    00252
    00253       double Merc_Delta_Easting;
    00254       double Merc_Delta_Northing;
    00255
    00256     };
    00257   }
    00258 }
    00259
    00260 #endif
    00261
    00262
    00263 // CLASSIFICATION: UNCLASSIFIED