spatref.h

Go to the documentation of this file.
00001 /**
00002  * \file spatref.h <mi32/spatref.h>
00003  * \brief Spatial Reference (SPATREF) System definitions
00004  *
00005  * \if NODOC
00006  * $Id: spatref.h_v 1.53 2004/11/24 17:47:13 mju Exp $
00007  *
00008  * $Log: spatref.h_v $
00009  * Revision 1.53  2004/11/24 17:47:13  mju
00010  * Mark some dlg variants as deprecated.
00011  *
00012  * Revision 1.52  2004/11/24 15:45:21  mju
00013  * Add datum/coordsys 'types' for GeorefObject.
00014  *
00015  * Revision 1.51  2004/11/23 23:06:19  mju
00016  * Add astroproj stuff.
00017  *
00018  * Revision 1.50  2004/11/23 17:24:30  mju
00019  * Add coordopmethod type enum.
00020  * Add ability to get projected operation type for projected coordsys.
00021  * Add method to get valid datum type for coordsys.
00022  *
00023  * Revision 1.49  2004/11/17 15:39:17  mju
00024  * Add datum type for astronomical.
00025  *
00026  * Revision 1.48  2004/11/09 22:30:33  mju
00027  * Add crs.setName.
00028  *
00029  * Revision 1.47  2004/11/09 18:25:47  mju
00030  * Add getdisplay values for all IDs and remarks.
00031  *
00032  * Revision 1.46  2004/11/08 17:37:56  mju
00033  * Add getdisplay value to skip valid area.
00034  *
00035  * Revision 1.45  2004/11/05 22:51:41  mju
00036  * Add equatorial coordsys type and appropriate axis and coordsys ids.
00037  *
00038  * Revision 1.44  2004/11/03 20:45:01  mju
00039  * Remove generic 'scale factor' parm as technically incorrect.
00040  *
00041  * Revision 1.41  2004/10/13 14:03:07  mju
00042  * Rename LCC to indicate 2SP.
00043  *
00044  * Revision 1.40  2004/10/06 21:00:17  dwilliss
00045  * added private method to SYSTEM
00046  *
00047  * Revision 1.39  2004/09/30 14:53:21  mju
00048  * Add cs idnums for ft/ftUS.
00049  *
00050  * Revision 1.38  2004/09/29 14:20:10  mju
00051  * Add crs.hasOwnDatumTransOpList.
00052  * Add system.isInitialized.
00053  *
00054  * Revision 1.37  2004/09/27 20:39:07  mju
00055  * Add system methods to get instances by idnum.
00056  *
00057  * Revision 1.36  2004/09/21 20:01:27  mju
00058  * Add idnums for UTM coordops.
00059  *
00060  * Revision 1.35  2004/07/28 15:19:48  mju
00061  * Change flags for dlgGetCoordRefSys to use Allow3D instead of No3D.
00062  * Add variant for specifying flags with default coordsystypes.
00063  *
00064  * Revision 1.34  2004/07/20 21:52:07  mju
00065  * Add crs.clear.
00066  *
00067  * Revision 1.33  2004/07/19 20:05:40  mju
00068  * Add ellipsoid idnums.
00069  *
00070  * Revision 1.32  2004/07/19 16:57:59  mju
00071  * Add coordopdef isprojected and setcoordsys by id num.
00072  *
00073  * Revision 1.31  2004/07/14 13:13:41  mju
00074  * Add crs.setDatum using idnum.
00075  *
00076  * Revision 1.30  2004/07/13 15:22:39  dwilliss
00077  * Just reread Mike's email and he wanted it named Undefined, not None.
00078  *
00079  * Revision 1.29  2004/07/13 15:21:20  dwilliss
00080  * Added new SELFLAG for None
00081  *
00082  * Revision 1.28  2004/07/13 14:10:13  mju
00083  * Add crs.getAxis,getDimension.
00084  * Add axis.getValidRange.
00085  *
00086  * Revision 1.27  2004/07/12 15:17:05  mju
00087  * Change op_string to op_zoned and redesign to have internal implementation.
00088  *
00089  * Revision 1.26  2004/07/09 17:43:45  mju
00090  * Remove unnecessary flag for dlgGetCRS.
00091  *
00092  * Revision 1.25  2004/07/09 17:40:17  mju
00093  * Add coordsys type for string and id for MGRS.
00094  *
00095  * Revision 1.24  2004/06/29 15:23:41  mju
00096  * Add dlggetcrs variant with no prompt.
00097  *
00098  * Revision 1.23  2004/06/29 13:24:59  mju
00099  * Add ellipsoid methods to compute linear scale and distance.
00100  *
00101  * Revision 1.22  2004/06/28 17:56:53  mju
00102  * Add HasDatumType.
00103  *
00104  * Revision 1.21  2004/06/28 17:55:55  mju
00105  * Add ComputeDistance and IsLocal.
00106  *
00107  * Revision 1.20  2004/06/24 19:58:53  mju
00108  * Add crs.HasCoordSysType.
00109  * Add crs.ComputeAngleToNorth.
00110  *
00111  * Revision 1.19  2004/06/24 19:14:10  mju
00112  * Use uom::idnum for setting parm value.
00113  *
00114  * Revision 1.18  2004/06/22 20:28:08  mju
00115  * Add coordopparm.getdisplaystrs.
00116  * Add more GETDISPLAY flags.
00117  *
00118  * Revision 1.17  2004/06/22 15:33:55  mju
00119  * Add crs Ini methods.
00120  * Add GetDisplay methods.
00121  *
00122  * Revision 1.16  2004/06/21 14:31:40  mju
00123  * Change getLegacyProjParm to return TRUE on success, FALSE if can't convert.
00124  *
00125  * Revision 1.15  2004/06/21 14:23:33  mju
00126  * Remove unit from getLegacyProjParm.
00127  *
00128  * Revision 1.14  2004/06/18 15:49:55  mju
00129  * Use oldprojparm.
00130  * Add CRS validation.
00131  * Add convenience crs creation using coordsys idnum.
00132  *
00133  * Revision 1.13  2004/06/17 17:43:44  mju
00134  * *** empty log message ***
00135  *
00136  * Revision 1.12  2004/05/25 21:21:29  mju
00137  * Add datum.getAbbr.
00138  *
00139  * Revision 1.11  2004/05/24 20:14:22  mju
00140  * More refinements.
00141  *
00142  * Revision 1.10  2004/05/20 14:50:58  mju
00143  * Change "type" enums to use unique bits so can combine for use in selection.
00144  * Add methods to get source/target axis lists for coordopmethod.
00145  *
00146  * Revision 1.9  2004/04/29 20:24:11  mju
00147  * Add getselectiongrouplist.
00148  *
00149  * Revision 1.8  2004/04/29 14:34:10  mju
00150  * Add assign from xml and getxml methods.
00151  * Finish datumtransop support.
00152  *
00153  * Revision 1.7  2004/04/20 13:49:29  mju
00154  * Add get/setMapProjParm.
00155  * Add DatumTransOp methods.
00156  *
00157  * Revision 1.6  2004/04/13 14:40:27  mju
00158  * Initial implementation for reading from XML now mostly complete.
00159  *
00160  * Revision 1.1  2003/09/19 14:06:27  mju
00161  * Initial revision
00162  *
00163  * \endif
00164 **/
00165 
00166 #ifndef  INC_MI32_SPATREF_H
00167 #define  INC_MI32_SPATREF_H
00168 
00169 #ifndef  INC_MI32_IDENTIFIER_H
00170 #include <mi32/identifier.h>
00171 #endif
00172 
00173 #ifndef  INC_MI32_MISTRING_H
00174 #include <mi32/mistring.h>
00175 #endif
00176 
00177 #ifndef  INC_MI32_MILIST_H
00178 #include <mi32/milist.h>
00179 #endif
00180 
00181 #ifndef  INC_MI32_UOM_H
00182 #include <mi32/uom.h>
00183 #endif
00184 
00185 #ifndef  INC_MI32_TEXTRES_H
00186 #include <mi32/textres.h>
00187 #endif
00188 
00189 #ifndef  INC_MI32_RANGE_H
00190 #include <mi32/range.h>
00191 #endif
00192 
00193 #ifdef GEOMDLL
00194    #define CLASSLIBEXPORT MI_DLLCLASSEXPORT
00195 #else
00196    #define CLASSLIBEXPORT MI_DLLCLASSIMPORT
00197 #endif
00198 
00199 #ifndef GENERATING_DOXYGEN_OUTPUT
00200 class XMLNODE;
00201 struct CHECKEXE;
00202 struct OLDPROJPARM;
00203 #endif // GENERATING_DOXYGEN_OUTPUT
00204 
00205 namespace SPATREF {
00206 
00207 class COORDSYS;
00208 class COORDREFSYS;
00209 class COORDOPDEF;
00210 class COORDOP_IMPL;
00211 class COORDOP_IMPL_SINGLE;
00212 
00213 enum GETDISPLAY {
00214    GETDISPLAY_None =          0x00,
00215    GETDISPLAY_MicroImagesID = 0x01,    //!< Show MicroImages ID number
00216    GETDISPLAY_SkipName =      0x02,    //!< Skip name, usually because included by caller
00217    GETDISPLAY_SkipMethod =    0x04,    //!< Skip method name for COORDOPDEF
00218    GETDISPLAY_SkipValidArea = 0x08,    //!< Skip valid area for COORDOPDEF
00219    GETDISPLAY_AllIDs =        0x10,    //!< Show all IDs
00220    GETDISPLAY_Remarks =       0x20,    //!< Show 'remarks' from database
00221    };
00222 DEFINE_ENUM_OP_BITWISE(GETDISPLAY)
00223 
00224 //=====================================================================================================================
00225 //! Ellipsoid specification.
00226 class CLASSLIBEXPORT ELLIPSOID {
00227    public:
00228 
00229       //! Ellipsoid ID numbers.
00230       //! Note, not all IDs in database are listed.
00231       enum IDNUM {
00232          IDNUM_Undefined =          -1,
00233          IDNUM_UnitSphere =         1300,
00234          IDNUM_Clarke_1866 =        1302,
00235          IDNUM_GRS_1980 =           1301,
00236          IDNUM_WGS_1984 =           1351,
00237          };
00238 
00239       //! Ellipsoid definition form
00240       enum FORM {
00241          FORM_Undefined =           0,
00242          FORM_Sphere =              1,    //!< Defined as sphere, semi-minor axis equal to semi-major.
00243          FORM_SemiMinorAxis =       2,    //!< Defined using value for semi-minor axis
00244          FORM_InverseFlattening =   3     //!< Defined using inverse flattening
00245          };
00246 
00247       //! Lookup IDNUM using axis values.
00248       static IDNUM LookupIdNum (
00249          double SemiMajorAxis,            //!< Semi-major axis (meters)
00250          double SemiMinorAxis,            //!< Semi-minor axis (meters), 0 to use InverseFlattening
00251          double InverseFlattening = 0     //!< Inverse flattening, 0 to use semi-minor axis
00252          );
00253 
00254       //! Default constructor.
00255       ELLIPSOID (
00256          );
00257 
00258       //! Copy constructor.
00259       ELLIPSOID (
00260          const ELLIPSOID& rhs
00261          );
00262 
00263       //! Destructor.
00264       ~ELLIPSOID (
00265          );
00266 
00267       //! Assignment.
00268       ELLIPSOID& operator= (
00269          const ELLIPSOID& rhs
00270          );
00271 
00272       //! Assign by IDENTIFIER.
00273       ERRVALUE Assign (
00274          const IDENTIFIER& Id
00275          );
00276 
00277       //! Assign by MicroImages ID number.
00278       ERRVALUE Assign (
00279          IDNUM IdNum
00280          );
00281 
00282       //! Compute geodesic distance over ellipsoid between specified points.
00283       ERRVALUE ComputeDistance (
00284          const DPOINT2D& point1,
00285          const DPOINT2D& point2,
00286          double& distance,
00287          const UOM::UNIT& PointUnit,
00288          const UOM::UNIT& LengthUnit
00289          ) const;
00290 
00291       //! Compute eccentricity.
00292       //! @return Eccentricity.
00293       double ComputeEccentricity (
00294          ) const;
00295 
00296       //! Compute flattening.
00297       //! @return Flattening, 0 if sphere.
00298       double ComputeFlattening (
00299          ) const;
00300 
00301       //! Compute scale from angular to linear units at specified latitude.
00302       void ComputeLinearScale (
00303          double GeodeticLatitude,               //!< Latitude at which to compute scale
00304          DPOINT2D& scale,                       //!< Scale from angular to linear unit on ellipsoid returned
00305          UOM::IDNUM LatitudeUnitIdNum = UOM::IDNUM_PlaneAngle_Degree,
00306          UOM::IDNUM LinearUnitIdNum = UOM::IDNUM_Length_Meter
00307          ) const;
00308 
00309       //! Get multiline string suitable for display.
00310       void GetDisplay (
00311          MISTRING& string,                      //!< String returned, will be initially cleared if indent is 0
00312          int indent,                            //!< Indent level
00313          GETDISPLAY flags = GETDISPLAY_None  //!< Flags for extra items to display
00314          ) const;
00315 
00316       //! Get ellipsoid definition form.
00317       FORM GetForm (
00318          ) const;
00319 
00320       //! Get identifer list.
00321       const IDENTIFIERLIST& GetIdList (
00322          ) const;
00323 
00324       //! Get MicroImages identification number.
00325       IDNUM GetIdNum (
00326          ) const;
00327 
00328       //! Get inverse flatting value.
00329       //! @return Inverse flattening, infinity if sphere.
00330       double GetInverseFlattening (
00331          ) const;
00332 
00333       //! Get name.
00334       const MISTRING& GetName (
00335          ) const;
00336 
00337       //! Get semi-major axis in meters.
00338       double GetSemiMajorAxis (
00339          ) const;
00340 
00341       //! Get semi-minor axis in meters.
00342       double GetSemiMinorAxis (
00343          ) const;
00344 
00345       #ifndef GENERATING_DOXYGEN_OUTPUT
00346       class PRIV;
00347       // Internal constructor.
00348       ELLIPSOID (PRIV& Priv);
00349       bool IsEqual (const ELLIPSOID& rhs) const { return (m_pPriv == rhs.m_pPriv); }
00350    private:
00351       PRIV *m_pPriv;
00352       #endif // GENERATING_DOXYGEN_OUTPUT
00353    };
00354 typedef MILIST<ELLIPSOID> ELLIPSOIDLIST;
00355 
00356 inline bool operator== (
00357    const ELLIPSOID& lhs,
00358    const ELLIPSOID& rhs
00359    ) {
00360    return (lhs.IsEqual(rhs)); 
00361    }
00362 
00363 inline bool operator!= (
00364    const ELLIPSOID& lhs,
00365    const ELLIPSOID& rhs
00366    ) {
00367    return (!lhs.IsEqual(rhs)); 
00368    }
00369 
00370 //=====================================================================================================================
00371 //! Prime meridian specification.
00372 class CLASSLIBEXPORT PRIMEMERIDIAN {
00373    public:
00374 
00375       //! Prime Meridian ID numbers.
00376       //! Note, not all IDs in database are listed.
00377       enum IDNUM {
00378          IDNUM_Undefined =          -1,
00379          IDNUM_Greenwich =          1001
00380          };
00381 
00382       //! Default constructor.
00383       PRIMEMERIDIAN (
00384          );
00385 
00386       //! Copy constructor.
00387       PRIMEMERIDIAN (
00388          const PRIMEMERIDIAN& rhs
00389          );
00390 
00391       //! Destructor.
00392       ~PRIMEMERIDIAN (
00393          );
00394 
00395       //! Assignment.
00396       PRIMEMERIDIAN& operator= (
00397          const PRIMEMERIDIAN& rhs
00398          );
00399 
00400       //! Assign by IDENTIFIER.
00401       ERRVALUE Assign (
00402          const IDENTIFIER& Id
00403          );
00404 
00405       //! Assign by MicroImages ID number.
00406       ERRVALUE Assign (
00407          IDNUM IdNum
00408          );
00409 
00410       //! Get multiline string suitable for display.
00411       void GetDisplay (
00412          MISTRING& string,                      //!< String returned, will be initially cleared if indent is 0
00413          int indent,                            //!< Indent level
00414          GETDISPLAY flags = GETDISPLAY_None  //!< Flags for extra items to display
00415          ) const;
00416 
00417       //! Get longitude positive eastward from Greenwich meridian in degrees.
00418       double GetGreenwichLongitude (
00419          ) const;
00420 
00421       //! Get identifer list.
00422       const IDENTIFIERLIST& GetIdList (
00423          ) const;
00424 
00425       //! Get MicroImages identification number.
00426       IDNUM GetIdNum (
00427          ) const;
00428 
00429       //! Get name.
00430       const MISTRING& GetName (
00431          ) const;
00432 
00433       #ifndef GENERATING_DOXYGEN_OUTPUT
00434       class PRIV;
00435       // Internal constructor.
00436       PRIMEMERIDIAN (PRIV& Priv);
00437    private:
00438       PRIV *m_pPriv;
00439       #endif // GENERATING_DOXYGEN_OUTPUT
00440    };
00441 typedef MILIST<PRIMEMERIDIAN> PRIMEMERIDIANLIST;
00442 
00443 enum PRIMEMERIDIAN_IDNUM {
00444    PRIMEMERIDIAN_IDNUM_Greenwich =     1001
00445    };
00446 
00447 //=====================================================================================================================
00448 //! Datum specification.
00449 class CLASSLIBEXPORT DATUM {
00450    public:
00451 
00452       //! Datum ID numbers.
00453       //! Note, not all IDs in database are listed.
00454       enum IDNUM {
00455          IDNUM_Undefined =                -1,
00456          IDNUM_Local =                    2000,
00457          IDNUM_WGS_1984 =                 2800,
00458          IDNUM_WGS_1972 =                 2802,
00459          IDNUM_AustralianGeodetic_1966 =  2219,
00460          IDNUM_AustralianGeodetic_1984 =  2220,
00461          IDNUM_CampoInchauspe =           2233,
00462          IDNUM_CorregoAlegre =            2245,
00463          IDNUM_European_1950 =            2260,
00464          IDNUM_NorthAmerican_1927 =       2346,
00465          IDNUM_NorthAmerican_1983 =       2347,
00466          IDNUM_SouthAmerican_1969 =       2386,
00467          IDNUM_Astronomical_Unspecified = 2700,
00468          IDNUM_MeanSeaLevel =             2900,
00469          };
00470 
00471       //! Datum type enumeration.
00472       enum TYPE {
00473          TYPE_Undefined =     0x0000,
00474          TYPE_Geodetic =      0x0002,  //!< Geodetic datum with ellipsoid and prime meridian
00475          TYPE_Vertical =      0x0004,  //!< Vertical (gravity-based) datum
00476          TYPE_Engineering =   0x0008,  //!< Engineering/Local datum
00477          TYPE_Temporal =      0x0010,  //!< Temporal (time-based) datum
00478          TYPE_Image =         0x0020,  //!< Image (pixel-based) datum
00479          TYPE_Astronomical =  0x0040,  //!< Astronomical datum
00480          TYPES_GeorefObject = (TYPE_Geodetic | TYPE_Engineering | TYPE_Astronomical)
00481          };
00482 
00483       //! Convert DATUM::TYPE to TEXTID.
00484       static TEXTID TypeToTextID (
00485          TYPE type
00486          );
00487 
00488       //! Default constructor.
00489       DATUM (
00490          );
00491 
00492       //! Copy constructor.
00493       DATUM (
00494          const DATUM& rhs
00495          );
00496 
00497       //! Destructor.
00498       ~DATUM (
00499          );
00500 
00501       //! Assignment.
00502       DATUM& operator= (
00503          const DATUM& rhs
00504          );
00505 
00506       //! Assign by IDENTIFIER.
00507       ERRVALUE Assign (
00508          const IDENTIFIER& Id
00509          );
00510 
00511       //! Assign by MicroImages ID number.
00512       ERRVALUE Assign (
00513          IDNUM IdNum
00514          );
00515 
00516       //! Assign from XMLNODE.
00517       ERRVALUE Assign (
00518          const XMLNODE* xmlnode
00519          );
00520 
00521       //! Get abbreviation.
00522       const MISTRING& GetAbbr (
00523          ) const;
00524 
00525       //! Get default transformation operation definition list.
00526       const MILIST<COORDOPDEF>& GetDftTransOpList (
00527          ) const;
00528 
00529       //! Get multiline string suitable for display.
00530       void GetDisplay (
00531          MISTRING& string,                      //!< String returned, will be initially cleared if indent is 0
00532          int indent,                            //!< Indent level
00533          GETDISPLAY flags = GETDISPLAY_None  //!< Flags for extra items to display
00534          ) const;
00535 
00536       //! Get ellipsoid reference for geodetic datum.
00537       //! @return Ellipsoid reference.
00538       const ELLIPSOID& GetEllipsoid (
00539          ) const;
00540 
00541       //! Get identifer list.
00542       const IDENTIFIERLIST& GetIdList (
00543          ) const;
00544 
00545       //! Get MicroImages identification number.
00546       IDNUM GetIdNum (
00547          ) const;
00548 
00549       //! Get name.
00550       const MISTRING& GetName (
00551          ) const;
00552 
00553       //! Get prime meridian reference for geodetic datum.
00554       const PRIMEMERIDIAN& GetPrimeMeridian (
00555          ) const;
00556 
00557       //! Get datum type.
00558       TYPE GetType (
00559          ) const;
00560 
00561       //! Get list of valid area names.
00562       const TEXTRESITEMLIST& GetValidAreaList (
00563          ) const;
00564 
00565       //! Get XMLNODE representation.
00566       XMLNODE* GetXML (
00567          XMLNODE *parentnode,                   //! Parent for contain node to be created
00568          const char *nodename = "Datum"
00569          ) const;
00570 
00571       //! Determine if datum can be converted to other datums.
00572       bool IsConvertible (
00573          ) const;
00574 
00575       #ifndef GENERATING_DOXYGEN_OUTPUT
00576       class PRIV;
00577       // Internal constructor.
00578       DATUM (PRIV& Priv);
00579       // Used internally for initialization.
00580       PRIV* GetPrivPtr () const { return (m_pPriv); }
00581       bool IsEqual (const DATUM& rhs) const { return (m_pPriv == rhs.m_pPriv); }
00582    private:
00583       PRIV *m_pPriv;
00584       #endif // GENERATING_DOXYGEN_OUTPUT
00585    };
00586 typedef MILIST<DATUM> DATUMLIST;
00587 DEFINE_ENUM_OP_BITWISE(DATUM::TYPE)
00588 
00589 inline bool operator== (
00590    const DATUM& lhs,
00591    const DATUM& rhs
00592    ) {
00593    return (lhs.IsEqual(rhs)); 
00594    }
00595 
00596 inline bool operator!= (
00597    const DATUM& lhs,
00598    const DATUM& rhs
00599    ) {
00600    return (!lhs.IsEqual(rhs)); 
00601    }
00602 
00603 //=====================================================================================================================
00604 //! Coordinate axis definition.
00605 class CLASSLIBEXPORT COORDAXIS {
00606    public:
00607 
00608       //! Coordinate Axis ID numbers.
00609       enum IDNUM {
00610          IDNUM_Undefined =               -1,
00611          IDNUM_None =                     0,
00612          IDNUM_GeodeticLatitude =      1101,
00613          IDNUM_GeodeticLongitude =     1102,
00614          IDNUM_EllipsoidalHeight =     1103,
00615          IDNUM_Easting =               1104,
00616          IDNUM_Northing =              1105,
00617          IDNUM_Westing =               1106,
00618          IDNUM_Southing =              1107,
00619          IDNUM_GravityRelatedHeight =  1108,
00620          IDNUM_GravityRelatedDepth =   1109,
00621          IDNUM_GeocentricX =           1110,
00622          IDNUM_GeocentricY =           1111,
00623          IDNUM_GeocentricZ =           1112,
00624          IDNUM_SphericalLatitude =     1113,
00625          IDNUM_SphericalLongitude =    1114,
00626          IDNUM_GeocentricRadius =      1115,
00627          IDNUM_LocalX =                1116,
00628          IDNUM_LocalY =                1117,
00629          IDNUM_LocalZ =                1118,
00630          IDNUM_ImageColumn =           1119,
00631          IDNUM_ImageRow =              1120,
00632          IDNUM_RightAscension =        1121,
00633          IDNUM_Declination =           1122,
00634          };
00635 
00636       enum SYMBOLUSAGE {
00637          SYMBOLUSAGE_Unspecified =     0,
00638          SYMBOLUSAGE_Positive =        1,
00639          SYMBOLUSAGE_Negative =        2
00640          };
00641 
00642       //! Default constructor.
00643       COORDAXIS (
00644          );
00645 
00646       //! Copy constructor.
00647       COORDAXIS (
00648          const COORDAXIS& rhs
00649          );
00650 
00651       //! Destructor.
00652       ~COORDAXIS (
00653          );
00654 
00655       //! Assignment.
00656       COORDAXIS& operator= (
00657          const COORDAXIS& rhs
00658          );
00659 
00660       //! Assign by IDENTIFIER.
00661       ERRVALUE Assign (
00662          const IDENTIFIER& Id
00663          );
00664 
00665       //! Assign by MicroImages ID number.
00666       ERRVALUE Assign (
00667          IDNUM IdNum
00668          );
00669 
00670       //! Assign from XMLNODE.
00671       ERRVALUE Assign (
00672          const XMLNODE* xmlnode
00673          );
00674 
00675       //! Create coordinate axis.
00676       ERRVALUE Create (
00677          const UOM::UNIT& unit,                 //!< Coordinate unit
00678          const MISTRING& name,                  //!< Axis name
00679          const MISTRING& SymbolPositive,        //!< Symbol for coordinate
00680          const MISTRING& SymbolNegative         //!< Symbol for negative coordinate, blank if same as for positive
00681          );
00682 
00683       //! Get abbreviation.
00684       const MISTRING& GetAbbr (
00685          ) const;
00686 
00687       //! Get multiline string suitable for display.
00688       void GetDisplay (
00689          MISTRING& string,                      //!< String returned, will be initially cleared if indent is 0
00690          int indent,                            //!< Indent level
00691          GETDISPLAY flags = GETDISPLAY_None     //!< Flags for extra items to display
00692          ) const;
00693 
00694       //! Get identifer list.
00695       const IDENTIFIERLIST& GetIdList (
00696          ) const;
00697 
00698       //! Get MicroImages identification number.
00699       IDNUM GetIdNum (
00700          ) const;
00701 
00702       //! Get name.
00703       const MISTRING& GetName (
00704          ) const;
00705 
00706       //! Get name fitted to limited space.
00707       //! Used where name is displayed in limited space such as a table column heading or field name.
00708       //! Returned name may contain spaces, and may contain symbol for axis if no other availble name will fit.
00709       //! If unit symbol is included, returned string will be in the form of "name (unitsym)".
00710       MISTRING GetNameFitted (
00711          int maxchars,                          //!< Maximum string length returned
00712          bool IncludeUnitSymbol                 //!< Include unit symbol in name
00713          ) const;
00714 
00715       //! Get symbol for specified usage.
00716       const MISTRING& GetSymbol (
00717          SYMBOLUSAGE usage = SYMBOLUSAGE_Unspecified
00718          ) const;
00719 
00720       //! Get axis measurement unit.
00721       const UOM::UNIT& GetUnit (
00722          ) const;
00723 
00724       //! Get valid range for ordinates on this axis.
00725       //! @return Valid range, will be arbitrarily large if no valid range defined.
00726       const DOUBLE_RANGE& GetValidRange (
00727          ) const;
00728 
00729       //! Get XMLNODE representation.
00730       XMLNODE* GetXML (
00731          XMLNODE *parentnode,                   //! Parent for contain node to be created
00732          const char *nodename = "CoordAxis"
00733          ) const;
00734 
00735       //! Determine if has different symbol for negative values than for positive.
00736       bool HasSymbolNegative (
00737          ) const;
00738 
00739       //! Set name for axis.
00740       void SetName (
00741          const MISTRING& textitem
00742          );
00743 
00744       //! Set symbol for reporting 'positive' values.
00745       //! Will use for all values if no 'negative' symbol specified.
00746       void SetSymbolPositive (
00747          const MISTRING& symbol
00748          );
00749 
00750       //! Set symbol for reporting 'negative' values.
00751       void SetSymbolNegative (
00752          const MISTRING& symbol
00753          );
00754 
00755       //! Set new measurement unit for axis.
00756       //! Does not alter valid range if any.
00757       void SetUnit (
00758          const UOM::UNIT& unit
00759          );
00760 
00761       //! Set valid range for axis values.
00762       void SetValidRange (
00763          const DOUBLE_RANGE& ValidRange   //!< Range to set
00764          );
00765 
00766       #ifndef GENERATING_DOXYGEN_OUTPUT
00767       class PRIV;
00768       // Internal constructor.
00769       COORDAXIS (PRIV& Priv);
00770       bool IsEqual (const COORDAXIS& rhs) const;
00771       void SetSymbolPositive (const TEXTRESITEM& textitem);
00772       void SetSymbolNegative (const TEXTRESITEM& textitem);
00773 
00774    private:
00775       PRIV *m_pPriv;
00776       void GetExclusive ();
00777       #endif // GENERATING_DOXYGEN_OUTPUT
00778    };
00779 typedef MILIST<COORDAXIS> COORDAXISLIST;
00780 
00781 inline bool operator== (
00782    const COORDAXIS& lhs,
00783    const COORDAXIS& rhs
00784    ) {
00785    return (lhs.IsEqual(rhs)); 
00786    }
00787 
00788 inline bool operator!= (
00789    const COORDAXIS& lhs,
00790    const COORDAXIS& rhs
00791    ) {
00792    return (!lhs.IsEqual(rhs)); 
00793    }
00794 
00795 
00796 //=====================================================================================================================
00797 //! Coordinate operation parameter definition.
00798 class CLASSLIBEXPORT COORDOPPARM {
00799    public:
00800 
00801       //! Coordinate Operation Parameter ID numbers.
00802       enum IDNUM {
00803          IDNUM_Undefined =                                    -1,
00804          IDNUM_LatitudeOffset =                             1501,
00805          IDNUM_LongitudeOffset =                            1502,
00806          IDNUM_VerticalOffset =                             1503,
00807          IDNUM_GeoidUndulation =                            1504,
00808          IDNUM_X_AxisTranslation =                          1505,
00809          IDNUM_Y_AxisTranslation =                          1506,
00810          IDNUM_Z_AxisTranslation =                          1507,
00811          IDNUM_X_AxisRotation =                             1508,
00812          IDNUM_Y_AxisRotation =                             1509,
00813          IDNUM_Z_AxisRotation =                             1510,
00814          IDNUM_ScaleDifference =                            1511,
00815          IDNUM_ScaleFactorForSourceCRSFirstAxis =           1512,
00816          IDNUM_ScaleFactorForSourceCRSSecondAxis =          1513,
00817          IDNUM_RotationAngleOfSourceCRSAxes =               1514,
00818          IDNUM_RotationAngleOfSourceCRSFirstAxis =          1515,
00819          IDNUM_RotationAngleOfSourceCRSSecondAxis =         1516,
00820          IDNUM_Ordinate1OfEvaluationPoint =                 1517,
00821          IDNUM_Ordinate2OfEvaluationPoint =                 1518,
00822          IDNUM_Ordinate3OfEvaluationPoint =                 1519,
00823          IDNUM_Ordinate1OfEvaluationPointInSourceCRS =      1520,
00824          IDNUM_Ordinate2OfEvaluationPointInSourceCRS =      1521,
00825          IDNUM_Ordinate1OfEvaluationPointInTargetCRS =      1522,
00826          IDNUM_Ordinate2OfEvaluationPointInTargetCRS =      1523,
00827          IDNUM_SemiMajorAxisLengthDifference =              1526,
00828          IDNUM_FlatteningDifference =                       1527,
00829          IDNUM_LatitudeAndLongitudeDifferenceFile =         1528,
00830          IDNUM_LatitudeDifferenceFile =                     1529,
00831          IDNUM_LongitudeDifferenceFile =                    1530,
00832          IDNUM_PointScaleFactor =                           1531,
00833          IDNUM_EastingAndNorthingDifferenceFile =           1532,
00834          IDNUM_MaritimeProvinceResidualFile =               1533,
00835          IDNUM_GeoideModelFile =                            1534,
00836          IDNUM_ScalingFactorForSourceCRSCoordDifferences =  1535,
00837          IDNUM_ScalingFactorForTargetCRSCoordDifferences =  1536,
00838          IDNUM_ScalingFactorForCoordDifferences =           1537,
00839          IDNUM_LatitudeOfNaturalOrigin =                    1538,
00840          IDNUM_LongitudeOfNaturalOrigin =                   1539,
00841          IDNUM_ScaleFactorAtNaturalOrigin =                 1540,
00842          IDNUM_FalseEasting =                               1541,
00843          IDNUM_FalseNorthing =                              1542,
00844          IDNUM_LatitudeOfProjectionCenter =                 1543,
00845          IDNUM_LongitudeOfProjectionCenter =                1544,
00846          IDNUM_AzimuthOfInitialLine =                       1545,
00847          IDNUM_AngleFromRectifiedToSkewGrid =               1546,
00848          IDNUM_ScaleFactorOnInitialLine =                   1547,
00849          IDNUM_EastingAtProjectionCenter =                  1548,
00850          IDNUM_NorthingAtProjectionCenter =                 1549,
00851          IDNUM_LatitudeOfPseudoStandardParallel =           1550,
00852          IDNUM_ScaleFactorOnPseudoStandardParallel =        1551,
00853          IDNUM_LatitudeOfFalseOrigin =                      1552,
00854          IDNUM_LongitudeOfFalseOrigin =                     1553,
00855          IDNUM_LatitudeOf1stStandardParallel =              1554,
00856          IDNUM_LatitudeOf2ndStandardParallel =              1555,
00857          IDNUM_EastingAtFalseOrigin =                       1556,
00858          IDNUM_NorthingAtFalseOrigin =                      1557,
00859          IDNUM_SphericalLatitudeOfOrigin =                  1558,
00860          IDNUM_SphericalLongitudeOfOrigin =                 1559,
00861          IDNUM_InitialLongitude =                           1560,
00862          IDNUM_ZoneWidth =                                  1561,
00863          IDNUM_HeightAboveEllipsoid =                       1563,
00864          IDNUM_IsSkewed =                                   1564,
00865          IDNUM_LandsatNumber =                              1565,
00866          IDNUM_SatellitePath =                              1566,
00867          IDNUM_X_AxisTranslationRev =                       1567,
00868          IDNUM_Y_AxisTranslationRev =                       1568,
00869          IDNUM_Z_AxisTranslationRev =                       1569,
00870          IDNUM_X_AxisRotationRev =                          1570,
00871          IDNUM_Y_AxisRotationRev =                          1571,
00872          IDNUM_Z_AxisRotationRev =                          1572,
00873          IDNUM_ScaleDifferenceRev =                         1573,
00874          IDNUM_RightAscensionOfProjectionCenter =           1578,
00875          IDNUM_DeclinationOfProjectionCenter =              1579,
00876          IDNUM_CoefficientA0 =                              1600,
00877          IDNUM_CoefficientB0 =                              1700
00878          };
00879 
00880       //! CoordOpParm type enumeration.
00881       enum TYPE {
00882          TYPE_Invalid =    0,
00883          TYPE_Boolean =    1,
00884          TYPE_Number =     2,
00885          TYPE_String =     3,
00886          };
00887 
00888       enum ANGLETYPE {
00889          ANGLETYPE_Invalid =        0,
00890          ANGLETYPE_General =        1,
00891          ANGLETYPE_Longitude =      2,
00892          ANGLETYPE_Latitude =       3,
00893          ANGLETYPE_RightAscension = 4,
00894          ANGLETYPE_Declination =    5
00895          };
00896 
00897       //! Convert IDNUM to AngleType.
00898       static ANGLETYPE IdNumToAngleType (
00899          IDNUM idnum
00900          );
00901 
00902       //! Lookup IDNUM given IDENTIFIER.
00903       static IDNUM LookupIdNum (
00904          const IDENTIFIER& Id
00905          );
00906 
00907       //! Default constructor.
00908       COORDOPPARM (
00909          );
00910 
00911       //! Copy constructor.
00912       COORDOPPARM (
00913          const COORDOPPARM& rhs
00914          );
00915 
00916       //! Destructor.
00917       ~COORDOPPARM (
00918          );
00919 
00920       //! Assignment.
00921       COORDOPPARM& operator= (
00922          const COORDOPPARM& rhs
00923          );
00924 
00925       //! Assign from XMLNODE.
00926       ERRVALUE Assign (
00927          const XMLNODE* xmlnode
00928          );
00929 
00930       //! Get 'angle type'.
00931       ANGLETYPE GetAngleType (
00932          ) const;
00933 
00934       //! Get description.
00935       const MISTRING& GetDescription (
00936          ) const;
00937 
00938       //! Get multiline string suitable for display.
00939       void GetDisplay (
00940          MISTRING& string,                      //!< String returned, will be initially cleared if indent is 0
00941          int indent,                            //!< Indent level
00942          GETDISPLAY flags = GETDISPLAY_None  //!< Flags for extra items to display
00943          ) const;
00944 
00945       //! Get formatted value and unit strings for display based on type.
00946       //! @return true if has value, false if not
00947       bool GetDisplayStrs (
00948          MISTRING& valstr,                      //!< Value string returned
00949          MISTRING& unitstr,                     //!< Unit string returned
00950          bool Strip0 = false                    //!< Strip trailing zeros from value
00951          ) const;
00952 
00953       //! Get identifer list.
00954       const IDENTIFIERLIST& GetIdList (
00955          ) const;
00956 
00957       //! Get MicroImages identification number.
00958       IDNUM GetIdNum (
00959          ) const;
00960 
00961       //! Get name.
00962       const MISTRING& GetName (
00963          ) const;
00964 
00965       //! Get parameter type.
00966       TYPE GetType (
00967          ) const;
00968 
00969       //! Get measurement unit.
00970       const UOM::UNIT& GetUnit (
00971          ) const { return (m_unit); }
00972 
00973       //! Get numeric value.
00974       //! @return true if successful, false if value not numeric or not set.
00975       bool GetValue (
00976          double& value                    //!< Value returned if available
00977          ) const;
00978 
00979       //! Get boolean value.
00980       //! @return true if successful, false if value not boolean or not set.
00981       bool GetValue (
00982          bool& value                      //!< Value returned if available
00983          ) const;
00984 
00985       //! Get string, filename or URL value as STRUTF8.
00986       //! @return true if successful, false if value not set.
00987       bool GetValue (
00988          STRUTF8& value                   //!< Value returned if available
00989          ) const;
00990 
00991       //! Get string, filename or URL value as MISTRING.
00992       //! @return true if successful, false if value not set.
00993       bool GetValue (
00994          MISTRING& value                  //!< Value returned if available
00995          ) const;
00996 
00997       //! Get XMLNODE representation.
00998       XMLNODE* GetXML (
00999          XMLNODE *parentnode,                   //! Parent for contain node to be created
01000          const char *nodename = "CoordOpParm"
01001          ) const;
01002 
01003       //! Determine if has value set.
01004       bool HasValue (
01005          ) const { return (!m_svalue.IsEmpty()); }
01006 
01007       //! Determine if parameter is optional.
01008       //! Only useful when accessing method parameter list.
01009       bool IsOptional (
01010          ) const { return (m_optional); }
01011 
01012       //! Set IDNUM and boolean value.
01013       ERRVALUE Set (
01014          IDNUM IdNum,
01015          bool value
01016          );
01017 
01018       //! Set IDNUM and unitless integer value.
01019       ERRVALUE Set (
01020          IDNUM IdNum,
01021          int value
01022          );
01023 
01024       //! Set IDNUM, numeric value and unit if applicable.
01025       ERRVALUE Set (
01026          IDNUM IdNum,
01027          double value,
01028          UOM::IDNUM UnitIdNum = UOM::IDNUM_Unspecified
01029          );
01030 
01031       //! Set IDNUM, numeric value and UNIT.
01032       ERRVALUE Set (
01033          IDNUM IdNum,
01034          double value,
01035          const UOM::UNIT& unit
01036          );
01037 
01038       //! Set IDNUM and value from MISTRING.
01039       ERRVALUE Set (
01040          IDNUM IdNum,
01041          const MISTRING& string
01042          );
01043 
01044       //! Set IDNUM and value from STRUTF8.
01045       ERRVALUE Set (
01046          IDNUM IdNum,
01047          const STRUTF8& string
01048          );
01049 
01050       #ifndef GENERATING_DOXYGEN_OUTPUT
01051       class PRIV;
01052       // Internal constructor.
01053       COORDOPPARM (PRIV& Priv);
01054       // Set ID number with no value, used by parser.
01055       ERRVALUE SetIdNum (IDNUM IdNum);
01056       // Set whether parameter is optional.
01057       void SetOptional (bool optional) { m_optional = optional; }
01058       // Set unit without value, used by parser.
01059       ERRVALUE SetUnit (UOM::IDNUM unitid);
01060       // Set value and unit, used by parser.
01061       ERRVALUE SetValue (const UINT8* value, UOM::IDNUM unitid);
01062       // Set value from COORDOPPARM, used by parser.
01063       ERRVALUE SetValue (const COORDOPPARM& parm);
01064 
01065       bool IsEqual (const COORDOPPARM& rhs) const;
01066    private:
01067       PRIV *m_pPriv;
01068       bool m_bvalue;
01069       double m_dvalue;
01070       STRUTF8 m_svalue;
01071       UOM::UNIT m_unit;
01072       bool m_optional;
01073 
01074       void FormatDoubleToStr ();
01075       #endif // GENERATING_DOXYGEN_OUTPUT
01076    };
01077 typedef MILIST<COORDOPPARM> COORDOPPARMLIST;
01078 
01079 inline bool operator== (
01080    const COORDOPPARM& lhs,
01081    const COORDOPPARM& rhs
01082    ) {
01083    return (lhs.IsEqual(rhs)); 
01084    }
01085 
01086 inline bool operator!= (
01087    const COORDOPPARM& lhs,
01088    const COORDOPPARM& rhs
01089    ) {
01090    return (!lhs.IsEqual(rhs)); 
01091    }
01092 
01093 
01094 //=====================================================================================================================
01095 
01096 //! Factory class for creating COORDOP_IMPL instance.
01097 class COORDOP_IMPL_FACTORY {
01098    public:
01099       virtual COORDOP_IMPL_SINGLE *v_ConstructImpl () = 0;
01100    };
01101 
01102 //=====================================================================================================================
01103 //! Coordinate Operation Method definition.
01104 class CLASSLIBEXPORT COORDOPMETHOD {
01105    public:
01106 
01107       enum TYPE {
01108          TYPE_Undefined =                 0x0000,
01109          TYPE_Unspecified =               0x0001,
01110          TYPE_DatumTransformation =       0x0002,
01111          TYPE_GeographicProjection =      0x0004,
01112          TYPE_PolarProjection =           0x0008,
01113          TYPE_AstronomicProjection =      0x0010,
01114          TYPE_AnyProjection =             (TYPE_GeographicProjection | TYPE_PolarProjection | TYPE_AstronomicProjection)
01115          };
01116 
01117       //! Coordinate Operation Method identification numbers.
01118       enum IDNUM {
01119          IDNUM_Undefined =                                       -1,
01120          IDNUM_FIRST =                                         1800,
01121          IDNUM_Identity =                                      1800,
01122          IDNUM_Linear =                                        1801,
01123          IDNUM_PlaneProjective =                               1802,
01124          IDNUM_Bilinear =                                      1803,
01125          IDNUM_Quintic =                                       1804,
01126          IDNUM_SpaceResection =                                1805,
01127          IDNUM_RubberSheet =                                   1806,
01128          IDNUM_RationalPolynomial =                            1807,
01129          IDNUM_PiecewiseAffine =                               1810,
01130          IDNUM_ReversiblePolynomialDegree2 =                   1820,
01131          IDNUM_ReversiblePolynomialDegree3 =                   1821,
01132          IDNUM_ReversiblePolynomialDegree4 =                   1822,
01133          IDNUM_ReversiblePolynomialDegree13 =                  1823,
01134          IDNUM_GeneralPolynomialDegree6 =                      1824,
01135          IDNUM_LongitudeOffset =                               1858,
01136          IDNUM_GeographicGeocentric =                          1859,
01137          IDNUM_Datum_GeocentricTranslation =                   1860,
01138          IDNUM_Datum_CoordinateFrameRotation =                 1861,
01139          IDNUM_Datum_PositionVector7Parameter =                1862,
01140          IDNUM_Datum_MolodenskiBadekas =                       1863,
01141          IDNUM_Datum_GeographicAndHeightOffsets =              1864,
01142          IDNUM_Datum_GeographicOffsets =                       1865,
01143          IDNUM_Datum_VerticalOffset =                          1866,
01144          IDNUM_Datum_MadridToED50 =                            1877,
01145          IDNUM_Datum_BuiltIn_WGS72 =                           1878,
01146          IDNUM_Datum_BuiltIn_MRE =                             1879,
01147          IDNUM_Datum_Grid_MicroImages =                        1880,
01148          IDNUM_Datum_Grid_NADCON1 =                            1881,
01149          IDNUM_Datum_Grid_NADCON2 =                            1882,
01150          IDNUM_Datum_Grid_NTv1 =                               1883,
01151          IDNUM_Datum_Grid_NTv2 =                               1884,
01152          IDNUM_Projection_AlbersConicalEqualArea =             1903,
01153          IDNUM_Projection_LambertConformalConic2SP =           1904,
01154          IDNUM_Projection_Mercator =                           1905,
01155          IDNUM_Projection_PolarStereographic =                 1906,
01156          IDNUM_Projection_Polyconic =                          1907,
01157          IDNUM_Projection_EquidistantConic =                   1908,
01158          IDNUM_Projection_TransverseMercator =                 1909,
01159          IDNUM_Projection_Stereographic =                      1910,
01160          IDNUM_Projection_LambertAzimuthalEqualArea =          1911,
01161          IDNUM_Projection_AzimuthalEquidistant =               1912,
01162          IDNUM_Projection_Gnomonic =                           1913,
01163          IDNUM_Projection_Orthographic =                       1914,
01164          IDNUM_Projection_GeneralVerticalNearSidePerspective = 1915,
01165          IDNUM_Projection_Sinusoidal =                         1916,
01166          IDNUM_Projection_Equirectangular =                    1917,
01167          IDNUM_Projection_MillerCylindrical =                  1918,
01168          IDNUM_Projection_VanDerGrintenI =                     1919,
01169          IDNUM_Projection_HotineObliqueMercator =              1920,
01170          IDNUM_Projection_Robinson =                           1921,
01171          IDNUM_Projection_BipolarObliqueConformalConic =       1922,
01172          IDNUM_Projection_LandsatSpaceObliqueMercator =        1923,
01173          IDNUM_Projection_Cassini =                            1924,
01174          IDNUM_Projection_NewZealandMapGrid =                  1925,
01175          IDNUM_Projection_SwissConformalCylindrical =          1926,
01176          IDNUM_Projection_RoyalDutch =                         1927,
01177          IDNUM_Projection_ObliqueStereographic =               1928,
01178          IDNUM_Projection_InterruptedGoodeHomolosine =         1929,
01179          IDNUM_Projection_LabordeObliqueMercator =             1930,
01180          IDNUM_Projection_ObliqueMercator =                    1931,
01181          IDNUM_Projection_KrovakObliqueConicConformal =        1932,
01182          IDNUM_Projection_LambertConformalConic1SP =           1933,
01183          IDNUM_Projection_TransverseMercatorSouthOriented =    1934,
01184          IDNUM_Projection_LambertConformalConicWestOriented =  1935,
01185          IDNUM_Projection_LambertConformalConicBelgium2SP =    1936,
01186          IDNUM_Projection_LambertConicNearConformal =          1937,
01187          IDNUM_Projection_LambertAzimuthalEqualAreaSpherical = 1938,
01188          IDNUM_Projection_Bonne =                              1939,
01189          IDNUM_Projection_BonneSouthOriented =                 1940,
01190          IDNUM_Projection_PolarStereographicVariantB =         1941,
01191          IDNUM_Projection_PolarStereographicVariantC =         1942,
01192          IDNUM_AstroProjection_Orthographic =                  1980,
01193          IDNUM_AstroProjection_Mercator =                      1981,
01194          IDNUM_AstroProjection_Stereographic =                 1982,
01195          IDNUM_AstroProjection_Gnomonic =                      1983,
01196          IDNUM_AstroProjection_AzimuthalEqualArea =            1984,
01197          IDNUM_AstroProjection_AzimuthalEquidistant =          1985,
01198          IDNUM_LAST =                                          1998,
01199          IDNUM_Concatenated =                                  1999
01200          };
01201 
01202       //! Register implementation.
01203       static void RegisterImplementation (
01204          IDNUM IdNum,
01205          COORDOP_IMPL_FACTORY *pImplFactory
01206          );
01207 
01208       //! Default constructor.
01209       COORDOPMETHOD (
01210          );
01211 
01212       //! Copy constructor.
01213       COORDOPMETHOD (
01214          const COORDOPMETHOD& rhs
01215          );
01216 
01217       //! Destructor.
01218       ~COORDOPMETHOD (
01219          );
01220 
01221       //! Assignment.
01222       COORDOPMETHOD& operator= (
01223          const COORDOPMETHOD& rhs
01224          );
01225 
01226       //! Assign by IDENTIFIER.
01227       ERRVALUE Assign (
01228          const IDENTIFIER& Id
01229          );
01230 
01231       //! Assign by MicroImages ID number.
01232       ERRVALUE Assign (
01233          IDNUM IdNum
01234          );
01235 
01236       //! Construct implementation instance for operation method using previously registered factory.
01237       ERRVALUE ConstructImplementation (
01238          COORDOP_IMPL_SINGLE *& pImpl           //! Pointer to constructed implementation returned
01239          ) const;
01240 
01241       //! Get default target coordinate system for operation.
01242       ERRVALUE GetDefaultTargetCoordSys (
01243          COORDSYS& CoordSys                     //!< Coordinate system returned
01244          ) const;
01245 
01246       //! Get multiline string suitable for display.
01247       void GetDisplay (
01248          MISTRING& string,                      //!< String returned, will be initially cleared if indent is 0
01249          int indent,                            //!< Indent level
01250          GETDISPLAY flags = GETDISPLAY_None  //!< Flags for extra items to display
01251          ) const;
01252 
01253       //! Get identifer list.
01254       const IDENTIFIERLIST& GetIdList (
01255          ) const;
01256 
01257       //! Get MicroImages identification number.
01258       IDNUM GetIdNum (
01259          ) const;
01260 
01261       //! Get name.
01262       const MISTRING& GetName (
01263          ) const;
01264 
01265       const COORDOPPARMLIST& GetParmList (
01266          ) const;
01267 
01268       //! Get source axes for operation.
01269       const COORDAXISLIST& GetSourceAxisList (
01270          ) const;
01271 
01272       //! Get target axes for operation.
01273       const COORDAXISLIST& GetTargetAxisList (
01274          ) const;
01275 
01276       //! Get method type.
01277       TYPE GetType (
01278          ) const;
01279 
01280       //! Get XMLNODE representation.
01281       XMLNODE* GetXML (
01282          XMLNODE *parentnode,                   //! Parent for contain node to be created
01283          const char *nodename = "Method"
01284          ) const;
01285 
01286       //! Determine if operation method is implemented.
01287       bool IsImplemented (
01288          ) const;
01289 
01290       #ifndef GENERATING_DOXYGEN_OUTPUT
01291       class PRIV;
01292       // Internal constructor.
01293       COORDOPMETHOD (PRIV& Priv);
01294       bool IsEqual (const COORDOPMETHOD& rhs) const { return (m_pPriv == rhs.m_pPriv); }
01295    private:
01296       static COORDOP_IMPL_FACTORY* s_pImplementations[IDNUM_LAST-IDNUM_FIRST+1];
01297       PRIV *m_pPriv;
01298       #endif // GENERATING_DOXYGEN_OUTPUT
01299    };
01300 typedef MILIST<COORDOPMETHOD> COORDOPMETHODLIST;
01301 
01302 inline bool operator== (
01303    const COORDOPMETHOD& lhs,
01304    const COORDOPMETHOD& rhs
01305    ) {
01306    return (lhs.IsEqual(rhs)); 
01307    }
01308 
01309 inline bool operator!= (
01310    const COORDOPMETHOD& lhs,
01311    const COORDOPMETHOD& rhs
01312    ) {
01313    return (!lhs.IsEqual(rhs)); 
01314    }
01315 
01316 
01317 //=====================================================================================================================
01318 //! Coordinate System definition.
01319 class CLASSLIBEXPORT COORDSYS {
01320    public:
01321 
01322       //! Coordinate system ID numbers.
01323       //! Not all entries from database are listed.
01324       enum IDNUM {
01325          IDNUM_Undefined =                     -1,
01326          IDNUM_None =                           0,
01327          IDNUM_Projected2D_EN_m =            1200,    //! Projected 2D (east,north) meters
01328          IDNUM_Projected2D_EN_ft =           1201,    //! Projected 2D (east,north) feet
01329          IDNUM_Projected2D_EN_ftUS =         1202,    //! Projected 2D (east,north) US Survey feet
01330          IDNUM_UPS_North_m =                 1250,    //! Univeral Polar Stereographic North zone (east, north) meters
01331          IDNUM_UPS_South_m =                 1251,    //! Univeral Polar Stereographic South zone (east, north) meters
01332          IDNUM_Cartesian2D_XY_m =            1260,    //! Local 2D cartesian, not same as projected
01333          IDNUM_Cartesian3D_XYZ_m =           1261,    //! Local 3D cartesian, not same as geocentric
01334          IDNUM_Ellipsoidal2D_Deg =           1280,    //! Ellipsoidal 2D (lon,lat) degrees
01335          IDNUM_Ellipsoidal3D_DegM =          1281,    //! Ellipsoidal 3D (lon,lat,h) degrees, meters
01336          IDNUM_Ellipsoidal2D_Grad =          1282,    //! Ellipsoidal 2D (lon,lat) grads
01337          IDNUM_Ellipsoidal3D_GradM =         1283,    //! Ellipsoidal 3D (lon,lat,h) grads, meters
01338          IDNUM_Equatorial2D_Deg =            1288,    //! Equatorial (right ascension, declination) degrees
01339          IDNUM_Equatorial2D_HrDeg =          1289,    //! Equatorial (right ascension, declination) hours, degrees
01340          IDNUM_GravityRelated_Height_m =     1290,
01341          IDNUM_GravityRelated_Height_ftUS =  1291,
01342          IDNUM_GravityRelated_Depth_m =      1292,
01343          IDNUM_Zoned_MGRS =                  1295,    //! Military Grid Reference System (zoned)
01344          IDNUM_Spherical3D =                 1298,    //! Spherical 3D, not same as ellipsoidal 3D (lon,lat,r) degrees, meters
01345          IDNUM_Geocentric =                  1299     //! Geocentric (x,y,z) meters
01346          };
01347 
01348       //! Coordinate system type enumeration.
01349       enum TYPE {
01350          TYPE_Undefined =           0x0000,
01351          TYPE_Cartesian =           0x0001,  //! Cartesian (not projected)
01352          TYPE_ObliqueCartesian =    0x0002,
01353          TYPE_Projected =           0x0004,
01354          TYPE_Ellipsoidal =         0x0008,
01355          TYPE_Spherical =           0x0010,
01356          TYPE_Polar =               0x0020,
01357          TYPE_Cylindrical =         0x0040,
01358          TYPE_MultiLinear =         0x0080,
01359          TYPE_GravityRelated =      0x0100,
01360          TYPE_Temporal =            0x0200,
01361          TYPE_Equatorial =          0x0400,
01362          TYPE_Zoned =               0x8000,
01363          TYPES_GeorefObject =       (TYPE_Cartesian | TYPE_Projected | TYPE_Ellipsoidal | TYPE_Equatorial)
01364          };
01365 
01366       //! Convert COORDSYS::TYPE to TEXTID.
01367       static TEXTID TypeToTextID (
01368          TYPE type
01369          );
01370 
01371       //! Default constructor.
01372       COORDSYS (
01373          );
01374 
01375       //! Copy constructor.
01376       COORDSYS (
01377          const COORDSYS& rhs
01378          );
01379 
01380       //! Destructor.
01381       ~COORDSYS (
01382          );
01383 
01384       //! Assignment.
01385       COORDSYS& operator= (
01386          const COORDSYS& rhs
01387          );
01388 
01389       //! Assign by IDENTIFIER.
01390       ERRVALUE Assign (
01391          const IDENTIFIER& Id
01392          );
01393 
01394       //! Assign by MicroImages ID number.
01395       ERRVALUE Assign (
01396          IDNUM IdNum
01397          );
01398 
01399       //! Assign from XMLNODE.
01400       ERRVALUE Assign (
01401          const XMLNODE* xmlnode
01402          );
01403 
01404       //! Create coordinate system definition.
01405       ERRVALUE Create (
01406          TYPE type,                             //!< Coordinate system type
01407          const COORDAXISLIST& AxisList          //!< List of coordinate axes
01408          );
01409 
01410       //! Get coordinate axis using index.
01411       const COORDAXIS& GetAxis (
01412          int axisidx                            //!< 0-based position of axis in list
01413          ) const;
01414 
01415       //! Get coordinate axis list reference.
01416       const COORDAXISLIST& GetAxisList (
01417          ) const;
01418 
01419       //! Get coordinate system dimension.
01420       //! @return Dimension (1-3)
01421       int GetDimension (
01422          ) const;
01423 
01424       //! Get multiline string suitable for display.
01425       void GetDisplay (
01426          MISTRING& string,                      //!< String returned, will be initially cleared if indent is 0
01427          int indent,                            //!< Indent level
01428          GETDISPLAY flags = GETDISPLAY_None  //!< Flags for extra items to display
01429          ) const;
01430 
01431       //! Get identifer list.
01432       const IDENTIFIERLIST& GetIdList (
01433          ) const;
01434 
01435       //! Get MicroImages identification number.
01436       IDNUM GetIdNum (
01437          ) const;
01438 
01439       //! Get name.
01440       const MISTRING& GetName (
01441          ) const;
01442 
01443       //! Get method type for projected coordinate system.
01444       COORDOPMETHOD::TYPE GetProjectedMethodType (
01445          ) const;
01446 
01447       //! Get coordinate system type.
01448       TYPE GetType (
01449          ) const;
01450 
01451       //! Get valid datum type for coordinate system.
01452       DATUM::TYPE GetValidDatumType (
01453          ) const;
01454 
01455       //! Get XMLNODE representation.
01456       XMLNODE* GetXML (
01457          XMLNODE *parentnode,                   //!< Parent for contain node to be created
01458          const char *nodename = "CoordSys"
01459          ) const;
01460 
01461       //! Determine if has all axes in specified list.
01462       bool HasAxes (
01463          const COORDAXISLIST& AxisList          //!< List of axes
01464          ) const;
01465 
01466       #ifndef GENERATING_DOXYGEN_OUTPUT
01467       class PRIV;
01468       // Internal constructor.
01469       COORDSYS (PRIV& Priv);
01470       bool IsEqual (const COORDSYS& rhs) const;
01471    private:
01472       PRIV *m_pPriv;
01473       void GetExclusive ();
01474       #endif // GENERATING_DOXYGEN_OUTPUT
01475    };
01476 typedef MILIST<COORDSYS> COORDSYSLIST;
01477 DEFINE_ENUM_OP_BITWISE(COORDSYS::TYPE)
01478 
01479 inline bool operator== (
01480    const COORDSYS& lhs,
01481    const COORDSYS& rhs
01482    ) {
01483    return (lhs.IsEqual(rhs)); 
01484    }
01485 
01486 inline bool operator!= (
01487    const COORDSYS& lhs,
01488    const COORDSYS& rhs
01489    ) {
01490    return (!lhs.IsEqual(rhs)); 
01491    }
01492 
01493 
01494 //=====================================================================================================================
01495 //! Coordinate Operation definition.
01496 class CLASSLIBEXPORT COORDOPDEF {
01497    public:
01498 
01499       enum IDNUM {
01500          IDNUM_Undefined =            -1,
01501          IDNUM_None =                  0,
01502          IDNUM_UPS_North =             25382,
01503          IDNUM_UPS_South =             25383,
01504          };
01505 
01506       //! Default constructor.
01507       COORDOPDEF (
01508          );
01509 
01510       //! Copy constructor.
01511       COORDOPDEF (
01512          const COORDOPDEF& rhs
01513          );
01514 
01515       //! Destructor.
01516       ~COORDOPDEF (
01517          );
01518 
01519       //! Assignment.
01520       COORDOPDEF& operator= (
01521          const COORDOPDEF& rhs
01522          );
01523 
01524       //! Assign by IDENTIFIER.
01525       ERRVALUE Assign (
01526          const IDENTIFIER& Id
01527          );
01528 
01529       //! Assign by MicroImages ID number.
01530       ERRVALUE Assign (
01531          IDNUM IdNum
01532          );
01533 
01534       //! Assign from XMLNODE.
01535       ERRVALUE Assign (
01536          const XMLNODE* xmlnode
01537          );
01538 
01539       //! Create operation definition with specified method and parameter list.
01540       ERRVALUE Create (
01541          const MISTRING& name,
01542          const COORDOPMETHOD& method,
01543          const COORDOPPARMLIST& parmlist
01544          );
01545 
01546       //! Get multiline string suitable for display.
01547       void GetDisplay (
01548          MISTRING& string,                   //!< String returned, will be initially cleared if indent is 0
01549          int indent,                         //!< Indent level
01550          GETDISPLAY flags = GETDISPLAY_None  //!< Flags for extra items to display
01551          ) const;
01552 
01553       //! Get identifer list.
01554       const IDENTIFIERLIST& GetIdList (
01555          ) const;
01556 
01557       //! Get MicroImages identification number.
01558       IDNUM GetIdNum (
01559          ) const;
01560 
01561       //! Get operation method.
01562       const COORDOPMETHOD& GetMethod (
01563          ) const;
01564 
01565       //! Get name.
01566       const MISTRING& GetName (
01567          ) const;
01568 
01569       ERRVALUE GetParm (
01570          COORDOPPARM::IDNUM idnum,
01571          COORDOPPARM& parm
01572          ) const;
01573 
01574       //! Get list of parameters.
01575       const COORDOPPARMLIST& GetParmList (
01576          ) const;
01577 
01578       //! Get value for numeric parameter in specified unit.
01579       ERRVALUE GetParmValue (
01580          COORDOPPARM::IDNUM idnum,        //!< Parameter ID number
01581          double& value,                   //!< Value returned if available
01582          const UOM::UNIT& unit            //!< Unit to return value in
01583          ) const;
01584 
01585       //! Get value for numeric parameter in specified unit ID.
01586       ERRVALUE GetParmValue (
01587          COORDOPPARM::IDNUM idnum,        //!< Parameter ID number
01588          double& value,                   //!< Value returned if available
01589          int unitid                       //!< Unit ID
01590          ) const;
01591 
01592       //! Get value for boolean parameter.
01593       ERRVALUE GetParmValue (
01594          COORDOPPARM::IDNUM idnum,        //!< Parameter ID number
01595          bool& value                      //!< Value returned if available
01596          ) const;
01597 
01598       //! Get value for string parameter.
01599       ERRVALUE GetParmValue (
01600          COORDOPPARM::IDNUM idnum,        //!< Parameter ID number
01601          MISTRING& value                  //!< Value returned if available
01602          ) const;
01603 
01604       //! Get source coordinate reference system.
01605       const COORDREFSYS& GetSourceCRS (
01606          ) const;
01607 
01608       //! Get list of operation steps for concatenated operation.
01609       const MILIST<COORDOPDEF>& GetStepList (
01610          ) const;
01611 
01612       //! Get target coordinate reference system.
01613       const COORDREFSYS& GetTargetCRS (
01614          ) const;
01615 
01616       //! Get list of valid area names.
01617       const TEXTRESITEMLIST& GetValidAreaList (
01618          ) const;
01619 
01620       //! Get XMLNODE representation.
01621       XMLNODE* GetXML (
01622          XMLNODE *parentnode,             //! Parent for contain node to be created
01623          const char *nodename = "CoordOp"
01624          ) const;
01625 
01626       //! Determine if has specified parameter with value set.
01627       bool HasParmValue (
01628          COORDOPPARM::IDNUM idnum         //!< Parameter ID number
01629          ) const;
01630 
01631       //! Determine if is 'concatenated' coordinate operation.
01632       bool IsConcatenated (
01633          ) const;
01634 
01635       //! Determine if uses implemented operation method(s).
01636       bool IsImplemented (
01637          ) const;
01638 
01639       //! Set operation method.
01640       void SetMethod (
01641          const COORDOPMETHOD& CoordOpMethod
01642          );
01643 
01644       //! Set operation method using IDNUM.
01645       void SetMethod (
01646          COORDOPMETHOD::IDNUM MethodIdNum
01647          );
01648 
01649       //! Set parameter value.
01650       ERRVALUE SetParm (
01651          const COORDOPPARM& parm
01652          );
01653 
01654       //! Set parameter by ID number and boolean value.
01655       ERRVALUE SetParm (
01656          COORDOPPARM::IDNUM idnum,
01657          bool value
01658          );
01659 
01660       //! Set parameter by ID number and unitless integer value.
01661       ERRVALUE SetParm (
01662          COORDOPPARM::IDNUM idnum,
01663          int value
01664          );
01665 
01666       //! Set parameter by ID number, numeric value and UNIT.
01667       ERRVALUE SetParm (
01668          COORDOPPARM::IDNUM idnum,
01669          double value,
01670          const UOM::UNIT& unit
01671          );
01672 
01673       //! Set parameter by ID number, numeric value and unit IDNUM.
01674       ERRVALUE SetParm (
01675          COORDOPPARM::IDNUM idnum,
01676          double value,
01677          const UOM::IDNUM unitid
01678          );
01679 
01680       #ifndef GENERATING_DOXYGEN_OUTPUT
01681       class PRIV;
01682       // Internal constructor.
01683       COORDOPDEF (PRIV& Priv);
01684       bool IsEqual (const COORDOPDEF& rhs) const;
01685       ERRVALUE Resolve ();
01686    private:
01687       PRIV *m_pPriv;
01688       void GetExclusive ();
01689       #endif // GENERATING_DOXYGEN_OUTPUT
01690    };
01691 typedef MILIST<COORDOPDEF> COORDOPDEFLIST;
01692 
01693 inline bool operator== (
01694    const COORDOPDEF& lhs,
01695    const COORDOPDEF& rhs
01696    ) {
01697    return (lhs.IsEqual(rhs)); 
01698    }
01699 
01700 inline bool operator!= (
01701    const COORDOPDEF& lhs,
01702    const COORDOPDEF& rhs
01703    ) {
01704    return (!lhs.IsEqual(rhs)); 
01705    }
01706 
01707 //=====================================================================================================================
01708 //! Coordinate Reference System.
01709 class CLASSLIBEXPORT COORDREFSYS {
01710    public:
01711 
01712       //! Coordinate reference system ID numbers.
01713       //! Note, not all IDs in database are listed.
01714       enum IDNUM {
01715          IDNUM_Undefined =                  -1,
01716          IDNUM_None =                        0,
01717          IDNUM_Geographic2D_WGS84_Deg =   3800,
01718          IDNUM_Geographic2D_WGS72_Deg =   3802,
01719          IDNUM_Geographic3D_WGS84_DegM =  4800,
01720          IDNUM_Geographic3D_WGS72_DegM =  4802,
01721          IDNUM_Geocentric_WGS84 =         7800,
01722          IDNUM_Geocentric_ITRF_1988 =     7804,
01723          IDNUM_Geocentric_ITRF_1989 =     7805,
01724          IDNUM_Geocentric_ITRF_1990 =     7806,
01725          IDNUM_Geocentric_ITRF_1991 =     7807,
01726          IDNUM_Geocentric_ITRF_1992 =     7808,
01727          IDNUM_Geocentric_ITRF_1993 =     7809,
01728          IDNUM_Geocentric_ITRF_1994 =     7810,
01729          IDNUM_Geocentric_ITRF_1996 =     7811,
01730          IDNUM_Geocentric_ITRF_1997 =     7812,
01731          IDNUM_Geocentric_ITRF_2000 =     7813,
01732          IDNUM_Local2D_XY_m =             9000,
01733          };
01734 
01735       //! Method for distance computation.
01736       enum DISTANCEMETHOD {
01737          DISTANCEMETHOD_Projected,           //!< Projected distance, requires projected CRS
01738          DISTANCEMETHOD_Geodesic,            //!< Geodesic distance, shortest path over ellipsoid
01739 //       DISTANCEMETHOD_StraightLine,        //!< Straight line distance "through the earth"
01740          };
01741 
01742       //! Default constructor.
01743       COORDREFSYS (
01744          );
01745 
01746       //! Copy constructor.
01747       COORDREFSYS (
01748          const COORDREFSYS& rhs
01749          );
01750 
01751       //! Destructor.
01752       ~COORDREFSYS (
01753          );
01754 
01755       //! Assignment.
01756       COORDREFSYS& operator= (
01757          const COORDREFSYS& rhs
01758          );
01759 
01760       //! Assign by IDENTIFIER.
01761       ERRVALUE Assign (
01762          const IDENTIFIER& Id
01763          );
01764 
01765       //! Assign by MicroImages ID number.
01766       ERRVALUE Assign (
01767          IDNUM IdNum
01768          );
01769 
01770       //! Assign from XMLNODE.
01771       ERRVALUE Assign (
01772          const XMLNODE* xmlnode
01773          );
01774 
01775       //! Assign from MISTRING.
01776       ERRVALUE Assign (
01777          const MISTRING& string                 //!< String representation previously generated by GetString().
01778          );
01779 
01780       //! Assign from legacy projection parameter structure.
01781       ERRVALUE Assign (
01782          const OLDPROJPARM& projparm
01783          );
01784 
01785 // #ifndef NO_DEPRECATED
01786       //! Assign from legacy MAPPROJPARM structure.
01787       DEPRECATED ERRVALUE Assign (
01788          const MAPPROJPARM& projparm
01789          );
01790 // #endif
01791 
01792       //! Clear coordinate reference system, resetting to undefined.
01793       void Clear (
01794          );
01795 
01796       //! Compute angle between projected CRS and true north at specified point.
01797       ERRVALUE ComputeAngleToNorth (
01798          const DPOINT2D& point,                 //!< Point to compute at
01799          double& angle,                         //!< Angle in specified unit returned
01800          int angleunitid                        //!< Unit to return angle in (UNIT_PlaneAngle_...)
01801          ) const;
01802 
01803       //! Compute distance between pair of points.
01804       ERRVALUE ComputeDistance (
01805          const DPOINT2D& point1,                //!< First point
01806          const DPOINT2D& point2,                //!< Second point
01807          DISTANCEMETHOD method,                 //!< Distance computation method
01808          double& distance,                      //!< Distance returned
01809          UOM::IDNUM LengthUnitIdNum = UOM::IDNUM_Length_Meter
01810          ) const;
01811