OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Public Attributes | Private Types | Private Member Functions | Friends | List of all members
ossimImageRenderer::ossimRendererSubRectInfo Class Reference

Public Member Functions

 ossimRendererSubRectInfo (ossimImageViewTransform *transform=0)
 
 ossimRendererSubRectInfo (ossimImageViewTransform *transform, const ossimDpt &vul, const ossimDpt &vur, const ossimDpt &vlr, const ossimDpt &vll)
 
bool imageHasNans () const
 
bool imageIsNan () const
 
bool viewHasNans () const
 
bool viewIsNan () const
 
void splitView (std::vector< ossimRendererSubRectInfo > &result) const
 
void transformViewToImage ()
 
void transformImageToView ()
 
bool tooBig () const
 
void roundToInteger ()
 
void stretchImageOut (bool enableRound=false)
 
ossimDrect getViewRect () const
 
ossimDrect getImageRect () const
 
void roundImageToInteger ()
 
void roundViewToInteger ()
 
bool isViewEqual (const ossimRendererSubRectInfo &infoRect) const
 
bool isViewEqual (const ossimDrect &viewRect) const
 
ossimDpt computeViewToImageScale (const ossimDpt &viewPt, const ossimDpt &delta=ossimDpt(1.0, 1.0)) const
 
ossimDpt getAbsValueViewToImageScales () const
 
ossimDpt getAbsValueImageToViewScales () const
 
ossimDpt computeRoundTripErrorViewPt (const ossimDpt &dpt) const
 
bool isViewAPoint () const
 
bool isIdentity () const
 
bool canBilinearInterpolate (double error) const
 
ossimDpt getParametricCenter (const ossimDpt &ul, const ossimDpt &ur, const ossimDpt &lr, const ossimDpt &ll) const
 
void getViewMids (ossimDpt &upperMid, ossimDpt &rightMid, ossimDpt &bottomMid, ossimDpt &leftMid, ossimDpt &center) const
 
void getImageMids (ossimDpt &upperMid, ossimDpt &rightMid, ossimDpt &bottomMid, ossimDpt &leftMid, ossimDpt &center) const
 
ossim_uint16 getSplitFlags () const
 

Public Attributes

ossimDpt m_Iul
 
ossimDpt m_Iur
 
ossimDpt m_Ilr
 
ossimDpt m_Ill
 
ossimIpt m_Vul
 
ossimIpt m_Vur
 
ossimIpt m_Vlr
 
ossimIpt m_Vll
 
ossimDpt m_ViewToImageScale
 
ossimDpt m_ImageToViewScale
 
ossimDpt m_VulScale
 
ossimDpt m_VurScale
 
ossimDpt m_VlrScale
 
ossimDpt m_VllScale
 
ossimDpt m_ulRoundTripError
 
ossimDpt m_urRoundTripError
 
ossimDpt m_lrRoundTripError
 
ossimDpt m_llRoundTripError
 
ossimRefPtr< ossimImageViewTransformm_transform
 
const ossimPolyArea2dm_viewBounds
 

Private Types

enum  SplitFlag {
  SPLIT_NONE = 0, UPPER_LEFT_SPLIT_FLAG = 1, UPPER_RIGHT_SPLIT_FLAG = 2, LOWER_RIGHT_SPLIT_FLAG = 4,
  LOWER_LEFT_SPLIT_FLAG = 8, SPLIT_ALL = UPPER_LEFT_SPLIT_FLAG|UPPER_RIGHT_SPLIT_FLAG|LOWER_RIGHT_SPLIT_FLAG|LOWER_LEFT_SPLIT_FLAG
}
 

Private Member Functions

void splitHorizontal (std::vector< ossimRendererSubRectInfo > &result) const
 
void splitVertical (std::vector< ossimRendererSubRectInfo > &result) const
 
void splitAll (std::vector< ossimRendererSubRectInfo > &result) const
 

Friends

std::ostream & operator<< (std::ostream &out, const ossimRendererSubRectInfo &rhs)
 

Detailed Description

Definition at line 157 of file ossimImageRenderer.h.

Member Enumeration Documentation

◆ SplitFlag

Constructor & Destructor Documentation

◆ ossimRendererSubRectInfo() [1/2]

ossimImageRenderer::ossimRendererSubRectInfo::ossimRendererSubRectInfo ( ossimImageViewTransform transform = 0)
inline

Definition at line 345 of file ossimImageRenderer.h.

References m_Ill, m_Ilr, m_ImageToViewScale, m_Iul, m_Iur, m_ViewToImageScale, m_Vll, m_Vlr, m_Vul, m_Vur, ossimIpt::makeNan(), and ossimDpt::makeNan().

346 :m_transform(transform),
347 m_viewBounds(0)
348 {
349  m_Vul.makeNan();
350  m_Vur.makeNan();
351  m_Vlr.makeNan();
352  m_Vll.makeNan();
353  m_Iul.makeNan();
354  m_Iur.makeNan();
355  m_Ilr.makeNan();
356  m_Ill.makeNan();
359 }
ossimRefPtr< ossimImageViewTransform > m_transform
void makeNan()
Definition: ossimIpt.h:56
void makeNan()
Definition: ossimDpt.h:65

◆ ossimRendererSubRectInfo() [2/2]

ossimImageRenderer::ossimRendererSubRectInfo::ossimRendererSubRectInfo ( ossimImageViewTransform transform,
const ossimDpt vul,
const ossimDpt vur,
const ossimDpt vlr,
const ossimDpt vll 
)
inline

Definition at line 361 of file ossimImageRenderer.h.

References m_Ill, m_Ilr, m_ImageToViewScale, m_Iul, m_Iur, m_ViewToImageScale, and ossimDpt::makeNan().

366  :m_Vul(vul),
367  m_Vur(vur),
368  m_Vlr(vlr),
369  m_Vll(vll),
370  m_transform(transform),
371  m_viewBounds(0)
372 {
373  m_Iul.makeNan();
374  m_Iur.makeNan();
375  m_Ilr.makeNan();
376  m_Ill.makeNan();
379 }
ossimRefPtr< ossimImageViewTransform > m_transform
void makeNan()
Definition: ossimDpt.h:65

Member Function Documentation

◆ canBilinearInterpolate()

bool ossimImageRenderer::ossimRendererSubRectInfo::canBilinearInterpolate ( double  error) const

Definition at line 761 of file ossimImageRenderer.cpp.

References ossimDpt::hasNans(), ossimDpt::length(), ossimDpt::x, and ossimDpt::y.

