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

TransverseMercator.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 #ifndef _TransverseMercator_h
00075 #define _TransverseMercator_h
00076 
00077 #include "BaseSRF.h"
00078 #include "Coord.h"
00079 #include "Exception.h"
00080 
00081 namespace srm
00082 {
00089 class EXPORT_SRM_CPP_DLL SRF_TransverseMercator: public BaseSRF_MapProjection
00090 {
00091 public:
00095     static SRF_TransverseMercator* create(      SRM_ORM_Code orm,
00096                                                 SRM_RT_Code  rt,
00097                                           const SRM_TM_Parameters &params);
00098 
00102     static SRF_TransverseMercator* create(
00103                                           SRM_ORM_Code orm,
00104                                           SRM_RT_Code  rt,
00105                                           SRM_Long_Float origin_longitude,
00106                                           SRM_Long_Float origin_latitude,
00107                                           SRM_Long_Float central_scale,
00108                                           SRM_Long_Float false_easting,
00109                                           SRM_Long_Float false_northing
00110                                          );
00111 
00115     static SRF_TransverseMercator* create( SRM_SRF_Parameters_Info srf_params )
00116     {
00117         return create( srf_params.value.srf_template.orm_code,
00118                        srf_params.rt_code,
00119                        srf_params.value.srf_template.parameters.tm_srf_parameters );
00120     }
00121 
00124     Coord3D* createCoordinate3D(SRM_Long_Float coord_comp1,
00125                                 SRM_Long_Float coord_comp2,
00126                                 SRM_Long_Float coord_comp3 );
00127 
00130     CoordSurf* createSurfaceCoordinate(SRM_Long_Float coord_surf_comp1,
00131                                        SRM_Long_Float coord_surf_comp2 );
00132 
00136     const SRM_TM_Parameters &getSRFParameters() const;
00137 
00141     SRM_Long_Float get_origin_longitude() const;
00142 
00146     SRM_Long_Float get_origin_latitude() const;
00147 
00151     SRM_Long_Float get_central_scale() const;
00152 
00156     SRM_Long_Float get_false_easting() const;
00157 
00161     SRM_Long_Float get_false_northing() const;
00162 
00165     virtual bool isA( SRF_ClassType type ) const;
00166 
00169     virtual SRF_ClassType getClassType() const
00170     {
00171         return BaseSRF::SRF_TYP_TM;
00172     }
00173 
00177     bool isEqual( const SRF_TransverseMercator &srf ) const;
00178 
00182     bool operator==( const SRF_TransverseMercator &rhs ) const;
00183 
00187     SRF_TransverseMercator* makeCopy() const;
00188 
00196     virtual SRM_Coordinate_Valid_Region changeCoordinate3DSRF( const Coord3D &src_coord,
00197                                                                Coord3D &des_coord );
00198 
00202     const char* toString();
00203 
00204 protected:
00205     friend class BaseSRF;
00206     friend class BaseSRF_3D;
00207     friend class BaseSRF_WithEllipsoidalHeight;
00208     SRF_TransverseMercator( void *impl ); 
00209     SRF_TransverseMercator &operator =( const SRF_TransverseMercator & ) { return *this; } 
00210     virtual ~SRF_TransverseMercator(); 
00211 };
00212 
00213 
00214 inline bool SRF_TransverseMercator::isA( SRF_ClassType type ) const
00215 {
00216     if (type == BaseSRF::SRF_TYP_TM)
00217         return true;
00218     else
00219         return BaseSRF_MapProjection::isA(type);
00220 };
00221 
00222 
00224 typedef SRF_TransverseMercator SRF_TM;
00225 
00226 
00231 class EXPORT_SRM_CPP_DLL Coord3D_TransverseMercator: public Coord3D
00232 {
00233 public:
00236     Coord3D_TransverseMercator(SRF_TransverseMercator *srf,
00237                                SRM_Long_Float easting = 0.0,
00238                                SRM_Long_Float northing = 0.0,
00239                                SRM_Long_Float ellipsoidal_height = 0.0 )
00240     : Coord3D(srf)
00241     {
00242         setComponentValues(easting, northing, ellipsoidal_height);
00243     }
00244 
00247     Coord3D_TransverseMercator( const Coord3D_TransverseMercator &coord )
00248     : Coord3D(coord._srf)
00249     {
00250         setComponentValues( coord._values[0], coord._values[1], coord._values[2] );
00251     }
00252 
00258     void copyTo( Coord3D_TransverseMercator &coord ) const
00259     {
00260         if (coord._srf != _srf)
00261             throw Exception( SRM_STATCOD_INVALID_SOURCE_COORDINATE, "copyTo: Coordinate associated with a difference SRF" );
00262 
00263         coord._values[0] = _values[0];
00264         coord._values[1] = _values[1];
00265         coord._values[2] = _values[2];
00266     }
00267 
00272     bool isEqual( const Coord3D_TransverseMercator &coord ) const
00273     {
00274         return (_srf == coord._srf &&
00275                 _values[0] == coord._values[0] &&
00276                 _values[1] == coord._values[1] &&
00277                 _values[2] == coord._values[2] );
00278     }
00279 
00282     void setComponentValues( SRM_Long_Float easting, SRM_Long_Float northing, SRM_Long_Float ellipsoidal_height )
00283     {
00284         _values[0] = easting;
00285         _values[1] = northing;
00286         _values[2] = ellipsoidal_height;
00287     }
00288 
00291     SRM_Long_Float get_easting() const
00292     {
00293         return _values[0];
00294     }
00295 
00298     SRM_Long_Float get_northing() const
00299     {
00300         return _values[1];
00301     }
00302 
00305     SRM_Long_Float get_ellipsoidal_height() const
00306     {
00307         return _values[2];
00308     }
00309 
00312     void set_easting( SRM_Long_Float value )
00313     {
00314         _values[0] = value;
00315     }
00316 
00319     void set_northing( SRM_Long_Float value )
00320     {
00321         _values[1] = value;
00322     }
00323 
00326     void set_ellipsoidal_height( SRM_Long_Float value )
00327     {
00328         _values[2] = value;
00329     }
00330 
00333     virtual bool isA( Coord_ClassType type ) const;
00334 
00337     virtual Coord_ClassType getClassType() const
00338     {
00339         return Coord::COORD_TYP_TM;
00340     }
00341 
00344     bool operator==( const Coord3D_TransverseMercator &rhs ) const;
00345 
00351     bool isCompatibleWith( const Coord3D_TransverseMercator &rhs ) const
00352     {
00353         return ((*(SRF_TransverseMercator*)(this->_srf)) == (*(SRF_TransverseMercator*)(rhs._srf)));
00354     }
00355 
00360     Coord3D_TransverseMercator &operator= ( const Coord3D_TransverseMercator &rhs )
00361     {
00362         if((*(SRF_TransverseMercator*)(this->_srf)) == (*(SRF_TransverseMercator*)(rhs._srf)))
00363           {
00364             _values[0] = rhs._values[0];
00365             _values[1] = rhs._values[1];
00366             _values[2] = rhs._values[2];
00367           }
00368         else
00369           throw Exception(SRM_STATCOD_INVALID_TARGET_COORDINATE,
00370                           "Coord3D_TransverseMercator op=: incompatible rhs coordinate");
00371 
00372         return *this;
00373     }
00374 };
00375 
00376 
00377 inline bool Coord3D_TransverseMercator::isA( Coord_ClassType type ) const
00378 {
00379     if (type == Coord::COORD_TYP_TM)
00380         return true;
00381     else
00382         return Coord3D::isA(type);
00383 };
00384 
00385 
00387 typedef Coord3D_TransverseMercator Coord3D_TM;
00388 
00389 
00394 class EXPORT_SRM_CPP_DLL CoordSurf_TransverseMercator: public CoordSurf
00395 {
00396 public:
00399     CoordSurf_TransverseMercator(SRF_TransverseMercator *srf,
00400                                  SRM_Long_Float easting = 0.0,
00401                                  SRM_Long_Float northing = 0.0 )
00402     : CoordSurf(srf)
00403     {
00404         setComponentValues(easting, northing);
00405     }
00406 
00409     CoordSurf_TransverseMercator( const CoordSurf_TransverseMercator &coord )
00410     : CoordSurf(coord._srf)
00411     {
00412         setComponentValues( coord._values[0], coord._values[1] );
00413     }
00414 
00420     void copyTo( CoordSurf_TransverseMercator &coord ) const
00421     {
00422         if (coord._srf != _srf)
00423             throw Exception( SRM_STATCOD_INVALID_SOURCE_COORDINATE, "copyTo: Coordinate associated with a difference SRF" );
00424 
00425         coord._values[0] = _values[0];
00426         coord._values[1] = _values[1];
00427     }
00428 
00433     bool isEqual( const CoordSurf_TransverseMercator &coord ) const
00434     {
00435         return (_srf == coord._srf &&
00436                 _values[0] == coord._values[0] &&
00437                 _values[1] == coord._values[1] );
00438     }
00439 
00442     void setComponentValues( SRM_Long_Float easting, SRM_Long_Float northing )
00443     {
00444         _values[0] = easting;
00445         _values[1] = northing;
00446     }
00447 
00450     SRM_Long_Float get_easting() const
00451     {
00452         return _values[0];
00453     }
00454 
00457     SRM_Long_Float get_northing() const
00458     {
00459         return _values[1];
00460     }
00461 
00464     void set_easting( SRM_Long_Float value )
00465     {
00466         _values[0] = value;
00467     }
00468 
00471     void set_northing( SRM_Long_Float value )
00472     {
00473         _values[1] = value;
00474     }
00475 
00478     virtual bool isA( Coord_ClassType type ) const;
00479 
00482     virtual Coord_ClassType getClassType() const
00483     {
00484         return Coord::COORD_TYP_SURF_TM;
00485     }
00486 
00489     bool operator==( const CoordSurf_TransverseMercator &rhs ) const;
00490 
00496     bool isCompatibleWith( const CoordSurf_TransverseMercator &rhs ) const
00497     {
00498         return ((*(SRF_TransverseMercator*)(this->_srf)) == (*(SRF_TransverseMercator*)(rhs._srf)));
00499     }
00500 
00505     CoordSurf_TransverseMercator &operator= ( const CoordSurf_TransverseMercator &rhs )
00506     {
00507         if((*(SRF_TransverseMercator*)(this->_srf)) == (*(SRF_TransverseMercator*)(rhs._srf)))
00508         {
00509             _values[0] = rhs._values[0];
00510             _values[1] = rhs._values[1];
00511         }
00512         else
00513             throw Exception(SRM_STATCOD_INVALID_TARGET_COORDINATE,
00514                             "CoordSurf_TransverseMercator op=: incompatible rhs coordinate");
00515 
00516         return *this;
00517     }
00518 };
00519 
00520 
00521 inline bool CoordSurf_TransverseMercator::isA( Coord_ClassType type ) const
00522 {
00523     if (type == Coord::COORD_TYP_SURF_TM)
00524         return true;
00525     else
00526         return CoordSurf::isA(type);
00527 };
00528 
00529 
00531 typedef CoordSurf_TransverseMercator CoordSurf_TM;
00532 
00533 } // namespace srm
00534 
00535 #endif // _TransverseMercator_h

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