]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix bug 11416: Post-Pro: Simplify display/erase.
authorjfa <jfa@opencascade.com>
Mon, 13 Feb 2006 16:54:50 +0000 (16:54 +0000)
committerjfa <jfa@opencascade.com>
Mon, 13 Feb 2006 16:54:50 +0000 (16:54 +0000)
25 files changed:
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI_ClippingDlg.cxx
src/VISUGUI/VisuGUI_CutLinesDlg.cxx
src/VISUGUI/VisuGUI_CutPlanesDlg.cxx
src/VISUGUI/VisuGUI_Displayer.cxx
src/VISUGUI/VisuGUI_Module.cxx
src/VISUGUI/VisuGUI_Module.h
src/VISUGUI/VisuGUI_Plot3DDlg.cxx
src/VISUGUI/VisuGUI_PopupTools.cxx
src/VISUGUI/VisuGUI_Prs3dTools.h
src/VISUGUI/VisuGUI_ScalarBarDlg.cxx
src/VISUGUI/VisuGUI_Selection.cxx
src/VISUGUI/VisuGUI_TimeAnimation.cxx
src/VISUGUI/VisuGUI_Tools.cxx
src/VISUGUI/VisuGUI_Tools.h
src/VISUGUI/VisuGUI_TransparencyDlg.cxx
src/VISUGUI/VisuGUI_ViewTools.cxx
src/VISUGUI/VisuGUI_ViewTools.h
src/VISU_I/VISU_Prs3d_i.cc
src/VISU_I/VISU_TimeAnimation.cxx
src/VISU_I/VISU_ViewManager_i.cc
src/VISU_I/VISU_ViewManager_i.hh
src/VISU_I/VISU_View_i.cc
src/VVTK/VVTK_ViewModel.cxx
src/VVTK/VVTK_ViewModel.h

index 8bff4218a59d93df249fff59621bb6b2a9574db6..508cc0b5289e95afd3a330725d130e5892709fcf 100644 (file)
@@ -468,9 +468,10 @@ OnCreateMesh()
     return;
 
   // create a VTK view window if it does not exist
-  GetViewWindow( this, /*create=*/true );
+  SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
 
-  CreateMesh(this, anIO);
+  // create mesh presentation and display it in aViewWindow
+  CreateMesh(this, anIO, aViewWindow);
 }
 
 void
@@ -482,7 +483,7 @@ OnCreateManyMesh()
     return;
 
   // create a VTK view window if it does not exist
-  GetViewWindow( this, /*create=*/true );
+  SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
 
   // Get selected SObject
   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
@@ -494,7 +495,8 @@ OnCreateManyMesh()
     if (anIO.IsNull() || !anIO->hasEntry())
       return;
 
-    CreateMesh(this, anIO);
+    // create mesh presentation and display it in aViewWindow
+    CreateMesh(this, anIO, aViewWindow);
   }
 }
 
@@ -577,62 +579,65 @@ OnDisplayPrs()
 {
   if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
 
+  LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
+  if (!mgr) return;
+
   QApplication::setOverrideCursor(Qt::waitCursor);
+
+  SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
+
   SALOME_ListIO aSel, aList;
-  LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
-  mgr->selectedObjects( aSel );
+  mgr->selectedObjects(aSel);
+  extractContainers(aSel, aList);
 
-  extractContainers( aSel, 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());
 
-  Handle(SALOME_InteractiveObject) anIO;
-  for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
-    anIO = it.Value();
-    CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
-    if ( !CORBA::is_nil( anObject ) ) {
+    if (!CORBA::is_nil(anObject)) {
       // is it Prs3d object ?
       VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
-      if(aPrsObject){
+      if (aPrsObject) {
         if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Prs3d object");
         //UpdateViewer( this, aPrsObject );
-       SVTK_ViewWindow* vw = GetViewWindow( this, /*create=*/true );
-        if ( vw )
-       {
-         displayer()->Display( anIO->getEntry() );
+        if (vw) {
+         displayer()->Display(anIO->getEntry());
          vw->highlight(anIO, 1);
         }
         continue;
       }
       // is it Curve ?
       VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
-      if(aCurve){
+      if (aCurve) {
         if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Curve object");
         //PlotCurve( this, aCurve, VISU::eDisplay );
-       displayer()->Display( anIO->getEntry() );
+       displayer()->Display(anIO->getEntry());
         continue;
       }
       // is it Container ?
       VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
-      if(aContainer){
+      if (aContainer) {
         if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object");
         //PlotContainer( this, aContainer, VISU::eDisplay );
-       displayer()->Display( anIO->getEntry() );
+       displayer()->Display(anIO->getEntry());
         continue;
       }
       // is it Table ?
       VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
-      if(aTable){
+      if (aTable) {
         if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
         //PlotTable( this, aTable, VISU::eDisplay );
-       displayer()->Display( anIO->getEntry() );
+       displayer()->Display(anIO->getEntry());
         continue;
       }
     }
   }
-  SVTK_ViewWindow* vw = GetViewWindow( this );
-  if ( vw ) {
+
+  if (vw) {
     vw->getRenderer()->ResetCameraClippingRange();
     vw->Repaint();
   }
+
   QApplication::restoreOverrideCursor();
 }
 
@@ -652,27 +657,24 @@ OnErasePrs()
 
   QApplication::setOverrideCursor(Qt::waitCursor);
 
-  SVTK_ViewWindow* vw = GetViewWindow( this );
-  if (vw)
-    vw->unHighlightAll();
+  //SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
+  //if (vw)
+  //  vw->unHighlightAll();
 
   SALOME_ListIO aList, aSel;
   LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
-  mgr->selectedObjects( aSel );
-
-  extractContainers( aSel, aList );
+  mgr->selectedObjects(aSel);
+  extractContainers(aSel, aList);
 
-  Handle(SALOME_InteractiveObject) anIO;
-  for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
-    anIO = it.Value();
-    CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
-    if (!CORBA::is_nil(anObject))
-      RemoveScalarBarPosition(this,anObject);
-    ErasePrs( this, anObject, false );
+  for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
+    Handle(SALOME_InteractiveObject) anIO = it.Value();
+    CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
+    //ErasePrs(this, anObject, /*repaint_view_window = */false);
+    ErasePrs(this, anObject, /*repaint_view_window = */true);
   }
 
-  if (vw)
-    vw->Repaint();
+  //if (vw)
+  //  vw->Repaint();
 
   QApplication::restoreOverrideCursor();
 }
@@ -682,7 +684,7 @@ VisuGUI::
 OnEraseAll()
 {
   startOperation( myEraseAll );
-  if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
+  if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
     vw->unHighlightAll();
     if (vtkRenderer *aRen = vw->getRenderer()) {
       vtkActor *anActor;
@@ -690,7 +692,7 @@ OnEraseAll()
       for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
         if (anActor->GetVisibility() > 0)
           if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
-           RemoveScalarBarPosition(this,anVISUActor->GetPrs3d());
+           RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
             anVISUActor->VisibilityOff();
           }
       }
@@ -707,26 +709,17 @@ VisuGUI::
 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(this)){
-      aViewWindow->highlight(anIO, 1);
-    }
-  }
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+    EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
 }
 
-
 void
 VisuGUI::
 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(this)){
-      aViewWindow->highlight(anIO, 1);
-    }
-  }
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+    EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
 }
 
 void
@@ -734,12 +727,8 @@ VisuGUI::
 OnEditScalarMapOnDeformedShape()
 {
   Handle(SALOME_InteractiveObject) anIO;
-  if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
-    EditPrs3d<VISU::ScalarMapOnDeformedShape_i, VisuGUI_ScalarMapOnDeformedShapeDlg,1>(this, aPrs3d);
-    if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
-      aViewWindow->highlight(anIO, 1);
-    }
-  }
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+    EditPrs3d<VISU::ScalarMapOnDeformedShape_i, VisuGUI_ScalarMapOnDeformedShapeDlg, 1>(this, anIO, aPrs3d);
 }
 
 void
@@ -747,82 +736,53 @@ VisuGUI::
 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(this)){
-      aViewWindow->highlight(anIO, 1);
-    }
-  }
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+    EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
 }
 
-
 void
 VisuGUI::
 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(this)){
-      aViewWindow->highlight(anIO, 1);
-    }
-  }
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+    EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
 }
 
-
 void
 VisuGUI::
 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(this)){
-      aViewWindow->highlight(anIO, 1);
-    }
-  }
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+    EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
 }
 
-
 void
 VisuGUI::
 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(this)){
-      aViewWindow->highlight(anIO, 1);
-    }
-  }
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+    EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
 }
 
-
 void
 VisuGUI::
 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(this)){
-      aViewWindow->highlight(anIO, 1);
-    }
-  }
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+    EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
 }
 
-
 void
 VisuGUI::
 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(this)){
-      aViewWindow->highlight(anIO, 1);
-    }
-  }
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+    EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
 }
 
 
@@ -895,7 +855,7 @@ OnChangeColor()
   VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
   if (!aPrs3d) return;
 
-  SVTK_ViewWindow* vw = GetViewWindow(this);
+  SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
   if (!vw) return;
 
   VISU_Actor* anActor = GetActor(aPrs3d, vw);
@@ -967,7 +927,7 @@ OnChangeWireframeColor()
   VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
   if (!aPrs3d) return;
 
-  SVTK_ViewWindow* vw = GetViewWindow(this);
+  SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
   if (!vw) return;
 
   VISU_Actor* anActor = GetActor(aPrs3d, vw);
@@ -1002,7 +962,7 @@ OnChangeOpacity()
   VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
   if (!aPrsObject) return;
 
-  SVTK_ViewWindow* vw = GetViewWindow(this);
+  SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
   if (!vw) return;
 
   VISU_Actor* anActor = GetActor(aPrsObject, vw);
@@ -1025,7 +985,7 @@ OnChangeLines()
   VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
   if (!aPrsObject) return;
 
-  SVTK_ViewWindow* vw = GetViewWindow(this);
+  SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
   if (!vw) return;
 
   VISU_Actor* anActor = GetActor(aPrsObject, vw);
@@ -1549,7 +1509,7 @@ OnSweep()
   VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
   if (!aPrsObject) return;
 
-  SVTK_ViewWindow* vw = GetViewWindow(this);
+  SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
   if (!vw) return;
 
   VISU_Actor* aActor = GetActor(aPrsObject, vw);
@@ -1592,7 +1552,7 @@ void
 VisuGUI::
 OnTimeAnimation()
 {
-  if(!VISU::GetViewWindow(this))
+  if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
     return;
 
   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
@@ -1631,7 +1591,7 @@ void
 VisuGUI::
 OnShowAnimation()
 {
-  if(!VISU::GetViewWindow(this))
+  if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
     return;
 
   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
@@ -1689,7 +1649,6 @@ OnCopyPresentation()
       VISU::Mesh_i* aMeshPrs = dynamic_cast<VISU::Mesh_i*>(aPrsObject);
       VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult());
       aSameMesh->SameAs(aMeshPrs);
-      UpdateViewer(this, aSameMesh);
     }
     break;
   case VISU::TSCALARMAP:
@@ -1697,7 +1656,6 @@ OnCopyPresentation()
       VISU::ScalarMap_i* aScalarPrs = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
       VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true);
       aSameScalar->SameAs(aScalarPrs);
-      UpdateViewer(this, aSameScalar);
     }
     break;
   case VISU::TDEFORMEDSHAPE:
@@ -1705,15 +1663,15 @@ OnCopyPresentation()
       VISU::DeformedShape_i* aDefPrs = dynamic_cast<VISU::DeformedShape_i*>(aPrsObject);
       VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult(),true);
       aSameDeformed->SameAs(aDefPrs);
-      UpdateViewer(this, aSameDeformed);
     }
     break;
   case VISU::TSCALARMAPONDEFORMEDSHAPE:
     {
-      VISU::ScalarMapOnDeformedShape_i* aDefPrs = dynamic_cast<VISU::ScalarMapOnDeformedShape_i*>(aPrsObject);
-      VISU::ScalarMapOnDeformedShape_i* aSameScalarMapOnDeformed = new VISU::ScalarMapOnDeformedShape_i(aDefPrs->GetResult(),true);
+      VISU::ScalarMapOnDeformedShape_i* aDefPrs =
+        dynamic_cast<VISU::ScalarMapOnDeformedShape_i*>(aPrsObject);
+      VISU::ScalarMapOnDeformedShape_i* aSameScalarMapOnDeformed =
+        new VISU::ScalarMapOnDeformedShape_i(aDefPrs->GetResult(),true);
       aSameScalarMapOnDeformed->SameAs(aDefPrs);
-      UpdateViewer(this, aSameScalarMapOnDeformed);
     }
     break;
   case VISU::TCUTPLANES:
@@ -1721,7 +1679,6 @@ OnCopyPresentation()
       VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
       VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult(),true);
       aSameCut->SameAs(aCutPrs);
-      UpdateViewer(this, aSameCut);
     }
     break;
   case VISU::TCUTLINES:
@@ -1729,7 +1686,6 @@ OnCopyPresentation()
       VISU::CutLines_i* aCutPrs = dynamic_cast<VISU::CutLines_i*>(aPrsObject);
       VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult(),true);
       aSameCut->SameAs(aCutPrs);
-      UpdateViewer(this, aSameCut);
     }
     break;
   case VISU::TISOSURFACE:
@@ -1737,7 +1693,6 @@ OnCopyPresentation()
       VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aPrsObject);
       VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult(),true);
       aSameIso->SameAs(aIsoPrs);
-      UpdateViewer(this, aSameIso);
     }
     break;
   case VISU::TSTREAMLINES:
@@ -1745,7 +1700,6 @@ OnCopyPresentation()
       VISU::StreamLines_i* aLinesPrs = dynamic_cast<VISU::StreamLines_i*>(aPrsObject);
       VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult(),true);
       aSameLines->SameAs(aLinesPrs);
-      UpdateViewer(this, aSameLines);
     }
     break;
   case VISU::TVECTORS:
@@ -1753,7 +1707,6 @@ OnCopyPresentation()
       VISU::Vectors_i* aVectorsPrs = dynamic_cast<VISU::Vectors_i*>(aPrsObject);
       VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult(),true);
       aSameVectors->SameAs(aVectorsPrs);
-      UpdateViewer(this, aSameVectors);
     }
     break;
   case VISU::TPLOT3D:
@@ -1761,7 +1714,6 @@ OnCopyPresentation()
       VISU::Plot3D_i* aPlot3DPrs = dynamic_cast<VISU::Plot3D_i*>(aPrsObject);
       VISU::Plot3D_i* aSamePlot3D = new VISU::Plot3D_i(aPlot3DPrs->GetResult());
       aSamePlot3D->SameAs(aPlot3DPrs);
-      UpdateViewer(this, aSamePlot3D);
     }
     break;
   }
@@ -1772,7 +1724,7 @@ void
 VisuGUI::
 OnSelectionInfo()
 {
-  if (GetViewWindow(this))
+  if (GetActiveViewWindow<SVTK_ViewWindow>(this))
     (new VisuGUI_SelectionDlg(this))->show();
   else
     SUIT_MessageBox::warn1(GetDesktop(this),
@@ -1835,11 +1787,9 @@ OnMergeScalarBars()
     }
   }
   if (update) {
-    if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
-//if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
-        vw->getRenderer()->ResetCameraClippingRange();
-        vw->Repaint();
-//}
+    if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
+      vw->getRenderer()->ResetCameraClippingRange();
+      vw->Repaint();
     }
   }
 }
@@ -1874,11 +1824,9 @@ OnFreeScalarBars()
     }
   }
   if (update) {
-    if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
-//if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
-        vw->getRenderer()->ResetCameraClippingRange();
-        vw->Repaint();
-//}
+    if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
+      vw->getRenderer()->ResetCameraClippingRange();
+      vw->Repaint();
     }
   }
 }
@@ -1922,7 +1870,7 @@ void
 VisuGUI::
 OnArrangeActors()
 {
-  SVTK_ViewWindow* vw = GetViewWindow(this);
+  SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
   if (vw) {
     ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), vw);
     aDlg->exec();
@@ -2235,13 +2183,11 @@ createActions()
   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GLOBAL_SELECTION"));
   createAction( VISU_GLOBAL_SELECTION, tr("MEN_GLOBAL_SELECTION"), QIconSet(aPixmap),
                 tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false,
-                //this, SLOT(OnEraseAll()));
                 this);
 
   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PARTIAL_SELECTION"));
   createAction( VISU_PARTIAL_SELECTION, tr("MEN_PARTIAL_SELECTION"), QIconSet(aPixmap),
                 tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false,
-                //this, SLOT(OnEraseAll()));
                 this);
 
   createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIconSet(),
index 2c9f7f1bb2f2f628096e2f1f4d177d1bc0c17d25..1f35f9801f57002519c1606cbd7e5489e691f331 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
 
 #include "VISU_Prs3d_i.hh"
 #include "VISU_Result_i.hh"