762 {
763  bool result = false;
764 
765  // now check point placement
766  ossimDpt imageToViewScale = getAbsValueImageToViewScales();
767 
768  double testScale = imageToViewScale.length();
769 
770  // ossimDpt errorUl = transform->getRoundTripErrorView(m_Vul);
771  // ossimDpt errorUr = transform->getRoundTripErrorView(m_Vur);
772  // ossimDpt errorLr = transform->getRoundTripErrorView(m_Vlr);
773  // ossimDpt errorLl = transform->getRoundTripErrorView(m_Vll);
774 
775  // if((errorUl.length() > 2 )||
776  // (errorUr.length() > 2 )||
777  // (errorLr.length() > 2 )||
778  // (errorLl.length() > 2))
779  // {
780  // return result;
781  // }
782  // std::cout << "_______________________\n"
783  // << "errorUl: " << errorUl << "\n"
784  // << "errorUr: " << errorUr << "\n"
785  // << "errorLr: " << errorLr << "\n"
786  // << "errorLl: " << errorLl << "\n";
787 
788  // if there is a large shrink or expansion then just return true.
789  // You are probably not worried about error in bilinear interpolation
790  //
791  if ((testScale > 256) ||
792  (testScale < 1.0 / 256.0))
793  {
794  return true;
795  }
796 
797  if (m_VulScale.hasNans() ||
798  m_VurScale.hasNans() ||
799  m_VlrScale.hasNans() ||
801  {
802  return result;
803  }
804 
805  // std::cout << "ulScale: " << m_VulScale << "\n"
806  // << "urScale: " << m_VurScale << "\n"
807  // << "lrScale: " << m_VlrScale << "\n"
808  // << "llScale: " << m_VllScale << "\n";
809 
810  // check overage power of 2 variance
811  // If there is a variance of 1 resolution level
812  // then we must split further
813  //
814  ossim_float64 averageUlScale = m_VulScale.length();
815  ossim_float64 averageUrScale = m_VurScale.length();
816  ossim_float64 averageLrScale = m_VlrScale.length();
817  ossim_float64 averageLlScale = m_VllScale.length();
818 
819  // std::cout << "_________________________\n";
820  // std::cout << log(averageUlScale)/(log(2)) << "\n";
821  // std::cout << log(averageUrScale)/(log(2)) << "\n";
822  // std::cout << log(averageLrScale)/(log(2)) << "\n";
823  // std::cout << log(averageLlScale)/(log(2)) << "\n";
824 
825  ossim_float64 ratio1 = averageUlScale / averageUrScale;
826  ossim_float64 ratio2 = averageUlScale / averageLrScale;
827  ossim_float64 ratio3 = averageUlScale / averageLlScale;
828 
829  // std::cout << "_________________________\n";
830  // std::cout << "ratio1: " << ratio1 << "\n";
831  // std::cout << "ratio2: " << ratio2 << "\n";
832  // std::cout << "ratio3: " << ratio3 << "\n";
833 
834  // make sure all are within a power of 2 shrink or expand
835  // which means the range of each ratio should be
836  // between .5 and 2
837  result = (((ratio1 < 2) && (ratio1 > 0.5)) &&
838  ((ratio2 < 2) && (ratio2 > 0.5)) &&
839  ((ratio3 < 2) && (ratio3 > 0.5)));
840 
841  //result = ((diff1<=2)&&(diff2<=2)&&(diff3<=2));
842  //std::cout << "DIFF1: " << diff1 << std::endl;
843  //std::cout << "DIFF2: " << diff2 << std::endl;
844  //std::cout << "DIFF3: " << diff3 << std::endl;
845 
846  if (result)
847  {
848 #if 1
849  ossimDpt vUpper, vRight, vBottom, vLeft, vCenter;
850  ossimDpt iUpper, iRight, iBottom, iLeft, iCenter;
851  ossimDpt testUpper, testRight, testBottom, testLeft, testCenter;
852 
853  getViewMids(vUpper, vRight, vBottom, vLeft, vCenter);
854  getImageMids(iUpper, iRight, iBottom, iLeft, iCenter);
855 
856  // get the model centers for the mid upper left right bottom
857  m_transform->viewToImage(vCenter, testCenter);
858 
859  if (testCenter.hasNans())
860  {
861  return false;
862  }
863 
864  m_transform->viewToImage(vUpper, testUpper);
865  if (testCenter.hasNans())
866  {
867  return false;
868  }
869  m_transform->viewToImage(vRight, testRight);
870  if (testRight.hasNans())
871  {
872  return false;
873  }
874  m_transform->viewToImage(vBottom, testBottom);
875  if (testBottom.hasNans())
876  {
877  return false;
878  }
879  m_transform->viewToImage(vLeft, testLeft);
880  if (testLeft.hasNans())
881  {
882  return false;
883  }
884 
885  // now get the model error to bilinear estimate of those points
886  double errorCheck1 = (testCenter - iCenter).length();
887  double errorCheck2 = (testUpper - iUpper).length();
888  double errorCheck3 = (testRight - iRight).length();
889  double errorCheck4 = (testBottom - iBottom).length();
890  double errorCheck5 = (testLeft - iLeft).length();
891  result = ((errorCheck1 < error) &&
892  (errorCheck2 < error) &&
893  (errorCheck3 < error) &&
894  (errorCheck4 < error) &&
895  (errorCheck5 < error));
896  // std::cout <<"__________________________\n"
897  // << "ERROR1:" <<errorCheck1 << "\n"
898  // << "ERROR2:" <<errorCheck2 << "\n"
899  // << "ERROR3:" <<errorCheck3 << "\n"
900  // << "ERROR4:" <<errorCheck4 << "\n"
901  // << "ERROR5:" <<errorCheck5 << "\n"
902  // << "SENS: " << error << "\n";
903 
904 #else
905  ossimDpt vUpper, vRight, vBottom, vLeft, vCenter;
906  ossimDpt iUpper, iRight, iBottom, iLeft, iCenter;
907 
908  ossimDpt testCenter;
909  getViewMids(vUpper, vRight, vBottom, vLeft, vCenter);
910  getImageMids(iUpper, iRight, iBottom, iLeft, iCenter);
911 
912  ossimDpt iFullRes(iCenter.x * imageToViewScale.x,
913  iCenter.y * imageToViewScale.y);
914 
915  m_transform->viewToImage(vCenter, testCenter);
916 
917  if (testCenter.hasNans())
918  {
919  return false;
920  }
921  ossimDpt testFullRes(testCenter.x * imageToViewScale.x,
922  testCenter.y * imageToViewScale.y);
923 
924  double errorCheck1 = (testFullRes - iFullRes).length();
925 
926  iFullRes = ossimDpt(iUpper.x * imageToViewScale.x,
927  iUpper.y * imageToViewScale.y);
928 
929  m_transform->viewToImage(vUpper, testCenter);
930  if (testCenter.hasNans())
931  {
932  return false;
933  }
934  testFullRes = ossimDpt(testCenter.x * imageToViewScale.x,
935  testCenter.y * imageToViewScale.y);
936  double errorCheck2 = (testFullRes - iFullRes).length();
937 
938  iFullRes = ossimDpt(iRight.x * imageToViewScale.x,
939  iRight.y * imageToViewScale.y);
940 
941  m_transform->viewToImage(vRight, testCenter);
942  if (testCenter.hasNans())
943  {
944  return false;
945  }
946  testFullRes = ossimDpt(testCenter.x * imageToViewScale.x,
947  testCenter.y * imageToViewScale.y);
948  double errorCheck3 = (testFullRes - iFullRes).length();
949 
950  iFullRes = ossimDpt(iBottom.x * imageToViewScale.x,
951  iBottom.y * imageToViewScale.y);
952 
953  m_transform->viewToImage(vBottom, testCenter);
954  if (testCenter.hasNans())
955  {
956  return false;
957  }
958  testFullRes = ossimDpt(testCenter.x * imageToViewScale.x,
959  testCenter.y * imageToViewScale.y);
960  double errorCheck4 = (testFullRes - iFullRes).length();
961 
962  iFullRes = ossimDpt(iLeft.x * imageToViewScale.x,
963  iLeft.y * imageToViewScale.y);
964 
965  m_transform->viewToImage(vLeft, testCenter);
966  testFullRes = ossimDpt(testCenter.x * imageToViewScale.x,
967  testCenter.y * imageToViewScale.y);
968  double errorCheck5 = (testFullRes - iFullRes).length();
969 
970  std::cout << "__________________________\n"
971  << "ERROR1:" << errorCheck1 << "\n"
972  << "ERROR2:" << errorCheck2 << "\n"
973  << "ERROR3:" << errorCheck3 << "\n"
974  << "ERROR4:" << errorCheck4 << "\n"
975  << "ERROR5:" << errorCheck5 << "\n"
976  << "SENS: " << error << "\n";
977 
978  result = ((errorCheck1 < error) &&
979  (errorCheck2 < error) &&
980  (errorCheck3 < error) &&
981  (errorCheck4 < error) &&
982  (errorCheck5 < error));
983  // std::cout << "CAN INTERPOLATE? " << result <<"\n";
984 #endif
985  }
986  return result;
987 }
ossimRefPtr< ossimImageViewTransform > m_transform
double y
Definition: ossimDpt.h:165
void getImageMids(ossimDpt &upperMid, ossimDpt &rightMid, ossimDpt &bottomMid, ossimDpt &leftMid, ossimDpt &center) const
double length() const
Definition: ossimDpt.h:81
double ossim_float64
void getViewMids(ossimDpt &upperMid, ossimDpt &rightMid, ossimDpt &bottomMid, ossimDpt &leftMid, ossimDpt &center) const
bool hasNans() const
Definition: ossimDpt.h:67
double x
Definition: ossimDpt.h:164
virtual void viewToImage(const ossimDpt &viewPoint, ossimDpt &imagePoint) const

◆ computeRoundTripErrorViewPt()

ossimDpt ossimImageRenderer::ossimRendererSubRectInfo::computeRoundTripErrorViewPt ( const ossimDpt dpt) const

◆ computeViewToImageScale()

ossimDpt ossimImageRenderer::ossimRendererSubRectInfo::computeViewToImageScale ( const ossimDpt viewPt,
const ossimDpt delta = ossimDpt(1.0,1.0) 
) const

Definition at line 663 of file ossimImageRenderer.cpp.

References ossimDpt::hasNans(), ossimDpt::isNan(), ossimDpt::length(), ossimDpt::makeNan(), ossimDpt::x, and ossimDpt::y.

665 {
666  ossimDpt result;
667  result.makeNan();
668  if(viewPt.hasNans()) return result;
669  ossimDpt ipt;
670  m_transform->viewToImage(viewPt, ipt);
671 
672  if(!ipt.isNan())
673  {
674 // ossimDpt delta;
675 // transform->viewToImage(viewPt+ossimDpt(0.5,0.5), delta);
676 
677 // delta = delta-ipt;
678 // result.x = delta.length()/std::sqrt(2);
679  // result.y = result.x;
680 
681  ossimDpt dx;
682  ossimDpt dy;
683 
684  m_transform->viewToImage(viewPt + ossimDpt(delta.x,0.0), dx);
685  m_transform->viewToImage(viewPt + ossimDpt(0.0,delta.y), dy);
686  dx = dx-ipt;
687  dy = dy-ipt;
688 
689  result.x = dx.length()/fabs(delta.x);
690  result.y = dy.length()/fabs(delta.y);
691  }
692 
693  return result;
694 }
ossimRefPtr< ossimImageViewTransform > m_transform
double y
Definition: ossimDpt.h:165
bool isNan() const
Definition: ossimDpt.h:72
double length() const
Definition: ossimDpt.h:81
bool hasNans() const
Definition: ossimDpt.h:67
double x
Definition: ossimDpt.h:164
void makeNan()
Definition: ossimDpt.h:65
virtual void viewToImage(const ossimDpt &viewPoint, ossimDpt &imagePoint) const

◆ getAbsValueImageToViewScales()

ossimDpt ossimImageRenderer::ossimRendererSubRectInfo::getAbsValueImageToViewScales ( ) const
inline

Definition at line 483 of file ossimImageRenderer.h.

Referenced by ossimImageRenderer::fillTile().

484 {
486  {
487  return m_ImageToViewScale;
488  }
489 
490  return ossimDpt(fabs(m_ImageToViewScale.x), fabs(m_ImageToViewScale.y));
491 }
double y
Definition: ossimDpt.h:165
bool hasNans() const
Definition: ossimDpt.h:67
double x
Definition: ossimDpt.h:164

◆ getAbsValueViewToImageScales()

ossimDpt ossimImageRenderer::ossimRendererSubRectInfo::getAbsValueViewToImageScales ( ) const
inline

Definition at line 474 of file ossimImageRenderer.h.

475 {
477  {
478  return m_ImageToViewScale;
479  }
480  return ossimDpt(fabs(m_ViewToImageScale.x), fabs(m_ViewToImageScale.y));
481 }
double y
Definition: ossimDpt.h:165
bool hasNans() const
Definition: ossimDpt.h:67
double x
Definition: ossimDpt.h:164

◆ getImageMids()

void ossimImageRenderer::ossimRendererSubRectInfo::getImageMids ( ossimDpt upperMid,
ossimDpt rightMid,
ossimDpt bottomMid,
ossimDpt leftMid,
ossimDpt center 
) const

Definition at line 1003 of file ossimImageRenderer.cpp.

References ossimDpt::makeNan().

1008 {
1009  if(imageHasNans())
1010  {
1011  upperMid.makeNan();
1012  rightMid.makeNan();
1013  bottomMid.makeNan();
1014  leftMid.makeNan();
1015  center.makeNan();
1016  }
1017  else
1018  {
1019  upperMid = (m_Iul + m_Iur)*.5;
1020  rightMid = (m_Iur + m_Ilr)*.5;
1021  bottomMid = (m_Ilr + m_Ill)*.5;
1022  leftMid = (m_Iul + m_Ill)*.5;
1023  center = (m_Iul + m_Iur + m_Ilr + m_Ill)*.25;
1024  }
1025 }
void makeNan()
Definition: ossimDpt.h:65

◆ getImageRect()

ossimDrect ossimImageRenderer::ossimRendererSubRectInfo::getImageRect ( ) const
inline

◆ getParametricCenter()

ossimDpt ossimImageRenderer::ossimRendererSubRectInfo::getParametricCenter ( const ossimDpt ul,
const ossimDpt ur,
const ossimDpt lr,
const ossimDpt ll 
) const

Definition at line 1027 of file ossimImageRenderer.cpp.

1029 {
1030  ossimDpt top = ur - ul;
1031  ossimDpt bottom = lr - ll;
1032 
1033  ossimDpt centerTop = ul + top * .5;
1034  ossimDpt centerBottom = ll + bottom * .5;
1035 
1036  return centerBottom + (centerBottom - centerTop)*.5;
1037 }

◆ getSplitFlags()

ossim_uint16 ossimImageRenderer::ossimRendererSubRectInfo::getSplitFlags ( ) const

Definition at line 381 of file ossimImageRenderer.cpp.

References ossimDrect::height(), and ossimDrect::width().

382 {
383  #if 0
384  ossim_uint16 result = SPLIT_NONE;
385  ossimDrect vRect = getViewRect();
386 
387  //---
388  // Don't allow splits beyond 8x8 pixel. ossim2dBilinearTransform was core dumping with
389  // very small rectangles in canBilinearInterpolate(...) method.
390  // DRB 05 Dec. 2017
391  //---
392  if ( imageHasNans()||(vRect.width() < 8 && vRect.height() < 8) )
393  {
394  return result;
395  }
396 
397  if(imageHasNans())
398  {
399  if(m_viewBounds->intersects(vRect))
400  {
401  result = SPLIT_ALL;
402  }
403  else
404  {
405  return result;
406  }
407  }
408  /*
409  if(result != SPLIT_ALL)
410  {
411  if(m_ulRoundTripError.hasNans()&&m_urRoundTripError.hasNans()&&
412  m_lrRoundTripError.hasNans()&&m_llRoundTripError.hasNans())
413  {
414  if(m_viewBounds->intersects(getViewRect()))
415  {
416  result = SPLIT_ALL;
417  }
418  return result;
419  }
420  else if(tooBig())
421  {
422  result = SPLIT_ALL;
423  }
424  }
425 
426  if(result != SPLIT_ALL)
427  {
428  if(m_ulRoundTripError.hasNans()) result |= UPPER_LEFT_SPLIT_FLAG;
429  if(m_urRoundTripError.hasNans()) result |= UPPER_RIGHT_SPLIT_FLAG;
430  if(m_lrRoundTripError.hasNans()) result |= LOWER_RIGHT_SPLIT_FLAG;
431  if(m_llRoundTripError.hasNans()) result |= LOWER_LEFT_SPLIT_FLAG;
432  }
433  */
434  if(result != SPLIT_ALL)
435  {
437  if(bias < 1.0) bias = 1.0/bias;
438  bias = std::sqrt(bias);
439 
440  if(bias < 1) bias = 1.0;
441 
442  // if((m_ulRoundTripError.length() > bias)||
443  // (m_urRoundTripError.length() > bias)||
444  // (m_lrRoundTripError.length() > bias)||
445  // (m_llRoundTripError.length() > bias))
446  // {
447  // std::cout << "________________\n";
448 
449  // std::cout << "Bias: " << bias << "\n"
450  // << "View: " << getViewRect() << "\n"
451  // << "UL: " << m_ulRoundTripError.length() << "\n"
452  // << "UR: " << m_urRoundTripError.length() << "\n"
453  // << "LR: " << m_lrRoundTripError.length() << "\n"
454  // << "LL: " << m_llRoundTripError.length() << "\n";
455 // }
456  // if(m_ulRoundTripError.length() > sensitivityScale) result |= UPPER_LEFT_SPLIT_FLAG;
457  // if(m_urRoundTripError.length() > sensitivityScale) result |= UPPER_RIGHT_SPLIT_FLAG;
458  // if(m_lrRoundTripError.length() > sensitivityScale) result |= LOWER_RIGHT_SPLIT_FLAG;
459  // if(m_llRoundTripError.length() > sensitivityScale) result |= LOWER_LEFT_SPLIT_FLAG;
460  // std::cout << result << " == " << SPLIT_ALL << "\n";
461 
462  if((result!=SPLIT_ALL)&&!canBilinearInterpolate(bias))
463  {
464  // std::cout << "TESTING BILINEAR!!!!\n";
465  result = SPLIT_ALL;
466 
467  }
468  else
469  {
470  // std::cout << "CAN BILINEAR!!!!\n";
471  }
472  }
473 
474  return result;
475 #else
476  ossim_uint16 result = SPLIT_NONE;
477  ossimDrect vRect = getViewRect();
478 
479  if(imageHasNans()||tooBig())
480  {
482  {
483  result = SPLIT_ALL;
484  }
485  else
486  {
487  return result;
488  }
489  }
490  /*
491  if(result != SPLIT_ALL)
492  {
493  if(m_ulRoundTripError.hasNans()&&m_urRoundTripError.hasNans()&&
494  m_lrRoundTripError.hasNans()&&m_llRoundTripError.hasNans())
495  {
496  if(m_viewBounds->intersects(getViewRect()))
497  {
498  result = SPLIT_ALL;
499  }
500  return result;
501  }
502  else if(tooBig())
503  {
504  result = SPLIT_ALL;
505  }
506  }
507 
508  if(result != SPLIT_ALL)
509  {
510  if(m_ulRoundTripError.hasNans()) result |= UPPER_LEFT_SPLIT_FLAG;
511  if(m_urRoundTripError.hasNans()) result |= UPPER_RIGHT_SPLIT_FLAG;
512  if(m_lrRoundTripError.hasNans()) result |= LOWER_RIGHT_SPLIT_FLAG;
513  if(m_llRoundTripError.hasNans()) result |= LOWER_LEFT_SPLIT_FLAG;
514  }
515 */
516  if(result != SPLIT_ALL)
517  {
518  ossim_float64 sensitivityScale = m_ImageToViewScale.length();
519  //std::cout << sensitivityScale << std::endl;
520  if(sensitivityScale < 1.0) sensitivityScale = 1.0/sensitivityScale;
521 
522 
523  // if((m_ulRoundTripError.length() > sensitivityScale)||
524  // (m_urRoundTripError.length() > sensitivityScale)||
525  // (m_lrRoundTripError.length() > sensitivityScale)||
526  // (m_llRoundTripError.length() > sensitivityScale))
527  // {
528  // std::cout << "________________\n";
529 
530  // std::cout << "Sens: " << sensitivityScale << "\n"
531  // << "View: " << getViewRect() << "\n"
532  // << "UL: " << m_ulRoundTripError.length() << "\n"
533  // << "UR: " << m_urRoundTripError.length() << "\n"
534  // << "LR: " << m_lrRoundTripError.length() << "\n"
535  // << "LL: " << m_llRoundTripError.length() << "\n";
536  // }
537  // if(m_ulRoundTripError.length() > sensitivityScale) result |= UPPER_LEFT_SPLIT_FLAG;
538  // if(m_urRoundTripError.length() > sensitivityScale) result |= UPPER_RIGHT_SPLIT_FLAG;
539  // if(m_lrRoundTripError.length() > sensitivityScale) result |= LOWER_RIGHT_SPLIT_FLAG;
540  // if(m_llRoundTripError.length() > sensitivityScale) result |= LOWER_LEFT_SPLIT_FLAG;
541  // std::cout << result << " == " << SPLIT_ALL << "\n";
542 
543  if((result!=SPLIT_ALL)&&!canBilinearInterpolate(sensitivityScale))
544  {
545  // std::cout << "TESTING BILINEAR!!!!\n";
546  result = SPLIT_ALL;
547 
548  }
549  else
550  {
551  // std::cout << "CAN BILINEAR!!!!\n";
552  }
553  }
554 
555  return result;
556 #endif
557 }
ossim_float64 width() const
Definition: ossimDrect.h:522
bool intersects(const ossimPolyArea2d &rhs) const
unsigned short ossim_uint16
double length() const
Definition: ossimDpt.h:81
double ossim_float64
ossim_float64 height() const
Definition: ossimDrect.h:517

◆ getViewMids()

void ossimImageRenderer::ossimRendererSubRectInfo::getViewMids ( ossimDpt upperMid,
ossimDpt rightMid,
ossimDpt bottomMid,
ossimDpt leftMid,
ossimDpt center 
) const

Definition at line 989 of file ossimImageRenderer.cpp.

994 {
995 
996  upperMid = (m_Vul + m_Vur)*.5;
997  rightMid = (m_Vur + m_Vlr)*.5;
998  bottomMid = (m_Vlr + m_Vll)*.5;
999  leftMid = (m_Vul + m_Vll)*.5;
1000  center = (m_Vul + m_Vur + m_Vlr + m_Vll)*.25;
1001 }

◆ getViewRect()

ossimDrect ossimImageRenderer::ossimRendererSubRectInfo::getViewRect ( ) const
inline

◆ imageHasNans()

bool ossimImageRenderer::ossimRendererSubRectInfo::imageHasNans ( ) const
inline

◆ imageIsNan()

bool ossimImageRenderer::ossimRendererSubRectInfo::imageIsNan ( ) const
inline

◆ isIdentity()

bool ossimImageRenderer::ossimRendererSubRectInfo::isIdentity ( ) const

Definition at line 726 of file ossimImageRenderer.cpp.

References FLT_EPSILON.

727 {
728 // ossimDpt deltaP1P2 = m_Iul - m_Iur;
729 // ossimDpt deltaP1P3 = m_Iul - m_Ill;
730 
731 // ossimDpt deltaViewP1P2 = m_Vul - m_Vur;
732 // ossimDpt deltaViewP1P3 = m_Vul - m_Vll;
733 
734 // bool horizontalSigns = ossimGetSign(deltaP1P2.x)==ossimGetSign(deltaViewP1P2.x);
735 // bool verticalSigns = ossimGetSign(deltaP1P3.y)==ossimGetSign(deltaViewP1P3.y);
736 
737 // // check first to see if any horizontal or vertical flipping
738 // //
739 // if(horizontalSigns && verticalSigns)
740 // {
741 // // check scales to see if they are 1
742 // if(fabs(1-m_ViewToImageScale.x) <= FLT_EPSILON &&
743 // fabs(1-m_ViewToImageScale.y) <= FLT_EPSILON)
744 // {
745 // return true;
746 // }
747 // }
748 
749  double iulDelta = (m_Iul-m_Vul).length();
750  double iurDelta = (m_Iur-m_Vur).length();
751  double ilrDelta = (m_Ilr-m_Vlr).length();
752  double illDelta = (m_Ill-m_Vll).length();
753 
754  return ((iulDelta <= FLT_EPSILON)&&
755  (iurDelta <= FLT_EPSILON)&&
756  (ilrDelta <= FLT_EPSILON)&&
757  (illDelta <= FLT_EPSILON));
758 }
#define FLT_EPSILON

◆ isViewAPoint()

bool ossimImageRenderer::ossimRendererSubRectInfo::isViewAPoint ( ) const
inline

◆ isViewEqual() [1/2]

bool ossimImageRenderer::ossimRendererSubRectInfo::isViewEqual ( const ossimRendererSubRectInfo infoRect) const
inline

Definition at line 458 of file ossimImageRenderer.h.

References m_Vll, m_Vlr, m_Vul, and m_Vur.

459 {
460  return ( (m_Vul == infoRect.m_Vul)&&
461  (m_Vur == infoRect.m_Vur)&&
462  (m_Vlr == infoRect.m_Vlr)&&
463  (m_Vll == infoRect.m_Vll));
464 }

◆ isViewEqual() [2/2]

bool ossimImageRenderer::ossimRendererSubRectInfo::isViewEqual ( const ossimDrect viewRect) const
inline

Definition at line 466 of file ossimImageRenderer.h.

References ossimDrect::ll(), ossimDrect::lr(), ossimDrect::ul(), and ossimDrect::ur().

467 {
468  return ( (m_Vul == viewRect.ul())&&
469  (m_Vur == viewRect.ur())&&
470  (m_Vlr == viewRect.lr())&&
471  (m_Vll == viewRect.ll()));
472 }
const ossimDpt & ul() const
Definition: ossimDrect.h:339
const ossimDpt & ur() const
Definition: ossimDrect.h:340
const ossimDpt & ll() const
Definition: ossimDrect.h:342
const ossimDpt & lr() const
Definition: ossimDrect.h:341

◆ roundImageToInteger()

void ossimImageRenderer::ossimRendererSubRectInfo::roundImageToInteger ( )
inline

◆ roundToInteger()

void ossimImageRenderer::ossimRendererSubRectInfo::roundToInteger ( )
inline

◆ roundViewToInteger()

void ossimImageRenderer::ossimRendererSubRectInfo::roundViewToInteger ( )
inline

◆ splitAll()

void ossimImageRenderer::ossimRendererSubRectInfo::splitAll ( std::vector< ossimRendererSubRectInfo > &  result) const
private

Definition at line 174 of file ossimImageRenderer.cpp.

References ossimIrect::height(), ossimIrect::ll(), ossimIrect::lr(), m_viewBounds, ossimIrect::ul(), ossimIrect::ur(), ossimIrect::width(), ossimIpt::x, and ossimIpt::y.

175 {
176  //std::cout << "FULL Split\n" << std::endl;
177  // let splitAll for now. We can still optimize but will do that later
178  ossimIrect tempUlRect;
179  ossimIrect tempUrRect;
180  ossimIrect tempLrRect;
181  ossimIrect tempLlRect;
182  ossimIrect vrect(m_Vul,
183  m_Vur,
184  m_Vlr,
185  m_Vll);
186  ossim_int32 w = vrect.width();
187  ossim_int32 h = vrect.height();
188  ossim_int32 w2 = w>>1;
189  ossim_int32 h2 = h>>1;
190 
191  tempUlRect = ossimIrect(m_Vul.x,
192  m_Vul.y,
193  m_Vul.x + (w2 - 1),
194  m_Vul.y + (h2 - 1));
195 
196  tempUrRect = ossimIrect(tempUlRect.ur().x+1,
197  m_Vul.y,
198  m_Vur.x,
199  m_Vul.y + (h2 - 1));
200 
201  tempLrRect = ossimIrect(tempUlRect.lr().x,
202  tempUlRect.lr().y+1,
203  m_Vlr.x,
204  m_Vlr.y);
205 
206  tempLlRect = ossimIrect(m_Vul.x,
207  tempUlRect.ll().y+1,
208  tempLrRect.ul().x,
209  tempLrRect.ll().y);
210 
211 // std::cout << "VR: " << vrect.width() << ", " << vrect.height() << "\n"
212 // << "UL: " << tempUlRect.width() << ", " << tempUlRect.height() << "\n"
213 // << "UR: " << tempUrRect.width() << ", " << tempUrRect.height() << "\n"
214 // << "LR: " << tempLrRect.width() << ", " << tempLrRect.height() << "\n"
215 // << "LL: " << tempLlRect.width() << ", " << tempLlRect.height() << "\n";
216 
217  ossimRendererSubRectInfo ul(m_transform.get(),tempUlRect.ul(), tempUlRect.ur(),tempUlRect.lr(), tempUlRect.ll());
218  ossimRendererSubRectInfo ur(m_transform.get(),tempUrRect.ul(), tempUrRect.ur(),tempUrRect.lr(), tempUrRect.ll());
219  ossimRendererSubRectInfo lr(m_transform.get(),tempLrRect.ul(), tempLrRect.ur(),tempLrRect.lr(), tempLrRect.ll());
220  ossimRendererSubRectInfo ll(m_transform.get(),tempLlRect.ul(), tempLlRect.ur(),tempLlRect.lr(), tempLlRect.ll());
221 
222  ul.m_viewBounds = m_viewBounds;
223  ur.m_viewBounds = m_viewBounds;
224  lr.m_viewBounds = m_viewBounds;
225  ll.m_viewBounds = m_viewBounds;
226 
227  ul.transformViewToImage();
228  ur.transformViewToImage();
229  lr.transformViewToImage();
230  ll.transformViewToImage();
231 
232  if(ul.imageIsNan())
233  {
234  if(ul.m_viewBounds->intersects(ul.getViewRect()))
235  {
236  result.push_back(ul);
237  }
238  }
239  else
240  {
241  result.push_back(ul);
242  }
243  if(ur.imageIsNan())
244  {
245  if(ur.m_viewBounds->intersects(ur.getViewRect()))
246  {
247  result.push_back(ur);
248  }
249  }
250  else
251  {
252  result.push_back(ur);
253  }
254  if(lr.imageIsNan())
255  {
256  if(lr.m_viewBounds->intersects(lr.getViewRect()))
257  {
258  result.push_back(lr);
259  }
260  }
261  else
262  {
263  result.push_back(lr);
264  }
265  if(ll.imageIsNan())
266  {
267  if(ll.m_viewBounds->intersects(ll.getViewRect()))
268  {
269  result.push_back(ll);
270  }
271  }
272  else
273  {
274  result.push_back(ll);
275  }
276 }
ossimRefPtr< ossimImageViewTransform > m_transform
ossimRendererSubRectInfo(ossimImageViewTransform *transform=0)
const ossimIpt & ul() const
Definition: ossimIrect.h:274
const ossimIpt & ll() const
Definition: ossimIrect.h:277
const ossimIpt & lr() const
Definition: ossimIrect.h:276
const ossimIpt & ur() const
Definition: ossimIrect.h:275
ossim_int32 y
Definition: ossimIpt.h:142
ossim_int32 x
Definition: ossimIpt.h:141
int ossim_int32

◆ splitHorizontal()

void ossimImageRenderer::ossimRendererSubRectInfo::splitHorizontal ( std::vector< ossimRendererSubRectInfo > &  result) const
private

Definition at line 51 of file ossimImageRenderer.cpp.

References ossimRefPtr< T >::get(), ossimIrect::ll(), ossimIrect::lr(), m_transform, m_viewBounds, m_Vll, m_Vlr, m_Vul, m_Vur, ossimIrect::ul(), ossimIrect::ur(), ossimIrect::width(), ossimIpt::x, and ossimIpt::y.

52 {
53  ossimIrect vrect(m_Vul,
54  m_Vur,
55  m_Vlr,
56  m_Vll);
57  ossim_int32 w = vrect.width();
58  // ossim_int32 h = vrect.height();
59  ossim_int32 w2 = w>>1;
60  ossimIrect tempLeftRect(m_Vul.x,
61  m_Vul.y,
62  m_Vul.x+w2-1,
63  m_Vlr.y);
64  ossimIrect tempRightRect(tempLeftRect.ur().x+1,
65  m_Vul.y,
66  m_Vur.x,
67  m_Vlr.y);
68 
69 
72 
73  left.m_viewBounds = m_viewBounds;
74  right.m_viewBounds = m_viewBounds;
75 
76  left.m_Vul = tempLeftRect.ul();
77  left.m_Vur = tempLeftRect.ur();
78  left.m_Vlr = tempLeftRect.lr();
79  left.m_Vll = tempLeftRect.ll();
80 
81  right.m_Vul = tempRightRect.ul();
82  right.m_Vur = tempRightRect.ur();
83  right.m_Vlr = tempRightRect.lr();
84  right.m_Vll = tempRightRect.ll();
85 
86  left.transformViewToImage();
87  right.transformViewToImage();
88 
89  if(left.imageIsNan())
90  {
91  if(left.m_viewBounds->intersects(left.getViewRect()))
92  {
93  result.push_back(left);
94  }
95  }
96  else
97  {
98  result.push_back(left);
99  }
100  if(right.imageIsNan())
101  {
102  if(right.m_viewBounds->intersects(right.getViewRect()))
103  {
104  result.push_back(right);
105  }
106  }
107  else
108  {
109  result.push_back(right);
110  }
111 }
ossimRefPtr< ossimImageViewTransform > m_transform
ossimRendererSubRectInfo(ossimImageViewTransform *transform=0)
ossim_int32 y
Definition: ossimIpt.h:142
ossim_int32 x
Definition: ossimIpt.h:141
int ossim_int32

◆ splitVertical()

void ossimImageRenderer::ossimRendererSubRectInfo::splitVertical ( std::vector< ossimRendererSubRectInfo > &  result) const
private

Definition at line 113 of file ossimImageRenderer.cpp.

References ossimIrect::height(), ossimIrect::ll(), ossimIrect::lr(), m_viewBounds, ossimIrect::ul(), ossimIrect::ur(), and ossimIpt::y.

114 {
115  ossimIrect vrect(m_Vul,
116  m_Vur,
117  m_Vlr,
118  m_Vll);
119  // ossim_int32 w = vrect.width();
120  ossim_int32 h = vrect.height();
121  ossim_int32 h2 = h>>1;
122  ossimIrect tempTopRect(m_Vul.x,
123  m_Vul.y,
124  m_Vlr.x,
125  m_Vul.y+h2-1);
126  ossimIrect tempBottomRect(m_Vul.x,
127  tempTopRect.lr().y+1,
128  m_Vlr.x,
129  m_Vlr.y);
130 
133 
134  top.m_viewBounds = m_viewBounds;
135  bottom.m_viewBounds = m_viewBounds;
136 
137  top.m_Vul = tempTopRect.ul();
138  top.m_Vur = tempTopRect.ur();
139  top.m_Vlr = tempTopRect.lr();
140  top.m_Vll = tempTopRect.ll();
141 
142  bottom.m_Vul = tempBottomRect.ul();
143  bottom.m_Vur = tempBottomRect.ur();
144  bottom.m_Vlr = tempBottomRect.lr();
145  bottom.m_Vll = tempBottomRect.ll();
146 
147  top.transformViewToImage();
148  bottom.transformViewToImage();
149 
150  if(top.imageIsNan())
151  {
152  if(top.m_viewBounds->intersects(top.getViewRect()))
153  {
154  result.push_back(top);
155  }
156  }
157  else
158  {
159  result.push_back(top);
160  }
161  if(bottom.imageIsNan())
162  {
163  if(bottom.m_viewBounds->intersects(bottom.getViewRect()))
164  {
165  result.push_back(bottom);
166  }
167  }
168  else
169  {
170  result.push_back(bottom);
171  }
172 }
ossimRefPtr< ossimImageViewTransform > m_transform
ossimRendererSubRectInfo(ossimImageViewTransform *transform=0)
ossim_int32 y
Definition: ossimIpt.h:142
ossim_int32 x
Definition: ossimIpt.h:141
int ossim_int32

◆ splitView()

void ossimImageRenderer::ossimRendererSubRectInfo::splitView ( std::vector< ossimRendererSubRectInfo > &  result) const

Definition at line 278 of file ossimImageRenderer.cpp.

References ossimIrect::height(), m_viewBounds, and ossimIrect::width().

Referenced by ossimImageRenderer::recursiveResample().

279 {
280  ossim_uint16 splitFlags = getSplitFlags();
281  if(!splitFlags)
282  {
283  return;
284  }
285 
286 
287  // just do horizontal split for test
288  ossimIrect vrect(m_Vul,
289  m_Vur,
290  m_Vlr,
291  m_Vll);
292  ossim_int32 w = vrect.width();
293  ossim_int32 h = vrect.height();
294  ossim_int32 w2 = w>>1;
295  ossim_int32 h2 = h>>1;
296 
297  if((w2 <2)&&(h2<2))
298  {
300  m_Vul,
301  m_Vul,
302  m_Vul);
303  rect.m_viewBounds = m_viewBounds;
304  rect.transformViewToImage();
305 
306  if(rect.imageHasNans())
307  {
308  if(rect.m_viewBounds->intersects(rect.getViewRect()))
309  {
310  result.push_back(rect);
311  }
312  }
313  }
314  // horizontal split if only the upper left and lower left
315  // vertices need splitting
316  else if((splitFlags==(UPPER_LEFT_SPLIT_FLAG|LOWER_LEFT_SPLIT_FLAG))||
318  {
319  // std::cout << "Horizontal Split\n" << std::endl;
320  if(w > 1)
321  {
322  splitHorizontal(result);
323  }
324  }
325  // check vertical only split
326  else if((splitFlags==(UPPER_LEFT_SPLIT_FLAG|UPPER_RIGHT_SPLIT_FLAG))||
328  {
329  //std::cout << "Vertical Split\n" << std::endl;
330 
331  if(h>1)
332  {
333  splitVertical(result);
334  }
335  }
336  else//if((w>1)&&(h>1)&&(splitFlags))
337  {
338  if((w<2)&&(h>1))
339  {
340  splitVertical(result);
341  }
342  else if((w>1)&&(h<2))
343  {
344  splitHorizontal(result);
345  }
346  else
347  {
348  splitAll(result);
349  }
350  }
351 }
void splitVertical(std::vector< ossimRendererSubRectInfo > &result) const
ossimRefPtr< ossimImageViewTransform > m_transform
ossimRendererSubRectInfo(ossimImageViewTransform *transform=0)
void splitHorizontal(std::vector< ossimRendererSubRectInfo > &result) const
unsigned short ossim_uint16
void splitAll(std::vector< ossimRendererSubRectInfo > &result) const
int ossim_int32

◆ stretchImageOut()

void ossimImageRenderer::ossimRendererSubRectInfo::stretchImageOut ( bool  enableRound = false)

Definition at line 696 of file ossimImageRenderer.cpp.

References ossimDpt::length().

697 {
698  ossimDpt topDelta = m_Iur - m_Iul;
699  ossimDpt rightDelta = m_Ilr - m_Iur;
700  ossimDpt bottomDelta = m_Ill - m_Ilr;
701  ossimDpt leftDelta = m_Iul - m_Ill;
702 
703  topDelta = topDelta*(1.0/topDelta.length());
704  rightDelta = rightDelta*(1.0/rightDelta.length());
705  bottomDelta = bottomDelta*(1.0/bottomDelta.length());
706  leftDelta = leftDelta*(1.0/leftDelta.length());
707 
708  m_Iul = m_Iul + ((leftDelta - topDelta)*.5);
709  m_Iur = m_Iur + ((topDelta - rightDelta)*.5);
710  m_Ilr = m_Ilr + ((rightDelta - bottomDelta)*.5);
711  m_Ill = m_Ill + ((bottomDelta - leftDelta)*.5);
712 
713  if(enableRound)
714  {
715  m_Iul = ossimIpt(ossim::round<int>(m_Iul.x),
716  ossim::round<int>(m_Iul.y));
717  m_Iur = ossimIpt(ossim::round<int>(m_Iur.x),
718  ossim::round<int>(m_Iur.y));
719  m_Ilr = ossimIpt(ossim::round<int>(m_Ilr.x),
720  ossim::round<int>(m_Ilr.y));
721  m_Ill = ossimIpt(ossim::round<int>(m_Ill.x),
722  ossim::round<int>(m_Ill.y));
723  }
724 }
double y
Definition: ossimDpt.h:165
double length() const
Definition: ossimDpt.h:81
double x
Definition: ossimDpt.h:164

◆ tooBig()

bool ossimImageRenderer::ossimRendererSubRectInfo::tooBig ( ) const

Definition at line 374 of file ossimImageRenderer.cpp.

References ossimDrect::height(), and ossimDrect::width().

375 {
376  ossimDrect vRect = getViewRect();
377 
378  return ((vRect.width() > 32) || (vRect.height() > 32));
379 }
ossim_float64 width() const
Definition: ossimDrect.h:522
ossim_float64 height() const
Definition: ossimDrect.h:517

◆ transformImageToView()

void ossimImageRenderer::ossimRendererSubRectInfo::transformImageToView ( )

Definition at line 353 of file ossimImageRenderer.cpp.

354 {
355  ossimDpt vul;
356  ossimDpt vur;
357  ossimDpt vlr;
358  ossimDpt vll;
360  vul);
362  vur);
364  vlr);
366  vll);
367 
368  m_Vul = vul;
369  m_Vur = vur;
370  m_Vlr = vlr;
371  m_Vll = vll;
372 }
ossimRefPtr< ossimImageViewTransform > m_transform
virtual void imageToView(const ossimDpt &imagePoint, ossimDpt &viewPoint) const

