00001
00002
00004
00006
00007
00008
00009
00010
00011 #ifndef _Mercator_h
00012 #define _Mercator_h
00013
00019 #include "BaseSRF.h"
00020 #include "Coord.h"
00021 #include "Exception.h"
00022
00023 namespace srm
00024 {
00025
00026
00033 class EXPORT_SRM_CPP_DLL SRF_Mercator: public BaseSRF_MapProjection
00034 {
00035 public:
00036
00040 static SRF_Mercator* create( const SRM_ORM_Code orm,
00041 const SRM_RT_Code rt,
00042 const SRM_M_Parameters ¶ms );
00043
00047 static SRF_Mercator* create(
00048 SRM_ORM_Code orm,
00049 SRM_RT_Code rt,
00050 SRM_Long_Float origin_longitude,
00051 SRM_Long_Float central_scale,
00052 SRM_Long_Float false_easting,
00053 SRM_Long_Float false_northing
00054 );
00055
00059 static SRF_Mercator* create( SRM_SRF_Parameters_Info srf_params )
00060 {
00061 return create( srf_params.value.srf_template.orm_code,
00062 srf_params.rt_code,
00063 srf_params.value.srf_template.parameters.m_srf_parameters );
00064 }
00065
00067 Coord3D* createCoordinate3D(SRM_Long_Float coord_comp1,
00068 SRM_Long_Float coord_comp2,
00069 SRM_Long_Float coord_comp3 );
00070
00072 CoordSurf* createSurfaceCoordinate(SRM_Long_Float coord_surf_comp1,
00073 SRM_Long_Float coord_surf_comp2 );
00074
00078 const SRM_M_Parameters &getSRFParameters() const;
00079
00083 SRM_Long_Float get_origin_longitude() const;
00084
00088 SRM_Long_Float get_central_scale() const;
00089
00093 SRM_Long_Float get_false_easting() const;
00094
00098 SRM_Long_Float get_false_northing() const;
00099
00101 virtual bool isA( SRF_ClassType type ) const;
00102
00103
00105 virtual SRF_ClassType getClassType() const {
00106 return BaseSRF::SRF_TYP_M;
00107 }
00108
00110 bool isEqual( const SRF_Mercator &srf ) const;
00111
00112
00116 SRF_Mercator* makeCopy() const;
00117
00118
00122 const char* toString();
00123
00124 protected:
00125
00126 friend class BaseSRF;
00127 friend class BaseSRF_3D;
00128 friend class BaseSRF_WithEllipsoidalHeight;
00129 SRF_Mercator( void *impl ) : BaseSRF_MapProjection(impl) {}
00130 SRF_Mercator &operator =( const BaseSRF & ) { return *this; }
00131 virtual ~SRF_Mercator() {}
00132
00133 };
00134
00135
00136 inline bool SRF_Mercator::isA( SRF_ClassType type ) const
00137 {
00138 if (type == BaseSRF::SRF_TYP_M)
00139 return true;
00140 else
00141 return BaseSRF_MapProjection::isA(type);
00142 };
00143
00144
00146 typedef SRF_Mercator SRF_M;
00147
00148
00153 class EXPORT_SRM_CPP_DLL Coord3D_Mercator: public Coord3D
00154 {
00155 public:
00156
00158 Coord3D_Mercator( SRF_Mercator *srf,
00159 SRM_Long_Float easting = 0.0,
00160 SRM_Long_Float northing = 0.0,
00161 SRM_Long_Float ellipsoidal_height = 0.0 )
00162 : Coord3D(srf)
00163 {
00164 setComponentValues(easting, northing, ellipsoidal_height);
00165 }
00166
00168 Coord3D_Mercator( const Coord3D_Mercator &coord )
00169 : Coord3D(coord._srf)
00170 {
00171 setComponentValues( coord._values[0], coord._values[1], coord._values[2] );
00172 }
00173
00177 void copyTo( Coord3D_Mercator &coord ) const
00178 {
00179 if (coord._srf != _srf)
00180 throw Exception( SRM_STATCOD_INVALID_SOURCE_COORDINATE, "copyTo: Coordinate associated with a difference SRF" );
00181
00182 coord._values[0] = _values[0];
00183 coord._values[1] = _values[1];
00184 coord._values[2] = _values[2];
00185 }
00186
00188 bool isEqual( const Coord3D_Mercator &coord ) const
00189 {
00190 return (_srf == coord._srf &&
00191 _values[0] == coord._values[0] &&
00192 _values[1] == coord._values[1] &&
00193 _values[2] == coord._values[2] );
00194 }
00195
00197 void setComponentValues( SRM_Long_Float easting, SRM_Long_Float northing, SRM_Long_Float ellipsoidal_height )
00198 {
00199 _values[0] = easting;
00200 _values[1] = northing;
00201 _values[2] = ellipsoidal_height;
00202 }
00203
00205 SRM_Long_Float get_easting() const {
00206 return _values[0];
00207 }
00208
00210 SRM_Long_Float get_northing() const {
00211 return _values[1];
00212 }
00213
00215 SRM_Long_Float get_ellipsoidal_height() const {
00216 return _values[2];
00217 }
00218
00220 void set_easting( SRM_Long_Float value ) {
00221 _values[0] = value;
00222 }
00223
00225 void set_northing( SRM_Long_Float value ) {
00226 _values[1] = value;
00227 }
00228
00230 void set_ellipsoidal_height( SRM_Long_Float value ) {
00231 _values[2] = value;
00232 }
00233
00235 virtual bool isA( Coord_ClassType type ) const;
00236
00237
00239 virtual Coord_ClassType getClassType() const {
00240 return Coord::COORD_TYP_M;
00241 }
00242
00243 };
00244
00245
00246 inline bool Coord3D_Mercator::isA( Coord_ClassType type ) const
00247 {
00248 if (type == Coord::COORD_TYP_M)
00249 return true;
00250 else
00251 return Coord3D::isA(type);
00252 };
00253
00254
00256 typedef Coord3D_Mercator Coord3D_M;
00257
00258
00263 class EXPORT_SRM_CPP_DLL CoordSurf_Mercator: public CoordSurf
00264 {
00265 public:
00266
00268 CoordSurf_Mercator( SRF_Mercator *srf,
00269 SRM_Long_Float easting = 0.0,
00270 SRM_Long_Float northing = 0.0 )
00271 : CoordSurf(srf)
00272 {
00273 setComponentValues(easting, northing);
00274 }
00275
00277 CoordSurf_Mercator( const CoordSurf_Mercator &coord )
00278 : CoordSurf(coord._srf)
00279 {
00280 setComponentValues( coord._values[0], coord._values[1] );
00281 }
00282
00286 void copyTo( CoordSurf_Mercator &coord ) const
00287 {
00288 if (coord._srf != _srf)
00289 throw Exception( SRM_STATCOD_INVALID_SOURCE_COORDINATE, "copyTo: Coordinate associated with a difference SRF" );
00290
00291 coord._values[0] = _values[0];
00292 coord._values[1] = _values[1];
00293 }
00294
00296 bool isEqual( const CoordSurf_Mercator &coord ) const
00297 {
00298 return (_srf == coord._srf &&
00299 _values[0] == coord._values[0] &&
00300 _values[1] == coord._values[1] );
00301 }
00302
00304 void setComponentValues( SRM_Long_Float easting, SRM_Long_Float northing )
00305 {
00306 _values[0] = easting;
00307 _values[1] = northing;
00308 }
00309
00311 SRM_Long_Float get_easting() const {
00312 return _values[0];
00313 }
00314
00316 SRM_Long_Float get_northing() const {
00317 return _values[1];
00318 }
00319
00321 void set_easting( SRM_Long_Float value ) {
00322 _values[0] = value;
00323 }
00324
00326 void set_northing( SRM_Long_Float value ) {
00327 _values[1] = value;
00328 }
00329
00331 virtual bool isA( Coord_ClassType type ) const;
00332
00333
00335 virtual Coord_ClassType getClassType() const {
00336 return Coord::COORD_TYP_SURF_M;
00337 }
00338
00339 };
00340
00341
00342 inline bool CoordSurf_Mercator::isA( Coord_ClassType type ) const
00343 {
00344 if (type == Coord::COORD_TYP_SURF_M)
00345 return true;
00346 else
00347 return CoordSurf::isA(type);
00348 };
00349
00350
00352 typedef CoordSurf_Mercator CoordSurf_M;
00353
00354
00355 }
00356
00357 #endif // _Mercator_h