trans2dc.h

Go to the documentation of this file.
00001 /**
00002  * \file trans2dc.h <mi32/trans2dc.h>
00003  * \brief Classes for 2D coordinate transformation
00004  *
00005  * \if NODOC
00006  * $Id: trans2dc.h_v 1.54 2005/06/03 14:36:08 mju Exp $
00007  *
00008  * $Log: trans2dc.h_v $
00009  * Revision 1.54  2005/06/03 14:36:08  mju
00010  * Add isEqual method and comparison operators.
00011  *
00012  * Revision 1.53  2005/06/01 20:01:18  mju
00013  * Change densification function to use MIDOUBLEARRAY and only define if in GEOM dll.
00014  *
00015  * Revision 1.52  2005/04/07 19:51:07  mju
00016  * Fix getValues to have yscale/rot in proper order.
00017  *
00018  * Revision 1.51  2005/04/07 17:31:44  mju
00019  * Add affine.getValuesForward.
00020  *
00021  * Revision 1.50  2005/03/21 15:26:05  mju
00022  * Remove SetInput/OutputProjection methods.
00023  *
00024  * Revision 1.49  2005/03/16 14:21:57  mju
00025  * Prevent deprecation warnings for inlines.
00026  *
00027  * Revision 1.48  2005/03/15 18:18:55  mju
00028  * Remove getInput/OutputProjection.
00029  * Deprecate setInput/OutputProjection.
00030  *
00031  * Revision 1.47  2005/02/22 00:48:35  dfriberg
00032  * Added constructor for one MAT3X3
00033  *
00034  * Revision 1.46  2005/01/10 17:04:13  mju
00035  * Don't warn on deprecated usage for inline.
00036  *
00037  * Revision 1.45  2005/01/10 15:18:44  mju
00038  * Use deprecate_all for readGeoreference.
00039  *
00040  * Revision 1.44  2004/11/15 23:26:48  dwilliss
00041  * TRANS2D_AFFINE now exported from geom.dll.  4 methods no longer inlineable.
00042  *
00043  * Revision 1.43  2004/08/30 20:57:56  mju
00044  * Return error from SetCtrlPoint.
00045  *
00046  * Revision 1.42  2004/07/09 20:30:06  mju
00047  * Add mapgen IsInput/OutputTransIdentity.
00048  *
00049  * Revision 1.41  2004/07/07 22:02:07  mju
00050  * Return errvalue from getaffine.
00051  *
00052  * Revision 1.40  2004/06/24 20:39:55  mju
00053  * Add Apply...Reverse operations for affine.
00054  *
00055  * Revision 1.39  2004/06/22 15:30:55  mju
00056  * remove trans2d_carto as no longer used, replaced by spatref system.
00057  *
00058  * Revision 1.38  2004/06/18 21:48:09  mju
00059  * Remove GCTP references.
00060  * Support SPATREF.
00061  *
00062  * Revision 1.37  2004/03/04 17:55:47  scowan
00063  * Fixed new compiler warnings.
00064  *
00065  * Revision 1.36  2004/01/20 14:30:54  scowan
00066  * Added is equivalent to method for affine.
00067  *
00068  * Revision 1.35  2004/01/19 21:46:53  scowan
00069  * Added is identity method.
00070  *
00071  * Revision 1.34  2004/01/02 20:50:29  vdronov
00072  * add some methods
00073  *
00074  * Revision 1.33  2003/09/15 13:49:56  fileserver!dwilliss
00075  * Doxygen
00076  *
00077  * Revision 1.32  2003/08/13 20:18:34  scowan
00078  * Added bool value to disable cancel class.
00079  *
00080  * Revision 1.31  2003/06/12 19:33:09  scowan
00081  * Added set full affine.
00082  *
00083  * Revision 1.30  2003/06/11 19:36:32  scowan
00084  * More const.
00085  *
00086  * Revision 1.29  2002/07/30 18:52:52  dwilliss
00087  * Use 0 instead of NULL
00088  *
00089  * Revision 1.28  2002/05/31 22:02:58  dwilliss
00090  * *** empty log message ***
00091  *
00092  * Revision 1.27  2002/04/29 17:39:03  dwilliss
00093  * Added an ApplyPrescale method to TRANS2D_AFFINE
00094  *
00095  * Revision 1.26  2002/04/29 17:00:33  mju
00096  * Add GetInputTrans methods.
00097  *
00098  * Revision 1.25  2002/03/07 15:52:12  mju
00099  * Add AFFINE::setctrlpoints using CTRLPOINT3.
00100  *
00101  * Revision 1.24  2001/08/17 20:36:01  scowan
00102  * Added method to set affine with control points.
00103  *
00104  * Revision 1.23  2001/06/15 21:38:19  scowan
00105  * Nothing.
00106  *
00107  * Revision 1.22  2000/12/06 16:25:32  scowan
00108  * Fixed conversion warning.
00109  *
00110  * Revision 1.21  2000/10/03 22:21:53  msmith
00111  * Genitor documentation.
00112  *
00113  * Revision 1.20  2000/07/18 21:53:11  mju
00114  * Add ReadGeoreference().
00115  *
00116  * Revision 1.19  2000/05/12 16:15:53  scowan
00117  * Added disect methods
00118  *
00119  * Revision 1.18  2000/03/13 16:03:26  mju
00120  * Add MAPGEN::ConvertForward/Inverse for generic point array.
00121  *
00122  * Revision 1.17  2000/03/07 16:52:51  scowan
00123  * Added method to cast to const trans parm automatically.
00124  *
00125  * Revision 1.15  2000/01/26 17:13:44  scowan
00126  * Added update and clear methods.
00127  *
00128  * Revision 1.14  2000/01/26 14:41:05  mju
00129  * Change CARTO and MAPGEN classes to return converted values in reference parm.
00130  *
00131  * Revision 1.10  1999/12/16 23:57:30  scowan
00132  * Added more methods.
00133  *
00134  * Revision 1.9  1999/05/26 14:09:02  mju
00135  * Add AFFINE.ReverseDirection() method.
00136  *
00137  * Revision 1.8  1999/05/20  15:46:45  mju
00138  * Use INT32 for all "NumPoints" parameters.
00139  *
00140  * Revision 1.7  1999/05/19  17:28:41  mju
00141  * Add MAPGEN.GetTransParm.
00142  * Include rect.h.
00143  *
00144  * Revision 1.6  1999/05/19  17:22:05  mju
00145  * Use TransGenCopy().
00146  *
00147  * Revision 1.5  1999/05/19  13:51:40  mju
00148  * Add AFFINE.ConvertForward/Inverse for arrays.
00149  *
00150  * Revision 1.4  1999/05/06  22:14:48  mju
00151  * Add Disect methods.
00152  *
00153  * Revision 1.3  1999/05/05  13:52:51  mju
00154  * Add MAPGEN.Disect methods.
00155  *
00156  * Revision 1.2  1999/04/28  17:41:26  mju
00157  * Include ctrlpt.h.
00158  *
00159  * Revision 1.1  1999/04/19  14:15:57  mju
00160  * Initial revision
00161  *
00162  * \endif
00163 **/
00164 
00165 #ifndef  INC_MI32_TRANS2DC_H
00166 #define  INC_MI32_TRANS2DC_H
00167 
00168 #ifndef  INC_MI32_TRANS2D_H
00169 #include <mi32/trans2d.h>
00170 #endif
00171 
00172 #ifndef  INC_MI32_TRANSGEN_H
00173 #include <mi32/transgen.h>
00174 #endif
00175 
00176 #ifndef  INC_MI32_RECT_H
00177 #include <mi32/rect.h>
00178 #endif
00179 
00180 #ifndef  INC_MI32_CTRLPT_H
00181 #include <mi32/ctrlpt.h>
00182 #endif
00183 
00184 #ifndef  INC_MI32_RVCGREF_H
00185 #include <mi32/rvcgref.h>
00186 #endif
00187 
00188 #include <memory.h>     //! For memcpy() prototype
00189 
00190 
00191 #ifndef GENERATING_DOXYGEN_OUTPUT
00192 #ifdef GEOMDLL
00193    #define GEOMLIBEXPORT MI_DLLEXPORT
00194    #define GEOMLIBCLASSEXPORT MI_DLLCLASSEXPORT
00195 #else
00196    #define GEOMLIBEXPORT MI_DLLIMPORT
00197    #define GEOMLIBCLASSEXPORT MI_DLLCLASSIMPORT
00198 #endif
00199 
00200 //! Forward declarations
00201 
00202 class TRANS2D_MAPGEN;
00203 
00204 #endif // GENERATING_DOXYGEN_OUTPUT
00205 
00206 //-------------------------------------------------------------------------------------------------------------------
00207 //! Simple affine X/Y coordinate transformation.
00208 //!
00209 //! All conversion methods are inline for maximum speed.  For single point
00210 //! conversion, no function call will occur (assuming the compiler actually
00211 //! inlines the method).  This class replaces the trans2d...() C functions.
00212 class GEOMLIBCLASSEXPORT TRANS2D_AFFINE {
00213 
00214    public:
00215 
00216       enum AXIS {
00217          AXIS_X = 0,
00218          AXIS_Y = 1
00219          };
00220 
00221       //! Default constructor, create identity transformation.
00222       TRANS2D_AFFINE (
00223          ) { trans2dinit(m_fwd,m_inv); }
00224 
00225       //! Copy constructor.
00226       TRANS2D_AFFINE (
00227          const TRANS2D_AFFINE& rhs
00228          ) {
00229          memcpy(m_fwd,rhs.m_fwd,sizeof(MAT3X3));
00230          memcpy(m_inv,rhs.m_inv,sizeof(MAT3X3));
00231          }
00232 
00233       //! Construct from forward or inverse matrix
00234       TRANS2D_AFFINE (
00235          const MAT3X3 matrix,             //!< Transformation matrix
00236          bool IsForward = true            //!< True if forward transformation, false if inverse
00237          ) {
00238          if (IsForward) {
00239             memcpy(m_fwd,matrix,sizeof(MAT3X3));
00240             trans2dfindinverse(m_fwd,m_inv);
00241             } 
00242          else {
00243             memcpy(m_inv,matrix,sizeof(MAT3X3));
00244             trans2dfindinverse(m_inv,m_fwd);
00245             }
00246          }
00247 
00248       //! Construct from affine matrices.
00249       TRANS2D_AFFINE (
00250          const MAT3X3 fwd,                //!< Forward transformation matrix
00251          const MAT3X3 inv                 //!< Inverse transformation matrix
00252          ) {
00253          memcpy(m_fwd,fwd,sizeof(MAT3X3));
00254          memcpy(m_inv,inv,sizeof(MAT3X3));
00255          }
00256 
00257       //! Construct from combination of two affine transformations.
00258       TRANS2D_AFFINE (
00259          const TRANS2D_AFFINE& trans1,    //!< First transformation
00260          const TRANS2D_AFFINE& trans2     //!< Second transformation
00261          ) { trans2dmatrix2(m_fwd,m_inv,trans1.m_fwd,trans1.m_inv,trans2.m_fwd,trans2.m_inv); }
00262 
00263       //! Construct from CTRLPOINT array.
00264       TRANS2D_AFFINE (
00265          const CTRLPOINT *cp,             //!< Control point array
00266          int numpoints,                   //!< Number of control points
00267          bool invert = false              //!< Invert coordinate system (for images)
00268          ) { FindBestTrans2DA(numpoints,cp,m_fwd,m_inv,(invert)?TRANS2DMODEL_OrientInvert:0); }
00269 
00270       //! Construct from CTRLPOINT3 array.
00271       TRANS2D_AFFINE (
00272          const CTRLPOINT3 *cp,            //!< Control point array
00273          int numpoints,                   //!< Number of control points
00274          bool invert = false              //!< Invert coordinate system (for images)
00275          ) { FindBestTrans2D3A(numpoints,cp,m_fwd,m_inv,(invert)?TRANS2DMODEL_OrientInvert:0); }
00276 
00277       //! Destructor.
00278       ~TRANS2D_AFFINE (
00279          ) {}
00280 
00281       //! Assignment from TRANS2D_AFFINE.
00282       TRANS2D_AFFINE& operator= (
00283          const TRANS2D_AFFINE& rhs
00284          ) {
00285          if (this != &rhs) {
00286             memcpy(m_fwd,rhs.m_fwd,sizeof(MAT3X3));
00287             memcpy(m_inv,rhs.m_inv,sizeof(MAT3X3));
00288             }
00289          return (*this);
00290          }
00291 
00292       //! Apply coordinate offset.
00293       void ApplyOffset (
00294          double xoffset,                  //!< X offset
00295          double yoffset                   //!< Y offset
00296          ) { trans2dshift(m_fwd,m_inv,xoffset,yoffset); }
00297 
00298       //! Apply coordinate offset.
00299       void ApplyOffset (
00300          const DPOINT2D& offset           //!< Offset
00301          ) { trans2dshift(m_fwd,m_inv,offset.x,offset.y); }
00302 
00303       //! Apply coordinate offset relative to reverse direction.
00304       void ApplyOffsetReverse (
00305          double xoffset,                  //!< X offset
00306          double yoffset                   //!< Y offset
00307          ) { trans2dshift(m_inv,m_fwd,xoffset,yoffset); }
00308 
00309       //! Apply coordinate offset relative to reverse direction.
00310       void ApplyOffsetReverse (
00311          const DPOINT2D& offset           //!< Offset
00312          ) { trans2dshift(m_inv,m_fwd,offset.x,offset.y); }
00313 
00314       //! Apply rotation angle.
00315       void ApplyRotation (
00316          double angle                     //!< Rotation angle in radians
00317          ) { trans2drot(m_fwd,m_inv,angle); }
00318 
00319       //! Apply scale equally to X/Y axes.
00320       void ApplyScale (
00321          double scale                     //!< Scale
00322          ) { trans2dscale(m_fwd,m_inv,scale,scale); }
00323 
00324       //! Apply scale to X/Y axes.
00325       void ApplyScale (
00326          double xscale,                   //!< X scale
00327          double yscale                    //!< Y scale
00328          ) { trans2dscale(m_fwd,m_inv,xscale,yscale); }
00329 
00330       //! Apply scale to X/Y axes.
00331       void ApplyScale (
00332          const DPOINT2D &scale            //!< X/Y scale
00333          ) { trans2dscale(m_fwd,m_inv,scale.x,scale.y); }
00334 
00335       //! Apply scale to X/Y axes, relative to reverse direction.
00336       void ApplyScaleReverse (
00337          double xscale,                   //!< X scale
00338          double yscale                    //!< Y scale
00339          ) { trans2dscale(m_inv,m_fwd,xscale,yscale); }
00340 
00341       //! Apply scale to X/Y axes, relative to reverse direction.
00342       void ApplyScaleReverse (
00343          const DPOINT2D &scale            //!< X/Y scale
00344          ) { trans2dscale(m_inv,m_fwd,scale.x,scale.y); }
00345 
00346       //! Apply shear relative to specified axis.
00347       void ApplyShear (
00348          double angle,                    //!< Shear angle in radians
00349          AXIS axis                        //!< Axis to shear (AXIS_X or AXIS_Y)
00350          ) { trans2dshear(m_fwd,m_inv,angle,static_cast<int>(axis)); }
00351 
00352       //! Combine two affine transformations.
00353       void Combine (
00354          const TRANS2D_AFFINE& trans1     //!< First transformation
00355          ) {
00356          trans2dmatrix(m_fwd,trans1.m_fwd);
00357          trans2dmatrix(m_inv,trans1.m_inv);
00358          }
00359 
00360       //! Combine two affine transformations.
00361       void Combine (
00362          const TRANS2D_AFFINE& trans1,    //!< First transformation
00363          const TRANS2D_AFFINE& trans2     //!< Second transformation
00364          ) { trans2dmatrix2(m_fwd,m_inv,trans1.m_fwd,trans1.m_inv,trans2.m_fwd,trans2.m_inv); }
00365 
00366       //! Perform forward transformation on X/Y point.
00367       //! @return Converted point.
00368       DPOINT2D ConvertForward (
00369          double x,                        //!< X coordinate
00370          double y                         //!< Y coordinate
00371          ) const { return (DPOINT2D(trans2dx(x,y,m_fwd),trans2dy(x,y,m_fwd))); }
00372 
00373       //! Perform forward transformation on X/Y point.
00374       void ConvertForward (
00375          double x,                        //!< X coordinate
00376          double y,                        //!< Y coordinate
00377          double& ox,                      //!< X coordinate
00378          double& oy                       //!< Y coordinate
00379          ) const { ox = trans2dx(x,y,m_fwd); oy = trans2dy(x,y,m_fwd); }
00380 
00381       //! Perform forward transformation on DPOINT2D.
00382       //! @return Converted point.
00383       DPOINT2D ConvertForward (
00384          const DPOINT2D& ipoint           //!< Input point
00385          ) const { return (DPOINT2D(trans2dx(ipoint.x,ipoint.y,m_fwd),trans2dy(ipoint.x,ipoint.y,m_fwd))); }
00386 
00387       //! Perform forward transformation on DPOINT3D.
00388       //! @return Converted point.
00389       DPOINT3D ConvertForward (
00390          const DPOINT3D& ipoint           //!< Input point
00391          ) const { return (DPOINT3D(trans2dx(ipoint.x,ipoint.y,m_fwd),trans2dy(ipoint.x,ipoint.y,m_fwd),ipoint.z)); }
00392 
00393       //! Perform forward transformation on DPOINT2D array.
00394       void ConvertForward (
00395          const DPOINT2D* ipoints,         //!< Input point array
00396          DPOINT2D* opoints,               //!< Output point array
00397          INT32 NumPoints                  //!< Number of points to convert
00398          ) const;
00399 
00400       //! Perform forward transformation on DPOINT3D array.
00401       void ConvertForward (
00402          const DPOINT3D* ipoints,         //!< Input point array
00403          DPOINT3D* opoints,               //!< Output point array
00404          INT32 NumPoints                  //!< Number of points to convert
00405          ) const;
00406 
00407       //! Perform forward transformation on DRECT2D.
00408       //! @return Converted rectangle.
00409       DRECT2D ConvertForward (
00410          const DRECT2D& irect             //!< Input rectangle
00411          ) const {
00412          DRECT2D orect;
00413          Trans2DRect(m_fwd,&irect,&orect);
00414          return (orect);
00415          }
00416 
00417       //! Perform forward transformation on DRECT2D.
00418       void ConvertForward (
00419          const DRECT2D& irect,            //!< Input rectangle
00420          DRECT2D& orect                   //!< Output rectangle
00421          ) const { Trans2DRect(m_fwd,&irect,&orect); }
00422 
00423       //! Perform inverse transformation on X/Y point.
00424       //! @return Converted point.
00425       DPOINT2D ConvertInverse (
00426          double x,                        //!< X coordinate
00427          double y                         //!< Y coordinate
00428          ) const { return (DPOINT2D(trans2dx(x,y,m_inv),trans2dy(x,y,m_inv))); }
00429 
00430       //! Perform inverse transformation on DPOINT2D.
00431       //! @return Converted point.
00432       DPOINT2D ConvertInverse (
00433          const DPOINT2D& ipoint           //!< Input point
00434          ) const { return (DPOINT2D(trans2dx(ipoint.x,ipoint.y,m_inv),trans2dy(ipoint.x,ipoint.y,m_inv))); }
00435 
00436       //! Perform inverse transformation on DPOINT3D.
00437       //! @return Converted point.
00438       DPOINT3D ConvertInverse (
00439          const DPOINT3D& ipoint           //!< Input point
00440          ) const { return (DPOINT3D(trans2dx(ipoint.x,ipoint.y,m_inv),trans2dy(ipoint.x,ipoint.y,m_inv),ipoint.z)); }
00441 
00442       //! Perform inverse transformation on DPOINT2D array.
00443       void ConvertInverse (
00444          const DPOINT2D* ipoints,         //!< Input point array
00445          DPOINT2D* opoints,               //!< Output point array
00446          INT32 NumPoints                  //!< Number of points to convert
00447          ) const;
00448 
00449       //! Perform inverse transformation on DPOINT3D array.
00450       void ConvertInverse (
00451          const DPOINT3D* ipoints,         //!< Input point array
00452          DPOINT3D* opoints,               //!< Output point array
00453          INT32 NumPoints                  //!< Number of points to convert
00454          ) const;
00455 
00456       //! Perform inverse transformation on DRECT2D.
00457       //! @return Converted rectangle.
00458       DRECT2D ConvertInverse (
00459          const DRECT2D& irect             //!< Input rectangle
00460          ) const {
00461          DRECT2D orect;
00462          Trans2DRect(m_inv,&irect,&orect);
00463          return (orect);
00464          }
00465 
00466       //! Perform inverse transformation on DRECT2D.
00467       void ConvertInverse (
00468          const DRECT2D& irect,            //!< Input rectangle
00469          DRECT2D& orect                   //!< Output rectangle
00470          ) const { Trans2DRect(m_inv,&irect,&orect); }
00471 
00472       //! Determine scale/rotation/shear for forward transformation
00473       void DisectForward (
00474          double *xscale,                  //!< X scale returned (0 if don't need)
00475          double *yscale,                  //!< Y scale returned (0 if don't need)
00476          double *rotangle = 0,            //!< Rotation angle in radians returned (0 if don't need)
00477          double *shearangle = 0           //!< Shear angle in radians returned (0 if don't need)
00478          ) const { DisectTrans2D(m_fwd,xscale,yscale,rotangle,shearangle); }
00479          
00480       //! Determine scale/rotation/shear for inverse transformation
00481       void DisectInverse (
00482          double *xscale,                  //!< X scale returned (0 if don't need)
00483          double *yscale,                  //!< Y scale returned (0 if don't need)
00484          double *rotangle = 0,            //!< Rotation angle in radians returned (0 if don't need)
00485          double *shearangle = 0           //!< Shear angle in radians returned (0 if don't need)
00486          ) const { DisectTrans2D(m_inv,xscale,yscale,rotangle,shearangle); }
00487 
00488       //! Retrieve copy of affine matrices      
00489       void GetMatrices (
00490          MAT3X3 fwd,                      //!< Forward matrix returned
00491          MAT3X3 inv                       //!< Inverse matrix returned
00492          ) const { memcpy(fwd,m_fwd,sizeof(MAT3X3)); memcpy(inv,m_inv,sizeof(MAT3X3)); }
00493 
00494       //! Get values for forward transformation.
00495       void GetValuesForward (
00496          double& xscale,                  //!< X scale value returned
00497          double& xrot,                    //!< X rotation value returned
00498          double& xpos,                    //!< X position value returned
00499          double& yscale,                  //!< Y scale value returned
00500          double& yrot,                    //!< Y rotation value returned
00501          double& ypos                     //!< Y position value returned
00502          ) const {
00503          xscale = m_fwd[0][0]; xrot = m_fwd[0][1]; xpos = m_fwd[0][2];
00504          yscale = m_fwd[1][1]; yrot = m_fwd[1][0]; ypos = m_fwd[1][2];
00505          }
00506 
00507       bool IsEqual (
00508          const TRANS2D_AFFINE& rhs
00509          ) const {
00510          return (!memcmp(m_fwd,rhs.m_fwd,sizeof(MAT3X3)) && !memcmp(m_inv,rhs.m_inv,sizeof(MAT3X3)));
00511          }
00512 
00513       //! Determine if the two transformation's are equivalent
00514       //! @return 'True' if equivalent, 'false' if not         
00515       bool IsEquivalentTo (
00516          const TRANS2D_AFFINE& rhs
00517          ) const {
00518          for (int i = 0;(i < 3);++i) {
00519             for (int j = 0;(j < 3);++j) {
00520                if (fabs(m_fwd[i][j] - rhs.m_fwd[i][j]) > 0.0000001) return (false);
00521                }
00522             }
00523          return (true);
00524          }
00525 
00526       //! Determine if the transformation is an identity
00527       //! @return 'True' if identity, 'false' if not        
00528       bool IsIdentity (
00529          ) const {
00530          return (m_fwd[0][0] == 1.0 && m_fwd[1][1] == 1.0 && m_fwd[0][1] == 0.0 && m_fwd[0][2] == 0.0 && m_fwd[1][0] == 0.0 && m_fwd[1][2] == 0.0);
00531          }
00532 
00533       //! Reverse direction of transformation.
00534       void ReverseDirection (
00535          ) {
00536          MAT3X3 temp;
00537          memcpy(temp,m_fwd,sizeof(MAT3X3));
00538          memcpy(m_fwd,m_inv,sizeof(MAT3X3));
00539          memcpy(m_inv,temp,sizeof(MAT3X3));
00540          }
00541 
00542       //! Set transformation from CTRLPOINT array.
00543       ERRVALUE SetCtrlPoint (
00544          const CTRLPOINT *cp,             //!< Control point array
00545          int numpoints,                   //!< Number of control points
00546          bool invert = false              //!< Invert coordinate system (for images)
00547          ) { return (FindBestTrans2DA(numpoints,cp,m_fwd,m_inv,(invert)?TRANS2DMODEL_OrientInvert:0)); }
00548          
00549       //! Set transformation from CTRLPOINT3 array.
00550       ERRVALUE SetCtrlPoint (
00551          const CTRLPOINT3 *cp,            //!< Control point array
00552          int numpoints,                   //!< Number of control points
00553          bool invert = false              //!< Invert coordinate system (for images)
00554          ) { return (FindBestTrans2D3A(numpoints,cp,m_fwd,m_inv,(invert)?TRANS2DMODEL_OrientInvert:0)); }
00555          
00556       //! Set transformation to "identity".
00557       void SetIdentity (
00558          ) { trans2dinit(m_fwd,m_inv); }
00559 
00560       //! Set transformation from affine matrices.
00561       void SetMatrices (
00562          const MAT3X3 fwd,                //!< Forward transformation
00563          const MAT3X3 inv                 //!< Inverse transformation
00564          ) { memcpy(m_fwd,fwd,sizeof(MAT3X3)); memcpy(m_inv,inv,sizeof(MAT3X3)); }
00565 
00566    private:
00567       #ifndef GENERATING_DOXYGEN_OUTPUT
00568       MAT3X3 m_fwd;                       //!< Forward transformation matrix
00569       MAT3X3 m_inv;                       //!< Inverse transformation matrix
00570 
00571       friend class TRANS2D_MAPGEN;
00572       #endif // GENERATING_DOXYGEN_OUTPUT
00573    };
00574 
00575 
00576 //-------------------------------------------------------------------------------------------
00577 //!      TRANS2D_MAPGEN
00578 //-------------------------------------------------------------------------------------------
00579 
00580 //! Encapsulate TRANSPARM structure and TransGen...() functions
00581 class TRANS2D_MAPGEN {
00582    public:
00583 
00584       //! Transformation direction
00585       enum DIRECTION {
00586          DIRECTION_Forward = TRANSDIR_Forward,
00587          DIRECTION_Inverse = TRANSDIR_Inverse
00588          };
00589 
00590       //! Default constructor, create identity transformation
00591       TRANS2D_MAPGEN (
00592          ) { TransGenInit(&m_transparm); }
00593 
00594       //! Copy constructor.
00595       TRANS2D_MAPGEN (
00596          const TRANS2D_MAPGEN &rhs
00597          ) {
00598          TransGenInit(&m_transparm);
00599          TransGenCopy(&m_transparm,&rhs.m_transparm);
00600          }
00601 
00602       //! Construct from TRANSPARM (allows implicit conversion).
00603       TRANS2D_MAPGEN (
00604          const TRANSPARM& transparm
00605          ) {
00606          TransGenInit(&m_transparm);
00607          TransGenCopy(&m_transparm,&transparm);
00608          }
00609 
00610       //! Destructor.
00611       ~TRANS2D_MAPGEN (
00612          ) { TransGenFreeParm(&m_transparm); }
00613 
00614       //! Assignment from TRANS2D_MAPGEN.
00615       TRANS2D_MAPGEN& operator= (
00616          const TRANS2D_MAPGEN &rhs
00617          ) {
00618          if (this != &rhs) {
00619             TransGenCopy(&m_transparm,&rhs.m_transparm);
00620             }
00621          return (*this);
00622          }
00623 
00624       //! Assignment from TRANSPARM.
00625       TRANS2D_MAPGEN& operator= (
00626          const TRANSPARM &rhs
00627          ) {
00628          TransGenCopy(&m_transparm,&rhs);
00629          return (*this);
00630          }
00631 
00632       //! Cast to (const TRANSPARM *).
00633       operator const TRANSPARM* (
00634          ) const { return (&m_transparm); }
00635 
00636       void Clear (
00637          ) { TransGenFreeParm(&m_transparm); TransGenInit(&m_transparm); }
00638 
00639       //! Perform forward transformation on DPOINT2D
00640       ERRVALUE ConvertForward (
00641          const DPOINT2D& ipoint,          //!< Input point
00642          DPOINT2D& opoint                 //!< Output point
00643          ) const { return (TransGenConvPointFwd(&m_transparm,&ipoint,&opoint)); }
00644 
00645       //! Perform forward transformation on DPOINT3D.
00646       ERRVALUE ConvertForward (
00647          const DPOINT3D& ipoint,          //!< Input point
00648          DPOINT3D& opoint                 //!< Output point
00649          ) const { opoint.z = ipoint.z; return (TransGenConvPointFwd(&m_transparm, &ipoint, &opoint)); }
00650 
00651       //! Perform forward transformation on DPOINT2D array.
00652       ERRVALUE ConvertForward (
00653          const DPOINT2D* ipoints,         //!< Input point array
00654          DPOINT2D* opoints,               //!< Output point array
00655          INT32 NumPoints                  //!< Number of points to convert
00656          ) const { return (TransGenConvPointSetFwd(&m_transparm,reinterpret_cast<const double*>(ipoints),NumPoints,2,reinterpret_cast<double*>(opoints))); }
00657 
00658       //! Perform forward transformation on DPOINT3D array.
00659       ERRVALUE ConvertForward (
00660          const DPOINT3D* ipoints,         //!< Input point array
00661          DPOINT3D* opoints,               //!< Output point array
00662          INT32 NumPoints                  //!< Number of points to convert
00663          ) const { return (TransGenConvPointSetFwd(&m_transparm,reinterpret_cast<const double*>(ipoints),NumPoints,3,reinterpret_cast<double*>(opoints))); }
00664 
00665       //! Perform forward transformation on generic point array.
00666       ERRVALUE ConvertForward (
00667          const void* ipoints,             //!< Input point array
00668          void* opoints,                   //!< Output point array
00669          INT32 NumPoints,                 //!< Number of points to convert
00670          int NumDim                       //!< Number of dimensions
00671          ) const { return (TransGenConvPointSetFwd(&m_transparm,reinterpret_cast<const double*>(ipoints),NumPoints,NumDim,reinterpret_cast<double*>(opoints))); }
00672 
00673       //! Perform forward transformation on rectangle.
00674       ERRVALUE ConvertForward (
00675          const DRECT2D& irect,            //!< Input rectangle
00676          DRECT2D& orect,                  //!< Output rectangle
00677          int sidepoints=0                 //!< Number of extra points along sides for interpolation
00678          ) const { return (TransGenConvRectFwd(&m_transparm,&irect,&orect,sidepoints)); }
00679 
00680    #ifdef GEOMDLL
00681       //! Perform forward transformation with densification
00682       //! @return Number of output points or error < 0
00683       INT32 ConvertForwardDense (
00684          const double *ipoints,           //!< Input point array
00685          INT32 iNumPoints,                //!< Number of input points
00686          int NumDim,                      //!< Numer of dimensions
00687          MIDOUBLEARRAY& opoints           //!< Array of output points returned
00688          ) const {
00689          return (TransGenConvPointsFwdDense(&m_transparm,ipoints,iNumPoints,NumDim,opoints));
00690          }
00691    #endif
00692 
00693       //! Perform inverse transformation on DPOINT2D.
00694       ERRVALUE ConvertInverse (
00695          const DPOINT2D& ipoint,          //!< Input point
00696          DPOINT2D& opoint                 //!< Output point
00697          ) const { return (TransGenConvPointInv(&m_transparm,&ipoint,&opoint)); }
00698 
00699       //! Perform inverse transformation on DPOINT3D.
00700       ERRVALUE ConvertInverse (
00701          const DPOINT3D& ipoint,          //!< Input point
00702          DPOINT3D& opoint                 //!< Output point
00703          ) const { opoint.z = ipoint.z; return (TransGenConvPointInv(&m_transparm,&ipoint,&opoint)); }
00704 
00705       //! Perform inverse transformation on DPOINT2D array.
00706       ERRVALUE ConvertInverse (
00707          const DPOINT2D* ipoints,         //!< Input point array
00708          DPOINT2D* opoints,               //!< Output point array
00709          INT32 NumPoints                  //!< Number of points to convert
00710          ) const { return (TransGenConvPointSetInv(&m_transparm,reinterpret_cast<const double*>(ipoints),NumPoints,2,reinterpret_cast<double*>(opoints))); }
00711 
00712       //! Perform inverse transformation on DPOINT3D array.
00713       ERRVALUE ConvertInverse (
00714          const DPOINT3D* ipoints,         //!< Input point array
00715          DPOINT3D* opoints,               //!< Output point array
00716          INT32 NumPoints                  //!< Number of points to convert
00717          ) const { return (TransGenConvPointSetInv(&m_transparm,reinterpret_cast<const double*>(ipoints),NumPoints,3,reinterpret_cast<double*>(opoints))); }
00718 
00719       //! Perform inverse transformation on generic point array.
00720       ERRVALUE ConvertInverse (
00721          const void* ipoints,             //!< Input point array
00722          void* opoints,                   //!< Output point array
00723          INT32 NumPoints,                 //!< Number of points to convert
00724          int NumDim                       //!< Number of dimensions
00725          ) const { return (TransGenConvPointSetInv(&m_transparm,reinterpret_cast<const double*>(ipoints),NumPoints,NumDim,reinterpret_cast<double*>(opoints))); }
00726 
00727       //! Perform inverse transformation on rectangle.
00728       ERRVALUE ConvertInverse (
00729          const DRECT2D& irect,            //!< Input rectangle
00730          DRECT2D& orect,                  //!< Output rectangle
00731          int sidepoints=0                 //!< Number of extra points along sides for interpolation
00732          ) const { return (TransGenConvRectInv(&m_transparm,&irect,&orect,sidepoints)); }
00733 
00734    #ifdef GEOMDLL
00735       //! Perform inverse transformation with densification
00736       //! @return Number of output points or error < 0
00737       INT32 ConvertInverseDense (
00738          const double *ipoints,           //!< Input point array
00739          INT32 iNumPoints,                //!< Number of input points
00740          int NumDim,                      //!< Numer of dimensions
00741          MIDOUBLEARRAY& opoints           //!< Array of output points returned
00742          ) const {
00743          return (TransGenConvPointsInvDense(&m_transparm,ipoints,iNumPoints,NumDim,opoints));
00744          }
00745    #endif
00746 
00747       //! Convert from input map coordinates to output map coordinates.
00748       ERRVALUE ConvertMapToMapForward (
00749          const DPOINT2D& ipoint,          //!< Point to convert
00750          DPOINT2D& opoint                 //!< Output point
00751          ) const { return (TransGenConvPointMapToMapFwd(&m_transparm,&ipoint,&opoint)); }
00752 
00753       //! Convert from output map coordinates to input map coordinates.
00754       ERRVALUE ConvertMapToMapInverse (
00755          const DPOINT2D& ipoint,          //!< Point to convert
00756          DPOINT2D& opoint                 //!< Output point
00757          ) const { return (TransGenConvPointMapToMapInv(&m_transparm,&ipoint,&opoint)); }
00758 
00759       //! Convert from "output" to "map" coordinates.
00760       ERRVALUE ConvertOutputToMap (
00761          const DPOINT2D& ipoint,          //!< Point to convert
00762          DPOINT2D& opoint                 //!< Output point
00763          ) const { return (TransGenConvPointOutputToMap(&m_transparm,&ipoint,&opoint)); }
00764 
00765       //! Copy TRANSPARM "input" parameters to "input" parameters.
00766       void CopyInputToInput (
00767          const TRANSPARM& transparm
00768          ) {
00769          int err;
00770          if ((err = TransGenCopyInputParms(&m_transparm,&transparm)) < 0) {
00771             //! XXX throw an exception
00772             }
00773          return;
00774          }
00775 
00776       //! Copy MAPGEN "input" parameters to "input" parameters.
00777       void CopyInputToInput (
00778          const TRANS2D_MAPGEN& itrans
00779          ) { CopyInputToInput(itrans.m_transparm); }
00780 
00781       //! Copy TRANSPARM "input" parameters to "output" parameters.
00782       void CopyInputToOutput (
00783          const TRANSPARM& transparm
00784          ) {
00785          int err;
00786          if ((err = TransGenCopyInputToOutput(&m_transparm,&transparm)) < 0) {
00787             //! XXX throw an exception
00788             }
00789          return;
00790          }
00791 
00792       //! Copy MAPGEN "input" parameters to "output" parameters.
00793       void CopyInputToOutput (
00794          const TRANS2D_MAPGEN& itrans
00795          ) { CopyInputToOutput(itrans.m_transparm); }
00796 
00797       //! Copy TRANSPARM "output" parameters to "input" parameters.
00798       void CopyOutputToInput (
00799          const TRANSPARM& transparm
00800          ) {
00801          int err;
00802          if ((err = TransGenCopyOutputToInput(&m_transparm,&transparm)) < 0) {
00803             //! XXX throw an exception
00804             }
00805          return;
00806          }
00807 
00808       //! Copy MAPGEN "output" parameters to "input" parameters.
00809       void CopyOutputToInput (
00810          const TRANS2D_MAPGEN& itrans
00811          ) { CopyOutputToInput(itrans.m_transparm); }
00812 
00813       //! Copy TRANSPARM "output" parameters to "output" parameters.
00814       void CopyOutputToOutput (
00815          const TRANSPARM& transparm
00816          ) {
00817          int err;
00818          if ((err = TransGenCopyOutputParms(&m_transparm,&transparm)) < 0) {
00819             //! XXX throw an exception
00820             }
00821          return;
00822          }
00823 
00824       //! Copy MAPGEN "output" parameters to "output" parameters.
00825       void CopyOutputToOutput (
00826          const TRANS2D_MAPGEN& itrans
00827          ) { CopyOutputToOutput(itrans.m_transparm); }
00828 
00829       //! Determine scale/rotation/shear at specified point for forward transformation.
00830       ERRVALUE DisectForward (
00831          const DPOINT2D& point,           //!< Reference point at which values will be computed
00832          double *xscale,                  //!< X scale returned (0 if don't need)
00833          double *yscale,                  //!< Y scale returned (0 if don't need)
00834          double *rotangle = 0,            //!< Rotation angle in radians returned (0 if don't need)
00835          double *shearangle = 0,          //!< Shear angle in radians returned (0 if don't need)
00836          double size = 1.0                //!< Size of area over which to compute values
00837          ) const {
00838          return (TransGenDisectFwd(&m_transparm,&point,size,xscale,yscale,rotangle,shearangle));
00839          }
00840 
00841       //! Determine scale/rotation/shear at specified point for inverse transformation.
00842       ERRVALUE DisectInverse (
00843          const DPOINT2D& point,           //!< Reference point at which values will be computed
00844          double *xscale,                  //!< X scale returned (0 if don't need)
00845          double *yscale,                  //!< Y scale returned (0 if don't need)
00846          double *rotangle = 0,            //!< Rotation angle in radians returned (0 if don't need)
00847          double *shearangle = 0,          //!< Shear angle in radians returned (0 if don't need)
00848          double size = 1.0                //!< Size of area over which to compute values
00849          ) const {
00850          return (TransGenDisectInv(&m_transparm,&point,size,xscale,yscale,rotangle,shearangle));
00851          }
00852 
00853       //! Get affine transformation if available.
00854       //! Will return error if transformation is not affine.
00855       ERRVALUE GetAffine (
00856          MAT3X3 fwd,                      //!< Forward transformation
00857          MAT3X3 inv                       //!< Inverse transformation
00858          ) const { return (TransGenGetAffine(&m_transparm, fwd, inv)); }
00859 
00860       //! Get affine transformation if available.
00861       //! Will return error if transformation is not affine.
00862       ERRVALUE GetAffine (
00863          TRANS2D_AFFINE& trans            //!< Affine transformation
00864          ) const { return (TransGenGetAffine(&m_transparm, trans.m_fwd, trans.m_inv)); }
00865 
00866       //! Get 'input' map coordinate reference system.
00867       const SPATREF::COORDREFSYS& GetInputMapCoordRefSys (
00868          ) const { return (TransGenGetInputMapCoordRefSys(m_transparm)); }
00869 
00870       //! Get input model
00871       UINT16 GetInputModel (
00872          ) const {                       
00873          return (TransGenGetInputModel(&m_transparm));
00874          }
00875 
00876       //! Get input transformation as affine.
00877       ERRVALUE GetInputTrans (
00878          TRANS2D_AFFINE& trans            //!< Affine transformation
00879          ) { return (TransGenGetInputTransAffine(&m_transparm,trans.m_fwd,trans.m_inv)); }
00880 
00881       //! Get input transformation as affine.
00882       ERRVALUE GetInputTrans (
00883          MAT3X3 fwd,
00884          MAT3X3 inv
00885          ) { return (TransGenGetInputTransAffine(&m_transparm,fwd,inv)); }
00886 
00887       //! Get input transformation as control points.
00888       //! Will return number of points if any or error
00889       int GetInputTrans (
00890          CTRLPOINT3 **ctrlpoint           
00891          ) { return (TransGenGetInputTransCtrlPoint(&m_transparm, ctrlpoint)); }
00892 
00893       //! Get local affine transformation.
00894       ERRVALUE GetLocalAffine (
00895          const DPOINT2D& point,
00896          MAT3X3 fwd,                      //!< Forward transformation
00897          MAT3X3 inv,                      //!< Inverse transformation
00898          double size = 1.0,
00899          UINT32 flags = 0
00900          ) { return (TransGenGetAffineLocal(&m_transparm, &point, size, fwd, inv, flags)); }
00901 
00902       //! Get local affine transformation.
00903       ERRVALUE GetLocalAffine (
00904          const DPOINT2D& point,
00905          TRANS2D_AFFINE& trans,           //!< Affine transformation
00906          double size = 1.0,
00907          UINT32 flags = 0
00908          ) { return (TransGenGetAffineLocal(&m_transparm, &point, size, trans.m_fwd, trans.m_inv, flags)); }
00909 
00910       //! Get 'output' map coordinate reference system.
00911       const SPATREF::COORDREFSYS& GetOutputMapCoordRefSys (
00912          ) const { return (TransGenGetOutputMapCoordRefSys(m_transparm)); }
00913 
00914       //! Get output model
00915       UINT16 GetOutputModel (
00916          ) const {                       
00917          return (TransGenGetOutputModel(&m_transparm));
00918          }
00919 
00920       //! Get output transformation as affine.
00921       ERRVALUE GetOutputTrans (
00922          TRANS2D_AFFINE& trans            //!< Affine transformation
00923          ) { return (TransGenGetOutputTransAffine(&m_transparm,trans.m_fwd,trans.m_inv)); }
00924 
00925       //! Get output transformation as affine.
00926       ERRVALUE GetOutputTrans (
00927          MAT3X3 fwd,
00928          MAT3X3 inv
00929          ) { return (TransGenGetOutputTransAffine(&m_transparm,fwd,inv)); }
00930 
00931       //! Get output transformation as control points.
00932       //! Will return number of points if any or error
00933       int GetOutputTrans (
00934          CTRLPOINT3 **ctrlpoint           
00935          ) { return (TransGenGetOutputTransCtrlPoint(&m_transparm, ctrlpoint)); }
00936 
00937       const TRANSPARM& GetTransParm (
00938          ) const { return (m_transparm); }
00939 
00940       //! Determine if transformation is "affine".
00941       bool IsAffine (
00942          ) const { return (TransGenIsAffine(&m_transparm)); }
00943 
00944       //! Determine if transformation is "identity".
00945       bool IsIdentity (
00946          ) const { return (TransGenIsIdentity(&m_transparm)); }
00947 
00948       //! Determine if 'input' transformation is 'identity'.
00949       bool IsInputTransIdentity (
00950          ) const { return (TransGenIsInputTransIdentity(&m_transparm)); }
00951 
00952       //! Determine if 'output' transformation is 'identity'.
00953       bool IsOutputTransIdentity (
00954          ) const { return (TransGenIsOutputTransIdentity(&m_transparm)); }
00955 
00956       //! Determine if transformation is "reversible".
00957       bool IsReversible (
00958          ) const { return (TransGenIsReversible(&m_transparm)); }
00959 
00960    #ifndef DEPRECATE_ALL
00961       //! Read georeference from RVC object.
00962       ERRVALUE ReadGeoreference (
00963          int fhandle,                     //!< Open RVC file hadnle
00964          RVCINODENUM inode,               //!< Georeference object inode
00965          bool dooutput = false            //!< Use "output" side of transformation
00966          ) {
00967          #ifdef WIN32
00968          #pragma warning (disable:4996)   // Disable warning about deprecated declaration within header
00969          #endif
00970          return (MfReadGeorefTransParm(fhandle,inode,0,&m_transparm,(dooutput)?RVCGREF_TransGenOutput:0));
00971          #ifdef WIN32
00972          #pragma warning (default:4996)
00973          #endif
00974          }
00975    #endif
00976 
00977       //! Set full transformation to approximated affine if within specified tolerance.
00978       //! The approximate affine transformation will be retained until the next "Set" method is used
00979       //! at which time the transformation will revert to its "exact" mode (which may also be affine).
00980       ERRVALUE SetAffineApproximation (
00981          const DRECT2D& rect,             //!< Rectangle over which transformation is to be used
00982          double tolerance,                //!< Tolerance in opposite coordinates from rectangle
00983          UINT32 coord                     //!< Coordinates of rectangle (XXX change to enum)
00984          ) { return (TransGenSetAffineApprox(&m_transparm,&rect,tolerance,static_cast<UINT32>(coord))); }
00985 
00986       //! Set whether to perform extrapolation outside specified bounds.
00987       //! If extrapolation is not enabled then an exception -may- occur if and attempt is made
00988       //! to convert points outside the previously-specified input/output bounds.  This is the
00989       //! default condition and will generally be much faster than extrapolating.
00990       void SetExtrapolation (
00991          bool extrapolate                 //!< Perform extrapolation if true, don't extrapolate if false
00992          ) { TransGenSetExtrapOutside(&m_transparm,extrapolate); }
00993 
00994       //! Set entire transformation as affine.
00995       void SetFullTransAffine (
00996          const TRANS2D_AFFINE& trans      //!< Affine transformation
00997          ) { TransGenSetFullTransAffine(&m_transparm,trans.m_fwd,trans.m_inv); }
00998 
00999       //! Set boundaries for valid transformation in input coordinates
01000       ERRVALUE SetInputBounds (
01001          const DRECT2D& boundrect         //!< Bounding rectangle in input coordinates
01002          ) { return (TransGenSetInputBound(&m_transparm,&boundrect)); }
01003 
01004       //! Set maximum error for point densification in input coordinates.
01005       void SetInputMaxError (
01006          double maxerror                  //!< Maximum error value to set
01007          ) {
01008          TransGenSetInputInsertMaxError(&m_transparm,maxerror);
01009          TransGenSetDoInsert(&m_transparm,1);
01010          }
01011 
01012       //! Set input map coordinate reference system.
01013       ERRVALUE SetInputMapCoordRefSys (
01014          const SPATREF::COORDREFSYS& MapCRS  //!< Map coordinate reference system
01015          ) { return (TransGenSetInputMapCoordRefSys(m_transparm,MapCRS)); }
01016 
01017       //! Set input transformation as affine.
01018       void SetInputTrans (
01019          const TRANS2D_AFFINE& trans      //!< Affine transformation
01020          ) { TransGenSetInputTransAffine(&m_transparm,trans.m_fwd,trans.m_inv); }
01021 
01022       //! Set input transformation as affine.
01023       void SetInputTrans (
01024          const MAT3X3 fwd,                //!< Forward transformation
01025          const MAT3X3 inv                 //!< Inverse transformation
01026          ) { TransGenSetInputTransAffine(&m_transparm,fwd,inv); }
01027 
01028       //! Set input transformation from control point array.
01029       ERRVALUE SetInputTrans (
01030          const CTRLPOINT3 *CtrlPoint,     //!< Control point array
01031          INT32 NumPoints,                 //!< Number of control points
01032          UINT16 Model                     //!< Transformation model
01033          ) { return (TransGenSetInputTransCtrlPoint(&m_transparm,CtrlPoint,NumPoints,Model)); }
01034 
01035       //! Set input transformation to identity.
01036       void SetInputTransIdentity (
01037          ) { TransGenSetInputTransIdentity(&m_transparm); }
01038 
01039       //! Set maximum number of vertices to insert if densifying points
01040       void SetMaxVertices (
01041          INT32 MaxVertices
01042          ) { TransGenSetMaxInsertVertices(&m_transparm, MaxVertices); }
01043 
01044       //! Set boundaries for valid transformation in output coordinates.
01045       ERRVALUE SetOutputBounds (
01046          const DRECT2D& boundrect         //!< Bounding rectangle in output coordinates
01047          ) { return (TransGenSetOutputBound(&m_transparm,&boundrect)); }
01048 
01049       //! Set maximum error for point densification in output coordinates.
01050       void SetOutputMaxError (
01051          double maxerror                  //!< Maximum error value to set
01052          ) { 
01053          TransGenSetOutputInsertMaxError(&m_transparm,maxerror);
01054          TransGenSetDoInsert(&m_transparm,1);
01055          }
01056 
01057       //! Set output map coordinate reference system.
01058       ERRVALUE SetOutputMapCoordRefSys (
01059          const SPATREF::COORDREFSYS& MapCRS  //!< Map coordinate reference system
01060          ) { return (TransGenSetOutputMapCoordRefSys(m_transparm,MapCRS)); }
01061 
01062       //! Set output transformation as affine.
01063       void SetOutputTrans (
01064          const TRANS2D_AFFINE& trans      //!< Affine transformation
01065          ) { TransGenSetOutputTransAffine(&m_transparm,trans.m_fwd,trans.m_inv); }
01066 
01067       //! Set output transformation as affine.
01068       void SetOutputTrans (
01069          const MAT3X3 fwd,
01070          const MAT3X3 inv
01071          ) { TransGenSetOutputTransAffine(&m_transparm,fwd,inv); }
01072 
01073       //! Set output transformation from control point array.
01074       ERRVALUE SetOutputTrans (
01075          const CTRLPOINT3 *CtrlPoint,     //!< Control point array
01076          INT32 NumPoints,                 //!< Number of control points
01077          UINT16 Model                     //!< Transformation model
01078          ) { return (TransGenSetOutputTransCtrlPoint(&m_transparm,CtrlPoint,NumPoints,Model)); }
01079 
01080       //! Set output transformation to identity.
01081       void SetOutputTransIdentity (
01082          ) { TransGenSetOutputTransIdentity(&m_transparm); }
01083 
01084       //! Set primary transformation direction.
01085       //! The default transformation direction if not set explicitly is "forward".  This method
01086       //! is used in cases where the time to do a reverse transformation is much higher than in
01087       //! the primary direction.  This is commonly used for raster warping.
01088       void SetPrimaryDirection (
01089          DIRECTION direction              //!< DIRECTION_Forward or DIRECTION_Inverse
01090          ) { TransGenSetPrimaryDirection(&m_transparm,static_cast<UINT8>(direction)); }
01091 
01092       ERRVALUE Update (
01093          ) { return (TransGenUpdate(&m_transparm)); }
01094 
01095 
01096    private:
01097       #ifndef GENERATING_DOXYGEN_OUTPUT
01098       TRANSPARM m_transparm;
01099       #endif // GENERATING_DOXYGEN_OUTPUT
01100    };
01101 
01102 inline bool operator==(
01103    const TRANS2D_AFFINE& lhs,
01104    const TRANS2D_AFFINE& rhs
01105    ) { return (lhs.IsEqual(rhs)); }
01106 
01107 inline bool operator!=(
01108    const TRANS2D_AFFINE& lhs,
01109    const TRANS2D_AFFINE& rhs
01110    ) { return (!lhs.IsEqual(rhs)); }
01111 
01112 
01113 #endif   //!< INC_MI32_TRANS2DC_H

Generated on Wed May 31 15:27:12 2006 for TNTsdk by  doxygen 1.3.8-20040913