]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
fix the pb with segmentation cursor during FitAll operation
authorpkv <pkv@opencascade.com>
Tue, 18 Oct 2005 07:48:45 +0000 (07:48 +0000)
committerpkv <pkv@opencascade.com>
Tue, 18 Oct 2005 07:48:45 +0000 (07:48 +0000)
src/PIPELINE/VISU_ImplicitFunctionWidget.cxx
src/PIPELINE/VISU_ImplicitFunctionWidget.h
src/VVTK/VVTK_Renderer.cxx
src/VVTK/VVTK_Renderer.h

index fd1e9e30867aae8f6f017d339077d14f242a5925..2ac6af1dc77cb39db3c2079cc01f565d7bb854a0 100644 (file)
@@ -1212,6 +1212,26 @@ void VISU_ImplicitFunctionWidget::CreateDefaultProperties()
   this->EdgesProperty->SetAmbientColor(1.0,1.0,1.0);
 }
 //==================================================================
+// function: InitialPlaceWidget
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::InitialPlaceWidget(float bds[6])
+{
+  float bounds[6], origin[3];
+
+  PlaceWidget(bds);
+  //
+  this->AdjustBounds(bds, bounds, origin);
+  this->SetOrigin((bounds[1]+bounds[0])/2.0,
+                 (bounds[3]+bounds[2])/2.0,
+                 (bounds[5]+bounds[4])/2.0);
+
+  static float DIST_COEFF = 0.1;
+  SetDistance(this->InitialLength*DIST_COEFF);
+  //
+  this->UpdateRepresentation();
+}
+//==================================================================
 // function: PlaceWidget
 // purpose :
 //==================================================================
@@ -1245,7 +1265,7 @@ void VISU_ImplicitFunctionWidget::PlaceWidget(float bds[6])
       myPlane2->SetNormal(-1,0,0);
       this->LineSource->SetPoint2(1,0,0);
     }
-    }
+  }
   
   for (i=0; i<6; i++)    {
     this->InitialBounds[i] = bounds[i];
@@ -1255,13 +1275,6 @@ void VISU_ImplicitFunctionWidget::PlaceWidget(float bds[6])
                              (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) +
                              (bounds[5]-bounds[4])*(bounds[5]-bounds[4]));
 
-  this->SetOrigin((bounds[1]+bounds[0])/2.0,
-                 (bounds[3]+bounds[2])/2.0,
-                 (bounds[5]+bounds[4])/2.0);
-
-  static float DIST_COEFF = 0.1;
-  SetDistance(this->InitialLength*DIST_COEFF);
-  
   this->UpdateRepresentation();
 }
 //==================================================================
index cdb4eb9981a4998db2c5b0fcef3929de1886fe18..994037792528a6c0556163ab35872f21b51df9ef 100644 (file)
@@ -167,6 +167,8 @@ public:
   // applies to the edges when tubed.)
   vtkGetObjectMacro(EdgesProperty,vtkProperty);
 
+  void InitialPlaceWidget(float bds[6]);
+
 protected:
   VISU_ImplicitFunctionWidget();
   ~VISU_ImplicitFunctionWidget();
index 3020edcfd379c20c67bd87ac2c1eacdfd5a73337..afe15d1c48cfea66bb8ef7ac0fe445458d687242 100644 (file)
@@ -234,6 +234,7 @@ VVTK_Renderer1
     anActor->SetImplicitFunctionWidget(GetImplicitFunctionWidget());
     anActor->SetOutsideCursorSettings(myOutsideCursorSettings);
     Superclass::AddActor(anActor);
+    AdjustImplicitFunctionWidget();
   }
 }
 
@@ -247,9 +248,20 @@ VVTK_Renderer1
     anActor->SetImplicitFunctionWidget(NULL);
     anActor->SetOutsideCursorSettings(NULL);
     Superclass::RemoveActor(theActor);
+    AdjustImplicitFunctionWidget();
+  }
+}
+//----------------------------------------------------------------------------
+void VVTK_Renderer1::AdjustImplicitFunctionWidget()
+{
+  if(SVTK_Renderer::OnAdjustActors()){
+    myImplicitFunctionWidget->InitialPlaceWidget(myBndBox);
+    myImplicitFunctionWidget->SetOrigin((myBndBox[1] + myBndBox[0]) / 2.0,
+                                       (myBndBox[3] + myBndBox[2]) / 2.0,
+                                       (myBndBox[5] + myBndBox[4]) / 2.0);
+    myImplicitFunctionWidget->SetHandleSize(myImplicitFunctionWidget->GetHandleSize());
   }
 }
-
 //----------------------------------------------------------------------------
 void 
 VVTK_Renderer1
@@ -280,15 +292,7 @@ bool
 VVTK_Renderer1
 ::OnAdjustActors()
 {
-  if(SVTK_Renderer::OnAdjustActors()){
-    myImplicitFunctionWidget->PlaceWidget(myBndBox);
-    myImplicitFunctionWidget->SetOrigin((myBndBox[1] + myBndBox[0]) / 2.0,
-                                       (myBndBox[3] + myBndBox[2]) / 2.0,
-                                       (myBndBox[5] + myBndBox[4]) / 2.0);
-    myImplicitFunctionWidget->SetHandleSize(myImplicitFunctionWidget->GetHandleSize());
-    return true;
-  }
-  return false;
+  return SVTK_Renderer::OnAdjustActors();
 }
 
 
@@ -342,7 +346,7 @@ VVTK_Renderer2
 
   switch(theEvent){
   case vtkCommand::EndInteractionEvent:
-    self->OnEndInteractionEvent();
+    self->OnEndInteractionEvent();  
     break;
   }
 }
index 85ac72b983ad00ab3f6b6d4543c5e6699726560b..60531f5623b4d8026bbc2efa9963e371f315b4af 100644 (file)
@@ -100,6 +100,8 @@ class VVTK_EXPORT VVTK_Renderer1 : public VVTK_Renderer
   bool
   OnAdjustActors();
 
+  void AdjustImplicitFunctionWidget();
+
   vtkSmartPointer<VISU_ImplicitFunctionWidget> myImplicitFunctionWidget;
   VISU_OutsideCursorSettings* myOutsideCursorSettings;
   vtkSmartPointer<VISU_FPSActor> myTextActor;