@@ -389,7 +390,7 @@ VisuGUI_ClippingDlg::~VisuGUI_ClippingDlg()
 {
   // no need to delete child widgets, Qt does it all for us
   std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false));
-  VISU::RenderViewWindow(VISU::GetViewWindow(myVisuGUI));
+  VISU::RenderViewWindow(VISU::GetActiveViewWindow<SVTK_ViewWindow>(myVisuGUI));
 }
 
 //=================================================================================
@@ -481,7 +482,7 @@ void VisuGUI_ClippingDlg::ClickOnApply()
   if (!myPrs3d)
     return;
 
-  if (SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myVisuGUI)) {
+  if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myVisuGUI)) {
     SUIT_OverrideCursor wc;
 
     // Save clipping planes, currently applied to the presentation
@@ -565,7 +566,7 @@ void VisuGUI_ClippingDlg::ClickOnCancel()
 //=================================================================================
 void VisuGUI_ClippingDlg::onSelectionChanged()
 {
-  if (SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myVisuGUI)) {
+  if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myVisuGUI)) {
     Handle(SALOME_InteractiveObject) anIO;
     CORBA::Object_var anObject = VISU::GetSelectedObj(myVisuGUI, &anIO);
     myIO = anIO;
@@ -653,7 +654,7 @@ void VisuGUI_ClippingDlg::ClickOnNew()
   if (!myPrs3d)
     return;
 
-  if (SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myVisuGUI)) {
+  if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myVisuGUI)) {
     OrientedPlane* aPlane = OrientedPlane::New(aViewWindow);
     VISU::TVTKPlane aTVTKPlane(aPlane);
     myPlanes.push_back(aTVTKPlane);
@@ -689,7 +690,7 @@ void VisuGUI_ClippingDlg::ClickOnDelete()
     ClickOnApply();
 
   Sinchronize();
-  if (SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myVisuGUI))
+  if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myVisuGUI))
     VISU::RenderViewWindow(aViewWindow);
 }
 
@@ -886,7 +887,7 @@ void VisuGUI_ClippingDlg::SetCurrentPlaneParam()
   if (AutoApplyCheckBox->isChecked())
     ClickOnApply();
 
-  if (SVTK_ViewWindow* vw = VISU::GetViewWindow(myVisuGUI))
+  if (SVTK_ViewWindow* vw = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myVisuGUI))
     VISU::RenderViewWindow(vw);
 }
 
@@ -1094,6 +1095,6 @@ void VisuGUI_ClippingDlg::onIJKAxisChanged(int axisId)
 void VisuGUI_ClippingDlg::OnPreviewToggle (bool theIsToggled)
 {
   std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(theIsToggled));
-  if (SVTK_ViewWindow* vw = VISU::GetViewWindow(myVisuGUI))
+  if (SVTK_ViewWindow* vw = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myVisuGUI))
     VISU::RenderViewWindow(vw);
 }
index a9983bf396bc30b2772be4eae45a0fa39e263874..545e8c8168e9512dcde831a3e6afd821baf99495 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
 
 #include "VISU_Gen_i.hh"
 #include "VISU_CutLines_i.hh"
@@ -105,7 +106,7 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule)
 
   QHBox* aPosBox = new QHBox (aPlanePane);
   aPosBox->setSpacing(5);
-  QLabel* aPosLbl = new QLabel (tr("LBL_POS"), aPosBox);
+  new QLabel (tr("LBL_POS"), aPosBox);
   myPosSpn = new QtxDblSpinBox (0, 1, 0.1, aPosBox);
   myPosSpn->setValue(0.5);
   aPlaneLayout->addWidget(aPosBox);
@@ -166,7 +167,7 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule)
 
   QHBox* aNbBox = new QHBox(aLinesPane);
   aNbBox->setSpacing(5);
-  QLabel* aNbLbl = new QLabel( tr( "LBL_NB_PLANS" ), aNbBox );
+  new QLabel( tr( "LBL_NB_PLANS" ), aNbBox );
   myNbSpn = new QtxDblSpinBox( 1, 100, 1, aNbBox );
   myNbSpn->setValue( 10 );
 
@@ -186,7 +187,7 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule)
 
   QHBox* aPosBox2 = new QHBox(aLinesPane);
   aPosBox2->setSpacing(5);
-  QLabel* aPosLbl2 = new QLabel( tr( "LBL_POS" ), aPosBox2 );
+  new QLabel( tr( "LBL_POS" ), aPosBox2 );
   myPosSpn2 = new QtxDblSpinBox( 0, 1, 0.1, aPosBox2 );
   myPosSpn2->setValue( 0.5 );
   aLinesLayout->addWidget( aPosBox2 );
@@ -258,7 +259,7 @@ VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg()
   deletePlanes();
   if (myCutLines) //delete myCutLines;
     myCutLines->Destroy();
-  if (SVTK_ViewWindow* vf = VISU::GetViewWindow())
+  if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
     vf->Repaint();
 }
 
