From b228710c9ded203c803f7dcfc2c67f7a19510101 Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 29 Dec 2016 14:00:14 +0300 Subject: [PATCH] ZFitAll leads to black screen of OCC viewer during rotation if gradient background mode is switched (#28304 issue in OCCT) --- src/OCCViewer/OCCViewer_ViewPort3d.cxx | 14 +++++++++++--- src/OCCViewer/OCCViewer_ViewPort3d.h | 2 ++ src/OCCViewer/OCCViewer_ViewWindow.cxx | 7 ++++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/OCCViewer/OCCViewer_ViewPort3d.cxx b/src/OCCViewer/OCCViewer_ViewPort3d.cxx index ee51e0b4e..e42313e63 100755 --- a/src/OCCViewer/OCCViewer_ViewPort3d.cxx +++ b/src/OCCViewer/OCCViewer_ViewPort3d.cxx @@ -245,10 +245,13 @@ bool OCCViewer_ViewPort3d::syncronize( const OCCViewer_ViewPort3d* ref ) /* update */ tgtView->Update(); tgtView->SetImmediateUpdate( Standard_True ); +#if OCC_VERSION_LARGE <= 0x07000000 tgtView->ZFitAll(); +#endif return true; } +#if OCC_VERSION_LARGE <= 0x07000000 /*! Returns Z-size of this view. [ public ] */ @@ -270,6 +273,7 @@ void OCCViewer_ViewPort3d::setZSize( double zsize ) if ( !myPerspView.IsNull() ) myPerspView->SetZSize( zsize );*/ } +#endif /*! Get axial scale to the view @@ -574,8 +578,8 @@ void OCCViewer_ViewPort3d::rotate( int x, int y, void OCCViewer_ViewPort3d::endRotation() { if ( !activeView().IsNull() ) { +#if OCC_VERSION_LARGE <= 0x07000000 activeView()->ZFitAll( 1.0 ); -#if OCC_VERSION_LARGE <= 0x06070100 activeView()->SetZSize( 0.0 ); #endif activeView()->Update(); @@ -651,12 +655,14 @@ void OCCViewer_ViewPort3d::fitAll( bool keepScale, bool withZ, bool upd ) #if OCC_VERSION_LARGE > 0x06070100 activeView()->FitAll( margin, upd ); +#if OCC_VERSION_LARGE <= 0x07000000 if(withZ) activeView()->ZFitAll(); -#else +#endif +#else activeView()->FitAll( margin, withZ, upd ); -#endif activeView()->SetZSize(0.); +#endif emit vpTransformed( this ); } @@ -770,7 +776,9 @@ bool OCCViewer_ViewPort3d::synchronize( OCCViewer_ViewPort* view ) aView3d->SetViewMapping( aRefView3d->ViewMapping() ); aView3d->SetViewOrientation( aRefView3d->ViewOrientation() ); #endif +#if OCC_VERSION_LARGE <= 0x07000000 aView3d->ZFitAll(); +#endif aView3d->SetImmediateUpdate( Standard_True ); aView3d->Update(); blockSignals( blocked ); diff --git a/src/OCCViewer/OCCViewer_ViewPort3d.h b/src/OCCViewer/OCCViewer_ViewPort3d.h index f6f9f55f1..994284898 100755 --- a/src/OCCViewer/OCCViewer_ViewPort3d.h +++ b/src/OCCViewer/OCCViewer_ViewPort3d.h @@ -65,8 +65,10 @@ public: // void setActive( V3d_TypeOfView ); virtual bool syncronize( const OCCViewer_ViewPort3d* ); +#if OCC_VERSION_LARGE <= 0x07000000 double getZSize() const; void setZSize( double ); +#endif void getAxialScale( double&, double&, double& ); diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index 282daceb7..8959f5961 100644 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -406,7 +406,9 @@ bool OCCViewer_ViewWindow::eventFilter( QObject* watched, QEvent* e ) int x1 = (int)( aEvent->x() + width()*delta/100 ); int y1 = (int)( aEvent->y() + height()*delta/100 ); myViewPort->zoom( x, y, x1, y1 ); +#if OCC_VERSION_LARGE <= 0x07000000 myViewPort->getView()->ZFitAll(); +#endif emit vpTransformationFinished ( ZOOMVIEW ); } } @@ -1060,7 +1062,9 @@ void OCCViewer_ViewWindow::vpMouseReleaseEvent(QMouseEvent* theEvent) case PANVIEW: case ZOOMVIEW: +#if OCC_VERSION_LARGE <= 0x07000000 myViewPort->getView()->ZFitAll(); +#endif resetState(); break; @@ -3667,8 +3671,9 @@ void OCCViewer_ViewWindow::synchronize( SUIT_ViewWindow* theView ) #endif getViewPort()->setAxialScale( anAxialScale[0], anAxialScale[1], anAxialScale[2] ); - +#if OCC_VERSION_LARGE <= 0x07000000 aDestView->ZFitAll(); +#endif aDestView->SetImmediateUpdate( Standard_True ); aDestView->Redraw(); -- 2.39.2