From: apo Date: Fri, 19 Aug 2005 14:42:21 +0000 (+0000) Subject: To make myInteratorStyle member of SVTK_View, not of SVT_VieweWindow X-Git-Tag: BR-D5-38-2003_D2005-12-09~33 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=24635fa04a7deb4c355fa87ff692a4c76b0d3b2e;p=modules%2Fgui.git To make myInteratorStyle member of SVTK_View, not of SVT_VieweWindow --- diff --git a/src/SVTK/SVTK_RenderWindow.cxx b/src/SVTK/SVTK_RenderWindow.cxx index eccc4c75c..ffcc05210 100644 --- a/src/SVTK/SVTK_RenderWindow.cxx +++ b/src/SVTK/SVTK_RenderWindow.cxx @@ -25,9 +25,6 @@ #include #ifndef WNT #include -//#include -//#include -//#include #endif #if QT_VERSION > 300 @@ -308,7 +305,6 @@ SVTK_RenderWindow ::SetScale( double theScale[3] ) { myTransform->SetMatrixScale( theScale[0], theScale[1], theScale[2] ); - //myRWInteractor->Render(); Repaint(); } @@ -445,23 +441,10 @@ void SVTK_RenderWindow ::onResetView() { - int aTrihedronIsVisible = isTrihedronDisplayed(); - int aCubeAxesIsVisible = isCubeAxesDisplayed(); - - myTrihedron->SetVisibility( VTKViewer_Trihedron::eOnlyLineOn ); - myCubeAxes->SetVisibility(0); - - ::ResetCamera(myRenderer,true); + myRenderer->ResetCamera(); vtkCamera* aCamera = myRenderer->GetActiveCamera(); - aCamera->SetPosition(1,-1,1); - aCamera->SetViewUp(0,0,1); - ::ResetCamera(myRenderer,true); - - if (aTrihedronIsVisible) myTrihedron->VisibilityOn(); - else myTrihedron->VisibilityOff(); - - if (aCubeAxesIsVisible) myCubeAxes->VisibilityOn(); - else myCubeAxes->VisibilityOff(); + aCamera->SetPosition(1.0,-1.0,0.5); + aCamera->SetViewUp(0.0,0.0,1.0); static float aCoeff = 3.0; aCamera->SetParallelScale(aCoeff*aCamera->GetParallelScale()); @@ -473,41 +456,7 @@ void SVTK_RenderWindow ::onFitAll() { - int aTrihedronWasVisible = false; - int aCubeAxesWasVisible = false; - if (myTrihedron) { - aTrihedronWasVisible = isTrihedronDisplayed(); - if (aTrihedronWasVisible) - myTrihedron->VisibilityOff(); - } - - if (myCubeAxes) { - aCubeAxesWasVisible = isCubeAxesDisplayed(); - if (aCubeAxesWasVisible) - myCubeAxes->VisibilityOff(); - } - - if (myTrihedron->GetVisibleActorCount(myRenderer)) { - myTrihedron->VisibilityOff(); - myCubeAxes->VisibilityOff(); - ::ResetCamera(myRenderer); - } else { - myTrihedron->SetVisibility(VTKViewer_Trihedron::eOnlyLineOn); - myCubeAxes->SetVisibility(2); - ::ResetCamera(myRenderer,true); - } - - if (aTrihedronWasVisible) - myTrihedron->VisibilityOn(); - else - myTrihedron->VisibilityOff(); - - if (aCubeAxesWasVisible) - myCubeAxes->VisibilityOn(); - else - myCubeAxes->VisibilityOff(); - - ::ResetCameraClippingRange(myRenderer); + myRenderer->ResetCamera(); Repaint(); } @@ -589,8 +538,7 @@ SVTK_RenderWindow SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); static float aSizeInPercents = aResMgr->doubleValue("VTKViewer","trihedron_size", 105); - //bool isComputeTrihedronSize = - ::ComputeTrihedronSize(myRenderer, aNewSize, anOldSize, aSizeInPercents); + ComputeTrihedronSize(myRenderer, aNewSize, anOldSize, aSizeInPercents); myTrihedron->SetSize( aNewSize ); diff --git a/src/SVTK/SVTK_View.cxx b/src/SVTK/SVTK_View.cxx index 5a2c02b65..76c1c0102 100644 --- a/src/SVTK/SVTK_View.cxx +++ b/src/SVTK/SVTK_View.cxx @@ -49,6 +49,9 @@ SVTK_View SetSelector(SVTK_Selector::New()); GetSelector()->Delete(); + + SetInteractorStyle(SVTK_InteractorStyle::New()); + GetInteractorStyle()->Delete(); } //---------------------------------------------------------------------------- @@ -62,7 +65,7 @@ SVTK_InteractorStyle* SVTK_View ::GetInteractorStyle() { - return myInteractorStyle; + return myInteractorStyle.GetPointer(); } void @@ -71,6 +74,10 @@ SVTK_View { myInteractorStyle = theStyle; getInteractor()->SetInteractorStyle( theStyle ); + myInteractorStyle->FindPokedRenderer( 0, 0 ); + + myInteractorStyle->SetSelector( GetSelector() ); + myInteractorStyle->SetRenderWidget( this ); } //---------------------------------------------------------------------------- @@ -226,7 +233,6 @@ SVTK_View bool theIsHighlight, bool theIsUpdate ) { - //cout << "SVTK_View::highlight" << endl; using namespace VTK; ForEachIf( getRenderer()->GetActors(), TIsSameIObject( theIO ), diff --git a/src/SVTK/SVTK_View.h b/src/SVTK/SVTK_View.h index 9cff5031d..f8dcba03d 100644 --- a/src/SVTK/SVTK_View.h +++ b/src/SVTK/SVTK_View.h @@ -119,7 +119,7 @@ private: float myPriority; vtkSmartPointer mySelector; - SVTK_InteractorStyle* myInteractorStyle; + vtkSmartPointer myInteractorStyle; double myCurScale; };