@@ -327,7 +328,7 @@ int VisuGUI_CutLinesDlg::storeToPrsObject (VISU::CutLines_i* thePrs)
 //------------------------------------------------------------------------------
 void VisuGUI_CutLinesDlg::createPlanes()
 {
-  SVTK_ViewWindow* aView = VISU::GetViewWindow();
+  SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
   if (aView == NULL) return;
   if (myCutLines == NULL) return;
   if (myPreviewActor != 0) return;
@@ -357,7 +358,7 @@ void VisuGUI_CutLinesDlg::createPlanes()
 void VisuGUI_CutLinesDlg::deletePlanes()
 {
   if (myPreviewActor == 0) return;
-  if (SVTK_ViewWindow* aView = VISU::GetViewWindow()){
+  if (SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>()){
     aView->RemoveActor(myPreviewActor);
     aView->RemoveActor(myPreviewActorGlyphs);
   }
@@ -414,7 +415,7 @@ void VisuGUI_CutLinesDlg::onCutSelect (int theId, bool theUpdate)
     myRotXLbl2->setText( tr("LBL_ROT_Z"));
     myRotYLbl2->setText( tr("LBL_ROT_X"));
   }
-  SVTK_ViewWindow* aView = VISU::GetViewWindow();
+  SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
   if (aView) {
     if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
       /*myCutLines->SetOrientation2(getOrientaion(false),
@@ -443,7 +444,7 @@ void VisuGUI_CutLinesDlg::setBaseDefault (bool theUpdate)
     /*    float aPos = myCutLines->GetBasePlanePosition();
     myBasePlanePos->setText( QString::number(aPos) );
     myBasePlanePos->setEnabled(false);*/
-    SVTK_ViewWindow* aView = VISU::GetViewWindow();
+    SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
     if (aView) {
       if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
         //myCutLines->SetBasePlanePosition(aPos);
@@ -515,7 +516,7 @@ void VisuGUI_CutLinesDlg::DrawTable()
     vh->setLabel( i, str.arg(i+1) );
   }
   // Update preview
-  SVTK_ViewWindow* aView = VISU::GetViewWindow();
+  SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
   if (aView) {
     if (myPreviewCheck->isChecked()) {
       //      myCutLines->GetPL()->Update();
@@ -593,7 +594,7 @@ void VisuGUI_CutLinesDlg::updateGlyphs(bool update){
   source->Delete();
   aPlaneMapper->Delete();
 
-  if (SVTK_ViewWindow* vf = VISU::GetViewWindow())
+  if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
     if (update)
       vf->Repaint();
 }
@@ -684,7 +685,7 @@ void VisuGUI_CutLinesDlg::onValueChanged (int theRow, int theCol)
     QString aTxt = myPosTable->text(theRow, 0);
     bool isChanged = !aTxt.isEmpty();
     ((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged);
-    SVTK_ViewWindow* aView = VISU::GetViewWindow();
+    SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
     if (aView) {
       if (myPreviewCheck->isChecked()) {
        //Update Preview
@@ -700,7 +701,7 @@ void VisuGUI_CutLinesDlg::onValueChanged (int theRow, int theCol)
     if (isDefault) {
       //myCutLines->SetDefaultPosition(theRow);
       // myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
-      SVTK_ViewWindow* aView = VISU::GetViewWindow();
+      SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
       if (aView) {
        if (myPreviewCheck->isChecked()) {
          //Update Preview
@@ -820,7 +821,7 @@ void VisuGUI_CutLinesDlg::reject()
 
 void VisuGUI_CutLinesDlg::onPreviewCheck (bool thePreview)
 {
-  if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+  if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
     if (thePreview) {
       //storeToPrsObject(myCutLines);
       //      myCutLines->GetPL()->Update();
@@ -851,7 +852,7 @@ void VisuGUI_CutLinesDlg::onAllCurvesInvertedCheck(bool theInvert)
 void VisuGUI_CutLinesDlg::onRotation (double theValue)
 {
   if (myCutLines == NULL) return;
-  SVTK_ViewWindow* aView = VISU::GetViewWindow();
+  SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
   if (aView) {
     if (myPreviewCheck->isChecked()) {
 
@@ -872,7 +873,7 @@ void VisuGUI_CutLinesDlg::onRotation (double theValue)
 void VisuGUI_CutLinesDlg::onPlanePos (const QString& theValue)
 {
   if (myCutLines == NULL) return;
-  SVTK_ViewWindow* aView = VISU::GetViewWindow();
+  SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
   if (aView) {
     if (myPreviewCheck->isChecked()) {
       //myCutLines->SetBasePlanePosition(theValue.toDouble());
index c4072907cd942daefde932fd03132643960e4129..486a475d200b47b435f13d0fd01f54d9940c1843 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
 
 #include "VISU_CutPlanes_i.hh"
 #include "VISU_CutPlanesPL.hxx"
@@ -166,11 +167,10 @@ VisuGUI_CutPlanesPane::VisuGUI_CutPlanesPane (QWidget* theParent)
 
 VisuGUI_CutPlanesPane::~VisuGUI_CutPlanesPane()
 {
-  cout<<"### VisuGUI_CutPlanesPane::~VisuGUI_CutPlanesPane"<<endl;
   deletePlanes();
   if (myCutPlanes)
     myCutPlanes->Destroy();
-  if (SVTK_ViewWindow* vf = VISU::GetViewWindow())
+  if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
     vf->Repaint();
 }
 
@@ -194,7 +194,7 @@ void VisuGUI_CutPlanesPane::initFromPrsObject (VISU::CutPlanes_i* thePrs)
 
 void VisuGUI_CutPlanesPane::createPlanes()
 {
-  if (VISU::GetViewWindow() == NULL) return;
+  if (VISU::GetActiveViewWindow<SVTK_ViewWindow>() == NULL) return;
   if (myCutPlanes == NULL) return;
   if (myPreviewActor != 0) return;
 
@@ -211,7 +211,7 @@ void VisuGUI_CutPlanesPane::createPlanes()
   myPreviewActor->PickableOff();
   myPreviewActor->SetMapper(aPlaneMapper);
   aPlaneMapper->Delete();
-  VISU::GetViewWindow()->AddActor(myPreviewActor);
+  VISU::GetActiveViewWindow<SVTK_ViewWindow>()->AddActor(myPreviewActor);
 }
 
 int VisuGUI_CutPlanesPane::storeToPrsObject (VISU::CutPlanes_i* thePrs)
@@ -349,7 +349,7 @@ void VisuGUI_CutPlanesPane::DrawTable()
 
   // Update preview
   if (myPreviewCheck->isChecked()) {
-    if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+    if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
       myCutPlanes->GetPL()->Update();
       deletePlanes();
       createPlanes();
@@ -386,7 +386,7 @@ void VisuGUI_CutPlanesPane::onValueChanged (int theRow, int theCol)
 
     if (myPreviewCheck->isChecked()) {
       //Update Preview
-      if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+      if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
        myCutPlanes->SetPlanePosition( theRow, aTxt.toDouble());
        myCutPlanes->GetPL()->Update();
        deletePlanes();
@@ -401,7 +401,7 @@ void VisuGUI_CutPlanesPane::onValueChanged (int theRow, int theCol)
       myPosTable->setText(theRow, 0, QString::number(myCutPlanes->GetPlanePosition(theRow)));
 
       if (myPreviewCheck->isChecked()) {
-       if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+       if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
          //Update Preview
          myCutPlanes->GetPL()->Update();
          deletePlanes();
@@ -417,7 +417,7 @@ void VisuGUI_CutPlanesPane::onValueChanged (int theRow, int theCol)
 void VisuGUI_CutPlanesPane::deletePlanes()
 {
   if (myPreviewActor == 0) return;
-  if (SVTK_ViewWindow* vf = VISU::GetViewWindow())
+  if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
     vf->RemoveActor(myPreviewActor);
   myPreviewActor->Delete();
   myPreviewActor = 0;
@@ -427,7 +427,7 @@ void VisuGUI_CutPlanesPane::onRotation (double theValue)
 {
   if (myCutPlanes == NULL) return;
   if (myPreviewCheck->isChecked()) {
-    if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+    if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
       myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
       myCutPlanes->GetPL()->Update();
       deletePlanes();
@@ -439,7 +439,7 @@ void VisuGUI_CutPlanesPane::onRotation (double theValue)
 
 void VisuGUI_CutPlanesPane::onPreviewCheck (bool thePreview)
 {
-  if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+  if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
     if (thePreview) {
       storeToPrsObject(myCutPlanes);
       myCutPlanes->GetPL()->Update();
index 1fa6f098984eb6b1e560bf44fc517dd634a0beea..2939ca9082a037cab8963a7456937b517924be61 100644 (file)
 //  $Header: /home/server/cvs/VISU/VISU_SRC/src/VISUGUI/VisuGUI_Displayer.cxx
 
 #include "VisuGUI_Displayer.h"
-#include "VVTK_ViewModel.h"
+
 #include "VisuGUI_Tools.h"
+#include "VISU_ViewManager_i.hh"
 #include "VISU_Actor.h"
 
+#include "VVTK_ViewModel.h"
+
 #include <SVTK_ViewModel.h>
 #include <SVTK_ViewWindow.h>
 
@@ -41,7 +44,7 @@
 #include <SalomeApp_Application.h>
 #include <SalomeApp_Study.h>
 
-#include "VISU_ViewManager_i.hh"
+#include <SUIT_MessageBox.h>
 
 VisuGUI_Displayer::VisuGUI_Displayer( SalomeApp_Application* app )
 : LightApp_Displayer(),
@@ -67,7 +70,9 @@ SALOME_Prs* VisuGUI_Displayer::buildPresentation( const QString& entry, SALOME_V
     if( CORBA::is_nil( anObj ) )
       return 0;
 
-    SVTK_Viewer* vtk_viewer = dynamic_cast<SVTK_Viewer*>( aViewFrame );
+    SVTK_Viewer* vtk_viewer = dynamic_cast<VVTK_Viewer*>( aViewFrame );
+    if (!vtk_viewer)
+      vtk_viewer = dynamic_cast<SVTK_Viewer*>( aViewFrame );
     if( vtk_viewer )
     {
       SVTK_ViewWindow* wnd =
@@ -116,14 +121,22 @@ SALOME_Prs* VisuGUI_Displayer::buildPresentation( const QString& entry, SALOME_V
 
 void VisuGUI_Displayer::buildPrs3d( SVTK_ViewWindow* wnd, VISU::Prs3d_i* thePrs ) const
 {
-  VISU_Actor* newAct = VISU::FindActor( wnd, thePrs );
-  if( !newAct )
-  {
-    newAct = thePrs->CreateActor();
+  VISU_Actor* newAct = VISU::FindActor(wnd, thePrs);
+  if (!newAct) {
+    try {
+      newAct = thePrs->CreateActor();
+    } catch (std::runtime_error& exc) {
+      thePrs->RemoveActors();
+
+      INFOS(exc.what());
+      SUIT_MessageBox::warn1
+        (myApp->desktop(), QObject::tr("WRN_VISU"),
+         QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(exc.what()),
+         QObject::tr("BUT_OK"));
+    }
   }
-  if( newAct )
-  {
-    wnd->AddActor( newAct );
+  if (newAct) {
+    wnd->AddActor(newAct);
     wnd->Repaint();
   }
 }
index f496c5dcd25e2f6202f6c03e98fa634cf4f27b3e..c9742837085d463beb0af6ebcfe4da1f058e4d35 100644 (file)
@@ -1,4 +1,4 @@
-
+//  VISU VISUGUI : GUI of VISU component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -172,24 +172,24 @@ namespace VISU
 }
 
 //---------------------------------------------------------------
-VisuGUI_Module
-::VisuGUI_Module() : 
+VisuGUI_Module::
+VisuGUI_Module() : 
   VisuGUI()
 {
 }
 
 
 //---------------------------------------------------------------
-VisuGUI_Module
-::~VisuGUI_Module()
+VisuGUI_Module::
+~VisuGUI_Module()
 {
 }
 
 
 //---------------------------------------------------------------
 void
-VisuGUI_Module
-::initialize( CAM_Application* theApp )
+VisuGUI_Module::
+initialize( CAM_Application* theApp )
 {
   VisuGUI::initialize( theApp );
 
@@ -230,7 +230,8 @@ VisuGUI_Module
   accel->setActionKey( SVTK::PlusSpeedIncrementEvent, Key_Plus, aViewerType );
   accel->setActionKey( SVTK::MinusSpeedIncrementEvent, Key_Minus, aViewerType );
 
-  connect( getApp(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ), this, SLOT( OnViewManagerAdded (SUIT_ViewManager*) ) );
+  connect( getApp(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
+           this, SLOT( OnViewManagerAdded (SUIT_ViewManager*) ) );
 
   // Prepare popup menus
   QtxPopupMgr* mgr = popupMgr();
@@ -283,21 +284,21 @@ VisuGUI_Module
                 this, SLOT(OnErasePrs()));
   mgr->insert( action( GAUSS_ERASE_PRS ), -1, -1, -1 ); // erase
   mgr->setRule( action( GAUSS_ERASE_PRS ), 
-               aRule + " and (isVisible=true)", true );
+               aRule + " and ({true} in $canBeDisplayed) and (isVisible=true)", true );
 
   createAction( GAUSS_DISPLAY_PRS, VisuGUI::tr("MEN_DISPLAY"), QIconSet(),
                 VisuGUI::tr("MEN_DISPLAY"), "", 0, this, false,
                 this, SLOT(OnDisplayPrs()));
   mgr->insert( action( GAUSS_DISPLAY_PRS ), -1, -1, -1 ); // display
   mgr->setRule( action( GAUSS_DISPLAY_PRS ), 
-               aRule + " and (isVisible=false)", true );
+               aRule + " and ({true} in $canBeDisplayed) and (isVisible=false)", true );
 
   createAction( GAUSS_DISPLAY_ONLY_PRS, VisuGUI::tr("MEN_DISPLAY_ONLY"), QIconSet(),
                 VisuGUI::tr("MEN_DISPLAY_ONLY"), "", 0, this, false,
                 this, SLOT(OnDisplayOnlyPrs()));
   mgr->insert( action( GAUSS_DISPLAY_ONLY_PRS ), -1, -1, -1 ); // display only
   mgr->setRule( action( GAUSS_DISPLAY_ONLY_PRS ), 
-               aRule, true );
+               aRule + " and ({true} in $canBeDisplayed)", true );
 
   createAction( GAUSS_RENAME_CONFIGURATION, VisuGUI::tr("MEN_RENAME"), QIconSet(), 
                VisuGUI::tr("MEN_RENAME"), "", 0, this, false,
@@ -309,7 +310,8 @@ VisuGUI_Module
                 tr("MEN_SAVE_CONFIGURATION"), "", 0, this, false,
                 this, SLOT(OnSaveConfiguration()));
   mgr->insert( action( GAUSS_SAVE_CONFIGURATION ), -1, -1, -1 );
-  mgr->setRule( action( GAUSS_SAVE_CONFIGURATION ), "selcount>=0 and client='VVTK' and activeView='VVTK'", true );
+  mgr->setRule( action( GAUSS_SAVE_CONFIGURATION ),
+                "selcount>=0 and client='VVTK' and activeView='VVTK'", true );
 
   createAction( GAUSS_OVERWRITE_CONFIGURATION, tr("MEN_OVERWRITE_CONFIGURATION"), QIconSet(),
                 tr("MEN_OVERWRITE_CONFIGURATION"), "", 0, this, false,
@@ -328,8 +330,8 @@ VisuGUI_Module
 
 //---------------------------------------------------------------
 bool
-VisuGUI_Module
-::activateModule( SUIT_Study* theStudy )
+VisuGUI_Module::
+activateModule( SUIT_Study* theStudy )
 {
   VisuGUI::activateModule( theStudy );
 
@@ -341,8 +343,8 @@ VisuGUI_Module
 
 //---------------------------------------------------------------
 bool
-VisuGUI_Module
-::deactivateModule( SUIT_Study* theStudy )
+VisuGUI_Module::
+deactivateModule( SUIT_Study* theStudy )
 {
   VisuGUI::deactivateModule( theStudy );
 
@@ -354,8 +356,8 @@ VisuGUI_Module
 
 //---------------------------------------------------------------
 SUIT_ViewManager*
-VisuGUI_Module
-::onCreateViewManager()
+VisuGUI_Module::
+onCreateViewManager()
 {
   Viewer* aViewer = new Viewer( this, myViewerMap );
   return aViewer->getViewManager();
@@ -364,8 +366,8 @@ VisuGUI_Module
 
 //---------------------------------------------------------------
 void
-VisuGUI_Module
-::onLastViewClosed(SUIT_ViewManager* theViewManager)
+VisuGUI_Module::
+onLastViewClosed(SUIT_ViewManager* theViewManager)
 {
   myViewerMap.erase(theViewManager);
 }
@@ -373,8 +375,8 @@ VisuGUI_Module
 
 //---------------------------------------------------------------
 void 
-VisuGUI_Module
-::createPreferences()
+VisuGUI_Module::
+createPreferences()
 {
   VisuGUI::createPreferences();
 
@@ -389,15 +391,16 @@ VisuGUI_Module
 
 //---------------------------------------------------------------
 void 
-VisuGUI_Module
-::createGaussPointsPreferences()
+VisuGUI_Module::
+createGaussPointsPreferences()
 {
   int gaussTab = addPreference( tr( "VISU_GAUSS_PREF_TAB_TTL" ) );
   int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), gaussTab );
   setPreferenceProperty( primitiveGr, "columns", 1 );
 
   int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr,
-                                        LightApp_Preferences::Selector, "VISU", "point_sprite_primitive_type" );
+                                        LightApp_Preferences::Selector, "VISU",
+                                         "point_sprite_primitive_type" );
 
   QStringList values;
   values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) );
@@ -422,7 +425,8 @@ VisuGUI_Module
                 LightApp_Preferences::File, "VISU", "point_sprite_alpha_texture" );
 
   int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
-                                         LightApp_Preferences::DblSpin, "VISU", "point_sprite_alpha_threshold" );
+                                         LightApp_Preferences::DblSpin, "VISU",
+                                          "point_sprite_alpha_threshold" );
   setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
   setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
   setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
@@ -451,7 +455,8 @@ VisuGUI_Module
   setPreferenceProperty( maxSizePref, "max", 100 );
 
   int magnificationPref = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION" ), sizeGr,
-                                        LightApp_Preferences::IntSpin, "VISU", "point_sprite_magnification" );
+                                        LightApp_Preferences::IntSpin, "VISU",
+                                         "point_sprite_magnification" );
   setPreferenceProperty( magnificationPref, "min", 10 );
   setPreferenceProperty( magnificationPref, "max", 1000 );
 
@@ -513,8 +518,8 @@ VisuGUI_Module
 
 //---------------------------------------------------------------
 void 
-VisuGUI_Module
-::createInsideCursorPreferences()
+VisuGUI_Module::
+createInsideCursorPreferences()
 {
   int insideCursorTab = addPreference( tr( "VISU_GAUSS_INSIDE_CURSOR_PREF_TAB_TTL" ) );
 
@@ -522,7 +527,8 @@ VisuGUI_Module
   setPreferenceProperty( primitiveGr, "columns", 1 );
 
   int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr,
-                               LightApp_Preferences::Selector, "VISU", "inside_point_sprite_primitive_type" );
+                                         LightApp_Preferences::Selector, "VISU",
+                                         "inside_point_sprite_primitive_type" );
 
   QStringList values;
   values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) );
@@ -547,18 +553,21 @@ VisuGUI_Module
                 LightApp_Preferences::File, "VISU", "inside_point_sprite_alpha_texture" );
 
   int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
-                                         LightApp_Preferences::DblSpin, "VISU", "inside_point_sprite_alpha_threshold" );  
+                                         LightApp_Preferences::DblSpin, "VISU",
+                                          "inside_point_sprite_alpha_threshold" );  
   setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
   setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
   setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
 
   int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr,
-                                     LightApp_Preferences::IntSpin, "VISU", "inside_geom_sphere_resolution" );
+                                     LightApp_Preferences::IntSpin, "VISU",
+                                      "inside_geom_sphere_resolution" );
   setPreferenceProperty( resolutionPref, "min", 3 );
   setPreferenceProperty( resolutionPref, "max", 100 );
 
   int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr,
-                                    LightApp_Preferences::IntSpin, "VISU", "inside_geom_sphere_face_limit" );
+                                    LightApp_Preferences::IntSpin, "VISU",
+                                     "inside_geom_sphere_face_limit" );
   setPreferenceProperty( faceLimitPref, "min", 10 );
   setPreferenceProperty( faceLimitPref, "max", 1000000 );
 
@@ -566,12 +575,14 @@ VisuGUI_Module
   setPreferenceProperty( sizeGr, "columns", 2 );
 
   int minSizePref = addPreference( tr( "VISU_GAUSS_PREF_MIN_SIZE" ), sizeGr,
-                                  LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_min_size" );
+                                  LightApp_Preferences::IntSpin, "VISU",
+                                   "inside_point_sprite_min_size" );
   setPreferenceProperty( minSizePref, "min", 1 );
   setPreferenceProperty( minSizePref, "max", 100 );
 
   int maxSizePref = addPreference( tr( "VISU_GAUSS_PREF_MAX_SIZE" ), sizeGr,
-                                  LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_max_size" );
+                                  LightApp_Preferences::IntSpin, "VISU",
+                                   "inside_point_sprite_max_size" );
   setPreferenceProperty( maxSizePref, "min", 1 );
   setPreferenceProperty( maxSizePref, "max", 100 );
 
@@ -579,23 +590,24 @@ VisuGUI_Module
   setPreferenceProperty( magnificationGr, "columns", 2 );
 
   int magnificationPref = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION" ), magnificationGr,
-                                        LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_magnification" );
+                                        LightApp_Preferences::IntSpin, "VISU",
+                                         "inside_point_sprite_magnification" );
   setPreferenceProperty( magnificationPref, "min", 10 );
   setPreferenceProperty( magnificationPref, "max", 1000 );
 
   int incrementPref = addPreference( tr( "VISU_GAUSS_PREF_INCREMENT" ), magnificationGr,
-                                    LightApp_Preferences::DblSpin, "VISU", "inside_point_sprite_increment" );
+                                    LightApp_Preferences::DblSpin, "VISU",
+                                     "inside_point_sprite_increment" );
   setPreferenceProperty( incrementPref, "min", 0.01 );
   setPreferenceProperty( incrementPref, "max", 10 );
   setPreferenceProperty( incrementPref, "step", 0.1 );
-
 }
 
 
 //---------------------------------------------------------------
 void 
-VisuGUI_Module
-::createOutsideCursorPreferences()
+VisuGUI_Module::
+createOutsideCursorPreferences()
 {
   int outsideCursorTab = addPreference( tr( "VISU_GAUSS_OUTSIDE_CURSOR_PREF_TAB_TTL" ) );
 
@@ -603,7 +615,8 @@ VisuGUI_Module
   setPreferenceProperty( primitiveGr, "columns", 1 );
 
   int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr,
-                               LightApp_Preferences::Selector, "VISU", "outside_point_sprite_primitive_type" );
+                                         LightApp_Preferences::Selector, "VISU",
+                                         "outside_point_sprite_primitive_type" );
 
   QStringList values;
   values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) );
@@ -628,18 +641,21 @@ VisuGUI_Module
                 LightApp_Preferences::File, "VISU", "outside_point_sprite_alpha_texture" );
 
   int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
-                                         LightApp_Preferences::DblSpin, "VISU", "outside_point_sprite_alpha_threshold" );  
+                                         LightApp_Preferences::DblSpin, "VISU",
+                                          "outside_point_sprite_alpha_threshold" );  
   setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
   setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
   setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
 
   int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr,
-                                     LightApp_Preferences::IntSpin, "VISU", "outside_geom_sphere_resolution" );
+                                     LightApp_Preferences::IntSpin, "VISU",
+                                      "outside_geom_sphere_resolution" );
   setPreferenceProperty( resolutionPref, "min", 3 );
   setPreferenceProperty( resolutionPref, "max", 100 );
 
   int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr,
-                                    LightApp_Preferences::IntSpin, "VISU", "outside_geom_sphere_face_limit" );
+                                    LightApp_Preferences::IntSpin, "VISU",
+                                     "outside_geom_sphere_face_limit" );
   setPreferenceProperty( faceLimitPref, "min", 10 );
   setPreferenceProperty( faceLimitPref, "max", 1000000 );
 
@@ -663,8 +679,8 @@ VisuGUI_Module
 
 //---------------------------------------------------------------
 void 
-VisuGUI_Module
-::createPickingPreferences()
+VisuGUI_Module::
+createPickingPreferences()
 {
   int pickingTab = addPreference( tr( "VISU_PICKING_PREF_TAB_TTL" ) );
 
@@ -673,7 +689,7 @@ VisuGUI_Module
   setPreferenceProperty( cursorGr, "columns", 1 );
 
   int cursorSizePref = addPreference( tr( "VISU_PICKING_PREF_CURSOR_SIZE" ), cursorGr,
-                                        LightApp_Preferences::DblSpin, "VISU", "picking_cursor_size" );
+                                      LightApp_Preferences::DblSpin, "VISU", "picking_cursor_size" );
   setPreferenceProperty( cursorSizePref, "min", 0 );
   setPreferenceProperty( cursorSizePref, "max", 1.0 );
   setPreferenceProperty( cursorSizePref, "step", 0.1 );
@@ -683,14 +699,15 @@ VisuGUI_Module
   setPreferenceProperty( pyramidHeightPref, "min", 1 );
   setPreferenceProperty( pyramidHeightPref, "max", 100 );
 
-  int selectionColorPref = addPreference( tr( "VISU_PICKING_PREF_SELECTION_COLOR" ), cursorGr,
-                                         LightApp_Preferences::Color, "VISU", "picking_selection_color" );
+  /*int selectionColorPref = */
+  addPreference( tr( "VISU_PICKING_PREF_SELECTION_COLOR" ), cursorGr,
+                 LightApp_Preferences::Color, "VISU", "picking_selection_color" );
 
   // Tolerance
   int toleranceGr = addPreference( tr( "VISU_PICKING_PREF_TOLERANCE_GROUP_TTL" ), pickingTab );
 
   int pointTolerancePref = addPreference( tr( "VISU_PICKING_PREF_POINT_SELECTION_TOLERANCE" ), toleranceGr,
-                                        LightApp_Preferences::DblSpin, "VISU", "picking_point_tolerance" );
+                                          LightApp_Preferences::DblSpin, "VISU", "picking_point_tolerance" );
   setPreferenceProperty( pointTolerancePref, "min", 0.001 );
   setPreferenceProperty( pointTolerancePref, "max", 10 );
   setPreferenceProperty( pointTolerancePref, "step", 0.01 );
@@ -742,13 +759,14 @@ VisuGUI_Module
 
 //---------------------------------------------------------------
 void 
