Salome HOME
DCQ : Merge with Ecole Ete a6.
[modules/visu.git] / src / VISUGUI / VisuGUI.cxx
index 36e79fe1ccab28c314631bc7d5587d216ec27075..a8e596684c4e34793251588d26210fc13a9def1f 100644 (file)
@@ -90,6 +90,7 @@
 #include "Plot2d_SetupPlot2dDlg.h"
 #include "Plot2d_ViewFrame.h"
 #include "VTKViewer_ViewFrame.h"
+#include "VTKViewer_InteractorStyleSALOME.h"
 #include "VisuGUI_FileDlg.h"
 
 // QT Includes
@@ -164,7 +165,7 @@ private:
   QFont font;
 };
 
-static VisuGUI MYVISUGUI;
+static VisuGUI MYVISUGUI("");
 VisuGUI *visuGUI = &MYVISUGUI;
 
 VISU::VISU_Gen_i* VisuGUI::GetVisuGen(){
@@ -260,6 +261,27 @@ VTKViewer_ViewFrame* VisuGUI::GetVtkViewFrame(){
   return dynamic_cast<VTKViewer_ViewFrame*>(aViewFrame);
 }
 
+static void UpdateViewFrame() {
+  QList<QAD_StudyFrame> aFrameList = VisuGUI::GetActiveStudy()->getStudyFrames();
+
+  for (QAD_StudyFrame* aStudyFrame = aFrameList.first(); aStudyFrame; aStudyFrame = aFrameList.next()) {
+    if (aStudyFrame->getTypeView() == VIEW_VTK) {
+      QAD_ViewFrame* aViewFrame = aStudyFrame->getRightFrame()->getViewFrame();
+      VTKViewer_ViewFrame* aVtkViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(aViewFrame);
+      if (!aVtkViewFrame) continue;
+      VTKViewer_RenderWindowInteractor* anInteractor = aVtkViewFrame->getRWInteractor();
+      if (anInteractor) {
+       anInteractor->SetSelectionProp();
+       anInteractor->SetSelectionTolerance();
+       VTKViewer_InteractorStyleSALOME* aStyle = anInteractor->GetInteractorStyleSALOME();
+       if (aStyle) {
+         aStyle->setPreselectionProp();
+       }
+      }
+    }
+  }
+}
+
 SALOMEDS::Study_var VisuGUI::GetStudyDocument(){
   return GetActiveStudy()->getStudyDocument();
 }
@@ -335,7 +357,9 @@ void RepaintCurrentView(){
 }
 
 
-VisuGUI::VisuGUI(){    
+VisuGUI::VisuGUI( const QString& theName, QObject* theParent ): 
+  SALOMEGUI( theName, theParent ) 
+{    
   mySelectionDlg = 0;
 }
 
@@ -379,7 +403,6 @@ bool VisuGUI::OnGUIEvent(int theCommandID,  QAD_Desktop* parent)
       /* ======================================================================================== */
       /* Import Table from file                                                                  */
       /* ======================================================================================== */
-
     case 199:
       {
        if(checkLock(aStudy)) break;
@@ -448,12 +471,6 @@ bool VisuGUI::OnGUIEvent(int theCommandID,  QAD_Desktop* parent)
       visuGUI->SelectionInfo();
       break;
 
-      /* ========================================================================================================================= */
-      /* Selection - Shape                                                                                                        */
-      /* ========================================================================================================================= */
-
-      //case 413 :
-
       /* ========================================================================================================================= */
       /* Visualization - Wireframe                                                                                                */
       /* ========================================================================================================================= */
@@ -642,11 +659,25 @@ bool VisuGUI::OnGUIEvent(int theCommandID,  QAD_Desktop* parent)
                              tr ("VISU_BUT_OK") );
       break;
     } 
+  } catch (const std::bad_alloc& e ) { 
+    INFOS("bad_alloc exception is caught "<<e.what());
+    QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
+                         tr("ERR_NO_MEMORY") + " " + tr(e.what()),
+                         tr("VISU_BUT_OK") );
+    return false;
+    }
+  catch (std::exception& e){
+    INFOS(e.what());
+    QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
+                         tr(e.what()),
+                         tr("VISU_BUT_OK") );
   }catch (const SALOME::SALOME_Exception& S_ex) {
+    INFOS("const SALOME::SALOME_Exception& S_ex");
     QtCatchCorbaException(S_ex);
     return false;
   }
   catch(...) {
+    INFOS(tr("ERR_UNKNOWN_EXCEPTION").latin1());
     QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
                          tr("ERR_UNKNOWN_EXCEPTION"),
                          tr("VISU_BUT_OK") );
