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

Planetodetic.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: Planetodetic.h,v 1.10 2008/10/22 22:01:42 worleym Exp $
00075 
00076 #ifndef _Planetodetic_h
00077 #define _Planetodetic_h
00078 
00079 #include "BaseSRF.h"
00080 #include "Coord.h"
00081 #include "Exception.h"
00082 
00083 namespace srm
00084 {
00091 class EXPORT_SRM_CPP_DLL SRF_Planetodetic: public BaseSRF_WithEllipsoidalHeight
00092 {
00093 public:
00097     static SRF_Planetodetic* create( SRM_ORM_Code orm,
00098                                      SRM_RT_Code  rt );
00099 
00103     static SRF_Planetodetic* create( SRM_SRF_Parameters_Info srf_params )
00104     {
00105         return create( srf_params.value.srf_template.orm_code, srf_params.rt_code );
00106     }
00107 
00110     Coord3D* createCoordinate3D(SRM_Long_Float coord_comp1,
00111                                 SRM_Long_Float coord_comp2,
00112                                 SRM_Long_Float coord_comp3 );
00113 
00116     CoordSurf* createSurfaceCoordinate(SRM_Long_Float coord_surf_comp1,
00117                                        SRM_Long_Float coord_surf_comp2 );
00118 
00121     virtual bool isA( SRF_ClassType type ) const;
00122 
00125     virtual SRF_ClassType getClassType() const {
00126         return BaseSRF::SRF_TYP_PD;
00127     }
00128 
00132     bool isEqual( const SRF_Planetodetic &srf ) const;
00133 
00137     bool operator==( const SRF_Planetodetic &rhs ) const;
00138 
00142     SRF_Planetodetic* makeCopy() const;
00143 
00147     const char* toString();
00148 
00149 protected:
00150     friend class BaseSRF;
00151     SRF_Planetodetic( void *impl ) : BaseSRF_WithEllipsoidalHeight(impl) {} 
00152     SRF_Planetodetic &operator =( const SRF_Planetodetic & ) { return *this; } 
00153     virtual ~SRF_Planetodetic() {} 
00154 };
00155 
00156 
00157 inline bool SRF_Planetodetic::isA( SRF_ClassType type ) const
00158 {
00159     if (type == BaseSRF::SRF_TYP_PD)
00160         return true;
00161     else
00162         return BaseSRF_WithEllipsoidalHeight::isA(type);
00163 };
00164 
00165 
00167 typedef SRF_Planetodetic SRF_PD;
00168 
00169 
00174 class EXPORT_SRM_CPP_DLL Coord3D_Planetodetic: public Coord3D
00175 {
00176 public:
00179     Coord3D_Planetodetic(SRF_Planetodetic *srf,
00180                          SRM_Long_Float latitude = 0.0,
00181                          SRM_Long_Float longitude = 0.0,
00182                          SRM_Long_Float ellipsoidal_height = 0.0 )
00183     : Coord3D(srf)
00184     {
00185         setComponentValues(latitude, longitude, ellipsoidal_height);
00186     }
00187 
00190     Coord3D_Planetodetic( const Coord3D_Planetodetic &coord )
00191     : Coord3D(coord._srf)
00192     {
00193         setComponentValues( coord._values[0], coord._values[1], coord._values[2] );
00194     }
00195 
00201     void copyTo( Coord3D_Planetodetic &coord ) const
00202     {
00203         if (coord._srf != _srf)
00204             throw Exception( SRM_STATCOD_INVALID_SOURCE_COORDINATE, "copyTo: Coordinate associated with a difference SRF" );
00205 
00206         coord._values[0] = _values[0];
00207         coord._values[1] = _values[1];
00208         coord._values[2] = _values[2];
00209     }
00210 
00214     bool isEqual( const Coord3D_Planetodetic &coord ) const
00215     {
00216         return (_srf == coord._srf &&
00217                 _values[0] == coord._values[0] &&
00218                 _values[1] == coord._values[1] &&
00219                 _values[2] == coord._values[2] );
00220     }
00221 
00224     void setComponentValues( SRM_Long_Float latitude, SRM_Long_Float longitude, SRM_Long_Float ellipsoidal_height )
00225     {
00226         _values[0] = latitude;
00227         _values[1] = longitude;
00228         _values[2] = ellipsoidal_height;
00229     }
00230 
00233     SRM_Long_Float get_latitude() const
00234     {
00235         return _values[0];
00236     }
00237 
00240     SRM_Long_Float get_longitude() const
00241     {
00242         return _values[1];
00243     }
00244 
00247     SRM_Long_Float get_ellipsoidal_height() const
00248     {
00249         return _values[2];
00250     }
00251 
00254     void set_latitude( SRM_Long_Float value )
00255     {
00256         _values[0] = value;
00257     }
00258 
00261     void set_longitude( SRM_Long_Float value )
00262     {
00263         _values[1] = value;
00264     }
00265 
00268     void set_ellipsoidal_height( SRM_Long_Float value )
00269     {
00270         _values[2] = value;
00271     }
00272 
00275     virtual bool isA( Coord_ClassType type ) const;
00276 
00279     virtual Coord_ClassType getClassType() const
00280     {
00281         return Coord::COORD_TYP_PD;
00282     }
00283 
00286     bool operator==( const Coord3D_Planetodetic &rhs ) const;
00287 
00293     bool isCompatibleWith( const Coord3D_Planetodetic &rhs ) const {
00294         return ((*(SRF_Planetodetic*)(this->_srf)) == (*(SRF_Planetodetic*)(rhs._srf)));
00295     }
00296 
00301     Coord3D_Planetodetic &operator= ( const Coord3D_Planetodetic &rhs )
00302     {
00303         if((*(SRF_Planetodetic*)(this->_srf)) == (*(SRF_Planetodetic*)(rhs._srf)))
00304         {
00305             _values[0] = rhs._values[0];
00306             _values[1] = rhs._values[1];
00307             _values[2] = rhs._values[2];
00308         }
00309         else
00310             throw Exception(SRM_STATCOD_INVALID_TARGET_COORDINATE,
00311                             "Coord3D_Planetodetic op=: incompatible rhs coordinate");
00312 
00313         return *this;
00314     }
00315 };
00316 
00317 
00318 inline bool Coord3D_Planetodetic::isA( Coord_ClassType type ) const
00319 {
00320     if (type == Coord::COORD_TYP_PD)
00321         return true;
00322     else
00323         return Coord3D::isA(type);
00324 };
00325 
00326 
00328 typedef Coord3D_Planetodetic Coord3D_PD;
00329 
00330 
00335 class EXPORT_SRM_CPP_DLL CoordSurf_Planetodetic: public CoordSurf
00336 {
00337 public:
00340     CoordSurf_Planetodetic(SRF_Planetodetic *srf,
00341                            SRM_Long_Float latitude = 0.0,
00342                            SRM_Long_Float longitude = 0.0 )
00343     : CoordSurf(srf)
00344     {
00345         setComponentValues(latitude, longitude);
00346     }
00347 
00350     CoordSurf_Planetodetic( const CoordSurf_Planetodetic &coord )
00351     : CoordSurf(coord._srf)
00352     {
00353         setComponentValues( coord._values[0], coord._values[1] );
00354     }
00355 
00361     void copyTo( CoordSurf_Planetodetic &coord ) const
00362     {
00363         if (coord._srf != _srf)
00364             throw Exception( SRM_STATCOD_INVALID_SOURCE_COORDINATE, "copyTo: Coordinate associated with a difference SRF" );
00365 
00366         coord._values[0] = _values[0];
00367         coord._values[1] = _values[1];
00368     }
00369 
00373     bool isEqual( const CoordSurf_Planetodetic &coord ) const
00374     {
00375         return (_srf == coord._srf &&
00376                 _values[0] == coord._values[0] &&
00377                 _values[1] == coord._values[1] );
00378     }
00379 
00382     void setComponentValues( SRM_Long_Float longitude, SRM_Long_Float latitude )
00383     {
00384         _values[0] = latitude;
00385         _values[1] = longitude;
00386     }
00387 
00390     SRM_Long_Float get_latitude() const
00391     {
00392         return _values[0];
00393     }
00394 
00397     SRM_Long_Float get_longitude() const
00398     {
00399         return _values[1];
00400     }
00401 
00404     void set_latitude( SRM_Long_Float value )
00405     {
00406         _values[0] = value;
00407     }
00408 
00411     void set_longitude( SRM_Long_Float value )
00412     {
00413         _values[1] = value;
00414     }
00415 
00418     virtual bool isA( Coord_ClassType type ) const;
00419 
00422     virtual Coord_ClassType getClassType() const
00423     {
00424         return Coord::COORD_TYP_SURF_PD;
00425     }
00426 
00429     bool operator==( const CoordSurf_Planetodetic &rhs ) const;
00430 
00436     bool isCompatibleWith( const CoordSurf_Planetodetic &rhs ) const
00437     {
00438         return ((*(SRF_Planetodetic*)(this->_srf)) == (*(SRF_Planetodetic*)(rhs._srf)));
00439     }
00440 
00445     CoordSurf_Planetodetic &operator= ( const CoordSurf_Planetodetic &rhs )
00446     {
00447         if((*(SRF_Planetodetic*)(this->_srf)) == (*(SRF_Planetodetic*)(rhs._srf)))
00448         {
00449             _values[0] = rhs._values[0];
00450             _values[1] = rhs._values[1];
00451         }
00452         else
00453             throw Exception(SRM_STATCOD_INVALID_TARGET_COORDINATE,
00454                             "CoordSurf_Planetodetic op=: incompatible rhs coordinate");
00455 
00456         return *this;
00457     }
00458 };
00459 
00460 
00461 inline bool CoordSurf_Planetodetic::isA( Coord_ClassType type ) const
00462 {
00463     if (type == Coord::COORD_TYP_SURF_PD)
00464         return true;
00465     else
00466         return CoordSurf::isA(type);
00467 };
00468 
00469 
00471 typedef CoordSurf_Planetodetic CoordSurf_PD;
00472 
00473 } // namespace srm
00474 
00475 #endif // _Planetodetic_h

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