]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for Bug IPAL11972:
authorenk <enk@opencascade.com>
Tue, 28 Mar 2006 08:17:52 +0000 (08:17 +0000)
committerenk <enk@opencascade.com>
Tue, 28 Mar 2006 08:17:52 +0000 (08:17 +0000)
TC: Plot2d is not updated after editing source CutLines presentation

src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI_Tools.cxx
src/VISUGUI/VisuGUI_Tools.h

index b685e0f81df85f17633b9852e729fc72d9148345..1c7345991b08b665e76e564c2edcf84015492e21 100644 (file)
@@ -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<VISU::Curve_i*>(aServant.in());
+                 if(pCrv){
+                   PlotRemoveCurve(theModule,pCrv);
+                 }
+               }
+             }
+           }
+           
+         }
 
           aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child
 
index 757b1749ba1008371b112fd7f20a74af62b3c568..79b6607f01bf3a9ab43b6997bf10e8ea57aa2970 100644 (file)
@@ -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<Plot2d_ViewManager*>( mgr );
+      if( pvm ){
+       SPlot2d_Viewer* aSPlot2d = dynamic_cast<SPlot2d_Viewer*>( pvm->getViewModel() );
+       if( aSPlot2d ){
+         Plot2d_ViewFrame* aPlot = aSPlot2d->getActiveViewFrame();
+         if(aPlot){
+           QList<Plot2d_Curve> clist;
+           aPlot->getCurves( clist );
+           SPlot2d_Curve* plotCurve = 0;
+           SPlot2d_Curve* tmpCurve;
+           for (int i = 0; i < clist.count(); i++) {
+             tmpCurve = dynamic_cast<SPlot2d_Curve*>(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,
index af166ad68d056b883c06d9573279d5464e73f077..1d1418e82042627da49acd168881d957b18c57c7 100644 (file)
@@ -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 );