Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/visu.git] / src / VISUGUI / VisuGUI_ViewTools.cxx
index 868ab60672be4f118a6fed72a194313930c5df25..601e2a17589da21bfdd6437c8c793df019ffe338 100644 (file)
@@ -37,37 +37,35 @@ namespace VISU
 {
   void
   ErasePrs(VisuGUI* theModule,
-          VISU::Base_ptr theBase
-          bool thIsUpdate)
+          CORBA::Object_ptr theObject
+          bool theDoRepaintVW)
   {
-    VISU::VISUType aType = theBase->GetType();
+    if (CORBA::is_nil(theObject)) return;
+    VISU::Base_var aBase = VISU::Base::_narrow(theObject);
+    if (CORBA::is_nil(aBase)) return;
+
+    VISU::VISUType aType = aBase->GetType();
     switch (aType) {
     case VISU::TCURVE: {
-      if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(theBase).in()))
+      if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aBase).in()))
        PlotCurve(theModule, aCurve, VISU::eErase );
       break;
     }
     case VISU::TCONTAINER: {
-      if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(theBase).in()))
+      if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aBase).in()))
        PlotContainer(theModule, aContainer, VISU::eErase );
       break;
     }
     case VISU::TTABLE: {
-      if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(theBase).in()))
+      if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aBase).in()))
        PlotTable(theModule, aTable, VISU::eErase );
       break;
     }
     default: {
-      if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(theBase).in())){
-       if(aType == VISU::TGAUSSPOINTS)
-         ErasePrs3d<VVTK_Viewer>(theModule,aPrsObject,thIsUpdate);
-       else if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){
-         QString aType = aViewManager->getType();
-         if(aType == SVTK_Viewer::Type())
-           ErasePrs3d<SVTK_Viewer>(theModule,aPrsObject,thIsUpdate);
-         else if(aType == VVTK_Viewer::Type())
-           ErasePrs3d<VVTK_Viewer>(theModule,aPrsObject,thIsUpdate);
-       }
+      if (VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aBase).in())) {
+        SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+       RemoveScalarBarPosition(theModule, vw, aPrsObject);
+        ErasePrs3d(theModule, aPrsObject, theDoRepaintVW);
       }
     }} // switch (aType)
   }