]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Code layouting
authorapo <apo@opencascade.com>
Thu, 9 Feb 2006 13:16:37 +0000 (13:16 +0000)
committerapo <apo@opencascade.com>
Thu, 9 Feb 2006 13:16:37 +0000 (13:16 +0000)
src/VVTK/VVTK_Renderer.cxx

index 484eff95d63b51e8dd2180f19b762ea2be0ee683..8a1719860a52a815f4bfc9a8e37245ed1b21cc7a 100644 (file)
@@ -236,19 +236,17 @@ vtkStandardNewMacro(VVTK_Renderer1);
 
 //----------------------------------------------------------------------------
 VVTK_Renderer1::VVTK_Renderer1():
-  //myImplicitFunctionWidget(VISU_ImplicitFunctionWidget::New()),
   myWidgetCtrl(VISU_WidgetCtrl::New()),
   myOutsideCursorSettings(NULL)
 {
   if(MYDEBUG) INFOS("VVTK_Renderer1() - "<<this);
 
-  //myImplicitFunctionWidget->SetPlaceFactor(1.1);
   myWidgetCtrl->SetPlaceFactor(1.1);
   //
-  VISU_PlanesWidget *pPlanesWidget=myWidgetCtrl->GetPlanesWidget();
-  pPlanesWidget->SetOutlineTranslation(false);
-  vtkProperty* aSelectedPlaneProperty = pPlanesWidget->GetSelectedPlaneProperty();
-  vtkProperty* aPlaneProperty = pPlanesWidget->GetPlaneProperty();
+  VISU_PlanesWidget *aPlanesWidget = myWidgetCtrl->GetPlanesWidget();
+  aPlanesWidget->SetOutlineTranslation(false);
+  vtkProperty* aSelectedPlaneProperty = aPlanesWidget->GetSelectedPlaneProperty();
+  vtkProperty* aPlaneProperty = aPlanesWidget->GetPlaneProperty();
   aPlaneProperty->SetOpacity(aSelectedPlaneProperty->GetOpacity()*1.5);
   //
   myWidgetCtrl->Delete();
@@ -274,6 +272,7 @@ VVTK_Renderer1
   }
 }
 
+
 //----------------------------------------------------------------------------
 void
 VVTK_Renderer1
@@ -286,30 +285,32 @@ VVTK_Renderer1
     AdjustWidgetCtrl();
   }
 }
+
+
 //----------------------------------------------------------------------------
-void VVTK_Renderer1::AdjustWidgetCtrl()
+void
+VVTK_Renderer1
+::AdjustWidgetCtrl()
 {
-  if(SVTK_Renderer::OnAdjustActors()){
-    VISU_PlanesWidget *pPlanesWidget=myWidgetCtrl->GetPlanesWidget();
-    pPlanesWidget->InitialPlaceWidget(myBndBox);
-    pPlanesWidget->SetOrigin(0.5*(myBndBox[1] + myBndBox[0]),
-                            0.5*(myBndBox[3] + myBndBox[2]),
-                            0.5*(myBndBox[5] + myBndBox[4]));
-    //
-    VISU_SphereWidget *pSphereWidget=myWidgetCtrl->GetSphereWidget();
-    pSphereWidget->SetCenter(0.5*(myBndBox[1] + myBndBox[0]),
-                            0.5*(myBndBox[3] + myBndBox[2]),
-                            0.5*(myBndBox[5] + myBndBox[4]));
-    float dX, dXmin=1.e20;
-    for (int i=0; i<3; ++i) {
-      dX=myBndBox[2*i+1]-myBndBox[2*i];
-      if (dX<dXmin){
-       dXmin=dX;
-      }
-    }
-    pSphereWidget->SetRadius(dXmin);
+  VISU_PlanesWidget *aPlanesWidget = myWidgetCtrl->GetPlanesWidget();
+  aPlanesWidget->InitialPlaceWidget(myBndBox);
+  aPlanesWidget->SetOrigin(0.5*(myBndBox[1] + myBndBox[0]),
+                          0.5*(myBndBox[3] + myBndBox[2]),
+                          0.5*(myBndBox[5] + myBndBox[4]));
+  //
+  VISU_SphereWidget *aSphereWidget = myWidgetCtrl->GetSphereWidget();
+  aSphereWidget->SetCenter(0.5*(myBndBox[1] + myBndBox[0]),
+                          0.5*(myBndBox[3] + myBndBox[2]),
+                          0.5*(myBndBox[5] + myBndBox[4]));
+  
+  float aMinLength = VTK_LARGE_FLOAT;
+  for (int i=0; i<3; ++i) {
+    float aLength = myBndBox[2*i+1]-myBndBox[2*i];
+    aMinLength = std::min(aMinLength,aLength);
   }
+  aSphereWidget->SetRadius(aMinLength);
 }
+
 //----------------------------------------------------------------------------
 void 
 VVTK_Renderer1
@@ -329,7 +330,9 @@ VVTK_Renderer1
 }
 
 //----------------------------------------------------------------------------
-VISU_WidgetCtrl* VVTK_Renderer1::GetWidgetCtrl()
+VISU_WidgetCtrl* 
+VVTK_Renderer1
+::GetWidgetCtrl()
 {
   return myWidgetCtrl.GetPointer();
 }