]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To allow to display every VISU presentation into Gauss Viewer
authorapo <apo@opencascade.com>
Wed, 9 Nov 2005 15:20:40 +0000 (15:20 +0000)
committerapo <apo@opencascade.com>
Wed, 9 Nov 2005 15:20:40 +0000 (15:20 +0000)
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI_Module.cxx
src/VISUGUI/VisuGUI_Prs3dTools.h
src/VISUGUI/VisuGUI_Tools.cxx
src/VISUGUI/VisuGUI_ViewTools.cxx
src/VVTK/VVTK_Renderer.cxx

index def9b9fc5262927e034d45b62231750ddf51de92..1b40603c3f204eba12ec7c092ce85ac10a802033 100644 (file)
@@ -703,7 +703,7 @@ OnEditScalarMap()
   Handle(SALOME_InteractiveObject) anIO;
   if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg,1>(this, aPrs3d);
-    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
       aViewWindow->highlight(anIO, 1);
     }
   }
@@ -717,7 +717,7 @@ OnEditDeformedShape()
   Handle(SALOME_InteractiveObject) anIO;
   if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg,1>(this, aPrs3d);
-    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
       aViewWindow->highlight(anIO, 1);
     }
   }
@@ -731,7 +731,7 @@ OnEditCutPlanes()
   Handle(SALOME_InteractiveObject) anIO;
   if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg,0>(this, aPrs3d);
-    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
       aViewWindow->highlight(anIO, 1);
     }
   }
@@ -745,7 +745,7 @@ OnEditCutLines()
   Handle(SALOME_InteractiveObject) anIO;
   if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg,0>(this, aPrs3d);
-    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
       aViewWindow->highlight(anIO, 1);
     }
   }
@@ -759,7 +759,7 @@ OnEditIsoSurfaces()
   Handle(SALOME_InteractiveObject) anIO;
   if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg,1>(this, aPrs3d);
-    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
       aViewWindow->highlight(anIO, 1);
     }
   }
@@ -773,7 +773,7 @@ OnEditVectors()
   Handle(SALOME_InteractiveObject) anIO;
   if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg,1>(this, aPrs3d);
-    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
       aViewWindow->highlight(anIO, 1);
     }
   }
@@ -787,7 +787,7 @@ OnEditStreamLines()
   Handle(SALOME_InteractiveObject) anIO;
   if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg,1>(this, aPrs3d);
-    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
       aViewWindow->highlight(anIO, 1);
     }
   }
@@ -801,7 +801,7 @@ OnEditPlot3D()
   Handle(SALOME_InteractiveObject) anIO;
   if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
     EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg,0>(this, aPrs3d);
-    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
       aViewWindow->highlight(anIO, 1);
     }
   }