-VisuGUI_Module
-::createSpaceMousePreferences()
+VisuGUI_Module::
+createSpaceMousePreferences()
 {
   int mouseTab = addPreference( tr( "VISU_MOUSE_PREF_TAB_TLT" ) );
 
   int mouseGr = addPreference( tr( "VISU_MOUSE_PREF_GROUP_TLT" ), mouseTab );
-  int mousePref = addPreference( tr( "VISU_MOUSE_PREF" ), mouseGr, LightApp_Preferences::Selector, "VISU", "mouse_behaviour" );
+  int mousePref = addPreference( tr( "VISU_MOUSE_PREF" ), mouseGr,
+                                 LightApp_Preferences::Selector, "VISU", "mouse_behaviour" );
   QStringList values;
   values.append( tr( "VISU_MOUSE_PREF_STANDARD" ) );
   values.append( tr( "VISU_MOUSE_PREF_KEYBOARD_FREE" ) );
@@ -759,16 +777,27 @@ VisuGUI_Module
   setPreferenceProperty( mousePref, "indexes", indices );
 
   int keybrdGr = addPreference( tr( "VISU_KEYBOARD_PREF_GROUP_TTL" ), mouseTab );
-  int keybrdPref = addPreference( tr( "VISU_KEYBOARD_PREF" ), keybrdGr, LightApp_Preferences::IntSpin, "VISU", "speed_increment" );
+  int keybrdPref = addPreference( tr( "VISU_KEYBOARD_PREF" ), keybrdGr,
+                                  LightApp_Preferences::IntSpin, "VISU", "speed_increment" );
   setPreferenceProperty( keybrdPref,  "max",  1000  );
 
   int spacemouseGr = addPreference( tr( "VISU_SPACEMOUSE_PREF" ), mouseTab );
   setPreferenceProperty( spacemouseGr, "columns", 1 );
-  int spacemousePref1 = addPreference( tr( "VISU_SPACEMOUSE_PREF_1" ), spacemouseGr, LightApp_Preferences::Selector, "VISU", "spacemouse_func1_btn" ); //decrease_speed_increment
-  int spacemousePref2 = addPreference( tr( "VISU_SPACEMOUSE_PREF_2" ), spacemouseGr, LightApp_Preferences::Selector, "VISU", "spacemouse_func2_btn" ); //increase_speed_increment
-  int spacemousePref3 = addPreference( tr( "VISU_SPACEMOUSE_PREF_3" ), spacemouseGr, LightApp_Preferences::Selector, "VISU", "spacemouse_func3_btn" ); //decrease_gauss_point_magnification
-  int spacemousePref4 = addPreference( tr( "VISU_SPACEMOUSE_PREF_4" ), spacemouseGr, LightApp_Preferences::Selector, "VISU", "spacemouse_func4_btn" ); //increase_gauss_point_magnification
-  int spacemousePref5 = addPreference( tr( "VISU_SPACEMOUSE_PREF_5" ), spacemouseGr, LightApp_Preferences::Selector, "VISU", "spacemouse_func5_btn" ); //dominant_combined_switch
+  int spacemousePref1 = addPreference( tr( "VISU_SPACEMOUSE_PREF_1" ), spacemouseGr,
+                                       LightApp_Preferences::Selector, "VISU",
+                                       "spacemouse_func1_btn" ); //decrease_speed_increment
+  int spacemousePref2 = addPreference( tr( "VISU_SPACEMOUSE_PREF_2" ), spacemouseGr,
+                                       LightApp_Preferences::Selector, "VISU",
+                                       "spacemouse_func2_btn" ); //increase_speed_increment
+  int spacemousePref3 = addPreference( tr( "VISU_SPACEMOUSE_PREF_3" ), spacemouseGr,
+                                       LightApp_Preferences::Selector, "VISU",
+                                       "spacemouse_func3_btn" ); //decrease_gauss_point_magnification
+  int spacemousePref4 = addPreference( tr( "VISU_SPACEMOUSE_PREF_4" ), spacemouseGr,
+                                       LightApp_Preferences::Selector, "VISU",
+                                       "spacemouse_func4_btn" ); //increase_gauss_point_magnification
+  int spacemousePref5 = addPreference( tr( "VISU_SPACEMOUSE_PREF_5" ), spacemouseGr,
+                                       LightApp_Preferences::Selector, "VISU",
+                                       "spacemouse_func5_btn" ); //dominant_combined_switch
   values.clear();
   values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_1" ) );
   values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_2" ) );
@@ -808,8 +837,8 @@ VisuGUI_Module
 
 //---------------------------------------------------------------
 void 
-VisuGUI_Module
-::createRecorderPreferences()
+VisuGUI_Module::
+createRecorderPreferences()
 {
   int recorderTab = addPreference( tr( "VISU_RECORDER_PREF_TAB_TTL" ) );
 
@@ -844,27 +873,28 @@ VisuGUI_Module
 
 //---------------------------------------------------------------
 void
-VisuGUI_Module
-::OnCreateGaussPoints()
+VisuGUI_Module::
+OnCreateGaussPoints()
 {
   double initialTime = vtkTimerLog::GetCPUTime();
-  CreatePrs3d<VISU::GaussPoints_i,VVTK_Viewer,VisuGUI_GaussPointsDlg,1>(this,true);
+  CreatePrs3d<VISU::GaussPoints_i, VVTK_Viewer, VisuGUI_GaussPointsDlg, 1>(this);
   INFOS( "VisuGUI_Module::OnCreateGaussPoints() : Gauss Points created in " <<
         vtkTimerLog::GetCPUTime() - initialTime << " seconds" );
 }
 
 void
-VisuGUI_Module
-::OnViewManagerAdded(SUIT_ViewManager* viewMgr)
+VisuGUI_Module::
+OnViewManagerAdded(SUIT_ViewManager* viewMgr)
 {
   QString type = viewMgr->getViewModel()->getType();
   if ( type == VVTK_Viewer::Type() ) 
-    connect( viewMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ), this, SLOT( OnViewCreated( SUIT_ViewWindow* ) ) );
+    connect( viewMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ),
+             this, SLOT( OnViewCreated( SUIT_ViewWindow* ) ) );
 }
 
 void
-VisuGUI_Module
-::OnViewCreated(SUIT_ViewWindow* view)
+VisuGUI_Module::
+OnViewCreated(SUIT_ViewWindow* view)
 {
   SVTK_ViewWindow* viewWindow = dynamic_cast<SVTK_ViewWindow*>( view );
   if ( viewWindow ) {
@@ -878,8 +908,8 @@ VisuGUI_Module
 }
 
 void
-VisuGUI_Module
-::setProperty( SVTK_ViewWindow* viewWindow, const QString& pref )
+VisuGUI_Module::
+setProperty( SVTK_ViewWindow* viewWindow, const QString& pref )
 {
   if ( !viewWindow )
     return;
@@ -914,8 +944,8 @@ VisuGUI_Module
 }
 
 void
-VisuGUI_Module
-::setProperty( SVTK_ViewManager* vm, const QString& prop )
+VisuGUI_Module::
+setProperty( SVTK_ViewManager* vm, const QString& prop )
 {
   if ( !vm )
     return;
@@ -926,8 +956,8 @@ VisuGUI_Module
 }
 
 void
-VisuGUI_Module
-::preferencesChanged( const QString& group, const QString& pref )
+VisuGUI_Module::
+preferencesChanged( const QString& group, const QString& pref )
 {
   VisuGUI::preferencesChanged(group,pref);
 
@@ -945,14 +975,14 @@ VisuGUI_Module
 
 //---------------------------------------------------------------
 SUIT_ViewManager*
-VisuGUI_Module
-::getViewManager(const QString& theType, 
-                const bool theIsCreate)
+VisuGUI_Module::
+getViewManager(const QString& theType, 
+               const bool theIsCreate)
 {
-  if(SUIT_ViewManager* aViewManager = VisuGUI::getViewManager(theType,theIsCreate))
+  if (SUIT_ViewManager* aViewManager = VisuGUI::getViewManager(theType,theIsCreate))
     return aViewManager;
 
-  if(theIsCreate && VVTK_Viewer::Type() == theType)
+  if (theIsCreate && theType == VVTK_Viewer::Type())
     return onCreateViewManager();
 
   return NULL;
@@ -960,131 +990,16 @@ VisuGUI_Module
 
 //---------------------------------------------------------------
 void
-VisuGUI_Module
-::OnEditGaussPoints()
+VisuGUI_Module::
+OnEditGaussPoints()
 {
   Handle(SALOME_InteractiveObject) anIO;
-  if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
-    EditPrs3d<VISU::GaussPoints_i,VisuGUI_GaussPointsDlg,1>(this, aPrs3d);
-    if(SVTK_ViewWindow* aViewWindow = GetViewWindow<VVTK_Viewer>(this,true)){
-      aViewWindow->highlight(anIO,1);
-    }
-  }
-}
-
-
-//---------------------------------------------------------------
-void
-VisuGUI_Module
-::OnDisplayPrs()
-{
-  if(MYDEBUG) MESSAGE("VisuGUI_Module::OnDisplayPrs");
-
-  QApplication::setOverrideCursor(Qt::waitCursor);
-
-  if(LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this)){
-    SALOME_ListIO aSel, aList;
-    aSelectionMgr->selectedObjects(aSel);
-    extractContainers(aSel, 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() );
-
-      // is it a Prs3d object ?
-      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<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;
-       }
-      }
-
-      // is it Curve ?
-      if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in())){
-        if(MYDEBUG) MESSAGE("VisuGUI_Module::OnDisplayPrs : Curve object");
-        PlotCurve( this, aCurve, VISU::eDisplay );
-        continue;
-      }
-
-      // is it Container ?
-      if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in())){
-        if(MYDEBUG) MESSAGE("VisuGUI_Module::DisplayPrs : Container object");
-        PlotContainer( this, aContainer, VISU::eDisplay );
-        continue;
-      }
-
-      // is it Table ?
-      if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in())){
-        if(MYDEBUG) MESSAGE("VisuGUI_Module::DisplayPrs : Table object");
-        PlotTable( this, aTable, VISU::eDisplay );
-        continue;
-      }
+  if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO)) {
+    // Create VVTK_ViewWindow, if it does not exist
+    if (VVTK_ViewWindow* aViewWindow = GetViewWindow<VVTK_Viewer>(this)) {
+      EditPrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, anIO, aPrs3d, aViewWindow);
     }
   }
-
-  QApplication::restoreOverrideCursor();
-}
-
-
-//---------------------------------------------------------------
-void
-VisuGUI_Module
-::OnEraseAll()
-{
-  if(SUIT_ViewManager* aViewManager = getApp()->activeViewManager()){
-    QString aType = aViewManager->getType();
-    if(aType == SVTK_Viewer::Type())
-      VISU::OnEraseAll<SVTK_Viewer>(this);
-    else if(aType == VVTK_Viewer::Type())
-      VISU::OnEraseAll<VVTK_Viewer>(this);
-    else if(aType == SPlot2d_Viewer::Type())
-      VISU::OnEraseAll<SPlot2d_Viewer>(this);
-  }
-}
-
-
-//---------------------------------------------------------------
-void
-VisuGUI_Module
-::OnDisplayOnlyPrs()
-{
-  OnEraseAll();
-  OnDisplayPrs();
-}
-
-
-//---------------------------------------------------------------
-void
-VisuGUI_Module
-::OnErasePrs()
-{
-  QApplication::setOverrideCursor(Qt::waitCursor);
-
-  LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
-  SALOME_ListIO aSel, aList;
-  aSelectionMgr->selectedObjects(aSel);
-  extractContainers(aSel, 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)){
-      VISU::Base_var aBase = VISU::Base::_narrow(anObject);
-      if(!CORBA::is_nil(aBase)) 
-       VISU::ErasePrs(this,aBase,true);
-    }
-  }
-
-  QApplication::restoreOverrideCursor();
 }
 
 
