]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
In context of fix for Bug IPAL16041 - IOLS. Regressions with selection
authorapo <apo@opencascade.com>
Wed, 23 May 2007 12:50:20 +0000 (12:50 +0000)
committerapo <apo@opencascade.com>
Wed, 23 May 2007 12:50:20 +0000 (12:50 +0000)
src/VISUGUI/VisuGUI_Tools.h
src/VISUGUI/VisuGUI_ViewTools.cxx
src/VISUGUI/VisuGUI_ViewTools.h

index 469c19ce276f5ebc6353fcbdff9b3d3c9e766f75..901e4d21c049a311af6305541f1714f974e7c60f 100644 (file)
@@ -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);
 
index 4422d585fd082aec10bb9250c776b592be00434a..6062909c2f4144eef14e4f5b6d02f526de25a69b 100644 (file)
 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<SVTK_ViewWindow>(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<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());
+               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,
index 9c7ae8995d72a01a0b607d8b614c285a854c66d9..0b9d1fb6080e41372f48987924add957fcb8faa1 100644 (file)
@@ -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<SVTK_ViewWindow>(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<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());
-               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);
 
 
   //---------------------------------------------------------------