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
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 #ifndef INC_MI32_TRANS2DC_H
00101 #define INC_MI32_TRANS2DC_H
00102
00103 #ifndef INC_MI32_TRANS2D_H
00104 #include <mi32/trans2d.h>
00105 #endif
00106
00107 #ifndef INC_MI32_TRANSGEN_H
00108 #include <mi32/transgen.h>
00109 #endif
00110
00111 #ifndef INC_MI32_RECT_H
00112 #include <mi32/rect.h>
00113 #endif
00114
00115 #ifndef INC_MI32_MAPPROJ_H
00116 #include <mi32/mapproj.h>
00117 #endif
00118
00119 #ifndef INC_MI32_CTRLPT_H
00120 #include <mi32/ctrlpt.h>
00121 #endif
00122
00123 #ifndef INC_MI32_RVCGREF_H
00124 #include <mi32/rvcgref.h>
00125 #endif
00126
00127 #include <memory.h>
00128
00129
00130
00131 class TRANS2D_MAPGEN;
00132
00133
00134
00135
00136
00137
00138
00139 class TRANS2D_AFFINE {
00140
00141 public:
00142
00143 enum AXIS {
00144 AXIS_X = 0,
00145 AXIS_Y = 1
00146 };
00147
00148
00149 TRANS2D_AFFINE (
00150 ) { trans2dinit(m_fwd,m_inv); }
00151
00152
00153 TRANS2D_AFFINE (
00154 const TRANS2D_AFFINE& rhs
00155 ) {
00156 memcpy(m_fwd,rhs.m_fwd,sizeof(MAT3X3));
00157 memcpy(m_inv,rhs.m_inv,sizeof(MAT3X3));
00158 }
00159
00160
00161 TRANS2D_AFFINE (
00162 const MAT3X3 fwd,
00163 const MAT3X3 inv
00164 ) {
00165 memcpy(m_fwd,fwd,sizeof(MAT3X3));
00166 memcpy(m_inv,inv,sizeof(MAT3X3));
00167 }
00168
00169
00170 TRANS2D_AFFINE (
00171 const TRANS2D_AFFINE& trans1,
00172 const TRANS2D_AFFINE& trans2
00173 ) { trans2dmatrix2(m_fwd,m_inv,trans1.m_fwd,trans1.m_inv,trans2.m_fwd,trans2.m_inv); }
00174
00175
00176 TRANS2D_AFFINE (
00177 const CTRLPOINT *cp,
00178 int numpoints,
00179 bool invert = false
00180 ) { FindBestTrans2DA(numpoints,cp,m_fwd,m_inv,(invert)?TRANS2DMODEL_OrientInvert:0); }
00181
00182
00183 TRANS2D_AFFINE (
00184 const CTRLPOINT3 *cp,
00185 int numpoints,
00186 bool invert = false
00187 ) { FindBestTrans2D3A(numpoints,cp,m_fwd,m_inv,(invert)?TRANS2DMODEL_OrientInvert:0); }
00188
00189
00190 ~TRANS2D_AFFINE (
00191 ) {}
00192
00193
00194 TRANS2D_AFFINE& operator= (
00195 const TRANS2D_AFFINE& rhs
00196 ) {
00197 if (this != &rhs) {
00198 memcpy(m_fwd,rhs.m_fwd,sizeof(MAT3X3));
00199 memcpy(m_inv,rhs.m_inv,sizeof(MAT3X3));
00200 }
00201 return (*this);
00202 }
00203
00204
00205 void ApplyOffset (
00206 double xoffset,
00207 double yoffset
00208 ) { trans2dshift(m_fwd,m_inv,xoffset,yoffset); }
00209
00210
00211 void ApplyOffset (
00212 const DPOINT2D& offset
00213 ) { trans2dshift(m_fwd,m_inv,offset.x,offset.y); }
00214
00215
00216 void ApplyRotation (
00217 double angle
00218 ) { trans2drot(m_fwd,m_inv,angle); }
00219
00220
00221 void ApplyScale (
00222 double scale
00223 ) { trans2dscale(m_fwd,m_inv,scale,scale); }
00224
00225
00226 void ApplyScale (
00227 double xscale,
00228 double yscale
00229 ) { trans2dscale(m_fwd,m_inv,xscale,yscale); }
00230
00231
00232 void ApplyScale (
00233 const DPOINT2D &scale
00234 ) { trans2dscale(m_fwd,m_inv,scale.x,scale.y); }
00235
00236
00237 void ApplyShear (
00238 double angle,
00239 AXIS axis
00240 ) { trans2dshear(m_fwd,m_inv,angle,static_cast<int>(axis)); }
00241
00242
00243 void Combine (
00244 const TRANS2D_AFFINE& trans1
00245 ) {
00246 trans2dmatrix(m_fwd,trans1.m_fwd);
00247 trans2dmatrix(m_inv,trans1.m_inv);
00248 }
00249
00250
00251 void Combine (
00252 const TRANS2D_AFFINE& trans1,
00253 const TRANS2D_AFFINE& trans2
00254 ) { trans2dmatrix2(m_fwd,m_inv,trans1.m_fwd,trans1.m_inv,trans2.m_fwd,trans2.m_inv); }
00255
00256
00257
00258 DPOINT2D ConvertForward (
00259 double x,
00260 double y
00261 ) const { return (DPOINT2D(trans2dx(x,y,m_fwd),trans2dy(x,y,m_fwd))); }
00262
00263
00264 void ConvertForward (
00265 double x,
00266 double y,
00267 double& ox,
00268 double& oy
00269 ) const { ox = trans2dx(x,y,m_fwd); oy = trans2dy(x,y,m_fwd); }
00270
00271
00272
00273 DPOINT2D ConvertForward (
00274 const DPOINT2D& ipoint
00275 ) const { return (DPOINT2D(trans2dx(ipoint.x,ipoint.y,m_fwd),trans2dy(ipoint.x,ipoint.y,m_fwd))); }
00276
00277
00278
00279 DPOINT3D ConvertForward (
00280 const DPOINT3D& ipoint
00281 ) const { return (DPOINT3D(trans2dx(ipoint.x,ipoint.y,m_fwd),trans2dy(ipoint.x,ipoint.y,m_fwd),ipoint.z)); }
00282
00283
00284 void ConvertForward (
00285 const DPOINT2D* ipoints,
00286 DPOINT2D* opoints,
00287 INT32 NumPoints
00288 ) const {
00289 for (int i = 0; (i < NumPoints); ++i) {
00290 opoints[i] = ConvertForward(ipoints[i]);
00291 }
00292 }
00293
00294
00295 void ConvertForward (
00296 const DPOINT3D* ipoints,
00297 DPOINT3D* opoints,
00298 INT32 NumPoints
00299 ) const {
00300 for (int i = 0; (i < NumPoints); ++i) {
00301 opoints[i] = ConvertForward(ipoints[i]);
00302 }
00303 }
00304
00305
00306
00307 DRECT2D ConvertForward (
00308 const DRECT2D& irect
00309 ) const {
00310 DRECT2D orect;
00311 Trans2DRect(m_fwd,&irect,&orect);
00312 return (orect);
00313 }
00314
00315
00316 void ConvertForward (
00317 const DRECT2D& irect,
00318 DRECT2D& orect
00319 ) const { Trans2DRect(m_fwd,&irect,&orect); }
00320
00321
00322
00323 DPOINT2D ConvertInverse (
00324 double x,
00325 double y
00326 ) const { return (DPOINT2D(trans2dx(x,y,m_inv),trans2dy(x,y,m_inv))); }
00327
00328
00329
00330 DPOINT2D ConvertInverse (
00331 const DPOINT2D& ipoint
00332 ) const { return (DPOINT2D(trans2dx(ipoint.x,ipoint.y,m_inv),trans2dy(ipoint.x,ipoint.y,m_inv))); }
00333
00334
00335
00336 DPOINT3D ConvertInverse (
00337 const DPOINT3D& ipoint
00338 ) const { return (DPOINT3D(trans2dx(ipoint.x,ipoint.y,m_inv),trans2dy(ipoint.x,ipoint.y,m_inv),ipoint.z)); }
00339
00340
00341 void ConvertInverse (
00342 const DPOINT2D* ipoints,
00343 DPOINT2D* opoints,
00344 INT32 NumPoints
00345 ) const {
00346 for (int i = 0; (i < NumPoints); ++i) {
00347 opoints[i] = ConvertInverse(ipoints[i]);
00348 }
00349 }
00350
00351
00352 void ConvertInverse (
00353 const DPOINT3D* ipoints,
00354 DPOINT3D* opoints,
00355 INT32 NumPoints
00356 ) const {
00357 for (int i = 0; (i < NumPoints); ++i) {
00358 opoints[i] = ConvertInverse(ipoints[i]);
00359 }
00360 }
00361
00362
00363
00364 DRECT2D ConvertInverse (
00365 const DRECT2D& irect
00366 ) const {
00367 DRECT2D orect;
00368 Trans2DRect(m_inv,&irect,&orect);
00369 return (orect);
00370 }
00371
00372
00373 void ConvertInverse (
00374 const DRECT2D& irect,
00375 DRECT2D& orect
00376 ) const { Trans2DRect(m_inv,&irect,&orect); }
00377
00378
00379 void DisectForward (
00380 double *xscale,
00381 double *yscale,
00382 double *rotangle = 0,
00383 double *shearangle = 0
00384 ) const { DisectTrans2D(m_fwd,xscale,yscale,rotangle,shearangle); }
00385
00386
00387 void DisectInverse (
00388 double *xscale,
00389 double *yscale,
00390 double *rotangle = 0,
00391 double *shearangle = 0
00392 ) const { DisectTrans2D(m_inv,xscale,yscale,rotangle,shearangle); }
00393
00394
00395 void GetMatrices (
00396 MAT3X3 fwd,
00397 MAT3X3 inv
00398 ) const { memcpy(fwd,m_fwd,sizeof(MAT3X3)); memcpy(inv,m_inv,sizeof(MAT3X3)); }
00399
00400
00401 void ReverseDirection (
00402 ) {
00403 MAT3X3 temp;
00404 memcpy(temp,m_fwd,sizeof(MAT3X3));
00405 memcpy(m_fwd,m_inv,sizeof(MAT3X3));
00406 memcpy(m_inv,temp,sizeof(MAT3X3));
00407 }
00408
00409
00410 void SetCtrlPoint (
00411 const CTRLPOINT *cp,
00412 int numpoints,
00413 bool invert = false
00414 ) { FindBestTrans2DA(numpoints,cp,m_fwd,m_inv,(invert)?TRANS2DMODEL_OrientInvert:0); }
00415
00416
00417 void SetCtrlPoint (
00418 const CTRLPOINT3 *cp,
00419 int numpoints,
00420 bool invert = false
00421 ) { FindBestTrans2D3A(numpoints,cp,m_fwd,m_inv,(invert)?TRANS2DMODEL_OrientInvert:0); }
00422
00423
00424 void SetIdentity (
00425 ) { trans2dinit(m_fwd,m_inv); }
00426
00427
00428 void SetMatrices (
00429 const MAT3X3 fwd,
00430 const MAT3X3 inv
00431 ) { memcpy(m_fwd,fwd,sizeof(MAT3X3)); memcpy(m_inv,inv,sizeof(MAT3X3)); }
00432
00433 private:
00434 #ifndef GENERATING_DOXYGEN_OUTPUT
00435 MAT3X3 m_fwd;
00436 MAT3X3 m_inv;
00437
00438 friend class TRANS2D_MAPGEN;
00439 #endif // GENERATING_DOXYGEN_OUTPUT
00440 };
00441
00442
00443
00444
00445
00446
00447
00448
00449 class TRANS2D_CARTO {
00450 public:
00451
00452
00453
00454 TRANS2D_CARTO (
00455 ) {
00456 m_gctph = gctpAlloc();
00457 }
00458
00459
00460 TRANS2D_CARTO (
00461 const TRANS2D_CARTO& rhs
00462 ) {
00463 m_gctph = gctpAlloc();
00464 gctpCopy(m_gctph,rhs.m_gctph);
00465 }
00466
00467
00468 TRANS2D_CARTO (
00469 const MAPPROJPARM& projparm
00470 ) {
00471 m_gctph = gctpAlloc();
00472 gctpSetParm(m_gctph,&projparm);
00473 }
00474
00475
00476 ~TRANS2D_CARTO (
00477 ) {
00478 gctpFree(m_gctph);
00479 }
00480
00481
00482
00483
00484 TRANS2D_CARTO& operator= (
00485 const TRANS2D_CARTO& rhs
00486 ) {
00487 if (this != &rhs) {
00488 gctpCopy(m_gctph,rhs.m_gctph);
00489 }
00490 return (*this);
00491 }
00492
00493
00494 TRANS2D_CARTO& operator= (
00495 const MAPPROJPARM& rhs
00496 ) {
00497 gctpSetParm(m_gctph,&rhs);
00498 return (*this);
00499 }
00500
00501
00502
00503
00504 ERRVALUE Convert (
00505 const TRANS2D_CARTO& ocarto,
00506 const DPOINT2D& ipoint,
00507 DPOINT2D& opoint
00508 ) const {
00509 return (gctpConvert(m_gctph,&ipoint,ocarto.m_gctph,&opoint,1));
00510 }
00511
00512
00513 ERRVALUE Convert (
00514 const TRANS2D_CARTO& ocarto,
00515 const DPOINT3D& ipoint,
00516 DPOINT3D& opoint
00517 ) const {
00518 return (gctpConvertND(m_gctph,reinterpret_cast<const void*>(&ipoint),ocarto.m_gctph,reinterpret_cast<void*>(&opoint),1,3));
00519 }
00520
00521
00522 ERRVALUE Convert (
00523 const TRANS2D_CARTO& ocarto,
00524 const DPOINT2D *ipoints,
00525 DPOINT2D *opoints,
00526 INT32 NumPoints
00527 ) const {
00528 return (gctpConvert(m_gctph,ipoints,ocarto.m_gctph,opoints,NumPoints));
00529 }
00530
00531
00532 ERRVALUE Convert (
00533 const TRANS2D_CARTO& ocarto,
00534 const DPOINT3D *ipoints,
00535 DPOINT3D *opoints,
00536 INT32 NumPoints
00537 ) const {
00538 return (gctpConvertND(m_gctph,reinterpret_cast<const void*>(ipoints),ocarto.m_gctph,reinterpret_cast<void*>(opoints),NumPoints,3));
00539 }
00540
00541
00542 ERRVALUE ConvertLatLonToProj (
00543 const DPOINT2D& ipoint,
00544 DPOINT2D& opoint
00545 ) const {
00546 return (gctpConvertLatLonToProj(m_gctph,&ipoint,&opoint,1));
00547 }
00548
00549
00550 ERRVALUE ConvertLatLonToProj (
00551 const DPOINT2D *ipoints,
00552 DPOINT2D *opoints,
00553 INT32 NumPoints
00554 ) const {
00555 return (gctpConvertLatLonToProj(m_gctph,ipoints,opoints,NumPoints));
00556 }
00557
00558
00559 ERRVALUE ConvertProjToLatLon (
00560 const DPOINT2D& ipoint,
00561 DPOINT2D& opoint
00562 ) const {
00563 return (gctpConvertProjToLatLon(m_gctph,&ipoint,&opoint,1));
00564 }
00565
00566
00567 ERRVALUE ConvertProjToLatLon (
00568 const DPOINT2D *ipoints,
00569 DPOINT2D *opoints,
00570 INT32 NumPoints
00571 ) const {
00572 return (gctpConvertProjToLatLon(m_gctph,ipoints,opoints,NumPoints));
00573 }
00574
00575
00576 double GetAngleToNorth (
00577 double x,
00578 double y
00579 ) const {
00580 double angle;
00581 if (gctpAngleToNorth(m_gctph,x,y,&angle) < 0) return (0.0);
00582 return (angle);
00583 }
00584
00585
00586 double GetAngleToNorth (
00587 const DPOINT2D& point
00588 ) const {
00589 return (GetAngleToNorth(point.x,point.y));
00590 }
00591
00592
00593 const MAPPROJPARM& GetProjection (
00594 ) const {
00595 MAPPROJPARM *projparm = gctpGetParm(m_gctph,0);
00596 return (*projparm);
00597 }
00598
00599 protected:
00600
00601 private:
00602 #ifndef GENERATING_DOXYGEN_OUTPUT
00603 void *m_gctph;
00604
00605 friend bool operator== (const TRANS2D_CARTO&, const TRANS2D_CARTO&);
00606 #endif // GENERATING_DOXYGEN_OUTPUT
00607 };
00608
00609
00610 inline bool operator== (
00611 const TRANS2D_CARTO& lhs,
00612 const TRANS2D_CARTO& rhs
00613 ) {
00614 return (!gctpCompare(lhs.m_gctph,rhs.m_gctph));
00615 }
00616
00617
00618 inline bool operator!= (
00619 const TRANS2D_CARTO& lhs,
00620 const TRANS2D_CARTO& rhs
00621 ) {
00622 return (!operator==(lhs,rhs));
00623 }
00624
00625
00626
00627
00628
00629
00630
00631 class TRANS2D_MAPGEN {
00632 public:
00633
00634
00635 enum DIRECTION {
00636 DIRECTION_Forward = TRANSDIR_Forward,
00637 DIRECTION_Inverse = TRANSDIR_Inverse
00638 };
00639
00640
00641 TRANS2D_MAPGEN (
00642 ) { TransGenInit(&m_transparm); }
00643
00644
00645 TRANS2D_MAPGEN (
00646 const TRANS2D_MAPGEN &rhs
00647 ) {
00648 TransGenInit(&m_transparm);
00649 TransGenCopy(&m_transparm,&rhs.m_transparm);
00650 }
00651
00652
00653 TRANS2D_MAPGEN (
00654 const TRANSPARM& transparm
00655 ) {
00656 TransGenInit(&m_transparm);
00657 TransGenCopy(&m_transparm,&transparm);
00658 }
00659
00660
00661 ~TRANS2D_MAPGEN (
00662 ) { TransGenFreeParm(&m_transparm); }
00663
00664
00665 TRANS2D_MAPGEN& operator= (
00666 const TRANS2D_MAPGEN &rhs
00667 ) {
00668 if (this != &rhs) {
00669 TransGenCopy(&m_transparm,&rhs.m_transparm);
00670 }
00671 return (*this);
00672 }
00673
00674
00675 TRANS2D_MAPGEN& operator= (
00676 const TRANSPARM &rhs
00677 ) {
00678 TransGenCopy(&m_transparm,&rhs);
00679 return (*this);
00680 }
00681
00682
00683 operator const TRANSPARM* (
00684 ) const { return (&m_transparm); }
00685
00686 void Clear (
00687 ) { TransGenFreeParm(&m_transparm); TransGenInit(&m_transparm); }
00688
00689
00690 ERRVALUE ConvertForward (
00691 const DPOINT2D& ipoint,
00692 DPOINT2D& opoint
00693 ) const { return (TransGenConvPointFwd(&m_transparm,&ipoint,&opoint)); }
00694
00695
00696 ERRVALUE ConvertForward (
00697 const DPOINT3D& ipoint,
00698 DPOINT3D& opoint
00699 ) const { opoint.z = ipoint.z; return (TransGenConvPointFwd(&m_transparm,reinterpret_cast<const DPOINT2D*>(&ipoint),reinterpret_cast<DPOINT2D*>(&opoint))); }
00700
00701
00702 ERRVALUE ConvertForward (
00703 const DPOINT2D* ipoints,
00704 DPOINT2D* opoints,
00705 INT32 NumPoints
00706 ) const { return (TransGenConvPointSetFwd(&m_transparm,reinterpret_cast<const double*>(ipoints),NumPoints,2,reinterpret_cast<double*>(opoints))); }
00707
00708
00709 ERRVALUE ConvertForward (
00710 const DPOINT3D* ipoints,
00711 DPOINT3D* opoints,
00712 INT32 NumPoints
00713 ) const { return (TransGenConvPointSetFwd(&m_transparm,reinterpret_cast<const double*>(ipoints),NumPoints,3,reinterpret_cast<double*>(opoints))); }
00714
00715
00716 ERRVALUE ConvertForward (
00717 const void* ipoints,
00718 void* opoints,
00719 INT32 NumPoints,
00720 int NumDim
00721 ) const { return (TransGenConvPointSetFwd(&m_transparm,reinterpret_cast<const double*>(ipoints),NumPoints,NumDim,reinterpret_cast<double*>(opoints))); }
00722
00723
00724 ERRVALUE ConvertForward (
00725 const DRECT2D& irect,
00726 DRECT2D& orect,
00727 int sidepoints=0
00728 ) const { return (TransGenConvRectFwd(&m_transparm,&irect,&orect,sidepoints)); }
00729
00730
00731 INT32 ConvertForwardDense (
00732 const DPOINT2D* ipoint,
00733 INT32 iNumPoints,
00734 DPOINT2D** opoint
00735 ) const {
00736 INT32 oNumPoints;
00737 int err;
00738 if ((err = TransGenConvPointsFwd(&m_transparm,reinterpret_cast<const double*>(ipoint),iNumPoints,2,reinterpret_cast<double**>(opoint),&oNumPoints)) < 0) return (err);
00739 return (oNumPoints);
00740 }
00741
00742
00743 INT32 ConvertForwardDense (
00744 const DPOINT3D* ipoint,
00745 INT32 iNumPoints,
00746 DPOINT3D** opoint
00747 ) const {
00748 INT32 oNumPoints;
00749 int err;
00750 if ((err = TransGenConvPointsFwd(&m_transparm,reinterpret_cast<const double*>(ipoint),iNumPoints,3,reinterpret_cast<double**>(opoint),&oNumPoints)) < 0) return (err);
00751 return (oNumPoints);
00752 }
00753
00754
00755 ERRVALUE ConvertInputToMap (
00756 const DPOINT2D& ipoint,
00757 DPOINT2D& opoint
00758 ) const { return (TransGenConvPointInputToMap(&m_transparm,&ipoint,&opoint)); }
00759
00760
00761 ERRVALUE ConvertInverse (
00762 const DPOINT2D& ipoint,
00763 DPOINT2D& opoint
00764 ) const { return (TransGenConvPointInv(&m_transparm,&ipoint,&opoint)); }
00765
00766
00767 ERRVALUE ConvertInverse (
00768 const DPOINT3D& ipoint,
00769 DPOINT3D& opoint
00770 ) const { opoint.z = ipoint.z; return (TransGenConvPointInv(&m_transparm,reinterpret_cast<const DPOINT2D*>(&ipoint),reinterpret_cast<DPOINT2D*>(&opoint))); }
00771
00772
00773 ERRVALUE ConvertInverse (
00774 const DPOINT2D* ipoints,
00775 DPOINT2D* opoints,
00776 INT32 NumPoints
00777 ) const { return (TransGenConvPointSetInv(&m_transparm,reinterpret_cast<const double*>(ipoints),NumPoints,2,reinterpret_cast<double*>(opoints))); }
00778
00779
00780 ERRVALUE ConvertInverse (
00781 const DPOINT3D* ipoints,
00782 DPOINT3D* opoints,
00783 INT32 NumPoints
00784 ) const { return (TransGenConvPointSetInv(&m_transparm,reinterpret_cast<const double*>(ipoints),NumPoints,3,reinterpret_cast<double*>(opoints))); }
00785
00786
00787 ERRVALUE ConvertInverse (
00788 const void* ipoints,
00789 void* opoints,
00790 INT32 NumPoints,
00791 int NumDim
00792 ) const { return (TransGenConvPointSetInv(&m_transparm,reinterpret_cast<const double*>(ipoints),NumPoints,NumDim,reinterpret_cast<double*>(opoints))); }
00793
00794
00795 ERRVALUE ConvertInverse (
00796 const DRECT2D& irect,
00797 DRECT2D& orect,
00798 int sidepoints=0
00799 ) const { return (TransGenConvRectInv(&m_transparm,&irect,&orect,sidepoints)); }
00800
00801
00802 INT32 ConvertInverseDense (
00803 const DPOINT2D* ipoint,
00804 INT32 iNumPoints,
00805 DPOINT2D** opoint
00806 ) const {
00807 INT32 oNumPoints;
00808 int err;
00809 if ((err = TransGenConvPointsInv(&m_transparm,reinterpret_cast<const double*>(ipoint),iNumPoints,2,reinterpret_cast<double**>(opoint),&oNumPoints)) < 0) return (err);
00810 return (oNumPoints);
00811 }
00812
00813
00814 INT32 ConvertInverseDense (
00815 const DPOINT3D* ipoint,
00816 INT32 iNumPoints,
00817 DPOINT3D** opoint
00818 ) const {
00819 INT32 oNumPoints;
00820 int err;
00821 if ((err = TransGenConvPointsInv(&m_transparm,reinterpret_cast<const double*>(ipoint),iNumPoints,3,reinterpret_cast<double**>(opoint),&oNumPoints)) < 0) return (err);
00822 return (oNumPoints);
00823 }
00824
00825
00826 ERRVALUE ConvertMapToInput (
00827 const DPOINT2D& ipoint,
00828 DPOINT2D& opoint
00829 ) const { return (TransGenConvPointMapToInput(&m_transparm,&ipoint,&opoint)); }
00830
00831
00832 ERRVALUE ConvertMapToMapForward (
00833 const DPOINT2D& ipoint,
00834 DPOINT2D& opoint
00835 ) const { return (TransGenConvPointMapToMapFwd(&m_transparm,&ipoint,&opoint)); }
00836
00837
00838 ERRVALUE ConvertMapToMapInverse (
00839 const DPOINT2D& ipoint,
00840 DPOINT2D& opoint
00841 ) const { return (TransGenConvPointMapToMapInv(&m_transparm,&ipoint,&opoint)); }
00842
00843
00844 ERRVALUE ConvertMapToOutput (
00845 const DPOINT2D& ipoint,
00846 DPOINT2D& opoint
00847 ) const { return (TransGenConvPointMapToOutput(&m_transparm,&ipoint,&opoint)); }
00848
00849
00850 ERRVALUE ConvertOutputToMap (
00851 const DPOINT2D& ipoint,
00852 DPOINT2D& opoint
00853 ) const { return (TransGenConvPointOutputToMap(&m_transparm,&ipoint,&opoint)); }
00854
00855
00856 void CopyInputToInput (
00857 const TRANSPARM& transparm
00858 ) {
00859 int err;
00860 if ((err = TransGenCopyInputParms(&m_transparm,&transparm)) < 0) {
00861
00862 }
00863 return;
00864 }
00865
00866
00867 void CopyInputToInput (
00868 const TRANS2D_MAPGEN& itrans
00869 ) {
00870 CopyInputToInput(itrans.m_transparm);
00871 return;
00872 }
00873
00874
00875 void CopyInputToOutput (
00876 const TRANSPARM& transparm
00877 ) {
00878 int err;
00879 if ((err = TransGenCopyInputToOutput(&m_transparm,&transparm)) < 0) {
00880
00881 }
00882 return;
00883 }
00884
00885
00886 void CopyInputToOutput (
00887 const TRANS2D_MAPGEN& itrans
00888 ) {
00889 CopyInputToOutput(itrans.m_transparm);
00890 return;
00891 }
00892
00893
00894 void CopyOutputToInput (
00895 const TRANSPARM& transparm
00896 ) {
00897 int err;
00898 if ((err = TransGenCopyOutputToInput(&m_transparm,&transparm)) < 0) {
00899
00900 }
00901 return;
00902 }
00903
00904
00905 void CopyOutputToInput (
00906 const TRANS2D_MAPGEN& itrans
00907 ) {
00908 CopyOutputToInput(itrans.m_transparm);
00909 return;
00910 }
00911
00912
00913 void CopyOutputToOutput (
00914 const TRANSPARM& transparm
00915 ) {
00916 int err;
00917 if ((err = TransGenCopyOutputParms(&m_transparm,&transparm)) < 0) {
00918
00919 }
00920 return;
00921 }
00922
00923
00924 void CopyOutputToOutput (
00925 const TRANS2D_MAPGEN& itrans
00926 ) {
00927 CopyOutputToOutput(itrans.m_transparm);
00928 return;
00929 }
00930
00931
00932 ERRVALUE DisectForward (
00933 const DPOINT2D& point,
00934 double *xscale,
00935 double *yscale,
00936 double *rotangle = 0,
00937 double *shearangle = 0,
00938 double size = 1.0
00939 ) const {
00940 return (TransGenDisectFwd(&m_transparm,&point,size,xscale,yscale,rotangle,shearangle));
00941 }
00942
00943
00944 ERRVALUE DisectInverse (
00945 const DPOINT2D& point,
00946 double *xscale,
00947 double *yscale,
00948 double *rotangle = 0,
00949 double *shearangle = 0,
00950 double size = 1.0
00951 ) const {
00952 return (TransGenDisectInv(&m_transparm,&point,size,xscale,yscale,rotangle,shearangle));
00953 }
00954
00955
00956
00957 ERRVALUE GetAffine (
00958 MAT3X3 fwd,
00959 MAT3X3 inv
00960 ) const { return (TransGenGetAffine(&m_transparm, fwd, inv)); }
00961
00962
00963
00964 ERRVALUE GetAffine (
00965 TRANS2D_AFFINE& trans
00966 ) const { return (TransGenGetAffine(&m_transparm, trans.m_fwd, trans.m_inv)); }
00967
00968
00969 MAPPROJPARM GetInputProjection (
00970 ) const {
00971 MAPPROJPARM projparm;
00972 TransGenGetInputProj(&m_transparm,&projparm);
00973 return (projparm);
00974 }
00975
00976
00977 void GetInputTrans (
00978 TRANS2D_AFFINE& trans
00979 ) { TransGenGetInputTransAffine(&m_transparm,trans.m_fwd,trans.m_inv); }
00980
00981
00982 void GetInputTrans (
00983 MAT3X3 fwd,
00984 MAT3X3 inv
00985 ) { TransGenGetInputTransAffine(&m_transparm,fwd,inv); }
00986
00987
00988 ERRVALUE GetLocalAffine (
00989 const DPOINT2D& point,
00990 MAT3X3 fwd,
00991 MAT3X3 inv,
00992 double size = 1.0,
00993 UINT32 flags = 0
00994 ) { return (TransGenGetAffineLocal(&m_transparm, &point, size, fwd, inv, flags)); }
00995
00996
00997 ERRVALUE GetLocalAffine (
00998 const DPOINT2D& point,
00999 TRANS2D_AFFINE& trans,
01000 double size = 1.0,
01001 UINT32 flags = 0
01002 ) { return (TransGenGetAffineLocal(&m_transparm, &point, size, trans.m_fwd, trans.m_inv, flags)); }
01003
01004
01005 MAPPROJPARM GetOutputProjection (
01006 ) const {
01007 MAPPROJPARM projparm;
01008 TransGenGetOutputProj(&m_transparm,&projparm);
01009 return (projparm);
01010 }
01011
01012
01013 void GetOutputTrans (
01014 TRANS2D_AFFINE& trans
01015 ) { TransGenGetOutputTransAffine(&m_transparm,trans.m_fwd,trans.m_inv); }
01016
01017
01018 void GetOutputTrans (
01019 MAT3X3 fwd,
01020 MAT3X3 inv
01021 ) {
01022 TransGenGetOutputTransAffine(&m_transparm,fwd,inv);
01023 return;
01024 }
01025
01026 const TRANSPARM& GetTransParm (
01027 ) const {
01028 return (m_transparm);
01029 }
01030
01031
01032 bool IsAffine (
01033 ) const {
01034 return (TransGenIsAffine(&m_transparm));
01035 }
01036
01037
01038 bool IsIdentity (
01039 ) const {
01040 return (TransGenIsIdentity(&m_transparm));
01041 }
01042
01043
01044 bool IsReversible (
01045 ) const {
01046 return (TransGenIsReversible(&m_transparm));
01047 }
01048
01049
01050 ERRVALUE ReadGeoreference (
01051 int fhandle,
01052 RVCINODENUM inode,
01053 bool dooutput = false
01054 ) {
01055 return (MfReadGeorefTransParm(fhandle,inode,0,&m_transparm,(dooutput)?RVCGREF_TransGenOutput:0));
01056 }
01057
01058
01059
01060
01061 void SetAffineApproximation (
01062 const DRECT2D& rect,
01063 double tolerance,
01064 UINT32 coord
01065 ) {
01066 int err;
01067 if ((err = TransGenSetAffineApprox(&m_transparm,&rect,tolerance,static_cast<UINT32>(coord))) < 0) {
01068
01069 }
01070 return;
01071 }
01072
01073
01074
01075
01076
01077 void SetExtrapolation (
01078 bool extrapolate
01079 ) { TransGenSetExtrapOutside(&m_transparm,extrapolate); }
01080
01081
01082 void SetFullTransAffine (
01083 const TRANS2D_AFFINE& trans
01084 ) { TransGenSetFullTransAffine(&m_transparm,trans.m_fwd,trans.m_inv); }
01085
01086
01087 ERRVALUE SetInputBounds (
01088 const DRECT2D& boundrect
01089 ) { return (TransGenSetInputBound(&m_transparm,&boundrect)); }
01090
01091
01092 void SetInputMaxError (
01093 double maxerror
01094 ) {
01095 TransGenSetInputInsertMaxError(&m_transparm,maxerror);
01096 Tra