From 959198f20fd8f3718bf4f5e72e714bc9ea6ee043 Mon Sep 17 00:00:00 2001 From: apo Date: Wed, 12 Jan 2005 13:09:15 +0000 Subject: [PATCH] Fix on - Bug PAL7606 Controls operation aren't work during Clipping --- src/SMESHGUI/SMESHGUI_ClippingDlg.cxx | 28 +++++++++++++-------------- src/SMESHGUI/SMESHGUI_VTKUtils.cxx | 17 ++++++++++++++-- src/SMESHGUI/SMESHGUI_VTKUtils.h | 3 +++ 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx index d98228dde..567d567f3 100644 --- a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx @@ -63,6 +63,11 @@ #include "SALOME_InteractiveObject.hxx" #include "SMESH_ActorUtils.h" +#include "VTKViewer_ViewFrame.h" +#include "VTKViewer_RenderWindow.h" + +#include + using namespace std; @@ -151,8 +156,6 @@ protected: myActor->SetInfinitive(true); myActor->SetMapper( myMapper ); - static float anOpacity = 0.75; - vtkProperty* aProp = vtkProperty::New(); float anRGB[3]; anRGB[0] = SMESH::GetFloat("SMESH:SettingsFillColorRed", 0)/255.; @@ -375,9 +378,8 @@ SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( QWidget* parent, SMESHGUI_ClippingDlg::~SMESHGUI_ClippingDlg() { // no need to delete child widgets, Qt does it all for us - //cout<<"SMESHGUI_ClippingDlg::~SMESHGUI_ClippingDlg\n"; std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false)); - SMESH::GetCurrentVtkView()->Repaint(); + SMESH::RenderViewFrame(SMESH::GetCurrentVtkView()); } @@ -406,10 +408,8 @@ void SMESHGUI_ClippingDlg::ClickOnApply() aCollection->AddItem(anOrientedPlane); anOrientedPlane->Delete(); } - - myActor->SetVisibility(myActor->GetVisibility()); - - SMESH::GetCurrentVtkView()->Repaint(); + + SMESH::RenderViewFrame(SMESH::GetCurrentVtkView()); } } @@ -466,7 +466,7 @@ void SMESHGUI_ClippingDlg::onSelectionChanged() } } Sinchronize(); - SMESH::GetCurrentVtkView()->Repaint(); + SMESH::RenderViewFrame(SMESH::GetCurrentVtkView()); } @@ -484,8 +484,7 @@ void SMESHGUI_ClippingDlg::onSelectPlane(int theIndex) // Orientation SMESH::Orientation anOrientation = aPlane->GetOrientation(); - // Distance and Rotations - float aDistance; + // Rotations double aRot[2] = {aPlane->myAngle[0], aPlane->myAngle[1]}; // Set plane parameters in the dialog @@ -550,7 +549,7 @@ void SMESHGUI_ClippingDlg::ClickOnDelete() ClickOnApply(); Sinchronize(); - SMESH::GetCurrentVtkView()->Repaint(); + SMESH::RenderViewFrame(SMESH::GetCurrentVtkView()); } @@ -702,7 +701,6 @@ void SMESHGUI_ClippingDlg::SetCurrentPlaneParam() myActor->SetPlaneParam(aNormal, getDistance(), aPlane); - float* anOrig = aPlane->GetOrigin(); vtkDataSet* aDataSet = myActor->GetInput(); float *aPnt = aDataSet->GetCenter(); @@ -746,11 +744,11 @@ void SMESHGUI_ClippingDlg::SetCurrentPlaneParam() if(AutoApplyCheckBox->isChecked()) ClickOnApply(); - SMESH::GetCurrentVtkView()->Repaint(); + SMESH::RenderViewFrame(SMESH::GetCurrentVtkView()); } void SMESHGUI_ClippingDlg::OnPreviewToggle(bool theIsToggled){ std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(theIsToggled)); - SMESH::GetCurrentVtkView()->Repaint(); + SMESH::RenderViewFrame(SMESH::GetCurrentVtkView()); } diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx index c2d3deeaa..15a7be039 100644 --- a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx @@ -156,6 +156,19 @@ namespace SMESH{ } + void RepaintViewFrame(VTKViewer_ViewFrame* theFrame) + { + theFrame->Repaint(); + } + + + void RenderViewFrame(VTKViewer_ViewFrame* theFrame) + { + theFrame->getRW()->getRenderWindow()->Render(); + theFrame->Repaint(); + } + + SMESH_Actor* FindActorByEntry(QAD_StudyFrame *theStudyFrame, const char* theEntry) { @@ -507,7 +520,7 @@ namespace SMESH{ { theName = ""; if(theIO->hasEntry()){ - if(SMESH_Actor *anActor = FindActorByEntry(theIO->getEntry())){ + if(FindActorByEntry(theIO->getEntry())){ TColStd_IndexedMapOfInteger aMapIndex; theSel->GetIndex(theIO,aMapIndex); for(int i = 1; i <= aMapIndex.Extent(); i++){ @@ -536,7 +549,7 @@ namespace SMESH{ { theName = ""; if(theIO->hasEntry()){ - if(SMESH_Actor *anActor = FindActorByEntry(theIO->getEntry())){ + if(FindActorByEntry(theIO->getEntry())){ TColStd_IndexedMapOfInteger aMapIndex; theSel->GetIndex(theIO,aMapIndex); typedef std::set TIdContainer; diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.h b/src/SMESHGUI/SMESHGUI_VTKUtils.h index 9937073b6..a2732f703 100644 --- a/src/SMESHGUI/SMESHGUI_VTKUtils.h +++ b/src/SMESHGUI/SMESHGUI_VTKUtils.h @@ -63,6 +63,9 @@ namespace SMESH{ VTKViewer_ViewFrame* GetCurrentVtkView(); + void RepaintViewFrame(VTKViewer_ViewFrame* theFrame); + + void RenderViewFrame(VTKViewer_ViewFrame* theFrame); //---------------------------------------------------------------------------- SMESH_Actor* FindActorByEntry(QAD_StudyFrame *theStudyFrame,