From: apo Date: Fri, 21 Sep 2007 08:08:26 +0000 (+0000) Subject: Fix for Bug IPAL17020 X-Git-Tag: T_24092007~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c1e2a4190f9c434ef7daab516aa80fd99c68fa6e;p=modules%2Fvisu.git Fix for Bug IPAL17020 CRASH after calling "ApplyProperties()". --- diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index e9abf00f..ac0d71b7 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -1426,7 +1426,8 @@ module VISU { * 5) the field name is not the same; * 6) the entity is not the same. */ - void ApplyProperties(in long theFieldNum, in ColoredPrs3d thePrs); + void ApplyProperties(in long theFieldNum, in ColoredPrs3d thePrs) + raises (SALOME::SALOME_Exception); }; /*! \brief Interface %Result diff --git a/src/PIPELINE/VISUPipeLine.cxx b/src/PIPELINE/VISUPipeLine.cxx index 7c93e0c9..5bd01b4a 100644 --- a/src/PIPELINE/VISUPipeLine.cxx +++ b/src/PIPELINE/VISUPipeLine.cxx @@ -56,7 +56,7 @@ typedef VISU_DeformedShapePL TPresent; using namespace std; -static int isOnlyMesh = false; +static int isOnlyMesh = true; int main(int argc, char** argv){ try{ diff --git a/src/PIPELINE/VISU_MeshPL.cxx b/src/PIPELINE/VISU_MeshPL.cxx index e08b3413..027e60d5 100644 --- a/src/PIPELINE/VISU_MeshPL.cxx +++ b/src/PIPELINE/VISU_MeshPL.cxx @@ -33,6 +33,7 @@ #include #include #include +#include vtkStandardNewMacro(VISU_MeshPL); @@ -43,6 +44,9 @@ VISU_MeshPL::VISU_MeshPL() void VISU_MeshPL::Build() { + //VTKViewer_GeometryFilter* aFilter = VTKViewer_GeometryFilter::New(); + //aFilter->SetInput(GetClippedInput()); + //myMapper->SetInput(aFilter->GetOutput()); myMapper->SetInput(GetClippedInput()); } diff --git a/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx b/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx index e96c89c9..c1c9988d 100644 --- a/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx +++ b/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx @@ -129,6 +129,14 @@ VisuGUI_BuildProgressDlg::VisuGUI_BuildProgressDlg( QWidget* theParent ): myBuildFieldsButton->setPaletteBackgroundColor( Qt::red ); connect( myBuildFieldsCheckBox, SIGNAL( clicked() ), this, SLOT( onBuildCheckBoxClicked() ) ); + myBuildMinMaxCheckBox = new QCheckBox( tr( "BUILD_MINMAX" ), myProgressBox ); + myBuildMinMaxCheckBox->setChecked( aResourceMgr->booleanValue( "VISU", "build_min_max", true ) ); + myBuildMinMaxButton = new QPushButton( myProgressBox ); + myBuildMinMaxButton->setEnabled( false ); + myBuildMinMaxButton->setFixedSize( 30, 30 ); + myBuildMinMaxButton->setPaletteBackgroundColor( Qt::red ); + connect( myBuildMinMaxCheckBox, SIGNAL( clicked() ), this, SLOT( onBuildCheckBoxClicked() ) ); + myBuildGroupsCheckBox = new QCheckBox( tr( "BUILD_GROUPS" ), myProgressBox ); myBuildGroupsCheckBox->setChecked( aResourceMgr->booleanValue( "VISU", "build_groups", true ) ); myBuildGroupsButton = new QPushButton( myProgressBox ); @@ -141,8 +149,10 @@ VisuGUI_BuildProgressDlg::VisuGUI_BuildProgressDlg( QWidget* theParent ): aProgressLayout->addWidget( myBuildEntitiesButton, 0, 1 ); aProgressLayout->addWidget( myBuildFieldsCheckBox, 1, 0 ); aProgressLayout->addWidget( myBuildFieldsButton, 1, 1 ); - aProgressLayout->addWidget( myBuildGroupsCheckBox, 2, 0 ); - aProgressLayout->addWidget( myBuildGroupsButton, 2, 1 ); + aProgressLayout->addWidget( myBuildMinMaxCheckBox, 2, 0 ); + aProgressLayout->addWidget( myBuildMinMaxButton, 2, 1 ); + aProgressLayout->addWidget( myBuildGroupsCheckBox, 3, 0 ); + aProgressLayout->addWidget( myBuildGroupsButton, 3, 1 ); // Time myTimeBox = new QGroupBox( tr( "IMPORT_TIME" ), this ); @@ -222,7 +232,7 @@ void VisuGUI_BuildProgressDlg::onStart() tr("BUT_OK")); onClose(); }else{ - myResult->SetBuildFields( myBuildFieldsCheckBox->isChecked(), true ); + myResult->SetBuildFields( myBuildFieldsCheckBox->isChecked(), myBuildMinMaxCheckBox->isChecked() ); myResult->SetBuildGroups( myBuildGroupsCheckBox->isChecked() ); //setModal( false ); @@ -303,7 +313,8 @@ void VisuGUI_BuildProgressDlg::onTimer() bool isGroupsDone = myResult->IsGroupsDone(); updateButton( myBuildEntitiesButton, isEntitiesDone ); - updateButton( myBuildFieldsButton, isFieldsDone && isMinMaxDone); + updateButton( myBuildFieldsButton, isFieldsDone ); + updateButton( myBuildMinMaxButton, isMinMaxDone ); updateButton( myBuildGroupsButton, isGroupsDone ); } @@ -389,6 +400,14 @@ void VisuGUI_BuildProgressDlg::onBuildCheckBoxClicked() else if( aCheckBox == myBuildFieldsCheckBox ) { myBuildFieldsButton->setPaletteBackgroundColor( aColor ); + if( !anIsChecked && myBuildMinMaxCheckBox->isChecked() ) + myBuildMinMaxCheckBox->animateClick(); + } + else if( aCheckBox == myBuildMinMaxCheckBox ) + { + myBuildMinMaxButton->setPaletteBackgroundColor( aColor ); + if( anIsChecked && !myBuildFieldsCheckBox->isChecked() ) + myBuildFieldsCheckBox->animateClick(); } else if( aCheckBox == myBuildGroupsCheckBox ) myBuildGroupsButton->setPaletteBackgroundColor( aColor ); diff --git a/src/VISUGUI/VisuGUI_BuildProgressDlg.h b/src/VISUGUI/VisuGUI_BuildProgressDlg.h index 3eb7c1a1..8284c52d 100644 --- a/src/VISUGUI/VisuGUI_BuildProgressDlg.h +++ b/src/VISUGUI/VisuGUI_BuildProgressDlg.h @@ -95,6 +95,9 @@ private: QCheckBox* myBuildFieldsCheckBox; QPushButton* myBuildFieldsButton; + QCheckBox* myBuildMinMaxCheckBox; + QPushButton* myBuildMinMaxButton; + QCheckBox* myBuildGroupsCheckBox; QPushButton* myBuildGroupsButton; diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index b0da6dab..8e94b809 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -48,6 +48,19 @@ static int MYDEBUG = 0; namespace VISU { + //--------------------------------------------------------------- + inline + TMinMax + GetMinMax(VISU::Result_i* theResult, + VISU::PField theField, + vtkIdType theCompID) + { + if(!theResult->IsMinMaxDone()) + theResult->GetInput()->BuildMinMax(); + + return theField->GetMinMax(theCompID); + } + //--------------------------------------------------------------- vtkFloatingPointType TMinMaxController @@ -69,19 +82,20 @@ namespace VISU //--------------------------------------------------------------- struct TSimpleMinMaxController: virtual TVTKMinMaxController { + VISU::Result_i* myResult; VISU::PField myField; - TSimpleMinMaxController(VISU::PField theField) - { - myField = theField; - } + TSimpleMinMaxController(VISU::ColoredPrs3d_i* theColoredPrs3d): + myResult(theColoredPrs3d->GetResult()), + myField(theColoredPrs3d->GetField()) + {} virtual vtkFloatingPointType GetComponentMin(vtkIdType theCompID) { if(myField){ - TMinMax aMinMax = myField->GetMinMax(theCompID); + TMinMax aMinMax = GetMinMax(myResult, myField, theCompID); return aMinMax.first; } return TMinMaxController::GetComponentMin(theCompID); @@ -92,7 +106,7 @@ namespace VISU GetComponentMax(vtkIdType theCompID) { if(myField){ - TMinMax aMinMax = myField->GetMinMax(theCompID); + TMinMax aMinMax = GetMinMax(myResult, myField, theCompID); return aMinMax.second; } return TMinMaxController::GetComponentMax(theCompID); @@ -104,8 +118,7 @@ namespace VISU PMinMaxController CreateDefaultMinMaxController(VISU::ColoredPrs3d_i* theColoredPrs3d) { - PField aField = theColoredPrs3d->GetField(); - return PMinMaxController(new TSimpleMinMaxController(aField)); + return PMinMaxController(new TSimpleMinMaxController(theColoredPrs3d)); } @@ -358,7 +371,7 @@ VISU::ColoredPrs3d_i if(PMinMaxController aMinMaxController = GetMinMaxController()) return aMinMaxController->GetComponentMin(theCompID); - TMinMax aTMinMax = GetField()->GetMinMax(theCompID); + TMinMax aTMinMax = GetMinMax(GetResult(), GetField(), theCompID); return aTMinMax.first; } @@ -370,7 +383,7 @@ VISU::ColoredPrs3d_i if(PMinMaxController aMinMaxController = GetMinMaxController()) return aMinMaxController->GetComponentMax(theCompID); - TMinMax aTMinMax = GetField()->GetMinMax(theCompID); + TMinMax aTMinMax = GetMinMax(GetResult(), GetField(), theCompID); return aTMinMax.second; } diff --git a/src/VISU_I/VISU_Gen_i.hh b/src/VISU_I/VISU_Gen_i.hh index bc52199c..462a7c59 100644 --- a/src/VISU_I/VISU_Gen_i.hh +++ b/src/VISU_I/VISU_Gen_i.hh @@ -33,8 +33,6 @@ #include -UNEXPECT_CATCH(SalomeException, SALOME::SALOME_Exception); - namespace VISU { class Result_i; @@ -194,7 +192,7 @@ namespace VISU bool theAddToStudy = true) throw (SALOME::SALOME_Exception) { - Unexpect aCatch(SalomeException); + Unexpect aCatch(SALOME_SalomeException); typedef typename TPrs3d_i::TInterface TPrs3d; typename TPrs3d::_var_type aPrs3d; if(TPrs3d_i* aPrs3d = CreatePrs3d(theResult,theMeshName,theEntity,theFieldName,theIteration,theAddToStudy)) diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index fce481f9..5cd923b0 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -58,6 +58,8 @@ #include "SALOMEDSClient_AttributeString.hxx" #include "SALOMEDSClient_AttributeName.hxx" +#include "Utils_ExceptHandlers.hxx" + #include #include #include @@ -1781,19 +1783,24 @@ void VISU_TimeAnimation::onViewDeleted() void VISU_TimeAnimation::ApplyProperties(CORBA::Long theFieldNum, VISU::ColoredPrs3d_ptr thePrs) throw (SALOME::SALOME_Exception) { + Unexpect aCatch(SALOME_SalomeException); + VISU::ColoredPrs3d_i* aPrs_i = dynamic_cast(GetServant(thePrs).in()); if ( !aPrs_i ) - throw SALOME_Exception(LOCALIZED("Error : invalid dynamic cast of the given presentation to VISU::ColoredPrs3d_i")); + THROW_SALOME_CORBA_EXCEPTION("Error : invalid dynamic cast of the given presentation to VISU::ColoredPrs3d_i", + SALOME::INTERNAL_ERROR); if ( myAnimationMode == 0 ) { // parallel animation mode FieldData& aData = myFieldsLst[theFieldNum]; if ( aData.myPrs.empty() ) - throw SALOME_Exception(LOCALIZED("Error : presentations for the given field is not yet created!")); + THROW_SALOME_CORBA_EXCEPTION("Error : presentations for the given field is not yet created!", + SALOME::INTERNAL_ERROR); if ( aPrs_i->GetResult() != aData.myPrs[0]->GetResult() ) - throw SALOME_Exception(LOCALIZED("Error : the MED file is not the same!")); + THROW_SALOME_CORBA_EXCEPTION("Error : the MED file is not the same!", + SALOME::INTERNAL_ERROR); for (int i = 0; i < aData.myNbFrames; i++) { bool anIsFixedRange = false; @@ -1812,7 +1819,8 @@ void VISU_TimeAnimation::ApplyProperties(CORBA::Long theFieldNum, VISU::ColoredP FieldData& aData = myFieldsLst[f]; if ( aData.myPrs.empty() ) - throw SALOME_Exception(LOCALIZED("Error : presentations for the given field is not yet created!")); + THROW_SALOME_CORBA_EXCEPTION("Error : presentations for the given field is not yet created!", + SALOME::INTERNAL_ERROR); for (int i = 0; i < aData.myNbFrames; i++) { aData.myPrs[i]->SameAsParams(aPrs_i,