From: apo Date: Wed, 9 Nov 2005 15:20:40 +0000 (+0000) Subject: To allow to display every VISU presentation into Gauss Viewer X-Git-Tag: BR-D5-38-2003_D2005-24-11~59 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=75c5d15261b555420a3fa5d7796ea791d7db176a;p=modules%2Fvisu.git To allow to display every VISU presentation into Gauss Viewer --- diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index def9b9fc..1b40603c 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -703,7 +703,7 @@ OnEditScalarMap() Handle(SALOME_InteractiveObject) anIO; if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ EditPrs3d(this, aPrs3d); - if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){ + if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){ aViewWindow->highlight(anIO, 1); } } @@ -717,7 +717,7 @@ OnEditDeformedShape() Handle(SALOME_InteractiveObject) anIO; if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ EditPrs3d(this, aPrs3d); - if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){ + if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){ aViewWindow->highlight(anIO, 1); } } @@ -731,7 +731,7 @@ OnEditCutPlanes() Handle(SALOME_InteractiveObject) anIO; if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ EditPrs3d(this, aPrs3d); - if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){ + if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){ aViewWindow->highlight(anIO, 1); } } @@ -745,7 +745,7 @@ OnEditCutLines() Handle(SALOME_InteractiveObject) anIO; if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ EditPrs3d(this, aPrs3d); - if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){ + if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){ aViewWindow->highlight(anIO, 1); } } @@ -759,7 +759,7 @@ OnEditIsoSurfaces() Handle(SALOME_InteractiveObject) anIO; if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ EditPrs3d(this, aPrs3d); - if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){ + if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){ aViewWindow->highlight(anIO, 1); } } @@ -773,7 +773,7 @@ OnEditVectors() Handle(SALOME_InteractiveObject) anIO; if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ EditPrs3d(this, aPrs3d); - if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){ + if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){ aViewWindow->highlight(anIO, 1); } } @@ -787,7 +787,7 @@ OnEditStreamLines() Handle(SALOME_InteractiveObject) anIO; if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ EditPrs3d(this, aPrs3d); - if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){ + if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){ aViewWindow->highlight(anIO, 1); } } @@ -801,7 +801,7 @@ OnEditPlot3D() Handle(SALOME_InteractiveObject) anIO; if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ EditPrs3d(this, aPrs3d); - if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){ + if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){ aViewWindow->highlight(anIO, 1); } } @@ -812,7 +812,7 @@ void VisuGUI:: OnEraseAll() { - if (SVTK_ViewWindow* vw = GetViewWindow()) { + if (SVTK_ViewWindow* vw = GetViewWindow(this)) { vw->unHighlightAll(); if (vtkRenderer *aRen = vw->getRenderer()) { vtkActor *anActor; @@ -885,7 +885,7 @@ OnChangeColor() VISU::Prs3d_i* aPrs3d = dynamic_cast(aServant.in()); if (!aPrs3d) return; - SVTK_ViewWindow* vw = GetViewWindow(); + SVTK_ViewWindow* vw = GetViewWindow(this); if (!vw) return; VISU_Actor* anActor = GetActor(aPrs3d, vw); @@ -957,7 +957,7 @@ OnChangeWireframeColor() VISU::Prs3d_i* aPrs3d = dynamic_cast(aServant.in()); if (!aPrs3d) return; - SVTK_ViewWindow* vw = GetViewWindow(); + SVTK_ViewWindow* vw = GetViewWindow(this); if (!vw) return; VISU_Actor* anActor = GetActor(aPrs3d, vw); @@ -992,7 +992,7 @@ OnChangeOpacity() VISU::Prs3d_i* aPrsObject = dynamic_cast(aServant.in()); if (!aPrsObject) return; - SVTK_ViewWindow* vw = GetViewWindow(); + SVTK_ViewWindow* vw = GetViewWindow(this); if (!vw) return; VISU_Actor* anActor = GetActor(aPrsObject, vw); @@ -1032,7 +1032,7 @@ OnChangeLines() VISU::Prs3d_i* aPrsObject = dynamic_cast(aServant.in()); if (!aPrsObject) return; - SVTK_ViewWindow* vw = GetViewWindow(); + SVTK_ViewWindow* vw = GetViewWindow(this); if (!vw) return; VISU_Actor* anActor = GetActor(aPrsObject, vw); @@ -1544,7 +1544,7 @@ OnSweep() VISU::ScalarMap_i* aPrsObject = dynamic_cast(aServant.in()); if (!aPrsObject) return; - SVTK_ViewWindow* vw = GetViewWindow(); + SVTK_ViewWindow* vw = GetViewWindow(this); if (!vw) return; VISU_Actor* aActor = GetActor(aPrsObject, vw); @@ -1756,7 +1756,7 @@ void VisuGUI:: OnSelectionInfo() { - if (GetViewWindow()) + if (GetViewWindow(this)) (new VisuGUI_SelectionDlg(GetDesktop(this)))->show(); else SUIT_MessageBox::warn1(GetDesktop(this), @@ -1906,7 +1906,7 @@ void VisuGUI:: OnArrangeActors() { - SVTK_ViewWindow* vw = GetViewWindow(); + SVTK_ViewWindow* vw = GetViewWindow(this); if (vw) { ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), vw); aDlg->exec(); diff --git a/src/VISUGUI/VisuGUI_Module.cxx b/src/VISUGUI/VisuGUI_Module.cxx index b8974989..344c042e 100644 --- a/src/VISUGUI/VisuGUI_Module.cxx +++ b/src/VISUGUI/VisuGUI_Module.cxx @@ -751,10 +751,15 @@ VisuGUI_Module if(!CORBA::is_nil(anObject)){ if(VISU::Prs3d_i* aPrs3d = dynamic_cast(VISU::GetServant(anObject).in())){ if(MYDEBUG) MESSAGE("VisuGUI_Module::OnDisplayPrs : Prs3d object"); - if(aPrs3d->GetType() != VISU::TGAUSSPOINTS) - VISU::UpdateViewer(this,aPrs3d,false,true,true); - else + if(aPrs3d->GetType() == VISU::TGAUSSPOINTS) VISU::UpdateViewer(this,aPrs3d,false,true,true); + else if(SUIT_ViewManager* aViewManager = getApp()->activeViewManager()){ + QString aType = aViewManager->getType(); + if(aType == SVTK_Viewer::Type()) + VISU::UpdateViewer(this,aPrs3d,false,true,true); + else if(aType == VVTK_Viewer::Type()) + VISU::UpdateViewer(this,aPrs3d,false,true,true); + } continue; } } @@ -808,24 +813,7 @@ void VisuGUI_Module ::OnDisplayOnlyPrs() { - if(SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this)){ - SALOME_ListIO aList; - aSelectionMgr->selectedObjects(aList); - for(SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next()){ - Handle(SALOME_InteractiveObject) anIO = it.Value(); - CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() ); - - if(!CORBA::is_nil(anObject)){ - if(VISU::Prs3d_i* aPrs3d = dynamic_cast(VISU::GetServant(anObject).in())){ - if(aPrs3d->GetType() != VISU::TGAUSSPOINTS) - VISU::OnEraseAll(this); - else - VISU::OnEraseAll(this); - break; - } - } - } - } + OnEraseAll(); OnDisplayPrs(); } diff --git a/src/VISUGUI/VisuGUI_Prs3dTools.h b/src/VISUGUI/VisuGUI_Prs3dTools.h index 4287a9ab..d9a4b448 100644 --- a/src/VISUGUI/VisuGUI_Prs3dTools.h +++ b/src/VISUGUI/VisuGUI_Prs3dTools.h @@ -213,8 +213,15 @@ namespace VISU CreatePrs3d(VisuGUI* theModule, const bool theIsCreateView = true) { - CreatePrs3d(theModule,theIsCreateView); + if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){ + QString aType = aViewManager->getType(); + if(aType == SVTK_Viewer::Type()) + CreatePrs3d(theModule,theIsCreateView); + else if(aType == VVTK_Viewer::Type()) + CreatePrs3d(theModule,theIsCreateView); + } } + } #endif diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 71b4bcef..b764a1aa 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -462,9 +462,7 @@ namespace VISU ChangeRepresentation (const SalomeApp_Module* theModule, VISU::PresentationType theType) { - SUIT_ViewWindow* aView = GetActiveView(theModule, SVTK_Viewer::Type()); - if (!aView) return; - SVTK_ViewWindow* vw = dynamic_cast( aView ); + SVTK_ViewWindow* vw = GetViewWindow( theModule, false ); if( !vw ) return; @@ -606,11 +604,15 @@ namespace VISU SVTK_ViewWindow* GetViewWindow(const SalomeApp_Module* theModule, const bool theCreate ) { - if(SalomeApp_Application* anApp = theModule->getApp()){ - if(SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), theCreate )){ - if(SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()){ - return dynamic_cast(aViewWindow); - } + if (SalomeApp_Application* anApp = theModule->getApp()) + { + SVTK_ViewWindow* wnd = dynamic_cast(anApp->desktop()->activeWindow()); + if( wnd ) + return wnd; + else + { + SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), theCreate ); + return dynamic_cast( aViewManager->getActiveView() ); } } return NULL; @@ -761,14 +763,7 @@ namespace VISU try { thePrs->Update(); - - TViewWindows aViewWindows = GetViews(theModule); - for (int i = 0, iEnd = aViewWindows.size(); i < iEnd; i++) { - SVTK_ViewWindow* aView = aViewWindows[i]; - if (VISU_Actor* anActor = FindActor(aView, anEntry.in())) { - thePrs->UpdateActor(anActor); - } - } + thePrs->UpdateActors(); } catch (std::runtime_error& ex) { INFOS(ex.what()); QApplication::restoreOverrideCursor(); @@ -776,14 +771,7 @@ namespace VISU QObject::tr("ERR_CANT_BUILD_PRESENTATION") + " " + QObject::tr(ex.what()), QObject::tr("BUT_OK")); - TViewWindows aViewWindows = GetViews(theModule); - for (int i = 0, iEnd = aViewWindows.size(); i < iEnd; i++) { - SVTK_ViewWindow* aView = aViewWindows[i]; - if (VISU_Actor* anActor = FindActor(aView, anEntry.in())) { - aView->RemoveActor(anActor); - anActor->Delete(); - } - } + thePrs->RemoveActors(); return; } QApplication::restoreOverrideCursor(); diff --git a/src/VISUGUI/VisuGUI_ViewTools.cxx b/src/VISUGUI/VisuGUI_ViewTools.cxx index bc2650dc..868ab606 100644 --- a/src/VISUGUI/VisuGUI_ViewTools.cxx +++ b/src/VISUGUI/VisuGUI_ViewTools.cxx @@ -61,8 +61,13 @@ namespace VISU if(VISU::Prs3d_i* aPrsObject = dynamic_cast(VISU::GetServant(theBase).in())){ if(aType == VISU::TGAUSSPOINTS) ErasePrs3d(theModule,aPrsObject,thIsUpdate); - else - ErasePrs3d(theModule,aPrsObject,thIsUpdate); + else if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){ + QString aType = aViewManager->getType(); + if(aType == SVTK_Viewer::Type()) + ErasePrs3d(theModule,aPrsObject,thIsUpdate); + else if(aType == VVTK_Viewer::Type()) + ErasePrs3d(theModule,aPrsObject,thIsUpdate); + } } }} // switch (aType) } diff --git a/src/VVTK/VVTK_Renderer.cxx b/src/VVTK/VVTK_Renderer.cxx index 142008d1..596e9a19 100644 --- a/src/VVTK/VVTK_Renderer.cxx +++ b/src/VVTK/VVTK_Renderer.cxx @@ -173,8 +173,8 @@ VVTK_Renderer { if(VISU_GaussPtsAct* anActor = dynamic_cast(theActor)){ anActor->SetPickingSettings(myPickingSettings); - Superclass::AddActor(anActor); } + Superclass::AddActor(theActor); } //---------------------------------------------------------------------------- @@ -185,8 +185,8 @@ VVTK_Renderer using namespace VISU; if(VISU_GaussPtsAct1* anActor = dynamic_cast(theActor)){ anActor->SetPickingSettings(NULL); - Superclass::RemoveActor(theActor); } + Superclass::RemoveActor(theActor); } //---------------------------------------------------------------------------- @@ -230,10 +230,10 @@ void VVTK_Renderer1 ::AddActor(VTKViewer_Actor* theActor) { + Superclass::AddActor(theActor); if(VISU_GaussPtsAct1* anActor = dynamic_cast(theActor)){ anActor->SetImplicitFunctionWidget(GetImplicitFunctionWidget()); anActor->SetOutsideCursorSettings(myOutsideCursorSettings); - Superclass::AddActor(anActor); AdjustImplicitFunctionWidget(); } } @@ -243,11 +243,11 @@ void VVTK_Renderer1 ::RemoveActor(VTKViewer_Actor* theActor) { + Superclass::RemoveActor(theActor); using namespace VISU; if(VISU_GaussPtsAct1* anActor = dynamic_cast(theActor)){ anActor->SetImplicitFunctionWidget(NULL); anActor->SetOutsideCursorSettings(NULL); - Superclass::RemoveActor(theActor); AdjustImplicitFunctionWidget(); } }