From 7d3f8dac91e2f7540a89690d0260c7fcc600ddb4 Mon Sep 17 00:00:00 2001 From: apo Date: Wed, 23 May 2007 12:50:20 +0000 Subject: [PATCH] In context of fix for Bug IPAL16041 - IOLS. Regressions with selection --- src/VISUGUI/VisuGUI_Tools.h | 2 +- src/VISUGUI/VisuGUI_ViewTools.cxx | 86 +++++++++++++++++++++++++++++++ src/VISUGUI/VisuGUI_ViewTools.h | 75 +-------------------------- 3 files changed, 89 insertions(+), 74 deletions(-) diff --git a/src/VISUGUI/VisuGUI_Tools.h b/src/VISUGUI/VisuGUI_Tools.h index 469c19ce..901e4d21 100644 --- a/src/VISUGUI/VisuGUI_Tools.h +++ b/src/VISUGUI/VisuGUI_Tools.h @@ -130,7 +130,7 @@ namespace VISU void Remove(LightApp_SelectionMgr* theSelectionMgr, const Handle(SALOME_InteractiveObject)& theIO); - void RestoreSelection(VisuGUI* theModule, VISU::Prs3d_i* thePrs3d); + void RestoreSelection(VisuGUI* theModule, VISU::Prs3d_i* thePrs3d = NULL); bool IsRemovableSelected(const SalomeApp_Module* theModule); diff --git a/src/VISUGUI/VisuGUI_ViewTools.cxx b/src/VISUGUI/VisuGUI_ViewTools.cxx index 4422d585..6062909c 100644 --- a/src/VISUGUI/VisuGUI_ViewTools.cxx +++ b/src/VISUGUI/VisuGUI_ViewTools.cxx @@ -36,6 +36,92 @@ namespace VISU { //---------------------------------------------------------------------------- + VISU_Actor* + PublishInView(VisuGUI* theModule, + Prs3d_i* thePrs, + SVTK_ViewWindow* theViewWindow, + bool theIsHighlight) + { + if (theViewWindow) { + QApplication::setOverrideCursor( Qt::waitCursor ); + try { + 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 + (GetDesktop(theModule), QObject::tr("WRN_VISU"), + QObject::tr("ERR_CANT_CREATE_ACTOR") + ": " + QObject::tr(exc.what()), + QObject::tr("BUT_OK")); + } + } + return NULL; + } + + + //--------------------------------------------------------------- + VISU_Actor* + UpdateViewer(VisuGUI* theModule, + VISU::Prs3d_i* thePrs, + bool theDispOnly, + const bool theIsHighlight) + { + if (SVTK_ViewWindow* aViewWindow = GetActiveViewWindow(theModule)) { + vtkRenderer *aRen = aViewWindow->getRenderer(); + vtkActorCollection *anActColl = aRen->GetActors(); + anActColl->InitTraversal(); + VISU_Actor* aResActor = NULL; + bool isOk = true; + while (vtkActor *anAct = anActColl->GetNextActor()) { + if (VISU_Actor* anActor = dynamic_cast(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()); + SUIT_MessageBox::warn1 + (GetDesktop(theModule), QObject::tr("WRN_VISU"), + QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(exc.what()), + QObject::tr("BUT_OK")); + } + } else if (theDispOnly) { + anActor->VisibilityOff(); + } + } else if (theDispOnly && anActor->GetVisibility()) { + anActor->VisibilityOff(); + } + } + } + if (aResActor) { + if (theIsHighlight && isOk) + aViewWindow->highlight(aResActor->getIO(), true); + aViewWindow->getRenderer()->ResetCameraClippingRange(); + aViewWindow->Repaint(); + return aResActor; + } + return PublishInView(theModule, thePrs, aViewWindow, theIsHighlight); + } + return NULL; + } + + + //--------------------------------------------------------------- void ErasePrs3d(VisuGUI* theModule, VISU::Prs3d_i* thePrs, diff --git a/src/VISUGUI/VisuGUI_ViewTools.h b/src/VISUGUI/VisuGUI_ViewTools.h index 9c7ae899..0b9d1fb6 100644 --- a/src/VISUGUI/VisuGUI_ViewTools.h +++ b/src/VISUGUI/VisuGUI_ViewTools.h @@ -122,38 +122,11 @@ namespace VISU //--------------------------------------------------------------- - inline VISU_Actor* PublishInView(VisuGUI* theModule, Prs3d_i* thePrs, SVTK_ViewWindow* theViewWindow, - const bool theIsHighlight = false) - { - if (theViewWindow) { - QApplication::setOverrideCursor( Qt::waitCursor ); - try { - 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 - (GetDesktop(theModule), QObject::tr("WRN_VISU"), - QObject::tr("ERR_CANT_CREATE_ACTOR") + ": " + QObject::tr(exc.what()), - QObject::tr("BUT_OK")); - } - } - return NULL; - } + const bool theIsHighlight = false); //--------------------------------------------------------------- @@ -162,51 +135,7 @@ namespace VISU UpdateViewer(VisuGUI* theModule, VISU::Prs3d_i* thePrs, bool theDispOnly = false, - const bool theIsHighlight = false) - { - if (SVTK_ViewWindow* aViewWindow = GetActiveViewWindow(theModule)) { - vtkRenderer *aRen = aViewWindow->getRenderer(); - vtkActorCollection *anActColl = aRen->GetActors(); - anActColl->InitTraversal(); - VISU_Actor* aResActor = NULL; - bool isOk = true; - while (vtkActor *anAct = anActColl->GetNextActor()) { - if (VISU_Actor* anActor = dynamic_cast(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()); - SUIT_MessageBox::warn1 - (GetDesktop(theModule), QObject::tr("WRN_VISU"), - QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(exc.what()), - QObject::tr("BUT_OK")); - } - } else if (theDispOnly) { - anActor->VisibilityOff(); - } - } else if (theDispOnly && anActor->GetVisibility()) { - anActor->VisibilityOff(); - } - } - } - if (aResActor) { - if (theIsHighlight && isOk) - aViewWindow->highlight(aResActor->getIO(), true); - aViewWindow->getRenderer()->ResetCameraClippingRange(); - aViewWindow->Repaint(); - return aResActor; - } - return PublishInView(theModule, thePrs, aViewWindow, theIsHighlight); - } - return NULL; - } + const bool theIsHighlight = false); //--------------------------------------------------------------- -- 2.39.2