]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix some problems.
authorjfa <jfa@opencascade.com>
Fri, 3 Feb 2006 13:08:23 +0000 (13:08 +0000)
committerjfa <jfa@opencascade.com>
Fri, 3 Feb 2006 13:08:23 +0000 (13:08 +0000)
src/OBJECT/VISU_Actor.cxx
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI_Displayer.cxx
src/VISUGUI/VisuGUI_Prs3dTools.h
src/VISUGUI/VisuGUI_Tools.cxx
src/VISUGUI/VisuGUI_ViewTools.h

index 90e3009f12aa22ebe0801b711da8352c92b6b8c8..42591ab305f39bbb0f6c9d6362942850453e9c22 100644 (file)
@@ -223,18 +223,6 @@ VISU_Actor
   if(thePipeLine){
     if(vtkMapper *aMapper = myPipeLine->GetMapper()){
       if(vtkDataSet *aDataSet = aMapper->GetInput()){
-       if(!aDataSet)
-         throw std::runtime_error("VISU_Actor::SetPipeLine >> There is no input data !!!");
-
-       aDataSet->Update();
-
-       static float EPS = VTK_LARGE_FLOAT * 0.1 ;
-       if(aDataSet->GetLength() > EPS)
-         throw std::runtime_error("VISU_Actor::SetPipeLine >> Diagonal of the actor is too large !!!");
-
-       if(!aDataSet->GetNumberOfCells())
-         throw std::runtime_error("VISU_Actor::SetPipeLine >> There is no visible elements");
-
        SetShrinkable(thePipeLine->IsShrinkable());
 
        SetMapperInput(aDataSet);
index f5f1a2ed5a7726e2fb2c890fc8c23b4dc205fd46..3128e69f768cb59652dfe3761370166d33ebc732 100644 (file)
@@ -341,11 +341,11 @@ OnExportTableToFile()
        try {
          GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), aFile.latin1());
           application()->putInfo(aFile + " " + tr("INF_DONE"));
-       } catch(std::exception& ex) {
-         INFOS(ex.what());
+       } catch(std::exception& exc) {
+         INFOS(exc.what());
          SUIT_MessageBox::warn1(GetDesktop(this),
                                  tr("WRN_VISU"),
-                                tr("ERR_ERROR_DURING_EXPORT") + " " + tr(ex.what()),
+                                tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()),
                                 tr("BUT_OK"));
        } catch(...) {
          INFOS(tr("ERR_ERROR_DURING_EXPORT"));
@@ -681,6 +681,30 @@ OnErasePrs()
   QApplication::restoreOverrideCursor();
 }
 
+void
+VisuGUI::
+OnEraseAll()
+{
+  startOperation( myEraseAll );
+  if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
+    vw->unHighlightAll();
+    if (vtkRenderer *aRen = vw->getRenderer()) {
+      vtkActor *anActor;
+      vtkActorCollection *anActColl = aRen->GetActors();
+      for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
+        if (anActor->GetVisibility() > 0)
+          if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
+           RemoveScalarBarPosition(this,anVISUActor->GetPrs3d());
+            anVISUActor->VisibilityOff();
+          }
+      }
+      vw->Repaint();
+    }
+  } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
+    aPlot2d->EraseAll();
+  }
+}
+
 
 void
 VisuGUI::
@@ -806,30 +830,6 @@ OnEditPlot3D()
 }
 
 
-void
-VisuGUI::
-OnEraseAll()
-{
-  startOperation( myEraseAll );
-  if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
-    vw->unHighlightAll();
-    if (vtkRenderer *aRen = vw->getRenderer()) {
-      vtkActor *anActor;
-      vtkActorCollection *anActColl = aRen->GetActors();
-      for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
-        if (anActor->GetVisibility() > 0)
-          if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
-           RemoveScalarBarPosition(this,anVISUActor->GetPrs3d());
-            anVISUActor->VisibilityOff();
-          }
-      }
-      vw->Repaint();
-    }
-  } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
-    aPlot2d->EraseAll();
-  }
-}
-
 void
 VisuGUI::
 OnMakeSurfaceframe()