@@ -1375,7 +1290,7 @@ namespace
        PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
        if(VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in())){
          // To set visiblity
-         VISU::UpdateViewer<VVTK_Viewer>(theModule,aPrs3d,anIsFirst,false,false);
+         VISU::UpdateViewer(theModule, aPrs3d, /*disp_only = */anIsFirst, /*highlight = */false);
          anIsFirst = false;
          
          // To update selection
index c13c8235d997885cca1298ba144abd19b50da748..88371a1bb81b5f136456dcb9d0fe81018ba1405f 100644 (file)
@@ -24,7 +24,6 @@
 //  File   : VisuGUI_Module.h
 //  Author : 
 //  Module : VISU
-//  $Header$
 
 #ifndef VisuGUI_Module_HeaderFile
 #define VisuGUI_Module_HeaderFile
@@ -146,26 +145,6 @@ protected slots:
   void
   OnEditGaussPoints();
 
-  //! Reimplemented method of the Gauss Points displaying.
-  virtual 
-  void
-  OnDisplayPrs();
-
-  //! Reimplemented method of the Gauss Points displaying only.
-  virtual 
-  void
-  OnDisplayOnlyPrs();
-
-  //! Reimplemented method of the Gauss Points full erasing.
-  virtual
-  void
-  OnEraseAll();
-
-  //! Reimplemented method of the Gauss Points erasing.
-  virtual
-  void
-  OnErasePrs();
-
   //! Virtual method of saving configuration.
   virtual
   void
index a79356329eca42f54ff6e809e4cb6baa31ee5da2..04ba4334ef924c468b13079771bde7d30f1a6ca5 100644 (file)
 
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
 
 #include "VISU_ViewManager_i.hh"
 #include "VISU_Plot3DPL.hxx"
 
-#include "SALOME_Actor.h"
 #include "SVTK_ViewWindow.h"
+
+#include "SALOME_Actor.h"
 #include "SUIT_Desktop.h"
 
 #include <qlayout.h>
@@ -127,7 +129,7 @@ class TPlane : public SALOME_Actor
 //=======================================================================
 VisuGUI_Plot3DPane::VisuGUI_Plot3DPane (QWidget* parent)
      : QVBox(parent), myInitFromPrs(false), myPreviewActor(NULL),
-       myViewWindow(VISU::GetViewWindow()), myPrs(NULL), myPipeCopy(NULL)
+       myViewWindow(VISU::GetActiveViewWindow<SVTK_ViewWindow>()), myPrs(NULL), myPipeCopy(NULL)
 {
   layout()->setAlignment(Qt::AlignTop);
   setSpacing(6);
index b4ca7c2079eda64b23b1b2c1fd0852084e1bacec..682997773b06824d0155f94a037d898b82bcc271 100644 (file)
 //  Module : VISU
 
 #include "VisuGUI_PopupTools.h"
+
 #include "VisuGUI_ViewTools.h"
 #include "VisuGUI_Tools.h"
-#include "SalomeApp_Study.h"
-#include "LightApp_Study.h"
+
+#include "VISU_Result_i.hh"
 
 #include "VISU_Actor.h"
 #include "VISU_ScalarMapAct.h"
-#include "VISU_Result_i.hh"
+
 #include "SalomeApp_Study.h"
+#include "LightApp_Study.h"
 
 using namespace VISU;
 
@@ -211,10 +213,10 @@ QString VisuGUI_Selection::representation( const int ind ) const
 {
   QString aResStr;
 
-  if ( SVTK_ViewWindow* aView = GetViewWindow( myModule ) ){
-    if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) ){
+  if (SVTK_ViewWindow* aView = GetActiveViewWindow<SVTK_ViewWindow>(myModule)) {
+    if (VISU_Actor* anVISUActor = FindActor(aView, entry(ind).latin1())) {
       int aRepresent = anVISUActor->GetRepresentation();
-      switch ( aRepresent ){
+      switch (aRepresent) {
        ENUM2STRING( aResStr, VISU::POINT );
        ENUM2STRING( aResStr, VISU::WIREFRAME );
        ENUM2STRING( aResStr, VISU::SHADED );
@@ -278,8 +280,8 @@ namespace
        const QString& theEntry)
     {
       typedef typename TViewer::TViewWindow TViewWindow;
-      if(TViewWindow* aViewWindow = GetViewWindow<TViewer>(theModule))
-       if(VISU_Actor* anActor = FindActor(aViewWindow,theEntry.latin1()))
+      if (TViewWindow* aViewWindow = GetActiveViewWindow<TViewWindow>(theModule))
+       if (VISU_Actor* anActor = FindActor(aViewWindow,theEntry.latin1()))
          return anActor->GetVisibility() ? "true" : "false";
 
       return QString();
@@ -315,7 +317,7 @@ QString VisuGUI_Selection::isShrunk( const int ind ) const
 {
   QString aResStr;
 
-  if ( SVTK_ViewWindow* aView = GetViewWindow( myModule ) )
+  if ( SVTK_ViewWindow* aView = GetActiveViewWindow<SVTK_ViewWindow>(myModule) )
     if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) )
       if ( anVISUActor->IsShrunkable() )
        aResStr = anVISUActor->IsShrunk() ? "1" : "0";
@@ -332,7 +334,7 @@ QString VisuGUI_Selection::isShading( const int ind ) const
 {
   QString aResStr;
   
-  if ( SVTK_ViewWindow* aView = GetViewWindow( myModule ) )
+  if ( SVTK_ViewWindow* aView = GetActiveViewWindow<SVTK_ViewWindow>(myModule) )
     if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) )
       if ( VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(anVISUActor) )
        aResStr = anActor->IsShading() ? "1" : "0";
@@ -344,12 +346,12 @@ QString VisuGUI_Selection::isScalarMapAct( const int ind ) const
 {
   QString aResStr;
 
-  if ( SVTK_ViewWindow* aView = GetViewWindow( myModule ) )
+  if ( SVTK_ViewWindow* aView = GetActiveViewWindow<SVTK_ViewWindow>(myModule) )
     if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) )
-      {
-       VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(anVISUActor);
-       aResStr = anActor ? "1" : "0";
-      }
-  
+    {
+      VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(anVISUActor);
+      aResStr = anActor ? "1" : "0";
+    }
+
   return aResStr;
 }
index 7984a698872fe2e76323cec325b3bfd8c56adbb7..3fc626bbd3e55c8859882b2debcf14e1265245d8 100644 (file)
@@ -24,7 +24,6 @@
 //  File   : VisuGUI_Module.h
 //  Author : 
 //  Module : VISU
-//  $Header$
 
 #ifndef VisuGUI_Prs3dTools_HeaderFile
 #define VisuGUI_Prs3dTools_HeaderFile
@@ -52,9 +51,10 @@ namespace VISU
   template<class TPrs3d_i, class TViewer, class TDlg, int TIsDlgModal>
   void
   EditPrs3d(VisuGUI* theModule, 
-           VISU::Prs3d_i* thePrs3d)
+           VISU::Prs3d_i* thePrs3d,
+           SVTK_ViewWindow* theViewWindow)
   {
-    if(TPrs3d_i* aPrs3d = dynamic_cast<TPrs3d_i*>(thePrs3d)){
+    if (TPrs3d_i* aPrs3d = dynamic_cast<TPrs3d_i*>(thePrs3d)) {
       TDlg* aDlg = new TDlg (theModule);
       aDlg->initFromPrsObject(aPrs3d);
       if (runAndWait(aDlg,TIsDlgModal)) {
@@ -65,18 +65,17 @@ namespace VISU
        try {
          aPrs3d->UpdateActors();
        } catch (std::runtime_error& exc) {
+         aPrs3d->RemoveActors();
+
          INFOS(exc.what());
          SUIT_MessageBox::warn1
            (GetDesktop(theModule), QObject::tr("WRN_VISU"),
             QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(exc.what()),
             QObject::tr("BUT_OK"));
-
-         aPrs3d->RemoveActors();
        }
-       typedef typename TViewer::TViewWindow TViewWindow;
-       if(TViewWindow* aViewWindow = GetViewWindow<TViewer>(theModule)){
-         aViewWindow->getRenderer()->ResetCameraClippingRange();
-         aViewWindow->Repaint();
+       if (theViewWindow) {
+         theViewWindow->getRenderer()->ResetCameraClippingRange();
+         theViewWindow->Repaint();
        }
        // Optionally, create table and curves for cut lines
        QApplication::setOverrideCursor(Qt::waitCursor);
@@ -93,10 +92,19 @@ namespace VISU
   template<class TPrs3d_i, class TDlg, int TIsDlgModal>
   inline
   void
-  EditPrs3d(VisuGUI* theModule, 
-           VISU::Prs3d_i* thePrs3d)
+  EditPrs3d(VisuGUI* theModule,
+           Handle(SALOME_InteractiveObject)& theIO,
+           VISU::Prs3d_i* thePrs3d,
+           SVTK_ViewWindow* theViewWindow = NULL)
   {
-    EditPrs3d<TPrs3d_i,SVTK_Viewer,TDlg,TIsDlgModal>(theModule,thePrs3d);
+    SVTK_ViewWindow* aViewWindow = theViewWindow;
+    if (!aViewWindow)
+      // Create SVTK_ViewWindow, if it does not exist
+      aViewWindow = GetViewWindow<SVTK_Viewer>(theModule);
+    if (aViewWindow) {
+      EditPrs3d<TPrs3d_i,SVTK_Viewer,TDlg,TIsDlgModal>(theModule, thePrs3d, aViewWindow);
+      aViewWindow->highlight(theIO, 1);
+    }
   }
 
   //---------------------------------------------------------------
@@ -134,26 +142,30 @@ namespace VISU
   bool
   CreatePrs3d(VisuGUI* theModule,
              _PTR(SObject) theTimeStamp,
-             const Handle(SALOME_InteractiveObject)& theIO,
-             const bool theIsCreateView = false)
+             const Handle(SALOME_InteractiveObject)& theIO)
   {
     Storable::TRestoringMap aMap = getMapOfValue(theTimeStamp);
 
     bool isExist;
     QString aType = Storable::FindValue(aMap,"myType",&isExist);
-    if(!isExist || aType.toInt() != TTIMESTAMP )
+    if (!isExist || aType.toInt() != TTIMESTAMP )
       return false;
 
     QString aMeshName = Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
     QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
     QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
     QString aTimeStampId = Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
-    //
-    int aPos = GetFreePositionOfDefaultScalarBar(theModule);
-    GetResourceMgr()->setValue("VISU","scalar_bar_position_num",aPos);
-    //
+
+    // Create new TViewWindow instance, if it does not exist.
+    typedef typename TViewer::TViewWindow TViewWindow;
+    TViewWindow* aViewWindow = GetViewWindow<TViewer>(theModule);
+
+    // Define free position for scalar bar.
+    int aPos = GetFreePositionOfDefaultScalarBar(theModule, aViewWindow);
+    GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
+
     QApplication::setOverrideCursor(Qt::waitCursor);
-    
+
     TPrs3d_i* aPrs3d =
       CreatePrs3d<TPrs3d_i>(theModule,
                            theTimeStamp,
@@ -161,16 +173,16 @@ namespace VISU
                            (Entity)anEntity.toInt(),
                            aFieldName.latin1(),
                            aTimeStampId.toInt());
-    
+
     QApplication::restoreOverrideCursor();
-    if(aPrs3d){
+    if (aPrs3d) {
       SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
       int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
-      if(!aValue){
-       if(TDlg* aDlg = new TDlg(theModule)){ // dialog box in creation mode
+      if (!aValue) {
+       if (TDlg* aDlg = new TDlg(theModule)) { // dialog box in creation mode
          aDlg->initFromPrsObject(aPrs3d);
 
-           if(runAndWait(aDlg,IsDlgModal) && (aDlg->storeToPrsObject(aPrs3d))) {
+           if (runAndWait(aDlg,IsDlgModal) && (aDlg->storeToPrsObject(aPrs3d))) {
              // Optionally, create table and curves for cut lines
              QApplication::setOverrideCursor(Qt::waitCursor);
              CreateCurves( theModule,
@@ -187,57 +199,60 @@ namespace VISU
            }
        }
       }
-      PublishInView<TViewer>(theModule,aPrs3d,true,theIsCreateView);
 
-      AddScalarBarPosition(theModule,aPrs3d,aPos);
+      // Display created presentation.
+      if (aViewWindow) {
+       PublishInView(theModule, aPrs3d, aViewWindow, /*highlight = */true);
+       aViewWindow->onFitAll();
+
+       AddScalarBarPosition(theModule, aViewWindow, aPrs3d, aPos);
+      }
 
       return true;
     }
 
     return false;
   }
-  
+
 
   //---------------------------------------------------------------
   template<class TPrs3d_i, class TViewer, class TDlg, int IsDlgModal>
   inline
   void
-  CreatePrs3d(VisuGUI* theModule,
-             const bool theIsCreateView = true)
+  CreatePrs3d(VisuGUI* theModule)
   {
     if (CheckLock(GetCStudy(GetAppStudy(theModule)),GetDesktop(theModule)))
       return;
-    
+
     _PTR(SObject) aTimeStampSObj;
     Handle(SALOME_InteractiveObject) anIO;
-    if(!CheckTimeStamp(theModule,aTimeStampSObj,&anIO))
+    if (!CheckTimeStamp(theModule,aTimeStampSObj,&anIO))
       return;
-    
-    if(!CreatePrs3d<TPrs3d_i,TViewer,TDlg,IsDlgModal>(theModule,aTimeStampSObj,anIO,theIsCreateView))
+
+    // Create new TViewWindow instance, if it does not exist.
+    typedef typename TViewer::TViewWindow TViewWindow;
+    if (!GetViewWindow<TViewer>(theModule))
       return;
-    
+
+    if (!CreatePrs3d<TPrs3d_i,TViewer,TDlg,IsDlgModal>(theModule,aTimeStampSObj,anIO))
+      return;
+
     theModule->application()->putInfo(QObject::tr("INF_DONE"));
-    
-    typedef typename TViewer::TViewWindow TView;
-    if(TView* aView = GetViewWindow<TViewer>(theModule,theIsCreateView))
-      aView->onFitAll();
   }
 
   template<class TPrs3d_i, class TDlg, int IsDlgModal>
   inline
   void
-  CreatePrs3d(VisuGUI* theModule,
-             const bool theIsCreateView = true)
+  CreatePrs3d(VisuGUI* theModule)
   {
-    if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){
+    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);
+      if (aType == VVTK_Viewer::Type())
+       CreatePrs3d<TPrs3d_i,VVTK_Viewer,TDlg,IsDlgModal>(theModule);
+      else
+       CreatePrs3d<TPrs3d_i,SVTK_Viewer,TDlg,IsDlgModal>(theModule);
     }
   }
-
 }
 
 #endif
index a00194ae586ef06847d1988dedb67207b0675ddf..54c96b88ecbbc46435ecdaf58da03ad7f1d09f24 100644 (file)
 
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
-
-#include "SVTK_FontWidget.h"
-
-#include "SVTK_ViewWindow.h"
+#include "VisuGUI_ViewTools.h"
 
 #include "SVTK_ViewWindow.h"
+#include "SVTK_FontWidget.h"
 
 #include "VISUConfig.hh"
 #include "VISU_Convertor.hxx"
@@ -634,7 +632,7 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) {
 void VisuGUI_ScalarBarPane::updatePreview()
 {
   if (myPreviewCheck->isChecked()) {
-    if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+    if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
       deleteScalarBar();
       createScalarBar();
       vf->Repaint();
@@ -646,11 +644,11 @@ void VisuGUI_ScalarBarPane::updatePreview()
  */
 void VisuGUI_ScalarBarPane::createScalarBar()
 {
-  if (VISU::GetViewWindow() == NULL) return;
+  if (VISU::GetActiveViewWindow<SVTK_ViewWindow>() == NULL) return;
   if (myPreviewActor != 0) return;
   if (myScalarMap == NULL) return;
 
-  if(!check()) return;
+  if (!check()) return;
 
   if ( myBusy ) return;
 
@@ -737,7 +735,7 @@ void VisuGUI_ScalarBarPane::createScalarBar()
 
   aScalarBarActor->Modified();
 
-  VISU::GetViewWindow()->AddActor(myPreviewActor);
+  VISU::GetActiveViewWindow<SVTK_ViewWindow>()->AddActor(myPreviewActor);
 
   myBusy = false;
 }
@@ -748,7 +746,7 @@ void VisuGUI_ScalarBarPane::deleteScalarBar()
   if ( myBusy ) return;
   
   if (myPreviewActor == 0) return;
-  if (SVTK_ViewWindow* vf = VISU::GetViewWindow()){
+  if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()){
     vf->RemoveActor(myPreviewActor);
     myPreviewActor->GetScalarBar()->VisibilityOff();
   }
@@ -1045,7 +1043,7 @@ void VisuGUI_ScalarBarPane::onTextPref()
 
 void VisuGUI_ScalarBarPane::onPreviewCheck (bool thePreview)
 {
-  if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+  if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
     if (thePreview) {
       createScalarBar();
     } else {
index 5bcf465face56786563e21be085f1cefb845ce6a..371d50a50bf7f028d303132b8cf7b5e644beb78e 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
 
 #include "VISU_Actor.h"
 #include "VISU_PrsObject_i.hh"
@@ -49,7 +50,6 @@
 #include "SALOME_ListIteratorOfListIO.hxx"
 
 #include "SVTK_ViewWindow.h"
-#include "SVTK_ViewModel.h"
 #include "SVTK_Selector.h"
 
 #include "utilities.h"
@@ -263,7 +263,7 @@ VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (const SalomeApp_Module* theModule):
 
   // Activate Points pane
   myWidgetStack->raiseWidget(myPointsPane);
-  if(SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule))
+  if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule))
     aViewWindow->SetSelectionMode(NodeSelection);
   onSelectionEvent();
 
@@ -276,7 +276,7 @@ VisuGUI_SelectionDlg::~VisuGUI_SelectionDlg()
 
 void VisuGUI_SelectionDlg::onSelectionChange (int theId)
 {
-  SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule);
+  SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule);
   if (!aViewWindow) return;
 
   switch (theId) {
@@ -300,11 +300,10 @@ void VisuGUI_SelectionDlg::onSelectionChange (int theId)
 
 void VisuGUI_SelectionDlg::closeEvent (QCloseEvent* theEvent)
 {
-  if( mySelectionDlg )
-  {
+  if (mySelectionDlg) {
     mySelectionDlg = NULL;
     disconnect(mySelectionMgr,0,0,0);
-    if(SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule)){
+    if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule)) {
       switch(aViewWindow->SelectionMode()){
       case NodeSelection:
       case CellSelection:
@@ -337,10 +336,10 @@ template<class TData> QString getVector(TData* theData, int theId){
 #define ABS(a) (a>=0)?a:-a
 
 void VisuGUI_SelectionDlg::onSelectionEvent() {
-  SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule);
+  SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule);
   if (!aViewWindow) return;
 
-  switch(aViewWindow->SelectionMode()){
+  switch (aViewWindow->SelectionMode()) {
   case NodeSelection:
   case CellSelection:
   case ActorSelection:
@@ -538,7 +537,7 @@ bool onIdEdit (const QString& theText,
                QLabel* theFieldName)
 {
   SalomeApp_Application* anApp = theModule->getApp();
-  SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(theModule);
+  SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(theModule);
   if (!aViewWindow) return false;
   SVTK_Selector* aSelector = aViewWindow->GetSelector();
 
index 213b1ca32a579ead96b4834a4c6876e2256eef79..acec9415765f2173c32e4daea62446412a8e0b47 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
 #include "VisuGUI_DeformedShapeDlg.h"
 #include "VisuGUI_CutPlanesDlg.h"
 #include "VisuGUI_CutLinesDlg.h"
 #define  MAXVAL 1e10
 
 ArrangeDlg::ArrangeDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator)
-  : QDialog(theParent, "ArrangeDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
-    myAnimator(theAnimator), myViewWindow(theAnimator->getViewer())
+  : QDialog(theParent, "ArrangeDlg", true,
+            WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
+    myAnimator(theAnimator),
+    myViewWindow(theAnimator->getViewer())
 {
   myCurrent = 0;
   init();
@@ -970,7 +973,7 @@ VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule, _PTR(Stu
 
   myAnimator = new VISU_TimeAnimation (theStudy);
   myAnimator->setSpeed(1);
-  myAnimator->setViewer(VISU::GetViewWindow(theModule));
+  myAnimator->setViewer(VISU::GetActiveViewWindow<SVTK_ViewWindow>(theModule));
   connect(myAnimator, SIGNAL(frameChanged(long, double)), this, SLOT(onExecution(long, double)));
   connect(myAnimator, SIGNAL(stopped()),                 this, SLOT(onStop()));
 
index 978a4c24f0c010ad7cf0e2e503b9de443cd9308c..90f7dc2ccc3a0ddd6bb559893b723b687071daa4 100644 (file)
@@ -28,6 +28,9 @@
 
 #include "VisuGUI_Tools.h"
 
+#include "VisuGUI.h"
+#include "VisuGUI_ViewTools.h"
+
 #include "VISU_Gen_i.hh"
 #include "VISU_Prs3d_i.hh"
 #include "VISU_Result_i.hh"
 #include "SalomeApp_Study.h"
 #include "SalomeApp_Application.h"
 
-#include "OB_Browser.h"
 #include "LightApp_DataObject.h"
 #include "LightApp_SelectionMgr.h"
 
+#include "OB_Browser.h"
+
 #include "SALOME_ListIO.hxx"
 #include "SALOME_ListIteratorOfListIO.hxx"
 
 #include "SVTK_ViewWindow.h"
-#include "SVTK_ViewModel.h"
 #include "SVTK_Functor.h"
 
 #include "VTKViewer_Algorithm.h"
@@ -61,8 +64,6 @@
 #include "SUIT_Session.h"
 #include "SUIT_MessageBox.h"
 
-#include "VisuGUI.h"
-
 #include <vtkRenderer.h>
 #include <vtkActorCollection.h>
 
@@ -421,49 +422,6 @@ namespace VISU
     return true;
   }
 
-  // Display/Erase
-
-  void
-  ErasePrs (const SalomeApp_Module* theModule,
-            CORBA::Object_ptr theObject, bool theUpdate)
-  {
-    if (!CORBA::is_nil(theObject)) {
-      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(aBase).in()))
-            PlotCurve(theModule, aCurve, VISU::eErase );
-          break;
-        }
-      case VISU::TCONTAINER:
-        {
-          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(aBase).in()))
-            PlotTable(theModule, aTable, VISU::eErase );
-          break;
-        }
-      default:
-        {
-          if (VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aBase).in())) {
-            ErasePrs3d(theModule, aPrsObject);
-            if (theUpdate) {
-              if (SVTK_ViewWindow* vw = GetViewWindow(theModule))
-                vw->Repaint();
-            }
-          }
-        }
-      } // switch (aType)
-    }
-  }
-
   void
   DeleteSObject(VisuGUI* theModule,
                _PTR(Study) theStudy,
@@ -472,16 +430,13 @@ namespace VISU
     _PTR(ChildIterator) aChildIter = theStudy->NewChildIterator(theSObject);
     for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
       _PTR(SObject) aChildSObject = aChildIter->Value();
-      
       CORBA::Object_var aChildObj = VISU::ClientSObjectToObject(aChildSObject);
-      RemoveScalarBarPosition(theModule,aChildObj);
-      ErasePrs(theModule, aChildObj);
+      ErasePrs(theModule, aChildObj, /*repaint_view_window = */false);
     }
 
     CORBA::Object_var anObj = VISU::ClientSObjectToObject(theSObject);
     if (!CORBA::is_nil(anObj)) {
-      RemoveScalarBarPosition(theModule,anObj);
-      ErasePrs(theModule, anObj);
+      ErasePrs(theModule, anObj, /*repaint_view_window = */true);
 
       VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(anObj);
       if (!CORBA::is_nil(aRemovableObject)) {
@@ -506,19 +461,10 @@ namespace VISU
     if (CheckLock(GetCStudy(GetAppStudy(theModule)),GetDesktop(theModule)))
       return;
 
-    RemoveScalarBarPosition(theModule,thePrs);
-    thePrs->RemoveFromStudy();
-  }
+    SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+    RemoveScalarBarPosition(theModule, vw, thePrs);
 
-  void
-  ErasePrs3d(const SalomeApp_Module* theModule,
-             VISU::Prs3d_i* thePrs)
-  {
-    if ( SVTK_ViewWindow* vw = GetViewWindow( theModule ) ){
-      if (VISU_Actor* anVISUActor = FindActor( vw, thePrs )) {
-        anVISUActor->VisibilityOff();
-      }
-    }
+    thePrs->RemoveFromStudy();
   }
 
   // Presentation management
@@ -527,8 +473,8 @@ namespace VISU
   ChangeRepresentation (const SalomeApp_Module* theModule,
                         VISU::PresentationType  theType)
   {
-    SVTK_ViewWindow* vw  = GetViewWindow( theModule, false );
-    if( !vw )
+    SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+    if (!vw)
       return;
 
     Handle(SALOME_InteractiveObject) anIO;
@@ -563,17 +509,15 @@ namespace VISU
       }
     }
   }
-  
+
   void
   SetShading ( const SalomeApp_Module* theModule,
              bool theOn )
   {
-    SUIT_ViewWindow* aView = GetActiveView(theModule, SVTK_Viewer::Type());
-    if (!aView) return;
-    SVTK_ViewWindow* vw  = dynamic_cast<SVTK_ViewWindow*>( aView );
-    if( !vw )
+    SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+    if (!vw)
       return;
-    
+
     Handle(SALOME_InteractiveObject) anIO;
     CORBA::Object_var anObject = GetSelectedObj(theModule, &anIO);
     if (CORBA::is_nil(anObject)) return;
@@ -654,167 +598,30 @@ namespace VISU
     return dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject).in());
   }
 
-  // Views
-
-  SUIT_ViewWindow* GetActiveView(const SalomeApp_Module* theModule, QString theType)
-  {
-    if(SalomeApp_Application* anApp = theModule->getApp()){
-      if(SUIT_ViewManager* aViewManager = anApp->activeViewManager()){
-        if (!theType.isNull()) {
-          if (aViewManager->getType() != theType)
-            return 0;
-        }
-        return aViewManager->getActiveView();
-      }
-    }
-    return 0;
-  }
-
   // VTK View
 
-  TViewWindows
-  GetViews(const SalomeApp_Module* theModule)
-  {
-    TViewWindows aViewWindows;
-    if(SalomeApp_Application* anApp = theModule->getApp()){
-      ViewManagerList aViewManagerList;
-      anApp->viewManagers(SVTK_Viewer::Type(),aViewManagerList);
-      QPtrListIterator<SUIT_ViewManager> anIter(aViewManagerList);
-      while(SUIT_ViewManager* aViewManager = anIter.current()){
-        QPtrVector<SUIT_ViewWindow> aViews = aViewManager->getViews();
-        for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
-          if(SUIT_ViewWindow* aViewWindow = aViews.at(i))
-            if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewWindow))
-              aViewWindows.push_back(aView);
-        }
-        ++anIter;
-      }
-    }
-    return aViewWindows;
-  }
-
-  SVTK_ViewWindow*
-  GetViewWindow( const SalomeApp_Module* theModule, const bool theCreate )
-  {
-    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 aViewManager ? dynamic_cast<SVTK_ViewWindow*>( aViewManager->getActiveView() ) : 0;
-      }
-    }
-    return NULL;
-  }
-
-  /*SVTK_ViewWindow*
-  GetViewWindow(const SalomeApp_Module* theModule, const bool theCreate )
-  {
-    if (SalomeApp_Application* anApp = theModule->getApp())
-    {
-      SVTK_ViewWindow* wnd = dynamic_cast<SVTK_ViewWindow*>(anApp->desktop()->activeWindow());
-      if( wnd )
-       return wnd;
-      else
-      {
-       if(SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), theCreate ))
-         return dynamic_cast<SVTK_ViewWindow*>( aViewManager->getActiveView() );
-      }
-    }
-    return NULL;
-  }*/
-
-
-  SVTK_ViewWindow*
-  GetViewWindow()
-  {
-    SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
-      (SUIT_Session::session()->activeApplication());
-    if (anApp) {
-      if (SUIT_ViewManager* aViewManager = anApp->activeViewManager()) {
-        if (aViewManager->getType() == SVTK_Viewer::Type()) {
-          if (SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()) {
-            return dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
-          }
-        }
-      }
-    }
-    return NULL;
-  }
-
   VISU_Actor*
-  PublishInView(const SalomeApp_Module* theModule,
-                VISU::Prs3d_i* thePrs)
+  PublishMeshInView(const SalomeApp_Module* theModule,
+                    VISU::Prs3d_i* thePrs,
+                    SVTK_ViewWindow* theViewWindow)
   {
     VISU_Actor* aActor = NULL;
-    if(!thePrs)
+    if (!thePrs || !theViewWindow)
       return aActor;
-    if(SVTK_ViewWindow* aView = GetViewWindow(theModule)){
-      QApplication::setOverrideCursor( Qt::waitCursor );
-      try{
-       if(aActor = thePrs->CreateActor())
-         aView->AddActor(aActor);
-      }catch(std::exception& exc){
-       SUIT_MessageBox::warn1
-          (GetDesktop(theModule), QObject::tr("WRN_VISU"),
-           QObject::tr("ERR_CANT_CREATE_ACTOR") + ": " + QObject::tr(exc.what()),
-           QObject::tr("BUT_OK"));
-      }
-      QApplication::restoreOverrideCursor();
-    }
-    return aActor;
-  }
 
-  VISU_Actor*
-  UpdateViewer(const SalomeApp_Module* theModule,
-               VISU::Prs3d_i* thePrs,
-               bool theDispOnly)
-  {
-    SVTK_ViewWindow* vw = GetViewWindow( theModule );
-    if (!vw) return NULL;
-
-    vtkRenderer *aRen = vw->getRenderer();
-    vtkActorCollection *anActColl = aRen->GetActors();
-    anActColl->InitTraversal();
-
-    vtkActor *anActor;
-    VISU_Actor* anVISUActor = NULL;
-    VISU_Actor* aResActor = NULL;
-    while(vtkActor *anActor = anActColl->GetNextActor()){
-      anVISUActor = VISU_Actor::SafeDownCast(anActor);
-      if(anVISUActor){
-        VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d();
-        if(aPrs == NULL) continue;
-        if (thePrs == aPrs) {
-          try {
-           aResActor = anVISUActor;
-            thePrs->UpdateActor(aResActor);
-            aResActor->VisibilityOn();
-          } catch (std::runtime_error& exc) {
-            aResActor->VisibilityOff();
-            INFOS(exc.what());
-            SUIT_MessageBox::warn1
-              (GetDesktop(theModule), QObject::tr("WRN_VISU"),
-               QObject::tr("ERR_CANT_CREATE_ACTOR") + ": " + QObject::tr(exc.what()),
-               QObject::tr("BUT_OK"));
-          }
-        } else if (theDispOnly) {
-          anVISUActor->VisibilityOff();
-        } else {
-        }
-      } else if (theDispOnly && anActor->GetVisibility()) {
-        anActor->VisibilityOff();
-      } else {
-      }
+    QApplication::setOverrideCursor( Qt::waitCursor );
+    try {
+      if (aActor = thePrs->CreateActor())
+        theViewWindow->AddActor(aActor);
+    } catch(std::exception& exc) {
+      SUIT_MessageBox::warn1
+        (GetDesktop(theModule), QObject::tr("WRN_VISU"),
+         QObject::tr("ERR_CANT_CREATE_ACTOR") + ": " + QObject::tr(exc.what()),
+         QObject::tr("BUT_OK"));
     }
-    if (aResActor)
-      return aResActor;
+    QApplication::restoreOverrideCursor();
 
-    //anVISUActor = PublishInView( theModule, thePrs );
-    return anVISUActor;
+    return aActor;
   }
 
   void
@@ -1196,7 +1003,8 @@ namespace VISU
   // Others
 
   void CreateMesh (const SalomeApp_Module* theModule,
-                    const Handle(SALOME_InteractiveObject)& theIO)
+                   const Handle(SALOME_InteractiveObject)& theIO,
+                   SVTK_ViewWindow* theViewWindow)
   {
     _PTR(Study) aStudy = GetCStudy(GetAppStudy(theModule));
     //if (CheckLock(aStudy))
@@ -1243,7 +1051,7 @@ namespace VISU
     timer.Show();
 #endif
 
-    QApplication::restoreOverrideCursor();
+    //QApplication::restoreOverrideCursor();
     VISU::Mesh_i* pPresent = NULL;
     if (!CORBA::is_nil(aMesh))
       pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
@@ -1255,23 +1063,19 @@ namespace VISU
       return;
     }
 
-    if (SVTK_ViewWindow* aView = GetViewWindow(theModule)) {
+    if (theViewWindow) {
       try {
 #ifdef CHECKTIME
         Utils_Timer timer;
         timer.Start();
 #endif
-        PublishInView(theModule, pPresent);
-        //aView->onFitAll();
-        SetFitAll(aView);
+        PublishMeshInView(theModule, pPresent, theViewWindow);
+        SetFitAll(theViewWindow);
 #ifdef CHECKTIME
         timer.Stop();
         MESSAGE("VisuGUI::CreateMesh() - DISPLAY MESH");
         timer.Show();
 #endif
-        theModule->application()->putInfo(QObject::tr("INF_DONE"));
-        // Make "Save" button active
-        theModule->getApp()->updateActions();
       } catch (std::runtime_error& exc) {
         INFOS(exc.what());
         SUIT_MessageBox::warn1
@@ -1280,6 +1084,10 @@ namespace VISU
            QObject::tr("BUT_OK"));
       }
     }
+
+    theModule->application()->putInfo(QObject::tr("INF_DONE"));
+    // Make "Save" button active
+    theModule->getApp()->updateActions();
   }
 
   // ========================================================================================
