00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
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 ¶ms);
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 }
00527
00528 #endif // _Mercator_h