@@ -655,12 +686,7 @@ bool VisuGUI::OnGUIEvent(int theCommandID,  QAD_Desktop* parent)
   return true;
 }
 
-
 void VisuGUI::SelectionInfo() {
-  if (mySelectionDlg) {
-    mySelectionDlg->close(true);
-    mySelectionDlg = 0;
-  }
   mySelectionDlg = new VisuGUI_SelectionDlg();
   mySelectionDlg->show();
 }
@@ -759,7 +785,6 @@ bool VisuGUI::OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* st
 // Slot-functions for presentations creation
 //=====================================================================================
 
-
 #define CREATEPRESENTATION(FunctionName)  \
  void FunctionName() { \
    if (checkLock(GetStudyDocument())) return; \
@@ -786,12 +811,11 @@ CREATEPRESENTATION(VisuGUI::CreateStreamLines);
 
 
 
-
 //=====================================================================================
-// function : setSettings()
+// function : SetSettings()
 // purpose  :
 //=====================================================================================
-bool VisuGUI::setSettings(QAD_Desktop* parent)
+bool VisuGUI::SetSettings(QAD_Desktop* parent)
 {
   int anId = 53;
   QMenuData* pp;
@@ -808,6 +832,11 @@ bool VisuGUI::setSettings(QAD_Desktop* parent)
   if(aValue.isEmpty()? 0 : aValue.toInt()) 
     pp->setItemChecked(anId, true);
   
+  anId = 50;
+  parent->menuBar()->changeItem(anId,parent->getComponentUserName("VISU"));
+
+  ::UpdateViewFrame();
+
   return true;
 }
 
@@ -1130,10 +1159,10 @@ void VisuGUI::RecreateActor(VISU::Prs3d_i* thePrs) {
            thePrs->UpdateActor(anActor);
       }
   }catch(std::runtime_error& ex){
-    QApplication::restoreOverrideCursor();
     INFOS(ex.what());
+    QApplication::restoreOverrideCursor();
     QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"), 
-                           tr ("ERR_CANT_BUILD_PRESENTATION"), 
+                           tr ("ERR_CANT_BUILD_PRESENTATION") + " " + tr(ex.what())
                            tr ("VISU_BUT_OK") );
     for(int i = 0, nbFrames = GetActiveStudy()->getStudyFramesCount(); i < nbFrames; i++)
       if(QAD_StudyFrame* aFrame = GetActiveStudy()->getStudyFrame(i)){
@@ -1198,7 +1227,7 @@ void VisuGUI::EditPrs() {
     {
       VISU::CutPlanes_i* aPrsObject = dynamic_cast<VISU::CutPlanes_i*>(aPrs3d);
       if (aPrsObject) {
-       VisuGUI_CutPlanesDlg* aDlg = new VisuGUI_CutPlanesDlg(false, false);
+       VisuGUI_CutPlanesDlg* aDlg = new VisuGUI_CutPlanesDlg(false, false); 
         aDlg->initFromPrsObject(aPrsObject);
        aDlg->show();
        myActiveDialogBox = aDlg;      
@@ -1398,7 +1427,7 @@ void VisuGUI::CreateMesh() {
     }catch(std::runtime_error& exc){
       INFOS(exc.what());
       QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"), 
-                             tr ("ERR_CANT_CREATE_ACTOR"), 
+                             tr ("ERR_CANT_CREATE_ACTOR") + " " + tr(exc.what())
                              tr ("VISU_BUT_OK") ); 
     }
   }
@@ -2196,57 +2225,31 @@ void VisuGUI::DeletePrs() {
 void VisuGUI::SaveViewParams()
 {
   if (checkLock(GetStudyDocument())) return;
-  SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
-  if ( Sel->IObjectCount() > 1 || GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_VTK ) 
+  SALOME_Selection* aSel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
+  QAD_StudyFrame* aStudyFrame = GetActiveStudy()->getActiveStudyFrame();
+  if ( aSel->IObjectCount() > 1 || aStudyFrame->getTypeView() != VIEW_VTK ) 
     return;
-  VISU::ViewManager_var aVM = GetVisuGen()->GetViewManager();
-  if(!CORBA::is_nil(aVM.in())){
-    VISU::View_var aView = aVM->GetCurrentView();
-    if(!CORBA::is_nil(aView.in())){
-      VISU::View3D_var aView3D = VISU::View3D::_narrow(aView);
-      if(CORBA::is_nil(aView3D.in())) return;
-      if ( Sel->IObjectCount()  == 0 ) {
-       // Save view parameters by new name
-       aView3D->SaveViewParams( 0 );
-       GetActiveStudy()->updateObjBrowser( true );
-      }else{
-       bool isExist;
-       VISU::Storable::TRestoringMap aMap;
-       Handle(SALOME_InteractiveObject) anIO;    
-       CORBA::Object_var anObject = GetSelectedObj(&anIO,GetActiveStudy(),&aMap);
-       VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
-       if(isExist && aType == VISU::TVIEW3D){
-         aView3D->SaveViewParams( anIO->getName() );
-         GetActiveStudy()->updateObjBrowser( true );
-       }
-      }
-    }
+  if ( aSel->IObjectCount()  == 0 ) {
+    VISU::View3D_i::SaveViewParams(aStudyFrame,VISU::View3D_i::GenerateViewParamsName().latin1());
+  }else{
+    const Handle(SALOME_InteractiveObject)& anIO = aSel->firstIObject();
+    VISU::View3D_i::SaveViewParams(aStudyFrame,anIO->getName());
   }
+  GetActiveStudy()->updateObjBrowser( true );
 }
 
 
 void VisuGUI::RestoreViewParams()
 {
-  SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
-  if ( Sel->IObjectCount() > 1 || GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_VTK ) 
+  SALOME_Selection* aSel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
+  QAD_StudyFrame* aStudyFrame = GetActiveStudy()->getActiveStudyFrame();
+  if ( aSel->IObjectCount() > 1 || aStudyFrame->getTypeView() != VIEW_VTK ) 
     return;
-  VISU::ViewManager_var aVM = GetVisuGen()->GetViewManager();
-  if(!CORBA::is_nil(aVM.in())){
-    VISU::View_var aView = aVM->GetCurrentView();
-    if(!CORBA::is_nil(aView.in())){
-      VISU::View3D_var aView3D = VISU::View3D::_narrow(aView);
-      if(CORBA::is_nil(aView3D.in())) return;
-      bool isExist;
-      VISU::Storable::TRestoringMap aMap;
-      Handle(SALOME_InteractiveObject) anIO;    
-      CORBA::Object_var anObject = GetSelectedObj(&anIO,GetActiveStudy(),&aMap);
-      VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
-      if(isExist && aType == VISU::TVIEW3D)
-       aView3D->RestoreViewParams( anIO->getName() );
-    }
-  }
+  const Handle(SALOME_InteractiveObject)& anIO = aSel->firstIObject();
+  VISU::View3D_i::RestoreViewParams(aStudyFrame,anIO->getName());
 }
 
+
 //=====================================================================================
 // function : DeleteViewParams()
 // purpose  :
@@ -2304,14 +2307,20 @@ void VisuGUI::Sweep() {
   }
 
   QApplication::setOverrideCursor( Qt::waitCursor );
-  for (int j=0 ; j<aCycles; j++) {
-    for (int i=0 ; i<=aSteps; i++) {
-      float aPercents = float(i)/aSteps;
-      aPrsObject->SetMapScale(aPercents);
-      aPrsObject->UpdateActor(aActor);
-      vf->getRW()->getRenderWindow()->Render();
-      usleep(aTemp);
+  try{
+    for (int j=0 ; j<aCycles; j++) {
+      for (int i=0 ; i<=aSteps; i++) {
+       float aPercents = float(i)/aSteps;
+       aPrsObject->SetMapScale(aPercents);
+       aPrsObject->UpdateActor(aActor);
+       vf->getRW()->getRenderWindow()->Render();
+       usleep(aTemp);
+      }
     }
+  }catch(std::exception& exc){
+    INFOS("Follow exception was accured :\n"<<exc.what());
+  }catch(...){
+    INFOS("Unknown exception was accured!");
   }
   QApplication::restoreOverrideCursor();
 }
@@ -2728,8 +2737,7 @@ bool VisuGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* thePopup, const QStri
   thePopup->clear();
   SALOME_Selection* aSelection = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
   if ( aSelection->IObjectCount() == 0 ) {
-    if ( theParent == "Viewer" && isVTKViewer)
-      // Available only for VTK viewer
+    if ( theParent == "Viewer" && isVTKViewer && !aIsLocked)
       thePopup->insertItem( "Save view parameters", visuGUI, SLOT( SaveViewParams() ) );
     return false;
   }
@@ -2996,11 +3004,12 @@ bool VisuGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* thePopup, const QStri
          if ( !aIsLocked )thePopup->insertItem("Create Presentation", visuGUI, SLOT(CreateMesh()));    
          break;
        case VISU::TVIEW3D: 
+         if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK )
+           thePopup->insertItem( "Restore view parameters", visuGUI, SLOT( RestoreViewParams() ) );
          if ( !aIsLocked ) {
            if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { 
              // Available only for VTK viewer
              thePopup->insertItem( "Save view parameters", visuGUI, SLOT( SaveViewParams() ) );
-             thePopup->insertItem( "Restore view parameters", visuGUI, SLOT( RestoreViewParams() ) );
            }
            thePopup->insertItem( "Rename...", visuGUI, SLOT( Rename() ) );
            thePopup->insertItem("Delete", visuGUI, SLOT(DeleteViewParams()));
@@ -3098,73 +3107,34 @@ void VisuGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO)
          vf->AddActor(SelectedActor);
       }catch(std::runtime_error& exc){
        INFOS(exc.what());
+       throw exc; 
       }
   }else
     if(MYDEBUG) MESSAGE("CORBA::is_nil(anObject) = true");
   END_OF("VisuGUI::BuildPresentation");
 }
 
-extern "C"
-{
-  bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
-  {
-    //if(MYDEBUG) MESSAGE("VisuGUI::OnGUIEvent "<< theCommandID);
-    return VisuGUI::OnGUIEvent(theCommandID, parent);
-  }
-
-  bool OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
-  {
-    if(MYDEBUG) MESSAGE("VisuGUI::OnKeyPress ");
-    return VisuGUI::OnKeyPress (pe, parent, studyFrame);
-  }
-
-  bool OnMousePress (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
-  {
-    //if(MYDEBUG) MESSAGE("VisuGUI::OnMousePress ");
-    return VisuGUI::OnMousePress (pe, parent, studyFrame);
-  }
 
-  bool OnMouseMove (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
-  {
-    //if(MYDEBUG) MESSAGE("VisuGUI::OnMouseMove ");
-    return VisuGUI::OnMouseMove (pe, parent, studyFrame);
-  }
-
-  bool SetSettings ( QAD_Desktop* parent )
-  {
-    return VisuGUI::setSettings( parent );
-  }
-
-  bool customPopup ( QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext,
-                    const QString & theParent, const QString & theObject )
-  {
-    return VisuGUI::CustomPopup( parent, popup, theContext, theParent, theObject );
-  }
-
-  void definePopup ( QString & theContext, QString & theParent, QString & theObject )
-  {
-    VisuGUI::DefinePopup( theContext, theParent, theObject );
-  }
+//===========================================================================
+// SupportedViewType
+//===========================================================================
+void VisuGUI::SupportedViewType(int* buffer, int bufferSize)
+{
+  if (!buffer || !bufferSize) return;
+  buffer[0] = (int)VIEW_VTK;
+  if (--bufferSize) buffer[1] = (int)VIEW_PLOT2D;
+} 
 
-  bool activeStudyChanged ( QAD_Desktop* parent )
-  {
-    //VisuGUI::activeStudyChanged( parent );
-  }
-    void buildPresentation ( const Handle(SALOME_InteractiveObject)& theIO )
-  {
-    VisuGUI::BuildPresentation(theIO);
+extern "C"
+{
+  Standard_EXPORT SALOMEGUI* GetComponentGUI() {
+    if ( !visuGUI )
+      visuGUI = new VisuGUI( "" );
+    return visuGUI;
   }
-
-  void supportedViewType(int* buffer, int bufferSize)
-  {
-    if (!buffer || !bufferSize) return;
-    buffer[0] = (int)VIEW_VTK;
-    if (--bufferSize) buffer[1] = (int)VIEW_PLOT2D;
-  }  
-
 }
 
+
 //////////////////////////////////////////////////////////////////////////////////
 ////////////////               CHANGE ACTOR COLOR         ////////////////////////
 //////////////////////////////////////////////////////////////////////////////////
@@ -3261,8 +3231,8 @@ void VisuGUI::NewOpacity(VISU_Actor *Actor)
   int intopac;
   CursorDlg->Comment1->setText( tr( "Set value between") );
   CursorDlg->Comment2->setText( tr( "0 (transparent) and 100 (opaque)" ) );
-  oldopac=Actor->GetProperty()->GetOpacity();
-  intopac=int(oldopac*100.);
+  oldopac=Actor->GetOpacity();
+  intopac=int(oldopac*100.+0.5);
   CursorDlg->SpinBox1->setMinValue(0);
   CursorDlg->SpinBox1->setMaxValue(100);
   CursorDlg->SpinBox1->setValue(intopac);
@@ -3272,7 +3242,7 @@ void VisuGUI::NewOpacity(VISU_Actor *Actor)
     {
       intopac  = CursorDlg->SpinBox1->value() ;
       newopac = intopac/100.;
-      Actor->GetProperty()->SetOpacity(newopac);
+      Actor->SetOpacity(newopac);
     }
   delete CursorDlg;
 }
@@ -3477,7 +3447,10 @@ bool FNAME(SALOMEDS::SObject_var theField) { \
         return false; \
       } \
     } \
-    CreateActor(pPresent); \
+     try { \
+       CreateActor(pPresent); \
+     }catch (...) {\
+       return false;} \
     return true; \
   } \
   return false; \
@@ -3493,6 +3466,7 @@ BUILDPRS(VISU::StreamLines_i, CreateStreamLinesPrs, VisuGUI::CreateStreamLines,
 
 
 bool VisuGUI::CreateCutPlanes(SALOMEDS::SObject_var theField) { 
+  try {
   VISU::Storable::TRestoringMap aMap = getMapOfValue(theField); 
   bool isExist; 
   QString aType = VISU::Storable::FindValue(aMap,"myType",&isExist); 
@@ -3529,10 +3503,12 @@ bool VisuGUI::CreateCutPlanes(SALOMEDS::SObject_var theField) {
       return true;
     }
   }
+}catch (...){return false;}
   return false;
 }
 
 bool VisuGUI::CreateCutLines(SALOMEDS::SObject_var theField) { 
+try {
   VISU::Storable::TRestoringMap aMap = getMapOfValue(theField); 
   bool isExist; 
   QString aType = VISU::Storable::FindValue(aMap,"myType",&isExist); 
@@ -3593,6 +3569,7 @@ bool VisuGUI::CreateCutLines(SALOMEDS::SObject_var theField) {
 //     return true; 
     } 
   }
+}catch (...){return false; }
   return false; 
 }
 
@@ -3702,7 +3679,13 @@ void VisuGUI::ExportTableToFile()
        try {
          GetVisuGen() -> ExportTableToFile(aSObj, aFile.latin1());
          QAD_Application::getDesktop()->putInfo(aFile+" exported.");
+       } catch(std::exception& ex) {
+         INFOS(ex.what());
+         QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
+                                tr ("ERR_ERROR_DURING_EXPORT") + " " + tr(ex.what()),
+                                tr ("VISU_BUT_OK") );
        } catch(...) {
+         INFOS(tr ("ERR_ERROR_DURING_EXPORT"));
          QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
                                 tr ("ERR_ERROR_DURING_EXPORT"),
                                 tr ("VISU_BUT_OK") );
