Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

Coord.h

Go to the documentation of this file.
00001 // SRM SDK Release 4.1.2 - July 1, 2009
00002 
00003 // - SRM spec. 4.1
00004 
00005 /*
00006  *                             NOTICE
00007  * 
00008  * This software is provided openly and freely for use in representing and
00009  * interchanging environmental data & databases.
00010  * 
00011  * This software was developed for use by the United States Government with
00012  * unlimited rights.  The software was developed under contract
00013  * DASG60-02-D-0006 TO-193 by Science Applications International Corporation.
00014  * The software is unclassified and is deemed as Distribution A, approved
00015  * for Public Release.
00016  * 
00017  * Use by others is permitted only upon the ACCEPTANCE OF THE TERMS AND
00018  * CONDITIONS, AS STIPULATED UNDER THE FOLLOWING PROVISIONS:
00019  * 
00020  *    1. Recipient may make unlimited copies of this software and give
00021  *       copies to other persons or entities as long as the copies contain
00022  *       this NOTICE, and as long as the same copyright notices that
00023  *       appear on, or in, this software remain.
00024  * 
00025  *    2. Trademarks. All trademarks belong to their respective trademark
00026  *       holders.  Third-Party applications/software/information are
00027  *       copyrighted by their respective owners.
00028  * 
00029  *    3. Recipient agrees to forfeit all intellectual property and
00030  *       ownership rights for any version created from the modification
00031  *       or adaptation of this software, including versions created from
00032  *       the translation and/or reverse engineering of the software design.
00033  * 
00034  *    4. Transfer.  Recipient may not sell, rent, lease, or sublicense
00035  *       this software.  Recipient may, however enable another person
00036  *       or entity the rights to use this software, provided that this
00037  *       AGREEMENT and NOTICE is furnished along with the software and
00038  *       /or software system utilizing this software.
00039  * 
00040  *       All revisions, modifications, created by the Recipient, to this
00041  *       software and/or related technical data shall be forwarded by the 
00042  *       Recipient to the Government at the following address:
00043  * 
00044  *         SMDC
00045  *         Attention SEDRIS (TO193) TPOC
00046  *         P.O. Box 1500
00047  *         Hunstville, AL  35807-3801
00048  * 
00049  *         or via electronic mail to:  [email protected]
00050  * 
00051  *    5. No Warranty. This software is being delivered to you AS IS
00052  *       and there is no warranty, EXPRESS or IMPLIED, as to its use
00053  *       or performance.
00054  * 
00055  *       The RECIPIENT ASSUMES ALL RISKS, KNOWN AND UNKNOWN, OF USING
00056  *       THIS SOFTWARE.  The DEVELOPER EXPRESSLY DISCLAIMS, and the
00057  *       RECIPIENT WAIVES, ANY and ALL PERFORMANCE OR RESULTS YOU MAY
00058  *       OBTAIN BY USING THIS SOFTWARE OR DOCUMENTATION.  THERE IS
00059  *       NO WARRANTY, EXPRESS OR, IMPLIED, AS TO NON-INFRINGEMENT OF
00060  *       THIRD PARTY RIGHTS, MERCHANTABILITY, OR FITNESS FOR ANY
00061  *       PARTICULAR PURPOSE.  IN NO EVENT WILL THE DEVELOPER, THE
00062  *       UNITED STATES GOVERNMENT OR ANYONE ELSE ASSOCIATED WITH THE
00063  *       DEVELOPMENT OF THIS SOFTWARE BE HELD LIABLE FOR ANY CONSEQUENTIAL,
00064  *       INCIDENTAL OR SPECIAL DAMAGES, INCLUDING ANY LOST PROFITS
00065  *       OR LOST SAVINGS WHATSOEVER.
00066  */
00067 
00068 // SRM_OTHERS_GOES_HERE
00069 
00070 // $Id: Coord.h,v 1.19 2007/11/27 20:37:39 shend Exp $
00071 
00072 #ifndef _Coord_h
00073 #define _Coord_h
00074 
00075 #if !defined(_WIN32)
00076 #define EXPORT_SRM_CPP_DLL
00077 #elif defined(BUILD_SRM_CPP) /* SRM CPP Case */
00078 #if !defined(EXPORT_SRM_CPP_DLL)
00079 #if defined(_LIB)
00080 #define EXPORT_SRM_CPP_DLL
00081 #elif defined(_USRDLL)
00082 #define EXPORT_SRM_CPP_DLL __declspec(dllexport)
00083 #else
00084 #define EXPORT_SRM_CPP_DLL __declspec(dllimport)
00085 #endif
00086 #endif
00087 #else /* SRM C Case */
00088 #define EXPORT_SRM_CPP_DLL
00089 #endif /* _WIN32 && EXPORT_DLL */
00090 
00096 #include "BaseSRF.h" 
00097 
00098 namespace srm
00099 {
00100 
00101 
00110   class EXPORT_SRM_CPP_DLL Coord
00111     {
00112     public:
00113 
00115       enum Coord_ClassType
00116       {
00117         COORD_TYP_TWO_D,
00118         COORD_TYP_SURFACE,
00119         COORD_TYP_THREE_D,
00120         COORD_TYP_LSA,
00121         COORD_TYP_CC,
00122         COORD_TYP_CD,
00123         COORD_TYP_SURF_CD,
00124         COORD_TYP_CM,
00125         COORD_TYP_EC,
00126         COORD_TYP_SURF_EC,
00127         COORD_TYP_EI,
00128         COORD_TYP_HAEC,
00129         COORD_TYP_HEEC,
00130         COORD_TYP_HEEQ,
00131         COORD_TYP_LCC,
00132         COORD_TYP_SURF_LCC,
00133         COORD_TYP_LCE_3D,
00134         COORD_TYP_LSR_3D,
00135         COORD_TYP_LSR_2D,
00136         COORD_TYP_LTSAS,
00137         COORD_TYP_SURF_LTSAS,
00138         COORD_TYP_LTSC,
00139         COORD_TYP_SURF_LTSC,
00140         COORD_TYP_LTSE,
00141         COORD_TYP_SURF_LTSE,
00142         COORD_TYP_M,
00143         COORD_TYP_SURF_M,
00144         COORD_TYP_OMS,
00145         COORD_TYP_SURF_OMS,
00146         COORD_TYP_LSP,
00147         COORD_TYP_PS,
00148         COORD_TYP_SURF_PS,
00149         COORD_TYP_PD,
00150         COORD_TYP_SURF_PD,
00151         COORD_TYP_SEC,
00152         COORD_TYP_SEQ,
00153         COORD_TYP_SME,
00154         COORD_TYP_SMD,
00155         COORD_TYP_TM,
00156         COORD_TYP_SURF_TM
00157       };
00158 
00160       BaseSRF *getSRF() const {
00161         return _srf;
00162       }
00163 
00165       virtual Coord_ClassType getClassType() const = 0;
00166 
00168       virtual bool isA( Coord_ClassType type ) const;
00169 
00172       virtual const char *toString() = 0;
00173 
00174     protected:
00175     
00177       Coord( BaseSRF *srf ) {
00178         _srf = srf->clone();
00179       }
00180 
00184       Coord &operator =( const Coord &coord ) { 
00185     return *this; 
00186       }
00187 
00189       virtual ~Coord() {
00190         _srf->release();
00191       }
00192 
00194       BaseSRF *_srf;
00195     };
00196 
00197   inline bool Coord::isA( Coord_ClassType type ) const 
00198     {
00199       return false;
00200     }
00201 
00205   class EXPORT_SRM_CPP_DLL Coord2D: public Coord
00206     {
00207     public:
00208 
00210       virtual bool isA( Coord_ClassType type ) const;
00211 
00213       const SRM_Long_Float *getValues() const {
00214         return _values;
00215       }
00216 
00218       void setValues( const SRM_Vector_2D &values ) {
00219         _values[0] = values[0];
00220         _values[1] = values[1];
00221       }
00222 
00225       const char *toString() {
00226     static char ret_string[50];      
00227     sprintf( ret_string,"[ %lf, %lf ]\n", _values[0],  _values[1] );
00228     return ret_string;
00229       }
00230 
00231     protected:
00232 
00234       Coord2D( BaseSRF *srf )
00235         : Coord(srf)
00236     {
00237     }
00238 
00240       SRM_Vector_2D _values;
00241     };
00242 
00243 
00245   inline bool Coord2D::isA( Coord_ClassType type ) const 
00246     {
00247       if ( type == Coord::COORD_TYP_TWO_D )
00248     return true;
00249       else
00250     return Coord::isA(type);
00251     }
00252 
00253 
00257   class EXPORT_SRM_CPP_DLL CoordSurf: public Coord
00258     {
00259     public:
00260 
00262       virtual bool isA( Coord_ClassType type ) const;
00263 
00265       const SRM_Long_Float *getValues() const {
00266         return _values;
00267       }
00268 
00270       void setValues( const SRM_Vector_2D &values ) {
00271         _values[0] = values[0];
00272         _values[1] = values[1];
00273       }
00274 
00277       virtual const char *toString() {
00278     static char ret_string[50];      
00279     sprintf( ret_string,"[ %lf, %lf ]\n", _values[0], _values[1] );
00280     return ret_string;
00281       }
00282 
00283     protected:
00284 
00286       CoordSurf( BaseSRF *srf )
00287         : Coord(srf)
00288     {
00289     }
00290 
00292       SRM_Vector_2D _values;
00293     };
00294 
00295   inline bool CoordSurf::isA( Coord_ClassType type ) const 
00296     {
00297       if ( type == Coord::COORD_TYP_SURFACE )
00298     return true;
00299       else
00300     return Coord::isA(type);
00301     }
00302 
00306   class EXPORT_SRM_CPP_DLL Coord3D: public Coord
00307     {
00308     public:
00309 
00311       virtual bool isA( Coord_ClassType type ) const;
00312 
00314       const SRM_Long_Float *getValues() const {
00315         return _values;
00316       }
00317 
00319       void setValues( const SRM_Vector_3D &values ) {
00320         _values[0] = values[0];
00321         _values[1] = values[1];
00322         _values[2] = values[2];
00323       }
00324 
00327       virtual const char* toString();
00328 
00338       virtual const char* getMGRS( SRM_Integer precision );
00339 
00349       virtual void setCoord( const char* mgrs );
00350 
00351     protected:
00352 
00354       Coord3D( BaseSRF *srf )
00355         : Coord(srf)
00356     {
00357     }
00358 
00360       SRM_Vector_3D _values;
00361     };
00362 
00363   inline bool Coord3D::isA( Coord_ClassType type ) const 
00364     {
00365       if ( type == Coord::COORD_TYP_THREE_D )
00366     return true;
00367       else
00368     return Coord::isA(type);
00369     }
00370 
00371 } // namespace srm
00372 
00373 #endif // _Coord_h
00374 

Spatial Reference Model C++ API Version 4.1.2 - 1 Jul 2009
Copyright © 2009 SEDRIS Docs by Doxygen 1.3.2