◆ transformViewToImage()

void ossimImageRenderer::ossimRendererSubRectInfo::transformViewToImage ( )

Definition at line 559 of file ossimImageRenderer.cpp.

References FLT_EPSILON, ossimDrect::height(), ossimDpt::length(), n, and ossimDrect::width().

560 {
561 // std::cout << "TRANSFORM VIEW TO IMAGE!!!!!!!!!!!!!!\n";
562 
563  ossimDrect vrect = getViewRect();
564  ossim_float64 w = vrect.width() - 1; // subtract 1 to prevent core dump in full-earth view rect
565  ossim_float64 h = vrect.height();
566 
571 
572 // m_ulRoundTripError = m_transform->getRoundTripErrorView(m_Vul);
573 // m_urRoundTripError = m_transform->getRoundTripErrorView(m_Vur);
574 // m_lrRoundTripError = m_transform->getRoundTripErrorView(m_Vlr);
575 // m_llRoundTripError = m_transform->getRoundTripErrorView(m_Vll);
576 
577 #if 1
582 
583  ossim_int32 n = 0;
584  m_ViewToImageScale.x = 0.0;
585  m_ViewToImageScale.y = 0.0;
586 
587  if(!m_VulScale.hasNans())
588  {
590  ++n;
591  }
592  if(!m_VurScale.hasNans())
593  {
595  ++n;
596  }
597  if(!m_VlrScale.hasNans())
598  {
600  ++n;
601  }
602  if(!m_VllScale.hasNans())
603  {
605  ++n;
606  }
607  if(!n)
608  {
610  }
611  else
612  {
615  }
616 
617 #else
618  {
619  m_ViewToImageScale = ossimDpt(1.0, 1.0);
620 
621  ossimDpt topDelta = m_Iur - m_Iul;
622  ossimDpt rightDelta = m_Ilr - m_Iur;
623  ossimDpt bottomDelta = m_Ill - m_Ilr;
624  ossimDpt leftDelta = m_Iul - m_Ill;
625 
626  double topLen = topDelta.length();
627  double bottomLen = bottomDelta.length();
628  double rightLen = rightDelta.length();
629  double leftLen = leftDelta.length();
630 
631  double averageHoriz = ((topLen) + (bottomLen))*.5;
632  double averageVert = ((leftLen) + (rightLen))*.5;
633 
634  ossimDpt deltaViewP1P2 = m_Vul - m_Vur;
635  ossimDpt deltaViewP1P3 = m_Vul - m_Vll;
636 
637  double lengthViewP1P2 = deltaViewP1P2.length();//+1;
638  double lengthViewP1P3 = deltaViewP1P3.length();//+1;
639 
640  if(lengthViewP1P2 > FLT_EPSILON)
641  m_ViewToImageScale.x = averageHoriz/lengthViewP1P2;
642  else
644  if(lengthViewP1P3 > FLT_EPSILON)
645  m_ViewToImageScale.y = averageVert/lengthViewP1P3;
646  else
648  }
649 #endif
650 
651  //std::cout << m_ViewToImageScale << std::endl;
653  {
656  }
657  else
658  {
660  }
661 }
ossimRefPtr< ossimImageViewTransform > m_transform
ossim_float64 width() const
Definition: ossimDrect.h:522
double y
Definition: ossimDpt.h:165
double length() const
Definition: ossimDpt.h:81
double ossim_float64
os2<< "> n<< " > nendobj n
#define FLT_EPSILON
bool hasNans() const
Definition: ossimDpt.h:67
ossim_float64 height() const
Definition: ossimDrect.h:517
double x
Definition: ossimDpt.h:164
ossimDpt computeViewToImageScale(const ossimDpt &viewPt, const ossimDpt &delta=ossimDpt(1.0, 1.0)) const
void makeNan()
Definition: ossimDpt.h:65
virtual void viewToImage(const ossimDpt &viewPoint, ossimDpt &imagePoint) const
int ossim_int32

