From: inv Date: Mon, 27 Jan 2014 11:47:09 +0000 (+0000) Subject: RNV: Fix compilation with the DEV version of the OCCT. X-Git-Tag: V7_4_0a1~25 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=017ce23d41a9fe66d9d2f53e8d28561d96307cd9;p=modules%2Fgui.git RNV: Fix compilation with the DEV version of the OCCT. --- diff --git a/src/OCCViewer/OCCViewer_ViewPort3d.cxx b/src/OCCViewer/OCCViewer_ViewPort3d.cxx index de0302be4..096ea2782 100755 --- a/src/OCCViewer/OCCViewer_ViewPort3d.cxx +++ b/src/OCCViewer/OCCViewer_ViewPort3d.cxx @@ -41,8 +41,13 @@ #include #include + +#if OCC_VERSION_LARGE > 0x06070000 +#include +#else #include #include +#endif #include "utilities.h" @@ -72,6 +77,9 @@ OCCViewer_ViewPort3d::OCCViewer_ViewPort3d( QWidget* parent, const Handle( V3d_V // VSR: 01/07/2010 commented to avoid SIGSEGV at SALOME exit //selectVisualId(); +#if OCC_VERSION_LARGE > 0x06070000 + myActiveView = new V3d_View( viewer, type ); +#else if ( type == V3d_ORTHOGRAPHIC ) { myOrthoView = new V3d_OrthographicView( viewer ); myActiveView = myOrthoView; @@ -80,6 +88,8 @@ OCCViewer_ViewPort3d::OCCViewer_ViewPort3d( QWidget* parent, const Handle( V3d_V myPerspView = new V3d_PerspectiveView( viewer ); myActiveView = myPerspView; } +#endif + setBackground( Qtx::BackgroundData( Qt::black ) ); // set default background } @@ -665,7 +675,14 @@ void OCCViewer_ViewPort3d::fitAll( bool keepScale, bool withZ, bool upd ) myScale = activeView()->Scale(); Standard_Real margin = 0.01; + +#if OCC_VERSION_LARGE > 0x06070000 + activeView()->FitAll( margin, upd ); + if(withZ) + activeView()->ZFitAll(); +#else activeView()->FitAll( margin, withZ, upd ); +#endif activeView()->SetZSize(0.); emit vpTransformed( this ); } @@ -774,8 +791,12 @@ bool OCCViewer_ViewPort3d::synchronize( OCCViewer_ViewPort* view ) Handle(V3d_View) aView3d = getView(); Handle(V3d_View) aRefView3d = vp3d->getView(); aView3d->SetImmediateUpdate( Standard_False ); +#if OCC_VERSION_LARGE > 0x06070000 + aView3d->Camera()->Copy( aRefView3d->Camera() ); +#else aView3d->SetViewMapping( aRefView3d->ViewMapping() ); aView3d->SetViewOrientation( aRefView3d->ViewOrientation() ); +#endif aView3d->ZFitAll(); aView3d->SetImmediateUpdate( Standard_True ); aView3d->Update(); diff --git a/src/OCCViewer/OCCViewer_ViewPort3d.h b/src/OCCViewer/OCCViewer_ViewPort3d.h index e4f3cd724..1adedef4a 100755 --- a/src/OCCViewer/OCCViewer_ViewPort3d.h +++ b/src/OCCViewer/OCCViewer_ViewPort3d.h @@ -117,9 +117,11 @@ private: void updateBackground(); private: + Handle(V3d_View) myActiveView; +#if OCC_VERSION_LARGE <= 0x06070000 Handle(V3d_View) myOrthoView; Handle(V3d_View) myPerspView; - Handle(V3d_View) myActiveView; +#endif bool myBusy; double myScale; bool myIsAdvancedZoomingEnabled; diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index 683f0499e..5b6a2eae8 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -603,7 +603,11 @@ bool OCCViewer_ViewWindow::computeGravityCenter( double& theX, double& theY, dou Nstruct = MySetOfStructures.Extent() ; Graphic3d_MapIteratorOfMapOfStructure MyIterator(MySetOfStructures) ; - aView->ViewMapping().WindowLimit(Umin,Vmin,Umax,Vmax) ; +#if OCC_VERSION_LARGE > 0x06070000 + aView->Camera()->WindowLimit(Umin,Vmin,Umax,Vmax); +#else + aView->ViewMapping().WindowLimit(Umin,Vmin,Umax,Vmax); +#endif Npoint = 0 ; theX = theY = theZ = 0. ; for( ; MyIterator.More(); MyIterator.Next()) { if (!(MyIterator.Key())->IsEmpty()) { @@ -2695,9 +2699,15 @@ SUIT_CameraProperties OCCViewer_ViewWindow::cameraProperties() Precision::Confusion(), Precision::Confusion() ); - // get projection reference point in view coordinates +// get projection reference point in view coordinates +#if OCC_VERSION_LARGE > 0x06070000 + gp_Pnt aProjRef = aSourceView->Camera()->ProjectionShift(); + aProjRef.SetX( -aProjRef.X() ); + aProjRef.SetY( -aProjRef.Y() ); +#else Graphic3d_Vertex aProjRef = aSourceView->ViewMapping().ProjectionReferencePoint(); - +#endif + // transform to world-space coordinate system gp_Pnt aPosition = gp_Pnt(aProjRef.X(), aProjRef.Y(), aCameraDepth).Transformed(aTrsf); @@ -2771,6 +2781,11 @@ void OCCViewer_ViewWindow::synchronize( SUIT_ViewWindow* theView ) gp_Pnt aProjRef(aPosition[0], aPosition[1], aPosition[2]); aProjRef.Transform(aTrsf); +#if OCC_VERSION_LARGE > 0x06070000 + aDestView->Camera()->SetDirection( -aProjDir ); + aDestView->Camera()->SetUp( gp_Dir( anUpDir[0], anUpDir[1], anUpDir[2] ) ); + aDestView->Camera()->SetProjectionShift( gp_Pnt( -aProjRef.X(), -aProjRef.Y(), 0.0 ) ); +#else // set view camera properties using low-level approach. this is done // in order to avoid interference with static variables in v3d view used // when rotation is in process in another view. @@ -2791,6 +2806,7 @@ void OCCViewer_ViewWindow::synchronize( SUIT_ViewWindow* theView ) // set panning aDestView->SetCenter(aProjRef.X(), aProjRef.Y()); +#endif // set mapping scale Standard_Real aWidth, aHeight;