From: pkv Date: Tue, 18 Oct 2005 07:48:45 +0000 (+0000) Subject: fix the pb with segmentation cursor during FitAll operation X-Git-Tag: TG-D5-38-2003_D2005-20-12~147 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8c1000088d995ad840bd2f47b819bfe435bfdcf1;p=modules%2Fvisu.git fix the pb with segmentation cursor during FitAll operation --- diff --git a/src/PIPELINE/VISU_ImplicitFunctionWidget.cxx b/src/PIPELINE/VISU_ImplicitFunctionWidget.cxx index fd1e9e30..2ac6af1d 100644 --- a/src/PIPELINE/VISU_ImplicitFunctionWidget.cxx +++ b/src/PIPELINE/VISU_ImplicitFunctionWidget.cxx @@ -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(); } //================================================================== diff --git a/src/PIPELINE/VISU_ImplicitFunctionWidget.h b/src/PIPELINE/VISU_ImplicitFunctionWidget.h index cdb4eb99..99403779 100644 --- a/src/PIPELINE/VISU_ImplicitFunctionWidget.h +++ b/src/PIPELINE/VISU_ImplicitFunctionWidget.h @@ -167,6 +167,8 @@ public: // applies to the edges when tubed.) vtkGetObjectMacro(EdgesProperty,vtkProperty); + void InitialPlaceWidget(float bds[6]); + protected: VISU_ImplicitFunctionWidget(); ~VISU_ImplicitFunctionWidget(); diff --git a/src/VVTK/VVTK_Renderer.cxx b/src/VVTK/VVTK_Renderer.cxx index 3020edcf..afe15d1c 100644 --- a/src/VVTK/VVTK_Renderer.cxx +++ b/src/VVTK/VVTK_Renderer.cxx @@ -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; } } diff --git a/src/VVTK/VVTK_Renderer.h b/src/VVTK/VVTK_Renderer.h index 85ac72b9..60531f56 100644 --- a/src/VVTK/VVTK_Renderer.h +++ b/src/VVTK/VVTK_Renderer.h @@ -100,6 +100,8 @@ class VVTK_EXPORT VVTK_Renderer1 : public VVTK_Renderer bool OnAdjustActors(); + void AdjustImplicitFunctionWidget(); + vtkSmartPointer myImplicitFunctionWidget; VISU_OutsideCursorSettings* myOutsideCursorSettings; vtkSmartPointer myTextActor;