From: Paul RASCLE Date: Thu, 1 Oct 2020 14:15:32 +0000 (+0200) Subject: Bug on dragging rectangle in overview: Fatal error "ZFar should be greater than ZNear... X-Git-Tag: SH_V2_2_0~27 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=560a5e2229f273b7464fb955b334db3a7c6a2a9d;p=modules%2Fhydro.git Bug on dragging rectangle in overview: Fatal error "ZFar should be greater than ZNear" Fixed in HYDROGUI_Overview.cxx: remove patch for OCCT 6.9.1 --- diff --git a/src/HYDROGUI/HYDROGUI_Overview.cxx b/src/HYDROGUI/HYDROGUI_Overview.cxx index b6dd6ee8..f1075782 100644 --- a/src/HYDROGUI/HYDROGUI_Overview.cxx +++ b/src/HYDROGUI/HYDROGUI_Overview.cxx @@ -27,6 +27,9 @@ #include #include +//#define _DEVDEBUG_ +#include "HYDRO_trace.hxx" + class HYDROGUI_OverviewBand : public QtxPolyRubberBand { public: @@ -121,6 +124,7 @@ QPoint HYDROGUI_OverviewBand::center() const void HYDROGUI_OverviewBand::drag( const QPoint& thePoint, bool isStart ) { + DEBTRACE("drag"); if( myIsDrag==isStart ) return; @@ -148,6 +152,7 @@ bool HYDROGUI_OverviewBand::isDrag() const void HYDROGUI_OverviewBand::dragging( const QPoint& thePoint ) { + DEBTRACE("dragging"); int n = myPoints.size(); QPoint delta = thePoint - myStartPnt; for( int i=0; igetView()->Convert( main->width()/2, main->height()/2, x1, y1, z1 ); - + DEBTRACE("x1, y1, z1 " << x1 << " " << y1 << " " << z1); // Patch for OCCT 6.9.1, on 7.0.0 the moving of point to plane XY is not necessary - gp_Dir dm = main->getView()->Camera()->Direction(); - double t1 = -z1/dm.Z(); - x1 += dm.X()*t1; - y1 += dm.Y()*t1; - z1 += dm.Z()*t1; +// gp_Dir dm = main->getView()->Camera()->Direction(); +// double t1 = -z1/dm.Z(); +// x1 += dm.X()*t1; +// y1 += dm.Y()*t1; +// z1 += dm.Z()*t1; +// DEBTRACE("x1, y1, z1 " << x1 << " " << y1 << " " << z1); overview->getView()->Convert( c.x(), c.y(), x2, y2, z2 ); gp_Dir dov = overview->getView()->Camera()->Direction(); @@ -206,27 +212,37 @@ void HYDROGUI_OverviewBand::update( bool isFromMain ) x2 += dov.X()*t2; y2 += dov.Y()*t2; z2 += dov.Z()*t2; + DEBTRACE("x2, y2, z2 " << x2 << " " << y2 << " " << z2); gp_Trsf aTrsf; aTrsf.SetTranslation( gp_Pnt( x1, y1, z1 ), gp_Pnt( x2, y2, z2 ) ); // Temporary patch for bug in OCCT 6.9.1 - Handle(Graphic3d_Camera) cam = main->getView()->Camera(); - gp_Dir u = cam->Up(), nu = u.Transformed (aTrsf); - gp_Pnt e = cam->Eye(), ne = e.Transformed (aTrsf); - gp_Pnt cen = cam->Center(), ncen = cen.Transformed (aTrsf); - - if (!nu.IsEqual (u, 0.0)) - cam->SetUp(nu); - - if (!ne.IsEqual (e, 0.0)) - cam->SetEye(ne); - - if (!ncen.IsEqual(cen, 0.0)) - cam->SetCenter (ncen); +// Handle(Graphic3d_Camera) cam = main->getView()->Camera(); +// gp_Dir u = cam->Up(), nu = u.Transformed (aTrsf); +// gp_Pnt e = cam->Eye(), ne = e.Transformed (aTrsf); +// gp_Pnt cen = cam->Center(), ncen = cen.Transformed (aTrsf); +// +// if (!nu.IsEqual (u, 0.0)) +// { +// cam->SetUp(nu); +// DEBTRACE("nu " << nu.X() << " " << nu.Y() << " " << nu.Z()); +// } +// +// if (!ne.IsEqual (e, 0.0)) +// { +// cam->SetEye(ne); +// DEBTRACE("ne " << ne.X() << " " << ne.Y() << " " << ne.Z()) +// } +// +// if (!ncen.IsEqual(cen, 0.0)) +// { +// cam->SetCenter (ncen); +// DEBTRACE("ncen " << ncen.X() << " " << ncen.Y() << " " << ncen.Z()) +// } //version for new OCCT: - //main->getView()->Camera()->Transform( aTrsf ); + main->getView()->Camera()->Transform( aTrsf ); main->repaint(); } } @@ -507,6 +523,7 @@ void HYDROGUI_Overview::onViewPortDestr() void HYDROGUI_Overview::CustomFitSelection() const { + DEBTRACE("CustomFitSelection"); OCCViewer_ViewPort3d* main = getViewPort( true ); if( !main ) return; @@ -570,6 +587,7 @@ typedef NCollection_DataMap::Iterator AIS_MapIteratorOfMapOfObjectOwners1; Bnd_Box HYDROGUI_Overview::BoundingForSelection() const { + DEBTRACE("BoundingForSelection"); Handle(AIS_InteractiveContext) c = context(); Bnd_Box aBndSelected;