From: jfa Date: Fri, 3 Feb 2006 13:08:23 +0000 (+0000) Subject: Fix some problems. X-Git-Tag: mergeto_trunk_07Feb06~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2728a04deb785313ca994e4617309599cbec40bb;p=modules%2Fvisu.git Fix some problems. --- diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index 90e3009f..42591ab3 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -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); diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index f5f1a2ed..3128e69f 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -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() diff --git a/src/VISUGUI/VisuGUI_Displayer.cxx b/src/VISUGUI/VisuGUI_Displayer.cxx index 380ee7f4..1fa6f098 100644 --- a/src/VISUGUI/VisuGUI_Displayer.cxx +++ b/src/VISUGUI/VisuGUI_Displayer.cxx @@ -70,7 +70,8 @@ SALOME_Prs* VisuGUI_Displayer::buildPresentation( const QString& entry, SALOME_V SVTK_Viewer* vtk_viewer = dynamic_cast( aViewFrame ); if( vtk_viewer ) { - SVTK_ViewWindow* wnd = dynamic_cast( vtk_viewer->getViewManager()->getActiveView() ); + SVTK_ViewWindow* wnd = + dynamic_cast( vtk_viewer->getViewManager()->getActiveView() ); if( wnd ) { VISU::Prs3d_i* thePrs = dynamic_cast( VISU::GetServant( anObj ).in() ); @@ -85,7 +86,8 @@ SALOME_Prs* VisuGUI_Displayer::buildPresentation( const QString& entry, SALOME_V SPlot2d_Viewer* plot_viewer = dynamic_cast( aViewFrame ); if( plot_viewer ) { - Plot2d_ViewWindow* wnd = dynamic_cast( plot_viewer->getViewManager()->getActiveView() ); + Plot2d_ViewWindow* wnd = + dynamic_cast( plot_viewer->getViewManager()->getActiveView() ); if( !wnd ) return 0; diff --git a/src/VISUGUI/VisuGUI_Prs3dTools.h b/src/VISUGUI/VisuGUI_Prs3dTools.h index a832fbb5..ab12f335 100644 --- a/src/VISUGUI/VisuGUI_Prs3dTools.h +++ b/src/VISUGUI/VisuGUI_Prs3dTools.h @@ -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(theModule)){ aViewWindow->getRenderer()->ResetCameraClippingRange(); diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 1259dbee..970ef604 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -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")); } } } diff --git a/src/VISUGUI/VisuGUI_ViewTools.h b/src/VISUGUI/VisuGUI_ViewTools.h index 49500541..d70ee509 100644 --- a/src/VISUGUI/VisuGUI_ViewTools.h +++ b/src/VISUGUI/VisuGUI_ViewTools.h @@ -98,7 +98,7 @@ namespace VISU typedef typename TViewer::TViewWindow TView; if(TView* aView = GetViewWindow(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(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();