00001
00002
00004
00006
00007
00008
00009
00010
00011 #ifndef _Coord_h
00012 #define _Coord_h
00013
00019 #include "BaseSRF.h"
00020
00021 namespace srm
00022 {
00023
00024
00033 class EXPORT_SRM_CPP_DLL Coord
00034 {
00035 public:
00036
00038 enum Coord_ClassType
00039 {
00040 COORD_TYP_TWO_D,
00041 COORD_TYP_SURFACE,
00042 COORD_TYP_THREE_D,
00043 COORD_TYP_LSA,
00044 COORD_TYP_CC,
00045 COORD_TYP_CD,
00046 COORD_TYP_SURF_CD,
00047 COORD_TYP_CM,
00048 COORD_TYP_EC,
00049 COORD_TYP_SURF_EC,
00050 COORD_TYP_EI,
00051 COORD_TYP_HAEC,
00052 COORD_TYP_HEEC,
00053 COORD_TYP_HEEQ,
00054 COORD_TYP_LCC,
00055 COORD_TYP_SURF_LCC,
00056 COORD_TYP_LCE_3D,
00057 COORD_TYP_LSR_3D,
00058 COORD_TYP_LSR_2D,
00059 COORD_TYP_LTSAS,
00060 COORD_TYP_SURF_LTSAS,
00061 COORD_TYP_LTSC,
00062 COORD_TYP_SURF_LTSC,
00063 COORD_TYP_LTSE,
00064 COORD_TYP_SURF_LTSE,
00065 COORD_TYP_M,
00066 COORD_TYP_SURF_M,
00067 COORD_TYP_OMS,
00068 COORD_TYP_SURF_OMS,
00069 COORD_TYP_LSP,
00070 COORD_TYP_PS,
00071 COORD_TYP_SURF_PS,
00072 COORD_TYP_PD,
00073 COORD_TYP_SURF_PD,
00074 COORD_TYP_SEC,
00075 COORD_TYP_SEQ,
00076 COORD_TYP_SME,
00077 COORD_TYP_SMD,
00078 COORD_TYP_TM,
00079 COORD_TYP_SURF_TM
00080 };
00081
00083 BaseSRF *getSRF() const {
00084 return _srf;
00085 }
00086
00088 virtual Coord_ClassType getClassType() const = 0;
00089
00091 virtual bool isA( Coord_ClassType type ) const;
00092
00095 virtual const char *toString() = 0;
00096
00097 protected:
00098
00100 Coord( BaseSRF *srf ) {
00101 _srf = srf->clone();
00102 }
00103
00107 Coord &operator =( const Coord &coord ) {
00108 return *this;
00109 }
00110
00112 virtual ~Coord() {
00113 _srf->release();
00114 }
00115
00117 BaseSRF *_srf;
00118 };
00119
00120 inline bool Coord::isA( Coord_ClassType type ) const
00121 {
00122 return false;
00123 }
00124
00128 class EXPORT_SRM_CPP_DLL Coord2D: public Coord
00129 {
00130 public:
00131
00133 virtual bool isA( Coord_ClassType type ) const;
00134
00136 const SRM_Long_Float *getValues() const {
00137 return _values;
00138 }
00139
00141 void setValues( const Vector2 &values ) {
00142 _values[0] = values[0];
00143 _values[1] = values[1];
00144 }
00145
00148 const char *toString() {
00149 static char ret_string[50];
00150 sprintf( ret_string,"[ %lf, %lf ]\n", _values[0], _values[1] );
00151 return ret_string;
00152 }
00153
00154 protected:
00155
00157 Coord2D( BaseSRF *srf )
00158 : Coord(srf)
00159 {
00160 }
00161
00163 Vector2 _values;
00164 };
00165
00166
00168 inline bool Coord2D::isA( Coord_ClassType type ) const
00169 {
00170 if ( type == Coord::COORD_TYP_TWO_D )
00171 return true;
00172 else
00173 return Coord::isA(type);
00174 }
00175
00176
00180 class EXPORT_SRM_CPP_DLL CoordSurf: public Coord
00181 {
00182 public:
00183
00185 virtual bool isA( Coord_ClassType type ) const;
00186
00188 const SRM_Long_Float *getValues() const {
00189 return _values;
00190 }
00191
00193 void setValues( const Vector2 &values ) {
00194 _values[0] = values[0];
00195 _values[1] = values[1];
00196 }
00197
00200 virtual const char *toString() {
00201 static char ret_string[50];
00202 sprintf( ret_string,"[ %lf, %lf ]\n", _values[0], _values[1] );
00203 return ret_string;
00204 }
00205
00206 protected:
00207
00209 CoordSurf( BaseSRF *srf )
00210 : Coord(srf)
00211 {
00212 }
00213
00215 Vector2 _values;
00216 };
00217
00218 inline bool CoordSurf::isA( Coord_ClassType type ) const
00219 {
00220 if ( type == Coord::COORD_TYP_SURFACE )
00221 return true;
00222 else
00223 return Coord::isA(type);
00224 }
00225
00229 class EXPORT_SRM_CPP_DLL Coord3D: public Coord
00230 {
00231 public:
00232
00234 virtual bool isA( Coord_ClassType type ) const;
00235
00237 const SRM_Long_Float *getValues() const {
00238 return _values;
00239 }
00240
00242 void setValues( const Vector3 &values ) {
00243 _values[0] = values[0];
00244 _values[1] = values[1];
00245 _values[2] = values[2];
00246 }
00247
00250 virtual const char *toString() {
00251 static char ret_string[75];
00252 sprintf( ret_string,"[ %lf, %lf, %lf ]\n", _values[0], _values[1], _values[2] );
00253 return ret_string;
00254 }
00255
00265 virtual const char* getMGRS( SRM_Integer precision );
00266
00276 virtual void setCoord( const char* mgrs );
00277
00278 protected:
00279
00281 Coord3D( BaseSRF *srf )
00282 : Coord(srf)
00283 {
00284 }
00285
00287 Vector3 _values;
00288 };
00289
00290 inline bool Coord3D::isA( Coord_ClassType type ) const
00291 {
00292 if ( type == Coord::COORD_TYP_THREE_D )
00293 return true;
00294 else
00295 return Coord::isA(type);
00296 }
00297
00298 }
00299
00300 #endif // _Coord_h
00301