From: vsv Date: Tue, 28 Jun 2005 09:46:59 +0000 (+0000) Subject: Fixed bug with cut lines preview (9298) X-Git-Tag: T3_0_0_a4~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=866a5bc6f2449e10bfc447242da7e283385cb80b;p=modules%2Fvisu.git Fixed bug with cut lines preview (9298) --- diff --git a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx index 36e7abe8..b5343d67 100644 --- a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx @@ -11,6 +11,7 @@ #include "VisuGUI_CutLinesDlg.h" #include "VisuGUI.h" +#include "VisuGUI_Tools.h" #include "VISU_Gen_i.hh" #include "VISU_CutLines_i.hh" @@ -18,6 +19,8 @@ #include "VISU_PipeLine.hxx" #include "VISU_CutLinesPL.hxx" +#include "SVTK_ViewWindow.h" + #include "SalomeApp_Application.h" #include "SalomeApp_Study.h" @@ -254,10 +257,12 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (QWidget* parent, bool theIsCreation, b */ VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg() { + cout<<"### VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg"<Repaint(); + if (myCutLines) //delete myCutLines; + myCutLines->Destroy(); + if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) + vf->Repaint(); } //------------------------------------------------------------------------------ @@ -321,11 +326,13 @@ int VisuGUI_CutLinesDlg::storeToPrsObject (VISU::CutLines_i* thePrs) //------------------------------------------------------------------------------ void VisuGUI_CutLinesDlg::createPlanes() { - //jfa tmp:if (GET_VTK_VIEWWINDOW(myMgr) == NULL) - //jfa tmp: return; + SVTK_ViewWindow* aView = VISU::GetViewWindow(); + if (aView == NULL) return; if (myCutLines == NULL) return; if (myPreviewActor != 0) return; + storeToPrsObject(myCutLines); + myCutLines->GetPL()->Update(); vtkAppendPolyData* aPolyData = myCutLines->GetCutLinesPL()->GetAppendPolyData(); vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New(); aPlaneMapper->SetInput(aPolyData->GetOutput()); @@ -335,15 +342,17 @@ void VisuGUI_CutLinesDlg::createPlanes() myPreviewActor->PickableOff(); myPreviewActor->SetMapper(aPlaneMapper); aPlaneMapper->Delete(); - //jfa tmp:GET_VTK_VIEWWINDOW(myMgr)->AddActor(myPreviewActor); + aView->AddActor(myPreviewActor); + aView->getRenderer()->Render(); + aView->onFitAll(); } //------------------------------------------------------------------------------ void VisuGUI_CutLinesDlg::deletePlanes() { if (myPreviewActor == 0) return; - //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) - //jfa tmp: vf->RemoveActor(myPreviewActor); + if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) + aView->RemoveActor(myPreviewActor); myPreviewActor->Delete(); myPreviewActor = 0; } @@ -395,18 +404,18 @@ void VisuGUI_CutLinesDlg::onCutSelect (int theId, bool theUpdate) myRotXLbl2->setText( tr("LBL_ROT_Z")); myRotYLbl2->setText( tr("LBL_ROT_X")); } - //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) { + if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) { if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) { - myCutLines->SetOrientation2(getOrientaion(false), + /*myCutLines->SetOrientation2(getOrientaion(false), myRotXSpn2->value()*PI/180., myRotYSpn2->value()*PI/180.); - myCutLines->SetDisplacement2(myPosSpn2->value()); - myCutLines->GetPL()->Update(); + myCutLines->SetDisplacement2(myPosSpn2->value());*/ + //myCutLines->GetPL()->Update(); deletePlanes(); createPlanes(); - //jfa tmp:vf->Repaint(); + //aView->Repaint(); } - //jfa tmp:} + } } //------------------------------------------------------------------------------ @@ -416,22 +425,25 @@ void VisuGUI_CutLinesDlg::setBaseDefault (bool theUpdate) if (myCBSetDef->isChecked()) { if (!myCutLines->IsDefault()) myCutLines->SetDefault(); - myCutLines->SetOrientation(getOrientaion(), + /*myCutLines->SetOrientation(getOrientaion(), myRotXSpn->value()*PI/180., myRotYSpn->value()*PI/180.); - myCutLines->SetDisplacement(myPosSpn->value()); - float aPos = myCutLines->GetBasePlanePosition(); + myCutLines->SetDisplacement(myPosSpn->value());*/ + /* float aPos = myCutLines->GetBasePlanePosition(); myBasePlanePos->setText( QString::number(aPos) ); - myBasePlanePos->setEnabled(false); - //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) { + myBasePlanePos->setEnabled(false);*/ + if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) { if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) { - myCutLines->SetBasePlanePosition(aPos); - myCutLines->GetPL()->Update(); + //myCutLines->SetBasePlanePosition(aPos); + // myCutLines->GetPL()->Update(); deletePlanes(); createPlanes(); - //jfa tmp:vf->Repaint(); + //aView->Repaint(); } - //jfa tmp:} + } + float aPos = myCutLines->GetBasePlanePosition(); + myBasePlanePos->setText( QString::number(aPos) ); + myBasePlanePos->setEnabled(false); } else { myBasePlanePos->setEnabled(true); } @@ -491,14 +503,14 @@ void VisuGUI_CutLinesDlg::DrawTable() vh->setLabel( i, str.arg(i+1) ); } // Update preview - //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) { + if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) { if (myPreviewCheck->isChecked()) { - myCutLines->GetPL()->Update(); + // myCutLines->GetPL()->Update(); deletePlanes(); createPlanes(); - //jfa tmp:vf->Repaint(); + //aView->Repaint(); } - //jfa tmp:} + } } //------------------------------------------------------------------------------ @@ -588,31 +600,32 @@ void VisuGUI_CutLinesDlg::onValueChanged (int theRow, int theCol) bool isChanged = !aTxt.isEmpty(); ((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged); - //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) { + if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) { if (myPreviewCheck->isChecked()) { //Update Preview - myCutLines->SetLinePosition( theRow, aTxt.toDouble()); - myCutLines->GetPL()->Update(); + //myCutLines->SetLinePosition( theRow, aTxt.toDouble()); + // myCutLines->GetPL()->Update(); deletePlanes(); createPlanes(); - //jfa tmp:vf->Repaint(); + //aView->Repaint(); } - //jfa tmp:} + } } else { bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked(); if (isDefault) { - myCutLines->SetDefaultPosition(theRow); - myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow))); + //myCutLines->SetDefaultPosition(theRow); + // myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow))); - //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) { + if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) { if (myPreviewCheck->isChecked()) { //Update Preview - myCutLines->GetPL()->Update(); + // myCutLines->GetPL()->Update(); deletePlanes(); createPlanes(); - //jfa tmp:vf->Repaint(); + //aView->Repaint(); } - //jfa tmp:} + } + myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow))); } myPosTable->item(theRow, 0)->setEnabled(!isDefault); } @@ -622,7 +635,7 @@ void VisuGUI_CutLinesDlg::accept() { MYGenerateTable = myCreateTable->isChecked(); MYGenerateCurve = myCurvesCheck->isChecked(); - if (myScalarPane->check()) { + // if (myScalarPane->check()) { /*jfa tmp:((QWidget*)sender())->setDisabled(true); storeToPrsObject(myPrs); if (myIsCreation) { @@ -699,8 +712,9 @@ void VisuGUI_CutLinesDlg::accept() } } VisuGUI::application()->objectBrowser()->updateTree();*/ + deletePlanes(); QDialog::accept(); - } + // } } void VisuGUI_CutLinesDlg::reject() @@ -709,55 +723,57 @@ void VisuGUI_CutLinesDlg::reject() visuGUI->DeletePresentation(myPrs); VisuGUI::application()->objectBrowser()->updateTree(); }*/ + deletePlanes(); QDialog::reject(); } void VisuGUI_CutLinesDlg::onPreviewCheck (bool thePreview) { - /*jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) { + if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) { if (thePreview) { - storeToPrsObject(myCutLines); - myCutLines->GetPL()->Update(); + //storeToPrsObject(myCutLines); + // myCutLines->GetPL()->Update(); createPlanes(); - vf->onFitAll(); + //vf->onFitAll(); } else { deletePlanes(); vf->Repaint(); } - }*/ + } } void VisuGUI_CutLinesDlg::onRotation (double theValue) { if (myCutLines == NULL) return; - //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) { + if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) { if (myPreviewCheck->isChecked()) { - myCutLines->SetOrientation(getOrientaion(), + + /*myCutLines->SetOrientation(getOrientaion(), myRotXSpn->value()*PI/180., myRotYSpn->value()*PI/180.); myCutLines->SetOrientation2(getOrientaion(false), myRotXSpn2->value()*PI/180., - myRotYSpn2->value()*PI/180.); - myCutLines->GetPL()->Update(); + myRotYSpn2->value()*PI/180.);*/ + // myCutLines->GetPL()->Update(); deletePlanes(); createPlanes(); - //jfa tmp:vf->Repaint(); + //aView->Repaint(); } - //jfa tmp:} + } } void VisuGUI_CutLinesDlg::onPlanePos (const QString& theValue) { if (myCutLines == NULL) return; - //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) { + if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) { if (myPreviewCheck->isChecked()) { - myCutLines->SetBasePlanePosition(theValue.toDouble()); - myCutLines->GetPL()->Update(); + //myCutLines->SetBasePlanePosition(theValue.toDouble()); + // myCutLines->GetPL()->Update(); deletePlanes(); createPlanes(); - //jfa tmp:vf->Repaint(); + //aView->Repaint(); } - //jfa tmp:} + } } //jfa tmp:void VisuGUI_CutLinesDlg::onWindowActivated (SUIT_ViewWindow* theWnd) diff --git a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx index 3478808f..489cddfd 100644 --- a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx @@ -166,6 +166,7 @@ VisuGUI_CutPlanesPane::VisuGUI_CutPlanesPane (QWidget* theParent/*, SUIT_ViewMan VisuGUI_CutPlanesPane::~VisuGUI_CutPlanesPane() { + cout<<"### VisuGUI_CutPlanesPane::~VisuGUI_CutPlanesPane"<Destroy();