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 _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 }
00474
00475 #endif // _Planetodetic_h