index 380ee7f40e6425bf4ced77387b154e211c3f5aa0..1fa6f098984eb6b1e560bf44fc517dd634a0beea 100644 (file)
@@ -70,7 +70,8 @@ SALOME_Prs* VisuGUI_Displayer::buildPresentation( const QString& entry, SALOME_V
     SVTK_Viewer* vtk_viewer = dynamic_cast<SVTK_Viewer*>( aViewFrame );
     if( vtk_viewer )
     {
-      SVTK_ViewWindow* wnd = dynamic_cast<SVTK_ViewWindow*>( vtk_viewer->getViewManager()->getActiveView() );
+      SVTK_ViewWindow* wnd =
+        dynamic_cast<SVTK_ViewWindow*>( vtk_viewer->getViewManager()->getActiveView() );
       if( wnd )
       {
        VISU::Prs3d_i* thePrs = dynamic_cast<VISU::Prs3d_i*>( VISU::GetServant( anObj ).in() );
@@ -85,7 +86,8 @@ SALOME_Prs* VisuGUI_Displayer::buildPresentation( const QString& entry, SALOME_V
     SPlot2d_Viewer* plot_viewer = dynamic_cast<SPlot2d_Viewer*>( aViewFrame );
     if( plot_viewer )
     {
-      Plot2d_ViewWindow* wnd = dynamic_cast<Plot2d_ViewWindow*>( plot_viewer->getViewManager()->getActiveView() );
+      Plot2d_ViewWindow* wnd =
+        dynamic_cast<Plot2d_ViewWindow*>( plot_viewer->getViewManager()->getActiveView() );
       if( !wnd )
        return 0;
 
index a832fbb523374efb8fb58dae2c1c115bc44cdec9..ab12f3353e6f311635306d3a7a7743169fd845c6 100644 (file)
@@ -62,7 +62,17 @@ namespace VISU
          delete aDlg;
          return;
        }
-       aPrs3d->UpdateActors();
+       try {
+         aPrs3d->UpdateActors();
+       } catch (std::runtime_error& exc) {
+         INFOS(exc.what());
+         SUIT_MessageBox::warn1
+           (GetDesktop(theModule), QObject::tr("WRN_VISU"),
+            QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": pammy1 " + QObject::tr(exc.what()),
+            QObject::tr("BUT_OK"));
+
+         aPrs3d->RemoveActors();
+       }
        typedef typename TViewer::TViewWindow TViewWindow;
        if(TViewWindow* aViewWindow = GetViewWindow<TViewer>(theModule)){
          aViewWindow->getRenderer()->ResetCameraClippingRange();
index 1259dbeea6de7241462c6d2b859b6f76fac51088..970ef60407ad80e3aac9933503840f11fce59d34 100644 (file)
@@ -758,10 +758,10 @@ namespace VISU
        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"));
+       SUIT_MessageBox::warn1
+          (GetDesktop(theModule), QObject::tr("WRN_VISU"),
+           QObject::tr("ERR_CANT_CREATE_ACTOR") + ": pammy2 " + QObject::tr(exc.what()),
+           QObject::tr("BUT_OK"));
       }
       QApplication::restoreOverrideCursor();
     }
@@ -793,12 +793,13 @@ namespace VISU
            aResActor = anVISUActor;
             thePrs->UpdateActor(aResActor);
             aResActor->VisibilityOn();
-          } catch (std::runtime_error& ex) {
+          } catch (std::runtime_error& exc) {
             aResActor->VisibilityOff();
-            INFOS(ex.what());
-            SUIT_MessageBox::warn1(GetDesktop(theModule), QObject::tr("WRN_VISU"),
-                                   QObject::tr("ERR_CANT_CREATE_ACTOR") + ": " + QObject::tr(ex.what()),
-                                   QObject::tr("BUT_OK"));
+            INFOS(exc.what());
+            SUIT_MessageBox::warn1
+              (GetDesktop(theModule), QObject::tr("WRN_VISU"),
+               QObject::tr("ERR_CANT_CREATE_ACTOR") + ": pammy3 " + QObject::tr(exc.what()),
+               QObject::tr("BUT_OK"));
           }
         } else if (theDispOnly) {
           anVISUActor->VisibilityOff();
@@ -877,14 +878,14 @@ namespace VISU
     CORBA::String_var anEntry = aSObject->GetID();
 
     try {
-      thePrs->Update();
       thePrs->UpdateActors();
-    } catch (std::runtime_error& ex) {
-      INFOS(ex.what());
+    } catch (std::runtime_error& exc) {
+      INFOS(exc.what());
       QApplication::restoreOverrideCursor();
-      SUIT_MessageBox::warn1 (GetDesktop(theModule), QObject::tr("WRN_VISU"),
-                              QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(ex.what()),
-                              QObject::tr("BUT_OK"));
+      SUIT_MessageBox::warn1
+        (GetDesktop(theModule), QObject::tr("WRN_VISU"),
+         QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": pammy4 " + QObject::tr(exc.what()),
+         QObject::tr("BUT_OK"));
 
       thePrs->RemoveActors();
       return;
@@ -1273,10 +1274,10 @@ namespace VISU
         theModule->getApp()->updateActions();
       } catch (std::runtime_error& exc) {
         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"));
+        SUIT_MessageBox::warn1
+          (GetDesktop(theModule), QObject::tr("WRN_VISU"),
+           QObject::tr("ERR_CANT_CREATE_ACTOR") + ": pammy5 " + QObject::tr(exc.what()),
+           QObject::tr("BUT_OK"));
       }
     }
   }
