From 08a21c0af52971366dd5e6fea45c62a28d1337eb Mon Sep 17 00:00:00 2001 From: jfa Date: Fri, 14 Oct 2005 13:18:29 +0000 Subject: [PATCH] Fix for bug 9808: SIGFPE at Cut Lines edition --- src/OBJECT/VISU_Actor.cxx | 19 +++++++++++-------- src/VISUGUI/VisuGUI_Tools.cxx | 11 ++++++++--- src/VISU_I/VISU_Prs3d_i.cc | 17 ++++++++++++++++- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index ac8298d3..e38b8cd3 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -114,14 +114,17 @@ void VISU_Actor::SetPipeLine(VISU_PipeLine* thePipeLine) { this->Modified(); vtkMapper *aMapper = myPipeLine->GetMapper(); 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"); + + //This code has been moved into VISU::Prs3d_i::UpdateActor() for bug 9808 + //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"); + //Bug SAL4221: Mesh with less than 10 cells : shrink mode disable //SetShrinkable(aDataSet->GetNumberOfCells() > 10); SetShrinkable(thePipeLine->IsShrinkable()); diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index ca94e272..208b8a1a 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -652,7 +652,7 @@ namespace VISU }catch(std::exception& exc){ SUIT_MessageBox::warn1(GetDesktop(theModule), QObject::tr("WRN_VISU"), - QObject::tr("ERR_CANT_CREATE_ACTOR"), + QObject::tr("ERR_CANT_CREATE_ACTOR") + ": " + QObject::tr(exc.what()), QObject::tr("BUT_OK")); } QApplication::restoreOverrideCursor(); @@ -758,6 +758,7 @@ namespace VISU VISU::Prs3d_i* thePrs) { QApplication::setOverrideCursor(Qt::waitCursor); + bool isPublished = false; SALOMEDS::SObject_var aSObject = thePrs->GetSObject(); CORBA::String_var anEntry = aSObject->GetID(); @@ -769,6 +770,7 @@ namespace VISU for (int i = 0, iEnd = aViewWindows.size(); i < iEnd; i++) { SVTK_ViewWindow* aView = aViewWindows[i]; if (VISU_Actor* anActor = FindActor(aView, anEntry.in())) { + isPublished = true; thePrs->UpdateActor(anActor); } } @@ -776,7 +778,7 @@ namespace VISU INFOS(ex.what()); QApplication::restoreOverrideCursor(); SUIT_MessageBox::warn1 (GetDesktop(theModule), QObject::tr("WRN_VISU"), - QObject::tr("ERR_CANT_BUILD_PRESENTATION") + " " + QObject::tr(ex.what()), + QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(ex.what()), QObject::tr("BUT_OK")); TViewWindows aViewWindows = GetViews(theModule); @@ -790,6 +792,9 @@ namespace VISU return; } QApplication::restoreOverrideCursor(); + + if (!isPublished) + PublishInView(theModule, thePrs); } static bool ComputeVisiblePropBounds(SVTK_ViewWindow* theViewWindow, @@ -1167,7 +1172,7 @@ namespace VISU INFOS(exc.what()); SUIT_MessageBox::warn1 (GetDesktop(theModule), QObject::tr("WRN_VISU"), - QObject::tr("ERR_CANT_CREATE_ACTOR") + " " + QObject::tr(exc.what()), + QObject::tr("ERR_CANT_CREATE_ACTOR") + ": " + QObject::tr(exc.what()), QObject::tr("BUT_OK")); } } diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index 5e39d80e..7838834f 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -108,7 +108,22 @@ void VISU::Prs3d_i::CreateActor(VISU_Actor* theActor, const Handle(SALOME_Intera void VISU::Prs3d_i::UpdateActor(VISU_Actor* theActor) { if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor() - this = "<GetMapper()->ShallowCopy(myPipeLine->GetMapper()); + + // fix for bug 9808 BEGIN + vtkMapper *aMapper = myPipeLine->GetMapper(); + vtkDataSet *aDataSet = aMapper->GetInput(); + if (!aDataSet) + throw std::runtime_error("There is no input data !!!"); + aDataSet->Update(); + static float eps = VTK_LARGE_FLOAT * 0.1 ; + if (!aDataSet->GetNumberOfCells()) + throw std::runtime_error("There is no visible elements"); + if (aDataSet->GetLength() > eps) + throw std::runtime_error("Diagonal of the actor is too large !!!"); + // fix for bug 9808 END + + //theActor->GetMapper()->ShallowCopy(myPipeLine->GetMapper()); + theActor->GetMapper()->ShallowCopy(aMapper); theActor->SetPosition(myOffset); theActor->Modified(); } -- 2.39.2