00001
00020 #ifndef INC_MI32_TRANS2DMAPGEN_H
00021 #define INC_MI32_TRANS2DMAPGEN_H
00022
00023 #ifndef INC_MI32_TRANS2DMODEL_H
00024 #include <mi32/trans2dmodel.h>
00025 #endif
00026
00027 #ifndef INC_MI32_CTRLPT_H
00028 #include <mi32/ctrlpt.h>
00029 #endif
00030
00031 #ifndef INC_MI32_DOUBLEAR_H
00032 #include <mi32/doublear.h>
00033 #endif
00034
00035
00036 #ifndef GENERATING_DOXYGEN_OUTPUT
00037
00038 #ifdef GEOMDLL
00039 #define CLASSLIBEXPORT MI_DLLCLASSEXPORT
00040 #else
00041 #define CLASSLIBEXPORT MI_DLLCLASSIMPORT
00042 #endif
00043
00044
00045 class MISTRING;
00046 class PTTRIANGULATOR;
00047 class TRANS2D_AFFINE;
00048 namespace SPATREF {
00049 class COORDREFSYS;
00050 }
00051
00053 typedef int (*TRANSFUNC)(void*,void*,int,int,void*);
00054 #endif
00055
00056
00057
00059 class CLASSLIBEXPORT TRANS2D_MAPGEN {
00060 public:
00061
00063 enum DIRECTION {
00064 DIRECTION_Forward = 0,
00065 DIRECTION_Reverse = 1,
00066 DIRECTION_Inverse = DIRECTION_Reverse
00067 };
00068
00069 enum SIDE {
00070 SIDE_Input = 0,
00071 SIDE_Output = 1
00072 };
00073
00074 enum COORD {
00075 COORD_Exterior = 0,
00076 COORD_Map = 1
00077 };
00078
00080 TRANS2D_MAPGEN ();
00081
00083 TRANS2D_MAPGEN (
00084 const TRANS2D_MAPGEN& rhs
00085 );
00086
00088 ~TRANS2D_MAPGEN ();
00089
00091 TRANS2D_MAPGEN& operator= (
00092 const TRANS2D_MAPGEN& rhs
00093 );
00094
00096 ERRVALUE ApplyOffsetInputToMap (
00097 double OffsetX,
00098 double OffsetY
00099 );
00100
00102 ERRVALUE ApplyOffsetMapToInput (
00103 double OffsetX,
00104 double OffsetY
00105 );
00106
00108 ERRVALUE ApplyOffsetMapToOutput (
00109 double OffsetX,
00110 double OffsetY
00111 );
00112
00114 ERRVALUE ApplyOffsetOutputToMap (
00115 double OffsetX,
00116 double OffsetY
00117 );
00118
00120 ERRVALUE ApplyScaleInputToMap (
00121 double ScaleX,
00122 double ScaleY
00123 );
00124
00126 ERRVALUE ApplyScaleMapToInput (
00127 double ScaleX,
00128 double ScaleY
00129 );
00130
00132 ERRVALUE ApplyScaleMapToOutput (
00133 double ScaleX,
00134 double ScaleY
00135 );
00136
00138 ERRVALUE ApplyScaleOutputToMap (
00139 double ScaleX,
00140 double ScaleY
00141 );
00142
00144 void Clear ();
00145
00147 ERRVALUE ConvertForward (
00148 const DPOINT2D& ipoint,
00149 DPOINT2D& opoint
00150 ) const;
00151
00153 ERRVALUE ConvertForward (
00154 const DPOINT3D& ipoint,
00155 DPOINT3D& opoint
00156 ) const;
00157
00159 ERRVALUE ConvertForward (
00160 const DPOINT2D *ipoints,
00161 DPOINT2D *opoints,
00162 INT32 NumPoints
00163 ) const;
00164
00166 ERRVALUE ConvertForward (
00167 const DPOINT3D *ipoints,
00168 DPOINT3D *opoints,
00169 INT32 NumPoints
00170 ) const;
00171
00173 ERRVALUE ConvertForward (
00174 const void *ipoints,
00175 void *opoints,
00176 INT32 NumPoints,
00177 int NumDim
00178 ) const;
00179
00181 ERRVALUE ConvertForward (
00182 const DRECT2D& irect,
00183 DRECT2D& orect,
00184 int sidepoints=0
00185 ) const;
00186
00189 INT32 ConvertForwardDense (
00190 const double *ipoints,
00191 INT32 iNumPoints,
00192 int NumDim,
00193 MIDOUBLEARRAY& opoints
00194 ) const;
00195
00197 ERRVALUE ConvertInputToMap (
00198 const DPOINT2D& ipoint,
00199 DPOINT2D& opoint
00200 ) const;
00201
00203 ERRVALUE ConvertInverse (
00204 const DPOINT2D& ipoint,
00205 DPOINT2D& opoint
00206 ) const;
00207
00209 ERRVALUE ConvertInverse (
00210 const DPOINT3D& ipoint,
00211 DPOINT3D& opoint
00212 ) const;
00213
00215 ERRVALUE ConvertInverse (
00216 const DPOINT2D *ipoints,
00217 DPOINT2D *opoints,
00218 INT32 NumPoints
00219 ) const;
00220
00222 ERRVALUE ConvertInverse (
00223 const DPOINT3D *ipoints,
00224 DPOINT3D *opoints,
00225 INT32 NumPoints
00226 ) const;
00227
00229 ERRVALUE ConvertInverse (
00230 const void *ipoints,
00231 void *opoints,
00232 INT32 NumPoints,
00233 int NumDim
00234 ) const;
00235
00237 ERRVALUE ConvertInverse (
00238 const DRECT2D& irect,
00239 DRECT2D& orect,
00240 int sidepoints=0
00241 ) const;
00242
00245 INT32 ConvertInverseDense (
00246 const double *ipoints,
00247 INT32 iNumPoints,
00248 int NumDim,
00249 MIDOUBLEARRAY& opoints
00250 ) const;
00251
00253 ERRVALUE ConvertMapToInput (
00254 const DPOINT2D& ipoint,
00255 DPOINT2D& opoint
00256 ) const;
00257
00259 ERRVALUE ConvertMapToMapForward (
00260 const DPOINT2D& ipoint,
00261 DPOINT2D& opoint
00262 ) const;
00263
00265 ERRVALUE ConvertMapToMapInverse (
00266 const DPOINT2D& ipoint,
00267 DPOINT2D& opoint
00268 ) const;
00269
00271 ERRVALUE ConvertOutputToMap (
00272 const DPOINT2D& ipoint,
00273 DPOINT2D& opoint
00274 ) const;
00275
00277 ERRVALUE CopyInputToInput (
00278 const TRANS2D_MAPGEN& itrans
00279 );
00280
00282 ERRVALUE CopyInputToOutput (
00283 const TRANS2D_MAPGEN& itrans
00284 );
00285
00287 ERRVALUE CopyOutputToInput (
00288 const TRANS2D_MAPGEN& itrans
00289 );
00290
00292 ERRVALUE CopyOutputToOutput (
00293 const TRANS2D_MAPGEN& itrans
00294 );
00295
00297 ERRVALUE DisectForward (
00298 const DPOINT2D& point,
00299 double *xscale,
00300 double *yscale,
00301 double *rotangle = 0,
00302 double *shearangle = 0,
00303 double size = 1.0
00304 ) const;
00305
00307 ERRVALUE DisectInverse (
00308 const DPOINT2D& point,
00309 double *xscale,
00310 double *yscale,
00311 double *rotangle = 0,
00312 double *shearangle = 0,
00313 double size = 1.0
00314 ) const;
00315
00318 DEPRECATED ERRVALUE GetAffine (
00319 MAT3X3 fwd,
00320 MAT3X3 rev
00321 ) const;
00322
00325 ERRVALUE GetAffine (
00326 TRANS2D_AFFINE& trans
00327 ) const;
00328
00330 const DOUBLE_ARRAY<CTRLPOINT3>& GetInputCtrlPoints () const;
00331
00333 void GetInputFormulasDisplay (
00334 const MISTRING& ExtSymX,
00335 const MISTRING& ExtSymY,
00336 MISTRING& retstr
00337 ) const;
00338
00340 const SPATREF::COORDREFSYS& GetInputMapCoordRefSys () const;
00341
00343 TRANS2DMODEL GetInputModel () const;
00344
00346 ERRVALUE GetInputTrans (
00347 TRANS2D_AFFINE& trans
00348 ) const;
00349
00351 DEPRECATED ERRVALUE GetInputTrans (
00352 MAT3X3 fwd,
00353 MAT3X3 rev
00354 ) const;
00355
00358 int GetInputTrans (
00359 CTRLPOINT3 **ctrlpoint
00360 ) const;
00361
00363 ERRVALUE GetLocalAffine (
00364 const DPOINT2D& point,
00365 TRANS2D_AFFINE& trans,
00366 double size = 1.0,
00367 SIDE side = SIDE_Input
00368 ) const;
00369
00371 DEPRECATED ERRVALUE GetLocalAffine (
00372 const DPOINT2D& point,
00373 MAT3X3 fwd,
00374 MAT3X3 rev,
00375 double size = 1.0,
00376 SIDE side = SIDE_Input
00377 ) const;
00378
00380 bool GetNode2D (
00381 INT32 nodenum,
00382 DPOINT2D& point,
00383 SIDE side,
00384 COORD coord
00385 ) const;
00386
00388 bool GetNode3D (
00389 INT32 nodenum,
00390 DPOINT3D& point,
00391 SIDE side,
00392 COORD coord
00393 ) const;
00394
00396 const DOUBLE_ARRAY<CTRLPOINT3>& GetOutputCtrlPoints () const;
00397
00399 void GetOutputFormulasDisplay (
00400 const MISTRING& ExtSymX,
00401 const MISTRING& ExtSymY,
00402 MISTRING& retstr
00403 ) const;
00404
00406 const SPATREF::COORDREFSYS& GetOutputMapCoordRefSys () const;
00407
00409 TRANS2DMODEL GetOutputModel () const;
00410
00412 ERRVALUE GetOutputTrans (
00413 TRANS2D_AFFINE& trans
00414 ) const;
00415
00417 DEPRECATED ERRVALUE GetOutputTrans (
00418 MAT3X3 fwd,
00419 MAT3X3 rev
00420 ) const;
00421
00424 int GetOutputTrans (
00425 CTRLPOINT3 **ctrlpoint
00426 ) const;
00427
00429 const PTTRIANGULATOR& GetTriangulator (
00430 SIDE side
00431 ) const;
00432
00435 PTTRIANGULATOR& GetTriangulator (
00436 SIDE side
00437 );
00438
00440 bool HasForward () const;
00441
00443 bool HasInverse () const;
00444
00446 bool IsAffine () const;
00447
00449 bool IsEqual (
00450 const TRANS2D_MAPGEN& rhs
00451 ) const;
00452
00454 bool IsGeneral () const;
00455
00457 bool IsIdentity () const;
00458
00460 bool IsInputTransIdentity () const;
00461
00463 bool IsOutputTransIdentity () const;
00464
00466 bool IsReversible () const;
00467
00469 void ReverseDirection ();
00470
00472 void SetActiveTriangle (
00473 INT32 triangle,
00474 SIDE side
00475 ) const;
00476
00480 void SetAffineApproximation (
00481 const DRECT2D& SrcRect,
00482 double TgtTolerance,
00483 DIRECTION direction
00484 );
00485
00489 void SetAffineApproximation (
00490 const DRECT2D& SrcRect,
00491 double TgtTolerance,
00492 SIDE side
00493 ) { SetAffineApproximation(SrcRect,TgtTolerance,(side==SIDE_Input)?DIRECTION_Forward:DIRECTION_Reverse); }
00494
00498 void SetExcludeFlippedPieces (
00499 bool ExcludeFlippedPieces
00500 );
00501
00506 void SetExtrapolation (
00507 bool extrapolate
00508 );
00509
00511 void SetFullTransAffine (
00512 const TRANS2D_AFFINE& trans
00513 );
00514
00515 void SetGeneral (
00516 TRANSFUNC TransFuncFwd,
00517 TRANSFUNC TransFuncRev,
00518 void *userdata
00519 );
00520
00522 ERRVALUE SetInputBounds (
00523 const DRECT2D& boundrect
00524 );
00525
00527 void SetInputMaxError (
00528 double maxerror
00529 );
00530
00532 ERRVALUE SetInputMapCoordRefSys (
00533 const SPATREF::COORDREFSYS& MapCRS
00534 );
00535
00537 void SetInputTrans (
00538 const TRANS2D_AFFINE& trans
00539 );
00540
00542 DEPRECATED void SetInputTrans (
00543 const MAT3X3 fwd,
00544 const MAT3X3 rev
00545 );
00546
00548 ERRVALUE SetInputTrans (
00549 const CTRLPOINT3 *CtrlPoint,
00550 INT32 NumPoints,
00551 TRANS2DMODEL Model
00552 );
00553
00555 void SetInputTransIdentity ();
00556
00558 void SetMaxVertices (
00559 INT32 MaxVertices
00560 );
00561
00563 ERRVALUE SetOutputBounds (
00564 const DRECT2D& boundrect
00565 );
00566
00568 void SetOutputMaxError (
00569 double maxerror
00570 );
00571
00573 ERRVALUE SetOutputMapCoordRefSys (
00574 const SPATREF::COORDREFSYS& MapCRS
00575 );
00576
00578 void SetOutputTrans (
00579 const TRANS2D_AFFINE& trans
00580 );
00581
00583 DEPRECATED void SetOutputTrans (
00584 const MAT3X3 fwd,
00585 const MAT3X3 rev
00586 );
00587
00589 ERRVALUE SetOutputTrans (
00590 const CTRLPOINT3 *CtrlPoint,
00591 INT32 NumPoints,
00592 TRANS2DMODEL Model
00593 );
00594
00596 void SetOutputTransIdentity ();
00597
00602 void SetPrimaryDirection (
00603 DIRECTION direction
00604 );
00605
00606 void Update ();
00607
00608 ERRVALUE UpdatePiecewise (
00609 SIDE side
00610 );
00611
00612 private:
00613 #ifndef GENERATING_DOXYGEN_OUTPUT
00614 class PRIV;
00615 PRIV *m_pPriv;
00616 #endif // GENERATING_DOXYGEN_OUTPUT
00617 };
00618
00619 inline bool operator==(
00620 const TRANS2D_MAPGEN& lhs,
00621 const TRANS2D_MAPGEN& rhs
00622 ) { return (lhs.IsEqual(rhs)); }
00623
00624 inline bool operator!=(
00625 const TRANS2D_MAPGEN& lhs,
00626 const TRANS2D_MAPGEN& rhs
00627 ) { return (!lhs.IsEqual(rhs)); }
00628
00629 #define TRANSGENCOORD_Input TRANS2D_MAPGEN::SIDE_Input
00630 #define TRANSGENCOORD_Output TRANS2D_MAPGEN::SIDE_Output
00631
00632 #ifndef GENERATING_DOXYGEN_OUTPUT
00633 PREVENT_MEMFUNC(TRANS2D_MAPGEN)
00634 #endif
00635
00636
00637
00638 #undef CLASSLIBEXPORT
00639
00640 #endif // INC_MI32_TRANS2DMAPGEN_H