@@ -1411,58 +1219,45 @@ namespace VISU
     }
     return aList;
   }
-  
-  int GetFreePositionOfDefaultScalarBar(VisuGUI* theModule){
+
+  int GetFreePositionOfDefaultScalarBar(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow)
+  {
     int minIndx = 1;
     std::set<int> aIndexes;
-    SVTK_ViewWindow* vw = GetViewWindow(theModule);
     TViewToPrs3d aMap = theModule->getScalarBarsMap();
-    TViewToPrs3d::const_iterator aViewToPrsIter = aMap.find(vw);
-    if (aViewToPrsIter != aMap.end()){
+    TViewToPrs3d::const_iterator aViewToPrsIter = aMap.find(theViewWindow);
+    if (aViewToPrsIter != aMap.end()) {
       TSetPrs3d::const_iterator aPrsIter = (aViewToPrsIter->second).begin();
-      for(;aPrsIter!=(aViewToPrsIter->second).end();aPrsIter++){
+      for (; aPrsIter != (aViewToPrsIter->second).end(); aPrsIter++) {
        aIndexes.insert((*aPrsIter).second);
       }
     }
     std::set<int>::const_iterator aIter = aIndexes.begin();
-    for (int i=1,length=aIndexes.size(); i <= length; i++){
+    for (int i = 1,length = aIndexes.size(); i <= length; i++) {
       std::set<int>::const_iterator aIter = aIndexes.find(i);
-      if(aIter==aIndexes.end()){minIndx = i;break;
+      if (aIter == aIndexes.end()) { minIndx = i; break; 
       else minIndx = i + 1;
-      
     }
     return minIndx;
   }
-  
-  void AddScalarBarPosition(VisuGUI* theModule,VISU::Prs3d_i* thePrs3d, int pos){
-    SVTK_ViewWindow* vw = GetViewWindow(theModule);
+
+  void AddScalarBarPosition (VisuGUI* theModule, SVTK_ViewWindow* theViewWindow,
+                             VISU::Prs3d_i* thePrs3d, int pos)
+  {
     TViewToPrs3d& aMap = theModule->myScalarBarsMap;
-    TPrs3dToInd aPair; aPair.first=thePrs3d; aPair.second=pos;
-    aMap[vw].insert(aPair);
+    TPrs3dToInd aPair; aPair.first = thePrs3d; aPair.second = pos;
+    aMap[theViewWindow].insert(aPair);
   }
-  
-  void RemoveScalarBarPosition(VisuGUI* theModule,SVTK_ViewWindow* vw,VISU::Prs3d_i* thePrs3d){
+
+  void RemoveScalarBarPosition(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow,
+                               VISU::Prs3d_i* thePrs3d)
+  {
     TViewToPrs3d& aMap = theModule->myScalarBarsMap;
-    TSetPrs3d::iterator aIter = aMap[vw].begin();
-    for(;aIter!=aMap[vw].end();aIter++)
-      if((*aIter).first == thePrs3d){
-       aMap[vw].erase(*aIter);
+    TSetPrs3d::iterator aIter = aMap[theViewWindow].begin();
+    for (; aIter != aMap[theViewWindow].end(); aIter++)
+      if ((*aIter).first == thePrs3d) {
+       aMap[theViewWindow].erase(*aIter);
        return;
       }
   }
-
-  void RemoveScalarBarPosition(VisuGUI* theModule,VISU::Prs3d_i* thePrs3d){
-    SVTK_ViewWindow* vw = GetViewWindow(theModule);
-    RemoveScalarBarPosition(theModule,vw,thePrs3d);
-  }
-  
-  void RemoveScalarBarPosition(VisuGUI* theModule,CORBA::Object_ptr theObject){
-    if (!CORBA::is_nil(theObject)) {
-      Base_var aBase = Base::_narrow(theObject);
-      if (CORBA::is_nil(aBase)) return;
-      if (VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aBase).in())){
-       RemoveScalarBarPosition(theModule,aPrsObject);
-      }
-    }
-  }
 }
index d514b4b3a223fe691bcfc90bbf20f8767653b46c..af166ad68d056b883c06d9573279d5464e73f077 100644 (file)
@@ -98,18 +98,12 @@ namespace VISU {
 
   bool                                 IsRemovableSelected(const SalomeApp_Module* theModule);
 
-  // Display/Erase
-  void                                 ErasePrs(const SalomeApp_Module* theModule,
-                                               CORBA::Object_ptr theObject,
-                                               bool theUpdate = true);
   void                                 DeleteSObject(VisuGUI* theModule,
                                                     _PTR(Study)       theStudy,
                                                     _PTR(SObject)     theSObject);
   void                                 DeletePrs3d(VisuGUI* theModule,
                                                   VISU::Prs3d_i* thePrs,
                                                   const Handle(SALOME_InteractiveObject)& theIO);
-  void                                 ErasePrs3d(const SalomeApp_Module* theModule,
-                                                 VISU::Prs3d_i* thePrs);
 
   // Presentation management
   void ChangeRepresentation (const SalomeApp_Module* theModule,
@@ -126,21 +120,11 @@ namespace VISU {
                                                   VISU::Result_var& theResult);
   bool                                 IsSObjectTable(_PTR(SObject) theSObject);
 
-  // Views
-  SUIT_ViewWindow*                     GetActiveView(const SalomeApp_Module* theModule,
-                                                    QString theType = QString::null);
-
-  // VTK View
-  TViewWindows                         GetViews(const SalomeApp_Module* theModule);
-  SVTK_ViewWindow*                     GetViewWindow(const SalomeApp_Module* theModule,
-                                                    const bool theCreate = false );
-  SVTK_ViewWindow*                     GetViewWindow();
-
-  VISU_Actor*                          PublishInView(const SalomeApp_Module* theModule,
-                                                    VISU::Prs3d_i* thePrs);
-  VISU_Actor*                          UpdateViewer(const SalomeApp_Module* theModule,
-                                                   VISU::Prs3d_i* thePrs,
-                                                   bool theDispOnly = false);
+  /*! Display mesh presentation in given VTK view window
+   */
+  VISU_Actor*                          PublishMeshInView(const SalomeApp_Module* theModule,
+                                                        VISU::Prs3d_i* thePrs,
+                                                        SVTK_ViewWindow* theViewWindow);
 
   /*!
    * \brief Repaint all SVTK view windows, where the given object is displayed.
@@ -183,26 +167,32 @@ namespace VISU {
   void                                 CreatePlot( SalomeApp_Module* theModule,
                                                   _PTR(SObject) theSobj );
 
+  /*! Display/Erase/Update a curve presentation.
+   *  Parameter \a frame may be NULL, in this case there is only update without display/erase
+   */
   void                                 UpdateCurve( VISU::Curve_i*,
                                                    Plot2d_ViewFrame* frame,
                                                    SPlot2d_Curve*,
                                                    int theDisplaying );
-  //parameter frame may be 0, in this case there is only update without display/erase 
 
-  // Others
+  /*! Create mesh presentation and display it in \a theViewWindow.
+   *  If \a theViewWindow is NULL, no displaying will be done.
+   */
   void CreateMesh (const SalomeApp_Module* theModule,
-                  const Handle(SALOME_InteractiveObject)& theIO);
+                  const Handle(SALOME_InteractiveObject)& theIO,
+                  SVTK_ViewWindow* theViewWindow = NULL);
 
+  // Others
   std::vector<VISU::Prs3d_i*> GetPrs3dList (const SalomeApp_Module* theModule,
                                            const Handle(SALOME_InteractiveObject)& theIO);
   std::vector<VISU::Prs3d_i*> GetPrs3dList (const SalomeApp_Module* theModule,
                                            _PTR(SObject) theObject);
   
-  int GetFreePositionOfDefaultScalarBar(VisuGUI* theModule);
-  void AddScalarBarPosition(VisuGUI* theModule,VISU::Prs3d_i* thePrs3d, int pos);
-  void RemoveScalarBarPosition(VisuGUI* theModule,VISU::Prs3d_i* thePrs3d);
-  void RemoveScalarBarPosition(VisuGUI* theModule,SVTK_ViewWindow* vw,VISU::Prs3d_i* thePrs3d);
-  void RemoveScalarBarPosition(VisuGUI* theModule,CORBA::Object_ptr theObject);
+  int GetFreePositionOfDefaultScalarBar(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow);
+  void AddScalarBarPosition(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow,
+                           VISU::Prs3d_i* thePrs3d, int pos);
+  void RemoveScalarBarPosition(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow,
+                              VISU::Prs3d_i* thePrs3d);
 }
 
 #endif
index bf893f5045fb1cc1b37c1b7e777bc6c3d1161858..b9556c4c2a05a52da0cfd3d716c537b6f7019036 100644 (file)
@@ -66,7 +66,7 @@ VisuGUI_TransparencyDlg::VisuGUI_TransparencyDlg( VisuGUI* theModule,
      : QDialog( VISU::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
                 WStyle_Title | WStyle_SysMenu | WDestructiveClose ),
      mySelectionMgr( VISU::GetSelectionMgr( theModule ) ),
-     myViewWindow( VISU::GetViewWindow( theModule ) )
+     myViewWindow( VISU::GetActiveViewWindow<SVTK_ViewWindow>(theModule) )
 {
   if (!name)
     setName("VisuGUI_TransparencyDlg");
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)
   }
index f10bf63e9a5ee9e442e82c94967aa191dd359286..bb28861a977638c2bca62288146376f408b06e1d 100644 (file)
 
 #include "VisuGUI.h"
 
-#include "SUIT_MessageBox.h"
-#include "SUIT_ViewManager.h"
-#include "SUIT_ViewWindow.h"
+#include "VisuGUI_Tools.h"
+
+#include "VISU_Prs3d_i.hh"
+#include "VISU_Table_i.hh"
+#include "VISU_ViewManager_i.hh"
+
+#include "VISU_Actor.h"
 
 #include "SalomeApp_Module.h"
 #include "SalomeApp_Application.h"
 
-#include "VISU_Prs3d_i.hh"
-
 #include "VVTK_ViewModel.h"
 #include "VVTK_ViewWindow.h"
 
+#include "SVTK_Functor.h"
 #include "SVTK_ViewModel.h"
 #include "SVTK_ViewWindow.h"
 
-#include "VisuGUI_Tools.h"
+#include "SPlot2d_ViewModel.h"
+
 #include "VTKViewer_Algorithm.h"
-#include "SVTK_Functor.h"
 
-#include "VISU_Table_i.hh"
-#include "VISU_ViewManager_i.hh"
+#include "SUIT_Session.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_ViewManager.h"
+#include "SUIT_ViewWindow.h"
+
 #include "SALOME_ListIO.hxx"
 #include "SALOME_ListIteratorOfListIO.hxx"
 
-#include "SPlot2d_ViewModel.h"
-
-#include "VISU_Actor.h"
-
 #include <vtkActorCollection.h>
 #include <vtkRenderer.h>
 
@@ -65,17 +67,26 @@ class VVTK_Viewer;
 
 namespace VISU 
 {
-  //---------------------------------------------------------------
+  /*! Return active view window, if it instantiates TViewer::TViewWindow class,
+   *  overwise find or create corresponding view window, make it active and return it.
+   *  \note Active VVTK_ViewWindow can be returned by request GetViewWindow<SVTK_Viewer>(),
+   *        because VVTK_ViewWindow inherits SVTK_ViewWindow.
+   */
   template<class TViewer>
   inline
   typename TViewer::TViewWindow*
-  GetViewWindow(VisuGUI* theModule, 
-               const bool theIsViewCreate = false)
+  GetViewWindow(VisuGUI* theModule)
   {
-    typedef typename TViewer::TViewWindow TView;
-    if(SUIT_ViewManager* aViewManager = theModule->getViewManager(TViewer::Type(),theIsViewCreate)){
-      if(SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()){
-       if(TView* aView = dynamic_cast<TView*>(aViewWindow)){
+    typedef typename TViewer::TViewWindow TViewWindow;
+    if (SalomeApp_Application* anApp = theModule->getApp()) {
+      if (TViewWindow* aView = dynamic_cast<TViewWindow*>(anApp->desktop()->activeWindow()))
+       return aView;
+    }
+    SUIT_ViewManager* aViewManager =
+      theModule->getViewManager(TViewer::Type(), /*create = */true);
+    if (aViewManager) {
+      if (SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()) {
+       if (TViewWindow* aView = dynamic_cast<TViewWindow*>(aViewWindow)) {
          aViewWindow->raise();
          aViewWindow->setFocus();
          return aView;
@@ -85,30 +96,54 @@ namespace VISU
     return NULL;
   }
 
+  /*! Return active view window, if it instantiates TViewWindow class, overwise return NULL.
+   *  \note Active VVTK_ViewWindow can be returned by request GetActiveViewWindow<SVTK_ViewWindow>(),
+   *        because VVTK_ViewWindow inherits SVTK_ViewWindow.
+   */
+  template<class TViewWindow>
+  inline
+  TViewWindow*
+  GetActiveViewWindow(const SalomeApp_Module* theModule = NULL)
+  {
+    SalomeApp_Application* anApp = NULL;
+    if (theModule)
+      anApp = theModule->getApp();
+    else
+      anApp = dynamic_cast<SalomeApp_Application*>
+       (SUIT_Session::session()->activeApplication());
+
+    if (anApp)
+      if (SUIT_ViewManager* aViewManager = anApp->activeViewManager())
+       if (SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView())
+         return dynamic_cast<TViewWindow*>(aViewWindow);
+
+    return NULL;
+  }
+
 
   //---------------------------------------------------------------
-  template<class TViewer>
   inline
   VISU_Actor*
   PublishInView(VisuGUI* theModule,
                 Prs3d_i* thePrs,
-               const bool theIsHighlight = false,
-               const bool theIsCreateView = false)
+               SVTK_ViewWindow* theViewWindow,
+               const bool theIsHighlight = false)
   {
-    typedef typename TViewer::TViewWindow TView;
-    if(TView* aView = GetViewWindow<TViewer>(theModule,theIsCreateView)){
+    if (theViewWindow) {
       QApplication::setOverrideCursor( Qt::waitCursor );
       try {
-       if(VISU_Actor* anActor = thePrs->CreateActor()){
-         aView->AddActor(anActor);
-         if(theIsHighlight)
-           aView->highlight(anActor->getIO(),true);
-         aView->getRenderer()->ResetCameraClippingRange();
-         aView->Repaint();
+       if (VISU_Actor* anActor = thePrs->CreateActor()) {
+         theViewWindow->AddActor(anActor);
+         if (theIsHighlight)
+           theViewWindow->highlight(anActor->getIO(),true);
+         theViewWindow->getRenderer()->ResetCameraClippingRange();
+         theViewWindow->Repaint();
          QApplication::restoreOverrideCursor();
          return anActor;
        }
       } catch(std::exception& exc) {
+       thePrs->RemoveActors();
+
        QApplication::restoreOverrideCursor();
        INFOS(exc.what());
        SUIT_MessageBox::warn1
@@ -122,56 +157,53 @@ namespace VISU
 
 
   //---------------------------------------------------------------
-  template<class TViewer>
   inline
   VISU_Actor*
   UpdateViewer(VisuGUI* theModule,
                VISU::Prs3d_i* thePrs,
                bool theDispOnly = false,
-              const bool theIsHighlight = false,
-              const bool theIsViewCreate = false)
+              const bool theIsHighlight = false)
   {
-    typedef typename TViewer::TViewWindow TView;
-    if(TView* aView = GetViewWindow<TViewer>(theModule,theIsViewCreate)){
-      vtkRenderer *aRen = aView->getRenderer();
+    if (SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule)) {
+      vtkRenderer *aRen = aViewWindow->getRenderer();
       vtkActorCollection *anActColl = aRen->GetActors();
       anActColl->InitTraversal();
       VISU_Actor* aResActor = NULL;
-      while(vtkActor *anAct = anActColl->GetNextActor()){
-       if(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anAct)){
-         if(VISU::Prs3d_i* aPrs3d = anActor->GetPrs3d()){
-           if(thePrs == aPrs3d){
+      bool isOk = true;
+      while (vtkActor *anAct = anActColl->GetNextActor()) {
+       if (VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anAct)) {
+         if (VISU::Prs3d_i* aPrs3d = anActor->GetPrs3d()) {
+           if (thePrs == aPrs3d) {
              try {
+               aResActor = anActor;
                thePrs->UpdateActors();
+               aResActor->VisibilityOn();
              } catch (std::runtime_error& exc) {
+               thePrs->RemoveActors();
+               isOk = false;
+
                INFOS(exc.what());
-               QApplication::restoreOverrideCursor();
                SUIT_MessageBox::warn1
                  (GetDesktop(theModule), QObject::tr("WRN_VISU"),
                   QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(exc.what()),
                   QObject::tr("BUT_OK"));
-
-               thePrs->RemoveActors();
-               return NULL;
              }
-             aResActor = anActor;
-             aResActor->VisibilityOn();
-           }else if(theDispOnly){
+           } else if (theDispOnly) {
              anActor->VisibilityOff();
            }
-         }else if(theDispOnly && anActor->GetVisibility()){
+         } else if (theDispOnly && anActor->GetVisibility()) {
            anActor->VisibilityOff();
          }
        }
       }
-      if(aResActor){
-       if(theIsHighlight)
-         aView->highlight(aResActor->getIO(),true);
-       aView->getRenderer()->ResetCameraClippingRange();
-       aView->Repaint();
+      if (aResActor) {
+       if (theIsHighlight && isOk)
+         aViewWindow->highlight(aResActor->getIO(), true);
+       aViewWindow->getRenderer()->ResetCameraClippingRange();
+       aViewWindow->Repaint();
        return aResActor;
       }
-      return PublishInView<TViewer>(theModule,thePrs,theIsHighlight,theIsViewCreate);
+      return PublishInView(theModule, thePrs, aViewWindow, theIsHighlight);
     }
     return NULL;
   }
@@ -184,14 +216,14 @@ namespace VISU
   OnEraseAll(VisuGUI* theModule)
   {
     typedef typename TViewer::TViewWindow TViewWindow;
-    if(TViewWindow* aViewWindow = GetViewWindow<TViewer>(theModule)){
+    if (TViewWindow* aViewWindow = GetActiveViewWindow<TViewWindow>(theModule)) {
       aViewWindow->unHighlightAll();
-      if(vtkRenderer *aRen = aViewWindow->getRenderer()){
+      if (vtkRenderer *aRen = aViewWindow->getRenderer()) {
        vtkActorCollection *aCollection = aRen->GetActors();
        aCollection->InitTraversal();
-       while(vtkActor *anAct = aCollection->GetNextActor()){
-         if(anAct->GetVisibility() > 0)
-           if(SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(anAct)){
+       while (vtkActor *anAct = aCollection->GetNextActor()) {
+         if (anAct->GetVisibility() > 0)
+           if (SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(anAct)) {
              anActor->VisibilityOff();
            }
        }
@@ -199,57 +231,37 @@ namespace VISU
       }
     }
   }
-  
+
   template<>
   inline
   void
   OnEraseAll<SPlot2d_Viewer>(VisuGUI* theModule)
   {
-    if(SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(theModule,false))
+    if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(theModule, false))
       aPlot2d->EraseAll();
   }
 
 
   //---------------------------------------------------------------
-  template<class TVieweWindow>
-  inline
-  VISU_Actor*
-  FindActor(TVieweWindow* theViewWindow,
-            const char* theEntry)
-  {
-    using namespace SVTK;
-    if(vtkRenderer* aRenderer = theViewWindow->getRenderer()){
-      if(vtkActorCollection* aCollection = aRenderer->GetActors()){
-        if(VISU_Actor* anActor = Find<VISU_Actor>(aCollection,TIsSameEntry<VISU_Actor>(theEntry))){
-          return anActor;
-        }
-      }
-    }
-    return NULL;
-  }
-
-  template<class TViewer>
   inline
   void
   ErasePrs3d(VisuGUI* theModule,
              VISU::Prs3d_i* thePrs,
-            const bool thIsUpdate = true)
+            const bool theDoRepaintVW = true)
   {
-    typedef typename TViewer::TViewWindow TViewWindow;
-    if(TViewWindow* aViewWindow = GetViewWindow<TViewer>(theModule)){
-      if(VISU_Actor* anActor = FindActor(aViewWindow,thePrs)){
+    if (SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule)) {
+      if (VISU_Actor* anActor = FindActor(aViewWindow, thePrs)) {
         anActor->VisibilityOff();
-       if(thIsUpdate)
+       if (theDoRepaintVW)
          aViewWindow->Repaint();
       }
     }
   }
 
-
   void
   ErasePrs(VisuGUI* theModule,
-          VISU::Base_ptr theBase
-          bool thIsUpdate);
+          CORBA::Object_ptr theObject
+          bool theDoRepaintVW);
 }
 
 #endif
index 64bb0bb90bfec3c1aa23295cabfad5bb568bdf5b..1bdd88b8620cfb67340c3e95225f5072df705be1 100644 (file)
@@ -265,8 +265,8 @@ VISU::Prs3d_i
   }catch(std::bad_alloc& ex){
     throw std::runtime_error("CreateActor >> No enough memory");
     throw ex;
-  } catch(std::exception& ex){
-    throw ex;
+  } catch(std::exception&){
+    throw;
   }catch(...) {
     throw std::runtime_error("CreateActor >> unexpected exception was caught!!!");
   }
index c1db8093ddd405f3201c51f57c8751832da4c621..cf92735eefec9cdbb7c156931f7aed00850ebed3 100644 (file)
@@ -64,7 +64,7 @@ VISU_TimeAnimation::VISU_TimeAnimation (_PTR(Study) theStudy,
   if (!CORBA::is_nil(theView3D)) {
     VISU::View3D_i* pView = dynamic_cast<VISU::View3D_i*>(GetServant(theView3D).in());
     SUIT_ViewWindow* aVW = pView->GetViewWindow();
-    myView = VISU::GetViewWindow(aVW);
+    myView = dynamic_cast<SVTK_ViewWindow*>(aVW);
     connect( myView, SIGNAL( destroyed() ), this, SLOT( onViewDeleted() ) );
   }
 
index c86ac5d8cd41b7aa83fbb1c2ed9cf0794ddebd8d..7168bb996b9948d17c89a2a56e7e01e58b3b374e 100644 (file)
@@ -257,31 +257,29 @@ namespace VISU {
   //===========================================================================
   // VISU namespace functions
   //===========================================================================
-  SVTK_ViewWindow* GetViewWindow (SUIT_ViewWindow* theStudyFrame)
+  vtkRenderer* GetRenderer (SUIT_ViewWindow* theViewWindow)
   {
-    return dynamic_cast<SVTK_ViewWindow*>(theStudyFrame);
-  }
-
-  vtkRenderer* GetRenderer (SUIT_ViewWindow* theStudyFrame)
-  {
-    return GetViewWindow(theStudyFrame)->getRenderer();
+    if (SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(theViewWindow))
+      return vw->getRenderer();
+    return NULL;
   }
 
-  vtkCamera* GetCamera (SUIT_ViewWindow* theStudyFrame)
+  vtkCamera* GetCamera (SUIT_ViewWindow* theViewWindow)
   {
-    return GetRenderer(theStudyFrame)->GetActiveCamera();
+    return GetRenderer(theViewWindow)->GetActiveCamera();
   }
 
   void RepaintView (SUIT_ViewWindow* theViewWindow)
   {
-    SVTK_ViewWindow* vf = GetViewWindow(theViewWindow);
-    vf->getRenderer()->ResetCameraClippingRange();
-    vf->getRenderWindow()->Render();
+    if (SVTK_ViewWindow* vf = dynamic_cast<SVTK_ViewWindow*>(theViewWindow)) {
+      vf->getRenderer()->ResetCameraClippingRange();
+      vf->getRenderWindow()->Render();
+    }
   }
 
-  VISU_Actor* UpdateViewer (SUIT_ViewWindow* theStudyFrame, int theDisplaing, Prs3d_i* thePrs)
+  VISU_Actor* UpdateViewer (SUIT_ViewWindow* theViewWindow, int theDisplaing, Prs3d_i* thePrs)
   {
-    SVTK_ViewWindow* vf = GetViewWindow(theStudyFrame);
+    SVTK_ViewWindow* vf = dynamic_cast<SVTK_ViewWindow*>(theViewWindow);
     if (!vf) return NULL;
     if(MYDEBUG) MESSAGE("UpdateViewer - theDisplaing = "<<theDisplaing<<"; thePrs = "<<thePrs);
     vtkRenderer *aRen = vf->getRenderer();
@@ -306,7 +304,7 @@ namespace VISU {
       }
     }
     if (aResActor) {
-      RepaintView(theStudyFrame);
+      RepaintView(theViewWindow);
       return aResActor;
     }
     if(thePrs != NULL && theDisplaing < eErase){
@@ -321,7 +319,7 @@ namespace VISU {
        return NULL;
       }
     }
-    RepaintView(theStudyFrame);
+    RepaintView(theViewWindow);
     return anVISUActor;
   }
 
index 5fa7284a8925342d614716eee0cae3f00974ed4d..b87192801ea9ee5829e887a01446b95ffa489ebf 100644 (file)
@@ -64,14 +64,13 @@ namespace VISU {
     SalomeApp_Application *myApplication;
   };
 
-  SVTK_ViewWindow* GetViewWindow (SUIT_ViewWindow* theStudyFrame);
-  vtkRenderer*     GetRenderer   (SUIT_ViewWindow* theStudyFrame);
-  vtkCamera*       GetCamera     (SUIT_ViewWindow* theStudyFrame);
+  vtkRenderer*     GetRenderer   (SUIT_ViewWindow* theViewWindow);
+  vtkCamera*       GetCamera     (SUIT_ViewWindow* theViewWindow);
 
-  void RepaintView (SUIT_ViewWindow* theStudyFrame);
+  void RepaintView (SUIT_ViewWindow* theViewWindow);
 
   enum Displaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};
-  VISU_Actor* UpdateViewer (SUIT_ViewWindow* theStudyFrame, int theDisplaing, Prs3d_i* thePrs = NULL);
+  VISU_Actor* UpdateViewer (SUIT_ViewWindow* theViewWindow, int theDisplaing, Prs3d_i* thePrs = NULL);
   void UpdatePlot2d (Plot2d_ViewFrame *theView, int theDisplaying, Curve_i* theCurve);
 
   VISU_Actor* GetActor (VISU::Prs3d_i* thePrs, SVTK_ViewWindow* theViewWindow);
index 43224cd7a5f76e20ff75030ad128125699f7b9d0..57a37098107b80b087638d1b0536d23cd2899dfe 100644 (file)
@@ -1557,7 +1557,7 @@ namespace VISU {
       {}
       virtual void Execute()
       {
-       SVTK_ViewWindow* vf = VISU::GetViewWindow(myVW);
+       SVTK_ViewWindow* vf = dynamic_cast<SVTK_ViewWindow*>(myVW);
        vtkRenderer* Renderer = vf->getRenderer();
        vtkActorCollection* theActors = Renderer->GetActors();
        theActors->InitTraversal();
@@ -1786,7 +1786,7 @@ namespace VISU {
     Storable::DataToStream(theStr,"myParallelScale",GetParallelScale(theViewWindow));
 
     double aScaleFactor[3];
-    VISU::GetViewWindow(theViewWindow)->GetScale(aScaleFactor);
+    (dynamic_cast<SVTK_ViewWindow*>(theViewWindow))->GetScale(aScaleFactor);
     Storable::DataToStream(theStr,"myScaleFactor[0]",aScaleFactor[0]);
     Storable::DataToStream(theStr,"myScaleFactor[1]",aScaleFactor[1]);
     Storable::DataToStream(theStr,"myScaleFactor[2]",aScaleFactor[2]);
@@ -1841,7 +1841,7 @@ namespace VISU {
     aColor[1] = int(255.0*theColor.G);
     aColor[2] = int(255.0*theColor.B);
     QColor aNewColor (aColor[0],aColor[1],aColor[2]);
-    VISU::GetViewWindow(theViewWindow)->setBackgroundColor(aNewColor);
+    (dynamic_cast<SVTK_ViewWindow*>(theViewWindow))->setBackgroundColor(aNewColor);
   }
 
   SALOMEDS::Color View3D_i::GetBackground (SUIT_ViewWindow* theViewWindow)
@@ -1922,7 +1922,7 @@ namespace VISU {
     SUIT_ViewWindow* aVW = GetViewWindow();
     if (aVW) {
       ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
-                      (VISU::GetViewWindow(aVW), &SVTK_ViewWindow::onFitAll));
+                      (dynamic_cast<SVTK_ViewWindow*>(aVW), &SVTK_ViewWindow::onFitAll));
       Update();
     }
   }
@@ -1936,27 +1936,27 @@ namespace VISU {
     switch (theType) {
     case VISU::View3D::FRONT :
       ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
-                      (VISU::GetViewWindow(aVW), &SVTK_ViewWindow::onFrontView));
+                      (dynamic_cast<SVTK_ViewWindow*>(aVW), &SVTK_ViewWindow::onFrontView));
       break;
     case VISU::View3D::BACK :
       ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
-                      (VISU::GetViewWindow(aVW), &SVTK_ViewWindow::onBackView));
+                      (dynamic_cast<SVTK_ViewWindow*>(aVW), &SVTK_ViewWindow::onBackView));
       break;
     case VISU::View3D::LEFT :
       ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
-                      (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onLeftView));
+                      (dynamic_cast<SVTK_ViewWindow*>(aVW),&SVTK_ViewWindow::onLeftView));
       break;
     case VISU::View3D::RIGHT :
       ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
-                      (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onRightView));
+                      (dynamic_cast<SVTK_ViewWindow*>(aVW),&SVTK_ViewWindow::onRightView));
       break;
     case VISU::View3D::TOP :
       ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
-                      (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onTopView));
+                      (dynamic_cast<SVTK_ViewWindow*>(aVW),&SVTK_ViewWindow::onTopView));
       break;
     case VISU::View3D::BOTTOM :
       ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
-                      (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onBottomView));
+                      (dynamic_cast<SVTK_ViewWindow*>(aVW),&SVTK_ViewWindow::onBottomView));
       break;
     }
     Update();
@@ -2126,7 +2126,7 @@ namespace VISU {
   void View3D_i::ScaleView (SUIT_ViewWindow* theViewWindow,
                            VISU::View3D::Axis theAxis, CORBA::Double theParam)
   {
-    SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(theViewWindow);
+    SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(theViewWindow);
     double aScaleFactor[3];
     aViewWindow->GetScale(aScaleFactor);
     aScaleFactor[theAxis] = theParam;
@@ -2136,7 +2136,7 @@ namespace VISU {
   void SetScaleView (SUIT_ViewWindow* theViewWindow, const CORBA::Double theScale[3])
   {
     double aScale[3] = {theScale[0], theScale[1], theScale[2]};
-    VISU::GetViewWindow(theViewWindow)->SetScale(aScale);
+    (dynamic_cast<SVTK_ViewWindow*>(theViewWindow))->SetScale(aScale);
   }
 
   void View3D_i::ScaleView(VISU::View3D::Axis theAxis, CORBA::Double theParam)
@@ -2145,7 +2145,7 @@ namespace VISU {
     SUIT_ViewWindow* aVW = GetViewWindow();
     if (aVW) {
       double aScale[3];
-      VISU::GetViewWindow(aVW)->GetScale(aScale);
+      (dynamic_cast<SVTK_ViewWindow*>(aVW))->GetScale(aScale);
       aScale[theAxis] = theParam;
       ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,aVW,aScale));
     }
index e37788166805c9682d024b21562287cde436e73c..5fcc06f9e6c752c474588739f2087c2a97e04c51 100644 (file)
-#include <qpopupmenu.h>
-#include <qcolordialog.h>
-
 #include "VVTK_ViewModel.h"
-#include "VVTK_ViewWindow.h"
-
-#include "SVTK_View.h"
-#include "SVTK_MainWindow.h"
-#include "SVTK_RenderWindowInteractor.h"
 
-#include "VTKViewer_ViewModel.h"
+#include "VVTK_ViewWindow.h"
 
-//==========================================================
-VVTK_Viewer
-::VVTK_Viewer()
+VVTK_Viewer::
+VVTK_Viewer()
 {
-  myTrihedronSize = 105;
 }
 
-VVTK_Viewer
-::~VVTK_Viewer() 
-{}
-
-
-//==========================================================
-void
-VVTK_Viewer
-::setViewManager(SUIT_ViewManager* theViewManager)
+VVTK_Viewer::
+~VVTK_Viewer() 
 {
-  SUIT_ViewModel::setViewManager(theViewManager);
-
-  if ( !theViewManager )
-    return;
-
-  connect(theViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), 
-          this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*)));
-  
-  connect(theViewManager, SIGNAL(mouseMove(SUIT_ViewWindow*, QMouseEvent*)), 
-          this, SLOT(onMouseMove(SUIT_ViewWindow*, QMouseEvent*)));
-  
-  connect(theViewManager, SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)), 
-          this, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*)));
 }
 
-
 //==========================================================
-SUIT_ViewWindow* 
-VVTK_Viewer
-::createView( SUIT_Desktop* theDesktop )
+SUIT_ViewWindow*
+VVTK_Viewer::
+createView( SUIT_Desktop* theDesktop )
 {
-  TViewWindow* aViewWindow = new TViewWindow(theDesktop);
+  TViewWindow* aViewWindow = new TViewWindow (theDesktop);
   aViewWindow->Initialize(this);
-    
+
   aViewWindow->setBackgroundColor( backgroundColor() );
   aViewWindow->SetTrihedronSize( trihedronSize() );
 
   return aViewWindow;
 }
-
-
-//==========================================================
-void
-VVTK_Viewer
-::contextMenuPopup( QPopupMenu* thePopup )
-{
-  thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) );
-  thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) );
-
-  thePopup->insertSeparator();
-
-  if(TViewWindow* aView = dynamic_cast<TViewWindow*>(myViewManager->getActiveView())){
-    if ( !aView->getMainWindow()->getToolBar()->isVisible() ){
-      thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) );
-    }
-  }
-}
-
-
-//==========================================================
-void 
-VVTK_Viewer
-::Repaint()
-{
-  QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
-  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
-    if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at(i))){
-      aView->getMainWindow()->Repaint();
-    }
-  }
-}
-
-
-//==========================================================
-bool
-VVTK_Viewer
-::isVisible( const Handle(SALOME_InteractiveObject)& io )
-{
-  QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
-  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)
-    if(SUIT_ViewWindow* aViewWindow = aViews.at(i))
-      if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViewWindow))
-       if(!aView->getView()->isVisible( io ))
-         return false;
-
-  return true;
-}
-
-
-//==========================================================
-void
-VVTK_Viewer
-::onMousePress(SUIT_ViewWindow* vw, QMouseEvent* event)
-{}
-
-void 
-VVTK_Viewer
-::onMouseMove(SUIT_ViewWindow* vw, QMouseEvent* event)
-{}
-
-void 
-VVTK_Viewer
-::onMouseRelease(SUIT_ViewWindow* vw, QMouseEvent* event)
-{}
-
-
-//==========================================================
-QColor
-VVTK_Viewer
-::backgroundColor() const
-{
-  return myBgColor;
-}
-
-void
-VVTK_Viewer
-::setBackgroundColor( const QColor& theColor )
-{
-  if ( !theColor.isValid() )
-    return;
-
-  QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
-  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
-    if(SUIT_ViewWindow* aViewWindow = aViews.at(i)){
-      if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViewWindow)){
-       aView->setBackgroundColor(theColor);
-      }
-    }
-  }
-
-  myBgColor = theColor;
-}
-
-//==========================================================
-int
-VVTK_Viewer
-::trihedronSize() const
-{
-  return myTrihedronSize;
-}
-
-void 
-VVTK_Viewer
-::setTrihedronSize( const int theSize )
-{
-  myTrihedronSize = theSize;
-  if(SUIT_ViewManager* aViewManager = getViewManager()){
-    QPtrVector<SUIT_ViewWindow> aViews = aViewManager->getViews();
-    for ( int i = 0; i < aViews.count(); i++ ){
-      if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i ))){
-       aView->getMainWindow()->SetTrihedronSize( theSize );
-      }
-    }
-  }
-}
-
-//==========================================================
-void 
-VVTK_Viewer
-::onDumpView()
-{
-  if(SUIT_ViewWindow* aView = myViewManager->getActiveView())
-    aView->onDumpView();
-}
-
-//==========================================================
-void
-VVTK_Viewer
-::onChangeBgColor()
-{
-  if(SUIT_ViewWindow* aView = myViewManager->getActiveView()){
-    QColor aColor = QColorDialog::getColor( backgroundColor(), aView);
-    setBackgroundColor(aColor);
-  }
-}
-
-//==========================================================
-void
-VVTK_Viewer
-::onShowToolbar() 
-{
-  QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
-  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
-    if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at(i))){
-      aView->getMainWindow()->getToolBar()->show();
-    }
-  }
-}
-
index 0846edcd0a3618c46bfb8597a30392ad6f6df0ab..5f343dc9cb7c86c55946c6f46ed786a3f61fafd0 100644 (file)
@@ -4,15 +4,12 @@
 #include <qcolor.h>
 
 #include "VVTK.h"
