00001
00002
00003
00004
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 #ifndef _Coord_h
00073 #define _Coord_h
00074
00075 #if !defined(_WIN32)
00076 #define EXPORT_SRM_CPP_DLL
00077 #elif defined(BUILD_SRM_CPP)
00078 #if !defined(EXPORT_SRM_CPP_DLL)
00079 #if defined(_LIB)
00080 #define EXPORT_SRM_CPP_DLL
00081 #elif defined(_USRDLL)
00082 #define EXPORT_SRM_CPP_DLL __declspec(dllexport)
00083 #else
00084 #define EXPORT_SRM_CPP_DLL __declspec(dllimport)
00085 #endif
00086 #endif
00087 #else
00088 #define EXPORT_SRM_CPP_DLL
00089 #endif
00090
00096 #include "BaseSRF.h"
00097
00098 namespace srm
00099 {
00100
00101
00110 class EXPORT_SRM_CPP_DLL Coord
00111 {
00112 public:
00113
00115 enum Coord_ClassType
00116 {
00117 COORD_TYP_TWO_D,
00118 COORD_TYP_SURFACE,
00119 COORD_TYP_THREE_D,
00120 COORD_TYP_LSA,
00121 COORD_TYP_CC,
00122 COORD_TYP_CD,
00123 COORD_TYP_SURF_CD,
00124 COORD_TYP_CM,
00125 COORD_TYP_EC,
00126 COORD_TYP_SURF_EC,
00127 COORD_TYP_EI,
00128 COORD_TYP_HAEC,
00129 COORD_TYP_HEEC,
00130 COORD_TYP_HEEQ,
00131 COORD_TYP_LCC,
00132 COORD_TYP_SURF_LCC,
00133 COORD_TYP_LCE_3D,
00134 COORD_TYP_LSR_3D,
00135 COORD_TYP_LSR_2D,
00136 COORD_TYP_LTSAS,
00137 COORD_TYP_SURF_LTSAS,
00138 COORD_TYP_LTSC,
00139 COORD_TYP_SURF_LTSC,
00140 COORD_TYP_LTSE,
00141 COORD_TYP_SURF_LTSE,
00142 COORD_TYP_M,
00143 COORD_TYP_SURF_M,
00144 COORD_TYP_OMS,
00145 COORD_TYP_SURF_OMS,
00146 COORD_TYP_LSP,
00147 COORD_TYP_PS,
00148 COORD_TYP_SURF_PS,
00149 COORD_TYP_PD,
00150 COORD_TYP_SURF_PD,
00151 COORD_TYP_SEC,
00152 COORD_TYP_SEQ,
00153 COORD_TYP_SME,
00154 COORD_TYP_SMD,
00155 COORD_TYP_TM,
00156 COORD_TYP_SURF_TM
00157 };
00158
00160 BaseSRF *getSRF() const {
00161 return _srf;
00162 }
00163
00165 virtual Coord_ClassType getClassType() const = 0;
00166
00168 virtual bool isA( Coord_ClassType type ) const;
00169
00172 virtual const char *toString() = 0;
00173
00174 protected:
00175
00177 Coord( BaseSRF *srf ) {
00178 _srf = srf->clone();
00179 }
00180
00184 Coord &operator =( const Coord &coord ) {
00185 return *this;
00186 }
00187
00189 virtual ~Coord() {
00190 _srf->release();
00191 }
00192
00194 BaseSRF *_srf;
00195 };
00196
00197 inline bool Coord::isA( Coord_ClassType type ) const
00198 {
00199 return false;
00200 }
00201
00205 class EXPORT_SRM_CPP_DLL Coord2D: public Coord
00206 {
00207 public:
00208
00210 virtual bool isA( Coord_ClassType type ) const;
00211
00213 const SRM_Long_Float *getValues() const {
00214 return _values;
00215 }
00216
00218 void setValues( const SRM_Vector_2D &values ) {
00219 _values[0] = values[0];
00220 _values[1] = values[1];
00221 }
00222
00225 const char *toString() {
00226 static char ret_string[50];
00227 sprintf( ret_string,"[ %lf, %lf ]\n", _values[0], _values[1] );
00228 return ret_string;
00229 }
00230
00231 protected:
00232
00234 Coord2D( BaseSRF *srf )
00235 : Coord(srf)
00236 {
00237 }
00238
00240 SRM_Vector_2D _values;
00241 };
00242
00243
00245 inline bool Coord2D::isA( Coord_ClassType type ) const
00246 {
00247 if ( type == Coord::COORD_TYP_TWO_D )
00248 return true;
00249 else
00250 return Coord::isA(type);
00251 }
00252
00253
00257 class EXPORT_SRM_CPP_DLL CoordSurf: public Coord
00258 {
00259 public:
00260
00262 virtual bool isA( Coord_ClassType type ) const;
00263
00265 const SRM_Long_Float *getValues() const {
00266 return _values;
00267 }
00268
00270 void setValues( const SRM_Vector_2D &values ) {
00271 _values[0] = values[0];
00272 _values[1] = values[1];
00273 }
00274
00277 virtual const char *toString() {
00278 static char ret_string[50];
00279 sprintf( ret_string,"[ %lf, %lf ]\n", _values[0], _values[1] );
00280 return ret_string;
00281 }
00282
00283 protected:
00284
00286 CoordSurf( BaseSRF *srf )
00287 : Coord(srf)
00288 {
00289 }
00290
00292 SRM_Vector_2D _values;
00293 };
00294
00295 inline bool CoordSurf::isA( Coord_ClassType type ) const
00296 {
00297 if ( type == Coord::COORD_TYP_SURFACE )
00298 return true;
00299 else
00300 return Coord::isA(type);
00301 }
00302
00306 class EXPORT_SRM_CPP_DLL Coord3D: public Coord
00307 {
00308 public:
00309
00311 virtual bool isA( Coord_ClassType type ) const;
00312
00314 const SRM_Long_Float *getValues() const {
00315 return _values;
00316 }
00317
00319 void setValues( const SRM_Vector_3D &values ) {
00320 _values[0] = values[0];
00321 _values[1] = values[1];
00322 _values[2] = values[2];
00323 }
00324
00327 virtual const char* toString();
00328
00338 virtual const char* getMGRS( SRM_Integer precision );
00339
00349 virtual void setCoord( const char* mgrs );
00350
00351 protected:
00352
00354 Coord3D( BaseSRF *srf )
00355 : Coord(srf)
00356 {
00357 }
00358
00360 SRM_Vector_3D _values;
00361 };
00362
00363 inline bool Coord3D::isA( Coord_ClassType type ) const
00364 {
00365 if ( type == Coord::COORD_TYP_THREE_D )
00366 return true;
00367 else
00368 return Coord::isA(type);
00369 }
00370
00371 }
00372
00373 #endif // _Coord_h
00374