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

Coord.h

Go to the documentation of this file.
00001 
00005 // SRM SDK Release 4.4.0 - December 7, 2009
00006 
00007 // - SRM spec. 4.4
00008 
00009 /*
00010  *                             NOTICE
00011  * 
00012  * This software is provided openly and freely for use in representing and
00013  * interchanging environmental data & databases.
00014  * 
00015  * This software was developed for use by the United States Government with
00016  * unlimited rights.  The software was developed under contract
00017  * DASG60-02-D-0006 TO-193 by Science Applications International Corporation.
00018  * The software is unclassified and is deemed as Distribution A, approved
00019  * for Public Release.
00020  * 
00021  * Use by others is permitted only upon the ACCEPTANCE OF THE TERMS AND
00022  * CONDITIONS, AS STIPULATED UNDER THE FOLLOWING PROVISIONS:
00023  * 
00024  *    1. Recipient may make unlimited copies of this software and give
00025  *       copies to other persons or entities as long as the copies contain
00026  *       this NOTICE, and as long as the same copyright notices that
00027  *       appear on, or in, this software remain.
00028  * 
00029  *    2. Trademarks. All trademarks belong to their respective trademark
00030  *       holders.  Third-Party applications/software/information are
00031  *       copyrighted by their respective owners.
00032  * 
00033  *    3. Recipient agrees to forfeit all intellectual property and
00034  *       ownership rights for any version created from the modification
00035  *       or adaptation of this software, including versions created from
00036  *       the translation and/or reverse engineering of the software design.
00037  * 
00038  *    4. Transfer.  Recipient may not sell, rent, lease, or sublicense
00039  *       this software.  Recipient may, however enable another person
00040  *       or entity the rights to use this software, provided that this
00041  *       AGREEMENT and NOTICE is furnished along with the software and
00042  *       /or software system utilizing this software.
00043  * 
00044  *       All revisions, modifications, created by the Recipient, to this
00045  *       software and/or related technical data shall be forwarded by the
00046  *       Recipient to the Government at the following address:
00047  * 
00048  *         SMDC
00049  *         Attention SEDRIS (TO193) TPOC
00050  *         P.O. Box 1500
00051  *         Hunstville, AL  35807-3801
00052  * 
00053  *         or via electronic mail to:  [email protected]
00054  * 
00055  *    5. No Warranty. This software is being delivered to you AS IS
00056  *       and there is no warranty, EXPRESS or IMPLIED, as to its use
00057  *       or performance.
00058  * 
00059  *       The RECIPIENT ASSUMES ALL RISKS, KNOWN AND UNKNOWN, OF USING
00060  *       THIS SOFTWARE.  The DEVELOPER EXPRESSLY DISCLAIMS, and the
00061  *       RECIPIENT WAIVES, ANY and ALL PERFORMANCE OR RESULTS YOU MAY
00062  *       OBTAIN BY USING THIS SOFTWARE OR DOCUMENTATION.  THERE IS
00063  *       NO WARRANTY, EXPRESS OR, IMPLIED, AS TO NON-INFRINGEMENT OF
00064  *       THIRD PARTY RIGHTS, MERCHANTABILITY, OR FITNESS FOR ANY
00065  *       PARTICULAR PURPOSE.  IN NO EVENT WILL THE DEVELOPER, THE
00066  *       UNITED STATES GOVERNMENT OR ANYONE ELSE ASSOCIATED WITH THE
00067  *       DEVELOPMENT OF THIS SOFTWARE BE HELD LIABLE FOR ANY CONSEQUENTIAL,
00068  *       INCIDENTAL OR SPECIAL DAMAGES, INCLUDING ANY LOST PROFITS
00069  *       OR LOST SAVINGS WHATSOEVER.
00070  */
00071 
00072 // SRM_OTHERS_GOES_HERE
00073 
00074 // $Id: Coord.h,v 1.23 2009/08/13 15:48:02 worleym Exp $
00075 
00076 #ifndef _Coord_h
00077 #define _Coord_h
00078 
00079 #if !defined(_WIN32)
00080 #define EXPORT_SRM_CPP_DLL
00081 #elif defined(BUILD_SRM_CPP) /* SRM CPP Case */
00082 #if !defined(EXPORT_SRM_CPP_DLL)
00083 #if defined(_LIB)
00084 #define EXPORT_SRM_CPP_DLL
00085 #elif defined(_USRDLL)
00086 #define EXPORT_SRM_CPP_DLL __declspec(dllexport)
00087 #else
00088 #define EXPORT_SRM_CPP_DLL __declspec(dllimport)
00089 #endif
00090 #endif
00091 #else /* SRM C Case */
00092 #define EXPORT_SRM_CPP_DLL
00093 #endif /* _WIN32 && EXPORT_DLL */
00094 
00095 #include "BaseSRF.h" 
00096 
00097 namespace srm
00098 {
00099 
00108 class EXPORT_SRM_CPP_DLL Coord
00109 {
00110 public:
00113     enum Coord_ClassType
00114     {
00115         COORD_TYP_TWO_D,
00116         COORD_TYP_SURFACE,
00117         COORD_TYP_THREE_D,
00118         COORD_TYP_LSA,
00119         COORD_TYP_CC,
00120         COORD_TYP_CD,
00121         COORD_TYP_SURF_CD,
00122         COORD_TYP_CM,
00123         COORD_TYP_EC,
00124         COORD_TYP_SURF_EC,
00125         COORD_TYP_EI,
00126         COORD_TYP_HAEC,
00127         COORD_TYP_HEEC,
00128         COORD_TYP_HEEQ,
00129         COORD_TYP_LCC,
00130         COORD_TYP_SURF_LCC,
00131         COORD_TYP_LCE_3D,
00132         COORD_TYP_LSR_3D,
00133         COORD_TYP_LSR_2D,
00134         COORD_TYP_LTSAS,
00135         COORD_TYP_SURF_LTSAS,
00136         COORD_TYP_LTSC,
00137         COORD_TYP_SURF_LTSC,
00138         COORD_TYP_LTSE,
00139         COORD_TYP_SURF_LTSE,
00140         COORD_TYP_M,
00141         COORD_TYP_SURF_M,
00142         COORD_TYP_OMS,
00143         COORD_TYP_SURF_OMS,
00144         COORD_TYP_LSP,
00145         COORD_TYP_PS,
00146         COORD_TYP_SURF_PS,
00147         COORD_TYP_PD,
00148         COORD_TYP_SURF_PD,
00149         COORD_TYP_SEC,
00150         COORD_TYP_SEQ,
00151         COORD_TYP_SME,
00152         COORD_TYP_SMD,
00153         COORD_TYP_TM,
00154         COORD_TYP_SURF_TM
00155     };
00156 
00159     BaseSRF *getSRF() const
00160     {
00161       return _srf;
00162     }
00163 
00166     virtual Coord_ClassType getClassType() const = 0;
00167 
00170     virtual bool isA( Coord_ClassType type ) const;
00171 
00174     virtual const char *toString() = 0;
00175 
00176 protected:
00179     Coord( BaseSRF *srf )
00180     {
00181         _srf = srf->clone();
00182     }
00183 
00188     Coord &operator =( const Coord &coord )
00189     {
00190         return *this;
00191     }
00192 
00195     virtual ~Coord()
00196     {
00197         _srf->release();
00198     }
00199 
00202     BaseSRF *_srf;
00203 };
00204 
00205 inline bool Coord::isA( Coord_ClassType type ) const
00206 {
00207     return false;
00208 }
00209 
00213 class EXPORT_SRM_CPP_DLL Coord2D: public Coord
00214 {
00215 public:
00218     virtual bool isA( Coord_ClassType type ) const;
00219 
00222     const SRM_Long_Float *getValues() const
00223     {
00224         return _values;
00225     }
00226 
00229     void setValues( const SRM_Long_Float values[2])
00230     {
00231         _values[0] = values[0];
00232         _values[1] = values[1];
00233     }
00234 
00237     const char *toString();
00238 
00239 protected:
00242     Coord2D( BaseSRF *srf )
00243       : Coord(srf)
00244     {
00245     }
00246 
00249     SRM_Long_Float _values[2];
00250 };
00251 
00252 
00255 inline bool Coord2D::isA( Coord_ClassType type ) const
00256 {
00257     if ( type == Coord::COORD_TYP_TWO_D )
00258         return true;
00259     else
00260         return Coord::isA(type);
00261 }
00262 
00263 
00267 class EXPORT_SRM_CPP_DLL CoordSurf: public Coord
00268 {
00269 public:
00272     virtual bool isA( Coord_ClassType type ) const;
00273 
00276     const SRM_Long_Float *getValues() const
00277     {
00278         return _values;
00279     }
00280 
00283     void setValues( const SRM_Long_Float values[2] )
00284     {
00285         _values[0] = values[0];
00286         _values[1] = values[1];
00287     }
00288 
00291     virtual const char *toString();
00292 
00293 protected:
00296     CoordSurf( BaseSRF *srf )
00297       : Coord(srf)
00298     {
00299     }
00300 
00303     SRM_Long_Float _values[2];
00304 };
00305 
00306 inline bool CoordSurf::isA( Coord_ClassType type ) const
00307 {
00308     if ( type == Coord::COORD_TYP_SURFACE )
00309         return true;
00310     else
00311         return Coord::isA(type);
00312 }
00313 
00317 class EXPORT_SRM_CPP_DLL Coord3D: public Coord
00318 {
00319 public:
00322     virtual bool isA( Coord_ClassType type ) const;
00323 
00326     const SRM_Long_Float *getValues() const
00327     {
00328         return _values;
00329     }
00330 
00333     void setValues( const SRM_Long_Float values[3])
00334     {
00335         _values[0] = values[0];
00336         _values[1] = values[1];
00337         _values[2] = values[2];
00338     }
00339 
00342     virtual const char* toString();
00343 
00354     virtual const char* getMGRS( SRM_Integer precision );
00355 
00366     virtual void setCoord( const char* mgrs );
00367 
00368 protected:
00371     Coord3D( BaseSRF *srf )
00372       : Coord(srf)
00373     {
00374     }
00375 
00378     SRM_Long_Float _values[3];
00379 };
00380 
00381 inline bool Coord3D::isA( Coord_ClassType type ) const
00382 {
00383     if ( type == Coord::COORD_TYP_THREE_D )
00384         return true;
00385     else
00386         return Coord::isA(type);
00387 }
00388 
00389 } // namespace srm
00390 
00391 #endif // _Coord_h

Spatial Reference Model C++ API Version 4.4 - December 7, 2009
Copyright © 2009 SEDRIS Docs by Doxygen 1.3.2