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
00194 #ifndef _BaseSRF_h
00195 #define _BaseSRF_h
00196
00197 #if !defined(_WIN32)
00198 #define EXPORT_SRM_CPP_DLL
00199 #elif defined(BUILD_SRM_CPP)
00200 #if !defined(EXPORT_SRM_CPP_DLL)
00201 #if defined(_LIB)
00202 #define EXPORT_SRM_CPP_DLL
00203 #elif defined(_USRDLL)
00204 #define EXPORT_SRM_CPP_DLL __declspec(dllexport)
00205 #else
00206 #define EXPORT_SRM_CPP_DLL __declspec(dllimport)
00207 #endif
00208 #endif
00209 #else
00210 #define EXPORT_SRM_CPP_DLL
00211 #endif
00212
00213 #include <stdio.h>
00214 #include "srm_types.h"
00215
00216
00217
00218 extern bool g_fast_mode;
00219
00220 namespace srm
00221 {
00222
00224 class Coord;
00225 class Coord2D;
00226 class CoordSurf;
00227 class Coord3D;
00228 class Direction;
00229 class Orientation;
00230 class SRF_LocalTangentSpaceEuclidean;
00231
00233 typedef SRM_Long_Float SRM_Vector_2D[2];
00234 typedef SRM_Vector_2D Vector2;
00235 typedef SRM_Vector_3D Vector3;
00236 typedef SRM_Matrix_3x3 Matrix3x3;
00237
00244 class EXPORT_SRM_CPP_DLL BaseSRF
00245 {
00246 public:
00247
00249 enum SRF_ClassType
00250 {
00251 SRF_TYP_TWO_D,
00252 SRF_TYP_THREE_D,
00253 SRF_TYP_WITH_TANGENT_PLANE_SURFACE,
00254 SRF_TYP_WITH_ELLIPSOIDAL_HEIGHT,
00255 SRF_TYP_MAP_PROJECTION,
00256 SRF_TYP_LSA,
00257 SRF_TYP_CC,
00258 SRF_TYP_CD,
00259 SRF_TYP_CM,
00260 SRF_TYP_EC,
00261 SRF_TYP_EI,
00262 SRF_TYP_HAEC,
00263 SRF_TYP_HEEC,
00264 SRF_TYP_HEEQ,
00265 SRF_TYP_LCC,
00266 SRF_TYP_LCE_3D,
00267 SRF_TYP_LSR_2D,
00268 SRF_TYP_LSR_3D,
00269 SRF_TYP_LTSAS,
00270 SRF_TYP_LTSC,
00271 SRF_TYP_LTSE,
00272 SRF_TYP_M,
00273 SRF_TYP_OMS,
00274 SRF_TYP_PD,
00275 SRF_TYP_LSP,
00276 SRF_TYP_PS,
00277 SRF_TYP_SEC,
00278 SRF_TYP_SEQ,
00279 SRF_TYP_SME,
00280 SRF_TYP_SMD,
00281 SRF_TYP_TM
00282 };
00283
00298 static BaseSRF *createStandardSRF( SRM_SRF_Code srf_code,
00299 SRM_RT_Code rt_code );
00300
00316 static BaseSRF *createSRFSetMember( SRM_SRFS_Info srfs_info,
00317 SRM_RT_Code rt );
00318
00330 virtual void release();
00331
00349 virtual void getCodes( SRM_SRFT_Code &t_code,
00350 SRM_SRF_Code &srf_code,
00351 SRM_SRFS_Code_Info &srfs_code_info ) const;
00352
00356 virtual SRM_CS_Code getCSCode() const;
00357
00362 virtual SRM_ORM_Code get_orm() const;
00363
00367 virtual SRM_ORM_Code getOrm() const;
00368
00373 virtual SRM_RT_Code get_rt() const;
00374
00378 virtual SRM_RT_Code getRt() const;
00379
00383 virtual SRM_Long_Float getA() const;
00384
00388 virtual SRM_Long_Float getF() const;
00389
00395 static bool querySRFTSupport( SRM_SRFT_Code srft_code );
00396
00404 static bool queryORMSupport( SRM_ORM_Code orm_code,
00405 SRM_RT_Code rt_code );
00406
00412 virtual SRF_ClassType getClassType() const = 0;
00413
00416 virtual bool isA( SRF_ClassType type ) const;
00417
00431 virtual SRM_Coordinate_Valid_Region changeCoordinateSRF( const Coord &src_coord, Coord &des_coord );
00432
00438 virtual SRM_Coordinate_Valid_Region checkCoordinate( const Coord &src );
00439
00443 virtual void freeCoordinate( Coord *coord );
00444
00450 static SRM_Long_Float calculateEuclideanDistance( const Coord &coord1,
00451 const Coord &coord2 );
00452
00457 void setCoordinateValidationOn();
00458
00463 void setCoordinateValidationOff();
00464
00467 bool coordinateValidationIsOn();
00468
00471 virtual const char *toString() = 0;
00472
00477 virtual BaseSRF *clone();
00478
00479 protected:
00480 friend class Coord3D;
00481 friend class BaseSRF_3D;
00482 friend class BaseSRF_2D;
00483 friend class BaseSRF_MapProjection;
00484 friend class BaseSRF_WithEllipsoidalHeight;
00485 friend class BaseSRF_WithTangentPlaneSurface;
00486 BaseSRF( void *impl ) : _ref_cnt(1), _impl(impl),
00487 _cache(NULL), _validate_coords(true) {}
00488 BaseSRF &operator =( const BaseSRF & ) { return *this; }
00489 virtual ~BaseSRF() {}
00490
00492 unsigned int _ref_cnt;
00494 void *_impl, *_cache;
00495 bool _validate_coords;
00496
00497 void *getImpl() const { return _impl; }
00498 };
00499
00500
00501 inline BaseSRF *BaseSRF::clone()
00502 {
00503 ++_ref_cnt;
00504 return this;
00505 }
00506
00507 inline bool BaseSRF::isA( SRF_ClassType type ) const
00508 {
00509 return false;
00510 }
00511
00512
00519 class EXPORT_SRM_CPP_DLL BaseSRF_2D : public BaseSRF
00520 {
00521 public:
00522
00525 virtual bool isA( SRF_ClassType type ) const;
00526
00531 virtual Coord2D *createCoordinate2D( SRM_Long_Float coord_comp1,
00532 SRM_Long_Float coord_comp2 ) = 0;
00533
00537 virtual void getCoordinate2DValues( const Coord2D &coord,
00538 SRM_Long_Float &coord_comp1,
00539 SRM_Long_Float &coord_comp2 ) const;
00540
00544 virtual void freeCoordinate2D( Coord2D *coord );
00545
00552 virtual void changeCoordinate2DSRF( const Coord2D &src_coord,
00553 Coord2D &des_coord );
00554
00565 virtual void changeCoordinate2DArraySRF( Coord2D **src_coord_array,
00566 SRM_Integer_Positive *index,
00567 Coord2D **des_coord_array );
00568
00578 virtual void changeCoordinate2DSRFObject( const Coord2D &src_coord,
00579 const SRM_ORM_Transformation_2D_Parameters hst,
00580 Coord2D &des_coord );
00581
00595 virtual void changeCoordinate2DArraySRFObject( Coord2D **src_coord_array,
00596 const SRM_ORM_Transformation_2D_Parameters hst,
00597 SRM_Integer_Positive *index,
00598 Coord2D **des_coord_array );
00599
00600
00605 static SRM_Long_Float calculateEuclideanDistance( const Coord2D &coord1,
00606 const Coord2D &coord2 );
00607
00608 protected:
00609 BaseSRF_2D( void *impl ) : BaseSRF(impl) {}
00610 BaseSRF_2D &operator =( const BaseSRF_2D & ) { return *this; }
00611 virtual ~BaseSRF_2D() {}
00612 };
00613
00614
00615 inline bool BaseSRF_2D::isA( SRF_ClassType type ) const
00616 {
00617 if (type == BaseSRF::SRF_TYP_TWO_D)
00618 return true;
00619 else
00620 return BaseSRF::isA(type);
00621 }
00622
00623
00630 class EXPORT_SRM_CPP_DLL BaseSRF_3D : public BaseSRF
00631 {
00632 public:
00633
00636 virtual bool isA( SRF_ClassType type ) const;
00637
00643 virtual Coord3D *createCoordinate3D( SRM_Long_Float coord_comp1,
00644 SRM_Long_Float coord_comp2,
00645 SRM_Long_Float coord_comp3 ) = 0;
00646
00650 virtual void freeCoordinate3D( Coord3D *coord );
00651
00655 virtual void getCoordinate3DValues( const Coord3D &coord,
00656 SRM_Long_Float &coord_comp1,
00657 SRM_Long_Float &coord_comp2,
00658 SRM_Long_Float &coord_comp3 ) const;
00659
00667 virtual SRM_Coordinate_Valid_Region changeCoordinate3DSRF( const Coord3D &src_coord,
00668 Coord3D &des_coord );
00669
00681 virtual void changeCoordinate3DArraySRF( Coord3D **src_coord_array,
00682 SRM_Integer_Positive *index,
00683 Coord3D **des_coord_array,
00684 SRM_Coordinate_Valid_Region *region_array );
00685
00696 virtual SRM_Coordinate_Valid_Region changeCoordinate3DSRFObject( const Coord3D &src_coord,
00697 const SRM_ORM_Transformation_3D_Parameters hst,
00698 Coord3D &des_coord );
00699
00712 virtual void changeCoordinate3DArraySRFObject( Coord3D **src_coord_array,
00713 const SRM_ORM_Transformation_3D_Parameters hst,
00714 SRM_Integer_Positive *index,
00715 Coord3D **des_coord_array,
00716 SRM_Coordinate_Valid_Region *region_array );
00717
00732 virtual void setValidRegion( const SRM_Integer component,
00733 const SRM_Interval_Type type,
00734 const SRM_Long_Float lower,
00735 const SRM_Long_Float upper );
00736
00755 virtual void setExtendedValidRegion( const SRM_Integer component,
00756 const SRM_Interval_Type type,
00757 const SRM_Long_Float extended_lower,
00758 const SRM_Long_Float lower,
00759 const SRM_Long_Float upper,
00760 const SRM_Long_Float extended_upper );
00761
00773 virtual void getValidRegion( const SRM_Integer component,
00774 SRM_Interval_Type &type,
00775 SRM_Long_Float &lower,
00776 SRM_Long_Float &upper );
00777
00791 virtual void getExtendedValidRegion( const SRM_Integer component,
00792 SRM_Interval_Type &type,
00793 SRM_Long_Float &extended_lower,
00794 SRM_Long_Float &lower,
00795 SRM_Long_Float &upper,
00796 SRM_Long_Float &extended_upper );
00797
00802 virtual Direction *createDirection( const Coord3D &ref_coord,
00803 const SRM_Vector_3D vec );
00804
00809 virtual Direction *createDirection( const Coord3D &ref_coord,
00810 const SRM_Long_Float vectorComp1,
00811 const SRM_Long_Float vectorComp2,
00812 const SRM_Long_Float vectorComp3 );
00813
00821 virtual Direction *createDirection();
00822
00823
00827 virtual void freeDirection( Direction *direction );
00828
00832 virtual void getDirectionValues( const Direction &direction,
00833 Coord3D &ref_coord,
00834 SRM_Vector_3D vec ) const;
00835
00843 virtual SRM_Coordinate_Valid_Region changeDirectionSRF( const Direction &src_dir, Direction &des_dir );
00844
00856 void changeDirectionArraySRF( Direction **src_direction_array,
00857 SRM_Integer_Positive *index,
00858 Direction **des_direction_array,
00859 SRM_Coordinate_Valid_Region *region_array );
00860
00871 virtual SRM_Coordinate_Valid_Region changeDirectionSRFObject( const Direction &src_dir,
00872 const SRM_ORM_Transformation_3D_Parameters hst,
00873 Direction &des_dir);
00874
00889 void changeDirectionArraySRFObject( Direction **src_direction_array,
00890 const SRM_ORM_Transformation_3D_Parameters hst,
00891 SRM_Integer_Positive *index,
00892 Direction **des_direction_array,
00893 SRM_Coordinate_Valid_Region *region_array );
00894
00897 virtual SRM_Coordinate_Valid_Region checkDirection( const Direction &direction );
00898
00905 virtual Orientation *createOrientation( const Coord3D &ref_coord,
00906 const SRM_Matrix_3x3 mat );
00907
00916 virtual Orientation *createOrientation( const Coord3D &ref_coord,
00917 const SRM_Vector_3D vec1,
00918 const SRM_Vector_3D vec2,
00919 const SRM_Vector_3D vec3 );
00920
00930 virtual Orientation *createOrientation( const Direction &dir1,
00931 const Direction &dir2,
00932 const Direction &dir3 );
00933
00941 virtual Orientation *createOrientation();
00942
00946 virtual void freeOrientation( Orientation *orientation );
00947
00951 virtual void getOrientationValues( const Orientation &orientation,
00952 Coord3D &ref_coord,
00953 SRM_Matrix_3x3 mat ) const;
00954
00958 virtual SRM_Coordinate_Valid_Region checkOrientation( const Orientation &orientation );
00959
00967 virtual SRM_Coordinate_Valid_Region changeOrientationSRF( const Orientation &src_orient,
00968 Orientation &des_orient );
00969
00973 virtual void instanceAbstractSpaceCoordinate( const Coord3D &src_coord,
00974 const Orientation &orientation,
00975 Coord3D &des_coord );
00976
00986 static SRM_SRFS_Code_Info getNaturalSRFSetMemberCode( const Coord3D &src_coord,
00987 SRM_ORM_Code orm_dst,
00988 SRM_RT_Code rt_dst,
00989 SRM_SRFS_Code tgt_srfs);
00990
01000 static BaseSRF_3D* getNaturalSRFSetMember( Coord3D &src_coord,
01001 SRM_ORM_Code orm_dst,
01002 SRM_RT_Code rt_dst,
01003 SRM_SRFS_Code tgt_srfs);
01004
01009 static SRM_Long_Float calculateEuclideanDistance( const Coord3D &coord1,
01010 const Coord3D &coord2 );
01011
01012 protected:
01013 BaseSRF_3D( void *impl ) : BaseSRF(impl) {}
01014 BaseSRF_3D &operator =( const BaseSRF_3D & ) { return *this; }
01015 virtual ~BaseSRF_3D() {}
01016 };
01017
01018
01019 inline bool BaseSRF_3D::isA( SRF_ClassType type ) const
01020 {
01021 if (type == BaseSRF::SRF_TYP_THREE_D)
01022 return true;
01023 else
01024 return BaseSRF::isA(type);
01025 }
01026
01027
01035 class EXPORT_SRM_CPP_DLL BaseSRF_WithTangentPlaneSurface : public BaseSRF_3D
01036 {
01037 public:
01038
01041 virtual bool isA( SRF_ClassType type ) const;
01042
01046 virtual CoordSurf *createSurfaceCoordinate( SRM_Long_Float coord_surf_comp1,
01047 SRM_Long_Float coord_surf_comp2 ) = 0;
01048
01052 virtual void getSurfaceCoordinateValues( const CoordSurf &coord_surf,
01053 SRM_Long_Float &coord_surf_comp1,
01054 SRM_Long_Float &coord_surf_comp2 ) const;
01055
01059 virtual void freeSurfaceCoordinate( CoordSurf *coord_surf );
01060
01064 virtual void getAssociatedSurfaceCoordinate( const Coord3D &coord,
01065 CoordSurf &on_surface_coord );
01066
01071 virtual void getPromotedSurfaceCoordinate( const CoordSurf &surf_coord,
01072 Coord3D &three_d_coord );
01073
01078 static SRM_Long_Float calculateEuclideanDistance( const CoordSurf &coord1,
01079 const CoordSurf &coord2 );
01080
01081 protected:
01082 BaseSRF_WithTangentPlaneSurface( void *impl ) : BaseSRF_3D(impl) {}
01083 BaseSRF_WithTangentPlaneSurface &operator =( const BaseSRF_WithTangentPlaneSurface & ) { return *this; }
01084 virtual ~BaseSRF_WithTangentPlaneSurface() {}
01085 };
01086
01087
01088 inline bool BaseSRF_WithTangentPlaneSurface::isA( SRF_ClassType type ) const
01089 {
01090 if (type == BaseSRF::SRF_TYP_WITH_TANGENT_PLANE_SURFACE)
01091 return true;
01092 else
01093 return BaseSRF_3D::isA(type);
01094 }
01095
01096
01104 class EXPORT_SRM_CPP_DLL BaseSRF_WithEllipsoidalHeight : public BaseSRF_3D
01105 {
01106 public:
01107
01110 virtual bool isA( SRF_ClassType type ) const;
01111
01115 virtual CoordSurf *createSurfaceCoordinate( SRM_Long_Float coord_surf_comp1,
01116 SRM_Long_Float coord_surf_comp2 ) = 0;
01117
01121 virtual void getSurfaceCoordinateValues( const CoordSurf &coord_surf,
01122 SRM_Long_Float &coord_surf_comp1,
01123 SRM_Long_Float &coord_surf_comp2 ) const;
01124
01128 virtual void freeSurfaceCoordinate( CoordSurf *coord_surf );
01129
01133 virtual void getAssociatedSurfaceCoordinate( const Coord3D &coord,
01134 CoordSurf &on_surface_coord );
01135
01140 virtual void getPromotedSurfaceCoordinate( const CoordSurf &surf_coord,
01141 Coord3D &three_d_coord );
01142
01147 virtual SRF_LocalTangentSpaceEuclidean
01148 *createLocalTangentSpaceEuclideanSRF(
01149 const CoordSurf &surf_coord,
01150 SRM_Long_Float azimuth,
01151 SRM_Long_Float false_x_origin,
01152 SRM_Long_Float false_y_origin,
01153 SRM_Long_Float offset_height );
01154
01164 static SRM_SRFS_Code_Info getNaturalSRFSetMemberCode( CoordSurf &src_coord,
01165 SRM_ORM_Code orm_dst,
01166 SRM_RT_Code rt_dst,
01167 SRM_SRFS_Code tgt_srfs);
01168
01169
01179 static BaseSRF_3D* getNaturalSRFSetMember( CoordSurf &src_coord,
01180 SRM_ORM_Code orm_dst,
01181 SRM_RT_Code rt_dst,
01182 SRM_SRFS_Code tgt_srfs);
01183
01188 static SRM_Long_Float calculateEuclideanDistance( const CoordSurf &coord1,
01189 const CoordSurf &coord2 );
01190
01195 static SRM_Long_Float calculateGeodesicDistance( const CoordSurf &src_coord,
01196 const CoordSurf &des_coord );
01197
01201 virtual SRM_Long_Float calculateVerticalSeparationOffset( SRM_DSS_Code vos,
01202 const CoordSurf &surf_coord );
01203
01204 protected:
01205 BaseSRF_WithEllipsoidalHeight( void *impl ) : BaseSRF_3D(impl) {}
01206 BaseSRF_WithEllipsoidalHeight &operator =( const BaseSRF_WithEllipsoidalHeight & ) { return *this; }
01207 virtual ~BaseSRF_WithEllipsoidalHeight() {}
01208 };
01209
01210
01211 inline bool BaseSRF_WithEllipsoidalHeight::isA( SRF_ClassType type ) const
01212 {
01213 if (type == BaseSRF::SRF_TYP_WITH_ELLIPSOIDAL_HEIGHT)
01214 return true;
01215 else
01216 return BaseSRF_3D::isA(type);
01217 }
01218
01219
01227 class EXPORT_SRM_CPP_DLL BaseSRF_MapProjection : public BaseSRF_WithEllipsoidalHeight
01228 {
01229 public:
01230
01233 virtual bool isA( SRF_ClassType type ) const;
01234
01249 virtual void setValidGeodeticRegion( const SRM_Integer component,
01250 const SRM_Interval_Type type,
01251 const SRM_Long_Float lower,
01252 const SRM_Long_Float upper );
01253
01272 virtual void setExtendedValidGeodeticRegion( const SRM_Integer component,
01273 const SRM_Interval_Type type,
01274 const SRM_Long_Float extended_lower,
01275 const SRM_Long_Float lower,
01276 const SRM_Long_Float upper,
01277 const SRM_Long_Float extended_upper );
01278
01290 virtual void getValidGeodeticRegion( const SRM_Integer component,
01291 SRM_Interval_Type &type,
01292 SRM_Long_Float &lower,
01293 SRM_Long_Float &upper );
01294
01308 virtual void getExtendedValidGeodeticRegion( const SRM_Integer component,
01309 SRM_Interval_Type &type,
01310 SRM_Long_Float &extended_lower,
01311 SRM_Long_Float &lower,
01312 SRM_Long_Float &upper,
01313 SRM_Long_Float &extended_upper );
01314
01319 virtual SRM_Long_Float calculateConvergenceOfTheMeridian( const CoordSurf &surf_coord );
01320
01324 virtual SRM_Long_Float calculatePointDistortion( const CoordSurf &surf_coord );
01325
01329 virtual SRM_Long_Float calculateMapAzimuth( const CoordSurf &src_coord,
01330 const CoordSurf &des_coord );
01331
01332 protected:
01333 BaseSRF_MapProjection( void *impl ) : BaseSRF_WithEllipsoidalHeight(impl) {}
01334 BaseSRF_MapProjection &operator =( const BaseSRF_MapProjection & ) { return *this; }
01335 virtual ~BaseSRF_MapProjection() {}
01336 };
01337
01338
01339 inline bool BaseSRF_MapProjection::isA( SRF_ClassType type ) const
01340 {
01341 if (type == BaseSRF::SRF_TYP_MAP_PROJECTION)
01342 return true;
01343 else
01344 return BaseSRF_WithEllipsoidalHeight::isA(type);
01345 }
01346
01347 }
01348
01349 #endif // _BaseSRF_h