◆ viewHasNans()

bool ossimImageRenderer::ossimRendererSubRectInfo::viewHasNans ( ) const
inline

◆ viewIsNan()

bool ossimImageRenderer::ossimRendererSubRectInfo::viewIsNan ( ) const
inline

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const ossimRendererSubRectInfo rhs 
)
friend

Definition at line 168 of file ossimImageRenderer.h.

169  {
170  return out << "vul: " << rhs.m_Vul << endl
171  << "vur: " << rhs.m_Vur << endl
172  << "vlr: " << rhs.m_Vlr << endl
173  << "vll: " << rhs.m_Vll << endl
174  << "iul: " << rhs.m_Iul << endl
175  << "iur: " << rhs.m_Iur << endl
176  << "ilr: " << rhs.m_Ilr << endl
177  << "ill: " << rhs.m_Ill << endl
178  << "scale: " << rhs.m_ViewToImageScale << endl;
179 
180  }

Member Data Documentation

◆ m_Ill

ossimDpt ossimImageRenderer::ossimRendererSubRectInfo::m_Ill

Definition at line 238 of file ossimImageRenderer.h.

Referenced by ossimImageRenderer::fillTile(), and ossimRendererSubRectInfo().

◆ m_Ilr

ossimDpt ossimImageRenderer::ossimRendererSubRectInfo::m_Ilr