-#include "SVTK_ViewModelBase.h"
-
-#include "SALOME_Prs.h"
-#include "SALOME_InteractiveObject.hxx"
+#include "SVTK_ViewModel.h"
 
 class VVTK_ViewWindow;
 
-//! Extends two interfaces #SVTK_ViewModelBase and #SALOME_View 
-class VVTK_EXPORT VVTK_Viewer : public SVTK_ViewModelBase, public SALOME_View
+//! VVTK View Model
+class VVTK_EXPORT VVTK_Viewer : public SVTK_Viewer
 {
   Q_OBJECT;
 
@@ -23,48 +20,11 @@ public:
   VVTK_Viewer();
   virtual ~VVTK_Viewer();
 
-  //! Redefine SUIT_ViewModel::createView
+  //! See #SUIT_ViewModel::createView
   virtual SUIT_ViewWindow* createView(SUIT_Desktop*);
 
-  //! Redefine SUIT_ViewModel::setViewManager
-  virtual void setViewManager(SUIT_ViewManager* theViewManager);
-  //! Redefine SUIT_ViewModel::contextMenuPopup
-  virtual void contextMenuPopup( QPopupMenu* );
   //! See SUIT_ViewModel::getType
   virtual QString getType() const { return Type(); }
-
-  //! Redefine SALOME_View::Repaint
-  virtual void Repaint();
-
-  //! Redefine SALOME_View::isVisible
-  virtual bool isVisible( const Handle(SALOME_InteractiveObject)& );
-
-  //! Get background color of the viewer
-  QColor backgroundColor() const;
-
-  //! Set background color to the viewer
-  void   setBackgroundColor( const QColor& );
-
-  //! Get size of trihedron of the viewer (see SVTK_Renderer::SetTrihedronSize)
-  int    trihedronSize() const;
-
-  //! Set size of trihedron of the viewer (see SVTK_Renderer::SetTrihedronSize)
-  void   setTrihedronSize( const int );
-
-protected slots:
-  void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
-  void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
-  void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
-
-  void onDumpView();
-  void onShowToolbar();
-  void onChangeBgColor();
-
-private:
-  QColor myBgColor;
-  int    myTrihedronSize;
-  bool   mySelectionEnabled;
-  bool   myMultiSelectionEnabled;
 };
 
 #endif