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

Mercator.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: Mercator.h,v 1.18 2009/10/12 20:13:05 worleym Exp $
00075 
00076 #ifndef _Mercator_h
00077 #define _Mercator_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_Mercator: public BaseSRF_MapProjection
00092 {
00093 public:
00097     static SRF_Mercator* create(      SRM_ORM_Code orm,
00098                                       SRM_RT_Code  rt,
00099                                 const SRM_M_Parameters &params);
00100 
00104     static SRF_Mercator* create(
00105                                 SRM_ORM_Code   orm,
00106                                 SRM_RT_Code    rt,
00107                                 SRM_Long_Float origin_longitude,
00108                                 SRM_Long_Float central_scale,
00109                                 SRM_Long_Float false_easting,
00110                                 SRM_Long_Float false_northing
00111                                 );
00112 
00116     static SRF_Mercator* create( SRM_SRF_Parameters_Info srf_params )
00117     {
00118         return create(srf_params.value.srf_template.orm_code,
00119                       srf_params.rt_code,
00120                       srf_params.value.srf_template.parameters.m_srf_parameters);
00121     }
00122 
00125     Coord3D* createCoordinate3D(SRM_Long_Float coord_comp1,
00126                                 SRM_Long_Float coord_comp2,
00127                                 SRM_Long_Float coord_comp3);
00128 
00131     CoordSurf* createSurfaceCoordinate(SRM_Long_Float coord_surf_comp1,
00132                                        SRM_Long_Float coord_surf_comp2);
00133 
00137     const SRM_M_Parameters &getSRFParameters() const;
00138 
00142     SRM_Long_Float get_origin_longitude() const;
00143 
00147     SRM_Long_Float get_central_scale() const;
00148 
00152     SRM_Long_Float get_false_easting() const;
00153 
00157     SRM_Long_Float get_false_northing() const;
00158 
00161     virtual bool isA( SRF_ClassType type ) const;
00162 
00165     virtual SRF_ClassType getClassType() const
00166     {
00167         return BaseSRF::SRF_TYP_M;
00168     }
00169 
00173     bool isEqual( const SRF_Mercator &srf ) const;
00174 
00178     bool operator==( const SRF_Mercator &rhs ) const;
00179 
00183     SRF_Mercator* makeCopy() const;
00184 
00192     virtual SRM_Coordinate_Valid_Region changeCoordinate3DSRF(const Coord3D &src_coord,
00193                                                                     Coord3D &des_coord);
00194 
00198     const char* toString();
00199 
00200 protected:
00201     friend class BaseSRF;
00202     SRF_Mercator( void *impl ); 
00203     SRF_Mercator &operator =( const SRF_Mercator & ) { return *this; } 
00204     virtual ~SRF_Mercator(); 
00205 };
00206 
00207 
00208 inline bool SRF_Mercator::isA( SRF_ClassType type ) const
00209 {
00210     if (type == BaseSRF::SRF_TYP_M)
00211         return true;
00212     else
00213         return BaseSRF_MapProjection::isA(type);
00214 };
00215 
00216 
00218 typedef SRF_Mercator SRF_M;
00219 
00220 
00225 class EXPORT_SRM_CPP_DLL Coord3D_Mercator: public Coord3D
00226 {
00227 public:
00230     Coord3D_Mercator(SRF_Mercator *srf,
00231                      SRM_Long_Float easting = 0.0,
00232                      SRM_Long_Float northing = 0.0,
00233                      SRM_Long_Float ellipsoidal_height = 0.0)
00234     : Coord3D(srf)
00235     {
00236         setComponentValues(easting, northing, ellipsoidal_height);
00237     }
00238 
00241     Coord3D_Mercator( const Coord3D_Mercator &coord )
00242     : Coord3D(coord._srf)
00243     {
00244         setComponentValues( coord._values[0], coord._values[1], coord._values[2] );
00245     }
00246 
00252     void copyTo( Coord3D_Mercator &coord ) const
00253     {
00254         if (coord._srf != _srf)
00255             throw Exception( SRM_STATCOD_INVALID_SOURCE_COORDINATE, "copyTo: Coordinate associated with a difference SRF" );
00256 
00257         coord._values[0] = _values[0];
00258         coord._values[1] = _values[1];
00259         coord._values[2] = _values[2];
00260     }
00261 
00265     bool isEqual( const Coord3D_Mercator &coord ) const
00266     {
00267         return (_srf == coord._srf &&
00268                 _values[0] == coord._values[0] &&
00269                 _values[1] == coord._values[1] &&
00270                 _values[2] == coord._values[2]);
00271     }
00272 
00275     void setComponentValues( SRM_Long_Float easting, SRM_Long_Float northing, SRM_Long_Float ellipsoidal_height )
00276     {
00277         _values[0] = easting;
00278         _values[1] = northing;
00279         _values[2] = ellipsoidal_height;
00280     }
00281 
00284     SRM_Long_Float get_easting() const
00285     {
00286         return _values[0];
00287     }
00288 
00291     SRM_Long_Float get_northing() const
00292     {
00293         return _values[1];
00294     }
00295 
00298     SRM_Long_Float get_ellipsoidal_height() const
00299     {
00300         return _values[2];
00301     }
00302 
00305     void set_easting( SRM_Long_Float value )
00306     {
00307         _values[0] = value;
00308     }
00309 
00312     void set_northing( SRM_Long_Float value )
00313     {
00314         _values[1] = value;
00315     }
00316 
00319     void set_ellipsoidal_height( SRM_Long_Float value )
00320     {
00321         _values[2] = value;
00322     }
00323 
00326     virtual bool isA( Coord_ClassType type ) const;
00327 
00330     virtual Coord_ClassType getClassType() const
00331     {
00332         return Coord::COORD_TYP_M;
00333     }
00334 
00337     bool operator==( const Coord3D_Mercator &rhs ) const;
00338 
00344     bool isCompatibleWith( const Coord3D_Mercator &rhs ) const
00345     {
00346         return ((*(SRF_Mercator*)(this->_srf)) == (*(SRF_Mercator*)(rhs._srf)));
00347     }
00348 
00353     Coord3D_Mercator &operator= ( const Coord3D_Mercator &rhs )
00354     {
00355         if((*(SRF_Mercator*)(this->_srf)) == (*(SRF_Mercator*)(rhs._srf)))
00356         {
00357             _values[0] = rhs._values[0];
00358             _values[1] = rhs._values[1];
00359             _values[2] = rhs._values[2];
00360         }
00361         else
00362             throw Exception(SRM_STATCOD_INVALID_TARGET_COORDINATE,
00363                             "Coord3D_Mercator op=: incompatible rhs coordinate");
00364 
00365         return *this;
00366     }
00367 };
00368 
00369 
00370 inline bool Coord3D_Mercator::isA( Coord_ClassType type ) const
00371 {
00372     if (type == Coord::COORD_TYP_M)
00373         return true;
00374     else
00375         return Coord3D::isA(type);
00376 };
00377 
00378 
00380 typedef Coord3D_Mercator Coord3D_M;
00381 
00382 
00387 class EXPORT_SRM_CPP_DLL CoordSurf_Mercator: public CoordSurf
00388 {
00389 public:
00392     CoordSurf_Mercator( SRF_Mercator *srf,
00393                         SRM_Long_Float easting = 0.0,
00394                         SRM_Long_Float northing = 0.0 )
00395     : CoordSurf(srf)
00396     {
00397         setComponentValues(easting, northing);
00398     }
00399 
00402     CoordSurf_Mercator( const CoordSurf_Mercator &coord )
00403     : CoordSurf(coord._srf)
00404     {
00405         setComponentValues( coord._values[0], coord._values[1] );
00406     }
00407 
00413     void copyTo( CoordSurf_Mercator &coord ) const
00414     {
00415         if (coord._srf != _srf)
00416             throw Exception( SRM_STATCOD_INVALID_SOURCE_COORDINATE, "copyTo: Coordinate associated with a difference SRF" );
00417 
00418         coord._values[0] = _values[0];
00419         coord._values[1] = _values[1];
00420     }
00421 
00425     bool isEqual( const CoordSurf_Mercator &coord ) const
00426     {
00427         return (_srf == coord._srf &&
00428                 _values[0] == coord._values[0] &&
00429                 _values[1] == coord._values[1] );
00430     }
00431 
00434     void setComponentValues( SRM_Long_Float easting, SRM_Long_Float northing )
00435     {
00436         _values[0] = easting;
00437         _values[1] = northing;
00438     }
00439 
00442     SRM_Long_Float get_easting() const
00443     {
00444         return _values[0];
00445     }
00446 
00449     SRM_Long_Float get_northing() const
00450     {
00451         return _values[1];
00452     }
00453 
00456     void set_easting( SRM_Long_Float value )
00457     {
00458         _values[0] = value;
00459     }
00460 
00463     void set_northing( SRM_Long_Float value )
00464     {
00465         _values[1] = value;
00466     }
00467 
00470     virtual bool isA( Coord_ClassType type ) const;
00471 
00474     virtual Coord_ClassType getClassType() const
00475     {
00476         return Coord::COORD_TYP_SURF_M;
00477     }
00478 
00481     bool operator==( const CoordSurf_Mercator &rhs ) const;
00482 
00488     bool isCompatibleWith( const CoordSurf_Mercator &rhs ) const
00489     {
00490         return ((*(SRF_Mercator*)(this->_srf)) == (*(SRF_Mercator*)(rhs._srf)));
00491     }
00492 
00498     CoordSurf_Mercator &operator= ( const CoordSurf_Mercator &rhs )
00499     {
00500         if((*(SRF_Mercator*)(this->_srf)) == (*(SRF_Mercator*)(rhs._srf)))
00501         {
00502             _values[0] = rhs._values[0];
00503             _values[1] = rhs._values[1];
00504         }
00505         else
00506             throw Exception(SRM_STATCOD_INVALID_TARGET_COORDINATE,
00507                             "CoordSurf_Mercator op=: incompatible rhs coordinate");
00508 
00509         return *this;
00510     }
00511 };
00512 
00513 
00514 inline bool CoordSurf_Mercator::isA( Coord_ClassType type ) const
00515 {
00516     if (type == Coord::COORD_TYP_SURF_M)
00517         return true;
00518     else
00519         return CoordSurf::isA(type);
00520 };
00521 
00522 
00524 typedef CoordSurf_Mercator CoordSurf_M;
00525 
00526 } // namespace srm
00527 
00528 #endif // _Mercator_h

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