Definition at line 237 of file ossimImageRenderer.h.

Referenced by ossimImageRenderer::fillTile(), and ossimRendererSubRectInfo().

◆ m_ImageToViewScale

ossimDpt ossimImageRenderer::ossimRendererSubRectInfo::m_ImageToViewScale

Definition at line 246 of file ossimImageRenderer.h.

Referenced by ossimRendererSubRectInfo().

◆ m_Iul

ossimDpt ossimImageRenderer::ossimRendererSubRectInfo::m_Iul

Definition at line 235 of file ossimImageRenderer.h.

Referenced by ossimImageRenderer::fillTile(), and ossimRendererSubRectInfo().

◆ m_Iur

ossimDpt ossimImageRenderer::ossimRendererSubRectInfo::m_Iur

Definition at line 236 of file ossimImageRenderer.h.

Referenced by ossimImageRenderer::fillTile(), and ossimRendererSubRectInfo().

◆ m_llRoundTripError

ossimDpt ossimImageRenderer::ossimRendererSubRectInfo::m_llRoundTripError

Definition at line 257 of file ossimImageRenderer.h.

◆ m_lrRoundTripError

ossimDpt ossimImageRenderer::ossimRendererSubRectInfo::m_lrRoundTripError

Definition at line 256 of file ossimImageRenderer.h.

