From f71793e851b85301dc89445fb3839c3e3899a3b5 Mon Sep 17 00:00:00 2001 From: enk Date: Tue, 28 Mar 2006 08:17:52 +0000 Subject: [PATCH] Fix for Bug IPAL11972: TC: Plot2d is not updated after editing source CutLines presentation --- src/VISUGUI/VisuGUI.cxx | 17 ++++++++++++++++- src/VISUGUI/VisuGUI_Tools.cxx | 32 ++++++++++++++++++++++++++++++++ src/VISUGUI/VisuGUI_Tools.h | 2 ++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index b685e0f8..1c734599 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -443,8 +443,23 @@ CreateCurves( SalomeApp_Module* theModule, _PTR(ChildIterator) aChildIter = aStudy->NewChildIterator( aTblObj ); SalomeApp_Study* salome_study = GetAppStudy( theModule ); - for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ) + for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ){ salome_study->deleteReferencesTo( aChildIter->Value() ); + _PTR(SObject) aSO = aChildIter->Value(); + if(aSO){ + if (getValue(aSO, "myComment") == QString("CURVE")) { + CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO); + if(!CORBA::is_nil(aCORBAObject)){ + PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject); + VISU::Curve_i* pCrv = dynamic_cast(aServant.in()); + if(pCrv){ + PlotRemoveCurve(theModule,pCrv); + } + } + } + } + + } aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 757b1749..79b6607f 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -60,6 +60,7 @@ #include "SPlot2d_ViewModel.h" #include "Plot2d_ViewFrame.h" +#include "Plot2d_ViewManager.h" #include "SUIT_Session.h" #include "SUIT_MessageBox.h" @@ -936,6 +937,37 @@ namespace VISU aPlot->Repaint(); } + void + PlotRemoveCurve(const SalomeApp_Module* theModule, + VISU::Curve_i* pCrv) + { + QString anEntry = pCrv->GetEntry(); + ViewManagerList pvm_list; + theModule->getApp()->viewManagers( SPlot2d_Viewer::Type(), pvm_list ); + for( SUIT_ViewManager* mgr = pvm_list.first(); mgr; mgr = pvm_list.next() ){ + Plot2d_ViewManager* pvm = dynamic_cast( mgr ); + if( pvm ){ + SPlot2d_Viewer* aSPlot2d = dynamic_cast( pvm->getViewModel() ); + if( aSPlot2d ){ + Plot2d_ViewFrame* aPlot = aSPlot2d->getActiveViewFrame(); + if(aPlot){ + QList clist; + aPlot->getCurves( clist ); + SPlot2d_Curve* plotCurve = 0; + SPlot2d_Curve* tmpCurve; + for (int i = 0; i < clist.count(); i++) { + tmpCurve = dynamic_cast(clist.at(i)); + if (tmpCurve && + tmpCurve->hasIO() && + (tmpCurve->getIO()->getEntry() == anEntry)) + aPlot->eraseCurve(clist.at(i)); + } + } + } + } + } + } + void PlotContainer(const SalomeApp_Module* theModule, VISU::Container_i* container, diff --git a/src/VISUGUI/VisuGUI_Tools.h b/src/VISUGUI/VisuGUI_Tools.h index af166ad6..1d1418e8 100644 --- a/src/VISUGUI/VisuGUI_Tools.h +++ b/src/VISUGUI/VisuGUI_Tools.h @@ -161,6 +161,8 @@ namespace VISU { void PlotCurve( const SalomeApp_Module* theModule, VISU::Curve_i* curve, int theDisplaying ); + void PlotRemoveCurve(const SalomeApp_Module* theModule, + VISU::Curve_i* curve); void PlotContainer( const SalomeApp_Module* theModule, VISU::Container_i* container, int theDisplaying ); -- 2.39.2