@@ -3802,7 +3785,14 @@ void VisuGUI::ExportToFile(){
        try{
          //APO - aResult->GetInput()->ToFile(aFile.latin1());
          QAD_Application::getDesktop()->putInfo(aFile+" exported.");
-       }catch(...){
+       }catch(std::exception& ex) {
+         INFOS(ex.what());
+         QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
+                                tr ("ERR_ERROR_DURING_EXPORT") + " " +tr(ex.what()),
+                                tr ("VISU_BUT_OK") );
+       } 
+       catch(...){
+         INFOS(tr ("ERR_ERROR_DURING_EXPORT").latin1());
          QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
                                 tr ("ERR_ERROR_DURING_EXPORT"),
                                 tr ("VISU_BUT_OK") );
@@ -3882,11 +3872,11 @@ VISU_Actor* VisuGUI::UpdateViewer(VISU::Prs3d_i* thePrs, bool theDispOnly){
   try{
     anVISUActor = thePrs->CreateActor();
     vf->AddActor(anVISUActor);
-  }catch(std::runtime_error& exc){
+  } catch ( std::runtime_error& exc ){
     INFOS(exc.what());
     QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
-                           tr ("ERR_CANT_VISUALIZE_OBJECT"),
-                           tr ("VISU_BUT_OK") );
+                          tr("ERR_CANT_VISUALIZE_OBJECT") + " " + tr(exc.what()),
+                          tr ("VISU_BUT_OK") );
     anVISUActor = NULL;
   }
   return anVISUActor;