@@ -812,7 +812,7 @@ void
 VisuGUI::
 OnEraseAll()
 {
-  if (SVTK_ViewWindow* vw = GetViewWindow()) {
+  if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
     vw->unHighlightAll();
     if (vtkRenderer *aRen = vw->getRenderer()) {
       vtkActor *anActor;
@@ -885,7 +885,7 @@ OnChangeColor()
   VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
   if (!aPrs3d) return;
 
-  SVTK_ViewWindow* vw = GetViewWindow();
+  SVTK_ViewWindow* vw = GetViewWindow(this);
   if (!vw) return;
 
   VISU_Actor* anActor = GetActor(aPrs3d, vw);
@@ -957,7 +957,7 @@ OnChangeWireframeColor()
   VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
   if (!aPrs3d) return;
 
-  SVTK_ViewWindow* vw = GetViewWindow();
+  SVTK_ViewWindow* vw = GetViewWindow(this);
   if (!vw) return;
 
   VISU_Actor* anActor = GetActor(aPrs3d, vw);
@@ -992,7 +992,7 @@ OnChangeOpacity()
   VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
   if (!aPrsObject) return;
 
-  SVTK_ViewWindow* vw = GetViewWindow();
+  SVTK_ViewWindow* vw = GetViewWindow(this);
   if (!vw) return;
 
   VISU_Actor* anActor = GetActor(aPrsObject, vw);
@@ -1032,7 +1032,7 @@ OnChangeLines()
   VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
   if (!aPrsObject) return;
 
-  SVTK_ViewWindow* vw = GetViewWindow();
+  SVTK_ViewWindow* vw = GetViewWindow(this);
   if (!vw) return;
 
   VISU_Actor* anActor = GetActor(aPrsObject, vw);
@@ -1544,7 +1544,7 @@ OnSweep()
   VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
   if (!aPrsObject) return;
 
-  SVTK_ViewWindow* vw = GetViewWindow();
+  SVTK_ViewWindow* vw = GetViewWindow(this);
   if (!vw) return;
 
   VISU_Actor* aActor = GetActor(aPrsObject, vw);
@@ -1756,7 +1756,7 @@ void
 VisuGUI::
 OnSelectionInfo()
 {
-  if (GetViewWindow())
+  if (GetViewWindow(this))
     (new VisuGUI_SelectionDlg(GetDesktop(this)))->show();
   else
     SUIT_MessageBox::warn1(GetDesktop(this),
@@ -1906,7 +1906,7 @@ void
 VisuGUI::
 OnArrangeActors()
 {
-  SVTK_ViewWindow* vw = GetViewWindow();
+  SVTK_ViewWindow* vw = GetViewWindow(this);
   if (vw) {
     ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), vw);
     aDlg->exec();
index b89749894e45777e3569a35a5c23bb36767d05b5..344c042e1d84730fe38a05ed5d57b895b310d078 100644 (file)
@@ -751,10 +751,15 @@ VisuGUI_Module
       if(!CORBA::is_nil(anObject)){
        if(VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in())){
          if(MYDEBUG) MESSAGE("VisuGUI_Module::OnDisplayPrs : Prs3d object");
-         if(aPrs3d->GetType() != VISU::TGAUSSPOINTS)
-           VISU::UpdateViewer<SVTK_Viewer>(this,aPrs3d,false,true,true);
-         else
+         if(aPrs3d->GetType() == VISU::TGAUSSPOINTS)
            VISU::UpdateViewer<VVTK_Viewer>(this,aPrs3d,false,true,true);
+         else if(SUIT_ViewManager* aViewManager = getApp()->activeViewManager()){
+           QString aType = aViewManager->getType();
+           if(aType == SVTK_Viewer::Type())
+             VISU::UpdateViewer<SVTK_Viewer>(this,aPrs3d,false,true,true);
+           else if(aType == VVTK_Viewer::Type())
+             VISU::UpdateViewer<VVTK_Viewer>(this,aPrs3d,false,true,true);
+         }
          continue;
        }
       }
@@ -808,24 +813,7 @@ void
 VisuGUI_Module
 ::OnDisplayOnlyPrs()
 {
-  if(SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this)){
-    SALOME_ListIO aList;
-    aSelectionMgr->selectedObjects(aList);
-    for(SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next()){
-      Handle(SALOME_InteractiveObject) anIO = it.Value();
-      CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
-
-      if(!CORBA::is_nil(anObject)){
-       if(VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in())){
-         if(aPrs3d->GetType() != VISU::TGAUSSPOINTS)
-           VISU::OnEraseAll<SVTK_Viewer>(this);
-         else
-           VISU::OnEraseAll<VVTK_Viewer>(this);
-         break;
-       }
-      }
-    }
-  }
+  OnEraseAll();
   OnDisplayPrs();
 }
 
index 4287a9abe700782ea7a9a88fd40ab29922cd495f..d9a4b448c0b3c172d9bb38068ad30b58b7f7d555 100644 (file)
@@ -213,8 +213,15 @@ namespace VISU
   CreatePrs3d(VisuGUI* theModule,
              const bool theIsCreateView = true)
   {
-    CreatePrs3d<TPrs3d_i,SVTK_Viewer,TDlg,IsDlgModal>(theModule,theIsCreateView);
+    if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){
+      QString aType = aViewManager->getType();
+      if(aType == SVTK_Viewer::Type())
+       CreatePrs3d<TPrs3d_i,SVTK_Viewer,TDlg,IsDlgModal>(theModule,theIsCreateView);
+      else if(aType == VVTK_Viewer::Type())
+       CreatePrs3d<TPrs3d_i,VVTK_Viewer,TDlg,IsDlgModal>(theModule,theIsCreateView);
+    }
   }
+
 }
 
 #endif