◆ m_transform

ossimRefPtr<ossimImageViewTransform> ossimImageRenderer::ossimRendererSubRectInfo::m_transform
mutable

Definition at line 259 of file ossimImageRenderer.h.

Referenced by splitHorizontal().

◆ m_ulRoundTripError

ossimDpt ossimImageRenderer::ossimRendererSubRectInfo::m_ulRoundTripError

Definition at line 254 of file ossimImageRenderer.h.

◆ m_urRoundTripError

ossimDpt ossimImageRenderer::ossimRendererSubRectInfo::m_urRoundTripError

Definition at line 255 of file ossimImageRenderer.h.

◆ m_viewBounds

const ossimPolyArea2d* ossimImageRenderer::ossimRendererSubRectInfo::m_viewBounds
mutable

Definition at line 260 of file ossimImageRenderer.h.

Referenced by splitAll(), splitHorizontal(), splitVertical(), and splitView().

◆ m_ViewToImageScale

ossimDpt ossimImageRenderer::ossimRendererSubRectInfo::m_ViewToImageScale

Definition at line 245 of file ossimImageRenderer.h.

Referenced by ossimRendererSubRectInfo().

◆ m_Vll

ossimIpt ossimImageRenderer::ossimRendererSubRectInfo::m_Vll

Definition at line 243 of file ossimImageRenderer.h.