index 49500541d2c223d4fe3ee0578db31a0fafba9b52..d70ee509a0c5ebbe4da74e8a0b54c2a90b181410 100644 (file)
@@ -98,7 +98,7 @@ namespace VISU
     typedef typename TViewer::TViewWindow TView;
     if(TView* aView = GetViewWindow<TViewer>(theModule,theIsCreateView)){
       QApplication::setOverrideCursor( Qt::waitCursor );
-      try{
+      try {
        if(VISU_Actor* anActor = thePrs->CreateActor()){
          aView->AddActor(anActor);
          if(theIsHighlight)
@@ -108,11 +108,13 @@ namespace VISU
          QApplication::restoreOverrideCursor();
          return anActor;
        }
-      }catch(std::exception& exc){
-       SUIT_MessageBox::warn1(GetDesktop(theModule),
-                              QObject::tr("WRN_VISU"),
-                              QObject::tr("ERR_CANT_CREATE_ACTOR"),
-                              QObject::tr("BUT_OK"));
+      } catch(std::exception& exc) {
+       QApplication::restoreOverrideCursor();
+       INFOS(exc.what());
+       SUIT_MessageBox::warn1
+         (GetDesktop(theModule), QObject::tr("WRN_VISU"),
+          QObject::tr("ERR_CANT_CREATE_ACTOR") + ": pammy6 " + QObject::tr(exc.what()),
+          QObject::tr("BUT_OK"));
       }
     }
     return NULL;
@@ -139,8 +141,20 @@ namespace VISU
        if(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anAct)){
          if(VISU::Prs3d_i* aPrs3d = anActor->GetPrs3d()){
            if(thePrs == aPrs3d){
+             try {
+               thePrs->UpdateActors();
+             } catch (std::runtime_error& exc) {
+               INFOS(exc.what());
+               QApplication::restoreOverrideCursor();
+               SUIT_MessageBox::warn1
+                 (GetDesktop(theModule), QObject::tr("WRN_VISU"),
+                  QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": pammy7 " + QObject::tr(exc.what()),
+                  QObject::tr("BUT_OK"));
+
+               thePrs->RemoveActors();
+               return NULL;
+             }
              aResActor = anActor;
-             thePrs->UpdateActors();
              aResActor->VisibilityOn();
            }else if(theDispOnly){
              anActor->VisibilityOff();