index 71b4bcefe4664cfce41987def8f2acb21d81e71d..b764a1aa84ce092834af28d23fc285c6ecffca0b 100644 (file)
@@ -462,9 +462,7 @@ namespace VISU
   ChangeRepresentation (const SalomeApp_Module* theModule,
                         VISU::PresentationType  theType)
   {
-    SUIT_ViewWindow* aView = GetActiveView(theModule, SVTK_Viewer::Type());
-    if (!aView) return;
-    SVTK_ViewWindow* vw  = dynamic_cast<SVTK_ViewWindow*>( aView );
+    SVTK_ViewWindow* vw  = GetViewWindow( theModule, false );
     if( !vw )
       return;
 
@@ -606,11 +604,15 @@ namespace VISU
   SVTK_ViewWindow*
   GetViewWindow(const SalomeApp_Module* theModule, const bool theCreate )
   {
-    if(SalomeApp_Application* anApp = theModule->getApp()){
-      if(SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), theCreate )){
-        if(SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()){
-          return dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
-        }
+    if (SalomeApp_Application* anApp = theModule->getApp())
+    {
+      SVTK_ViewWindow* wnd = dynamic_cast<SVTK_ViewWindow*>(anApp->desktop()->activeWindow());
+      if( wnd )
+       return wnd;
+      else
+      {
+       SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), theCreate );
+       return dynamic_cast<SVTK_ViewWindow*>( aViewManager->getActiveView() );
       }
     }
     return NULL;
@@ -761,14 +763,7 @@ namespace VISU
 
     try {
       thePrs->Update();
-
-      TViewWindows aViewWindows = GetViews(theModule);
-      for (int i = 0, iEnd = aViewWindows.size(); i < iEnd; i++) {
-        SVTK_ViewWindow* aView = aViewWindows[i];
-        if (VISU_Actor* anActor = FindActor(aView, anEntry.in())) {
-          thePrs->UpdateActor(anActor);
-        }
-      }
+      thePrs->UpdateActors();
     } catch (std::runtime_error& ex) {
       INFOS(ex.what());
       QApplication::restoreOverrideCursor();
@@ -776,14 +771,7 @@ namespace VISU
                               QObject::tr("ERR_CANT_BUILD_PRESENTATION") + " " + QObject::tr(ex.what()),
                               QObject::tr("BUT_OK"));
 
-      TViewWindows aViewWindows = GetViews(theModule);
-      for (int i = 0, iEnd = aViewWindows.size(); i < iEnd; i++) {
-        SVTK_ViewWindow* aView = aViewWindows[i];
-        if (VISU_Actor* anActor = FindActor(aView, anEntry.in())) {
-          aView->RemoveActor(anActor);
-          anActor->Delete();
-        }
-      }
+      thePrs->RemoveActors();
       return;
     }
     QApplication::restoreOverrideCursor();
index bc2650dca293d6ef358beeda134800c11e00e6f6..868ab60672be4f118a6fed72a194313930c5df25 100644 (file)
@@ -61,8 +61,13 @@ namespace VISU
       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
-         ErasePrs3d<SVTK_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);
+       }
       }
     }} // switch (aType)
   }
index 142008d167e48aa6b64e14a57ac24c00dbd907c6..596e9a19e0b9b1501234328973a7ce39202d4954 100644 (file)
@@ -173,8 +173,8 @@ VVTK_Renderer
 {
   if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
     anActor->SetPickingSettings(myPickingSettings);
-    Superclass::AddActor(anActor);
   }
+  Superclass::AddActor(theActor);
 }
 
 //----------------------------------------------------------------------------
@@ -185,8 +185,8 @@ VVTK_Renderer
   using namespace VISU;  
   if(VISU_GaussPtsAct1* anActor = dynamic_cast<VISU_GaussPtsAct1*>(theActor)){
     anActor->SetPickingSettings(NULL);
-    Superclass::RemoveActor(theActor);
   }
+  Superclass::RemoveActor(theActor);
 }
 
 //----------------------------------------------------------------------------
@@ -230,10 +230,10 @@ void
 VVTK_Renderer1
 ::AddActor(VTKViewer_Actor* theActor)
 {
+  Superclass::AddActor(theActor);
   if(VISU_GaussPtsAct1* anActor = dynamic_cast<VISU_GaussPtsAct1*>(theActor)){
     anActor->SetImplicitFunctionWidget(GetImplicitFunctionWidget());
     anActor->SetOutsideCursorSettings(myOutsideCursorSettings);
-    Superclass::AddActor(anActor);
     AdjustImplicitFunctionWidget();
   }
 }
@@ -243,11 +243,11 @@ void
 VVTK_Renderer1
 ::RemoveActor(VTKViewer_Actor* theActor)
 {
+  Superclass::RemoveActor(theActor);
   using namespace VISU;  
   if(VISU_GaussPtsAct1* anActor = dynamic_cast<VISU_GaussPtsAct1*>(theActor)){
     anActor->SetImplicitFunctionWidget(NULL);
     anActor->SetOutsideCursorSettings(NULL);
-    Superclass::RemoveActor(theActor);
     AdjustImplicitFunctionWidget();
   }
 }