00001
00002
00004
00006
00007
00008
00009 #ifndef _TransverseMercator_h
00010 #define _TransverseMercator_h
00011
00017 #include "BaseSRF.h"
00018 #include "Coord.h"
00019 #include "Exception.h"
00020
00021 namespace srm
00022 {
00023
00024
00031 class EXPORT_SRM_CPP_DLL SRF_TransverseMercator: public BaseSRF_MapProjection
00032 {
00033 public:
00034
00038 static SRF_TransverseMercator* create( const SRM_ORM_Code orm,
00039 const SRM_RT_Code rt,
00040 const SRM_TM_Parameters ¶ms );
00041
00045 static SRF_TransverseMercator* create(
00046 SRM_ORM_Code orm,
00047 SRM_RT_Code rt,
00048 SRM_Long_Float origin_longitude,
00049 SRM_Long_Float origin_latitude,
00050 SRM_Long_Float central_scale,
00051 SRM_Long_Float false_easting,
00052 SRM_Long_Float false_northing
00053 );
00054
00058 static SRF_TransverseMercator* create( SRM_SRF_Parameters_Info srf_params )
00059 {
00060 return create( srf_params.value.srf_template.orm_code,
00061 srf_params.rt_code,
00062 srf_params.value.srf_template.parameters.tm_srf_parameters );
00063 }
00064
00066 Coord3D* createCoordinate3D(SRM_Long_Float coord_comp1,
00067 SRM_Long_Float coord_comp2,
00068 SRM_Long_Float coord_comp3 );
00069
00071 CoordSurf* createSurfaceCoordinate(SRM_Long_Float coord_surf_comp1,
00072 SRM_Long_Float coord_surf_comp2 );
00073
00077 const SRM_TM_Parameters &getSRFParameters() const;
00078
00082 SRM_Long_Float get_origin_longitude() const;
00083
00087 SRM_Long_Float get_origin_latitude() const;
00088
00092 SRM_Long_Float get_central_scale() const;
00093
00097 SRM_Long_Float get_false_easting() const;
00098
00102 SRM_Long_Float get_false_northing() const;
00103
00105 virtual bool isA( SRF_ClassType type ) const;
00106
00107
00109 virtual SRF_ClassType getClassType() const {
00110 return BaseSRF::SRF_TYP_TM;
00111 }
00112
00114 bool isEqual( const SRF_TransverseMercator &srf ) const;
00115
00116
00120 SRF_TransverseMercator* makeCopy() const;
00121
00122
00126 const char* toString();
00127
00128 protected:
00129
00130 friend class BaseSRF;
00131 friend class BaseSRF_3D;
00132 friend class BaseSRF_WithEllipsoidalHeight;
00133 SRF_TransverseMercator( void *impl ) : BaseSRF_MapProjection(impl) {}
00134 SRF_TransverseMercator &operator =( const BaseSRF & ) { return *this; }
00135 virtual ~SRF_TransverseMercator() {}
00136
00137 };
00138
00139
00140 inline bool SRF_TransverseMercator::isA( SRF_ClassType type ) const
00141 {
00142 if (type == BaseSRF::SRF_TYP_TM)
00143 return true;
00144 else
00145 return BaseSRF_MapProjection::isA(type);
00146 };
00147
00148
00150 typedef SRF_TransverseMercator SRF_TM;
00151
00152
00157 class EXPORT_SRM_CPP_DLL Coord3D_TransverseMercator: public Coord3D
00158 {
00159 public:
00160
00162 Coord3D_TransverseMercator( SRF_TransverseMercator *srf,
00163 SRM_Long_Float easting = 0.0,
00164 SRM_Long_Float northing = 0.0,
00165 SRM_Long_Float ellipsoidal_height = 0.0 )
00166 : Coord3D(srf)
00167 {
00168 setComponentValues(easting, northing, ellipsoidal_height);
00169 }
00170
00172 Coord3D_TransverseMercator( const Coord3D_TransverseMercator &coord )
00173 : Coord3D(coord._srf)
00174 {
00175 setComponentValues( coord._values[0], coord._values[1], coord._values[2] );
00176 }
00177
00181 void copyTo( Coord3D_TransverseMercator &coord ) const
00182 {
00183 if (coord._srf != _srf)
00184 throw Exception( SRM_STATCOD_INVALID_SOURCE_COORDINATE, "copyTo: Coordinate associated with a difference SRF" );
00185
00186 coord._values[0] = _values[0];
00187 coord._values[1] = _values[1];
00188 coord._values[2] = _values[2];
00189 }
00190
00192 bool isEqual( const Coord3D_TransverseMercator &coord ) const
00193 {
00194 return (_srf == coord._srf &&
00195 _values[0] == coord._values[0] &&
00196 _values[1] == coord._values[1] &&
00197 _values[2] == coord._values[2] );
00198 }
00199
00201 void setComponentValues( SRM_Long_Float easting, SRM_Long_Float northing, SRM_Long_Float ellipsoidal_height )
00202 {
00203 _values[0] = easting;
00204 _values[1] = northing;
00205 _values[2] = ellipsoidal_height;
00206 }
00207
00209 SRM_Long_Float get_easting() const {
00210 return _values[0];
00211 }
00212
00214 SRM_Long_Float get_northing() const {
00215 return _values[1];
00216 }
00217
00219 SRM_Long_Float get_ellipsoidal_height() const {
00220 return _values[2];
00221 }
00222
00224 void set_easting( SRM_Long_Float value ) {
00225 _values[0] = value;
00226 }
00227
00229 void set_northing( SRM_Long_Float value ) {
00230 _values[1] = value;
00231 }
00232
00234 void set_ellipsoidal_height( SRM_Long_Float value ) {
00235 _values[2] = value;
00236 }
00237
00239 virtual bool isA( Coord_ClassType type ) const;
00240
00241
00243 virtual Coord_ClassType getClassType() const {
00244 return Coord::COORD_TYP_TM;
00245 }
00246
00247 };
00248
00249
00250 inline bool Coord3D_TransverseMercator::isA( Coord_ClassType type ) const
00251 {
00252 if (type == Coord::COORD_TYP_TM)
00253 return true;
00254 else
00255 return Coord3D::isA(type);
00256 };
00257
00258
00260 typedef Coord3D_TransverseMercator Coord3D_TM;
00261
00262
00267 class EXPORT_SRM_CPP_DLL CoordSurf_TransverseMercator: public CoordSurf
00268 {
00269 public:
00270
00272 CoordSurf_TransverseMercator( SRF_TransverseMercator *srf,
00273 SRM_Long_Float easting = 0.0,
00274 SRM_Long_Float northing = 0.0 )
00275 : CoordSurf(srf)
00276 {
00277 setComponentValues(easting, northing);
00278 }
00279
00281 CoordSurf_TransverseMercator( const CoordSurf_TransverseMercator &coord )
00282 : CoordSurf(coord._srf)
00283 {
00284 setComponentValues( coord._values[0], coord._values[1] );
00285 }
00286
00290 void copyTo( CoordSurf_TransverseMercator &coord ) const
00291 {
00292 if (coord._srf != _srf)
00293 throw Exception( SRM_STATCOD_INVALID_SOURCE_COORDINATE, "copyTo: Coordinate associated with a difference SRF" );
00294
00295 coord._values[0] = _values[0];
00296 coord._values[1] = _values[1];
00297 }
00298
00300 bool isEqual( const CoordSurf_TransverseMercator &coord ) const
00301 {
00302 return (_srf == coord._srf &&
00303 _values[0] == coord._values[0] &&
00304 _values[1] == coord._values[1] );
00305 }
00306
00308 void setComponentValues( SRM_Long_Float easting, SRM_Long_Float northing )
00309 {
00310 _values[0] = easting;
00311 _values[1] = northing;
00312 }
00313
00315 SRM_Long_Float get_easting() const {
00316 return _values[0];
00317 }
00318
00320 SRM_Long_Float get_northing() const {
00321 return _values[1];
00322 }
00323
00325 void set_easting( SRM_Long_Float value ) {
00326 _values[0] = value;
00327 }
00328
00330 void set_northing( SRM_Long_Float value ) {
00331 _values[1] = value;
00332 }
00333
00335 virtual bool isA( Coord_ClassType type ) const;
00336
00337
00339 virtual Coord_ClassType getClassType() const {
00340 return Coord::COORD_TYP_SURF_TM;
00341 }
00342
00343 };
00344
00345
00346 inline bool CoordSurf_TransverseMercator::isA( Coord_ClassType type ) const
00347 {
00348 if (type == Coord::COORD_TYP_SURF_TM)
00349 return true;
00350 else
00351 return CoordSurf::isA(type);
00352 };
00353
00354
00356 typedef CoordSurf_TransverseMercator CoordSurf_TM;
00357
00358
00359 }
00360
00361 #endif // _TransverseMercator_h