@@ -3946,14 +3936,26 @@ void VisuGUI::CreateActor(VISU::Prs3d_i* thePrs) {
     timer.Start();
 #endif
     try{
+      MESSAGE("Available memory : "<<VISU_PipeLine::GetAvailableMemory());
       VISU_Actor* aActor = thePrs->CreateActor();
       vf->AddActor(aActor);
-    }catch(std::runtime_error& exc){
-      INFOS(exc.what());
+    }catch(std::runtime_error& exc) {
+      INFOS("std::runtime_error "<<exc.what());
+      INFOS("Available memory : "<<VISU_PipeLine::GetAvailableMemory());
       QApplication::restoreOverrideCursor();
       QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
-                             tr ("WRN_CANT_VISUALIZE_PRS"),
-                             tr ("VISU_BUT_OK") );
+                               tr ("WRN_CANT_VISUALIZE_PRS") + " " + tr(exc.what()),
+                               tr ("VISU_BUT_OK") );
+      throw exc;
+    } catch (...) {
+      cout<<" Unknown exception"<<endl;
+      QApplication::restoreOverrideCursor();
+      INFOS("Unknown exception is caught in VisuGUI::CreateActor");
+      INFOS("Available memory : "<<VISU_PipeLine::GetAvailableMemory());
+      QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
+                            tr ("WRN_CANT_VISUALIZE_PRS") + " " + tr("ERR_UNKNOWN_EXCEPTION"),
+                            tr ("VISU_BUT_OK") );
+      throw ;
     }
 #ifdef CHECKTIME
     timer.Stop();