Referenced by isViewEqual(), ossimRendererSubRectInfo(), and splitHorizontal().

◆ m_VllScale

ossimDpt ossimImageRenderer::ossimRendererSubRectInfo::m_VllScale

Definition at line 252 of file ossimImageRenderer.h.

◆ m_Vlr

ossimIpt ossimImageRenderer::ossimRendererSubRectInfo::m_Vlr

Definition at line 242 of file ossimImageRenderer.h.

Referenced by isViewEqual(), ossimRendererSubRectInfo(), and splitHorizontal().

◆ m_VlrScale

ossimDpt ossimImageRenderer::ossimRendererSubRectInfo::m_VlrScale

Definition at line 251 of file ossimImageRenderer.h.

◆ m_Vul

ossimIpt ossimImageRenderer::ossimRendererSubRectInfo::m_Vul

Definition at line 240 of file ossimImageRenderer.h.

Referenced by isViewEqual(), ossimRendererSubRectInfo(), and splitHorizontal().

◆ m_VulScale

ossimDpt ossimImageRenderer::ossimRendererSubRectInfo::m_VulScale

Definition at line 249 of file ossimImageRenderer.h.

◆ m_Vur

ossimIpt ossimImageRenderer::ossimRendererSubRectInfo::m_Vur

Definition at line 241 of file ossimImageRenderer.h.

Referenced by isViewEqual(), ossimRendererSubRectInfo(), and splitHorizontal().

◆ m_VurScale

ossimDpt ossimImageRenderer::ossimRendererSubRectInfo::m_VurScale

Definition at line 250 of file ossimImageRenderer.h.


The documentation for this class was generated from the following files: