]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
To make myInteratorStyle member of SVTK_View, not of SVT_VieweWindow
authorapo <apo@opencascade.com>
Fri, 19 Aug 2005 14:42:21 +0000 (14:42 +0000)
committerapo <apo@opencascade.com>
Fri, 19 Aug 2005 14:42:21 +0000 (14:42 +0000)
src/SVTK/SVTK_RenderWindow.cxx
src/SVTK/SVTK_View.cxx
src/SVTK/SVTK_View.h

index eccc4c75c8da3b7372026ee5e8ee742300edda0c..ffcc0521072ce84ceaa3d8fb2ec65eb607dbaeb9 100644 (file)
@@ -25,9 +25,6 @@
 #include <vtkCamera.h>
 #ifndef WNT
 #include <vtkXOpenGLRenderWindow.h>
-//#include <GL/gl.h>
-//#include <GL/glu.h>
-//#include <qgl.h>
 #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 );
 
index 5a2c02b6596ccf3bea0211c3363f5cfa77b1f4f3..76c1c01028fedd46b69034f964565554f9f81989 100644 (file)
@@ -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<SALOME_Actor>( getRenderer()->GetActors(),
                           TIsSameIObject<SALOME_Actor>( theIO ),
index 9cff5031db9bf999ee4c38b89b223b046c92f4e3..f8dcba03d91bfc39ec5496471f091626541b73a8 100644 (file)
@@ -119,7 +119,7 @@ private:
   float myPriority;
 
   vtkSmartPointer<SVTK_Selector> mySelector;
-  SVTK_InteractorStyle* myInteractorStyle;
+  vtkSmartPointer<SVTK_InteractorStyle> myInteractorStyle;
 
   double myCurScale;
 };