CRASH after calling "ApplyProperties()".
* 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);
};
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 );
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 );
tr("BUT_OK"));
onClose();
}else{
- myResult->SetBuildFields( myBuildFieldsCheckBox->isChecked(), true );
+ myResult->SetBuildFields( myBuildFieldsCheckBox->isChecked(), myBuildMinMaxCheckBox->isChecked() );
myResult->SetBuildGroups( myBuildGroupsCheckBox->isChecked() );
//setModal( false );
bool isGroupsDone = myResult->IsGroupsDone();
updateButton( myBuildEntitiesButton, isEntitiesDone );
- updateButton( myBuildFieldsButton, isFieldsDone && isMinMaxDone);
+ updateButton( myBuildFieldsButton, isFieldsDone );
+ updateButton( myBuildMinMaxButton, isMinMaxDone );
updateButton( myBuildGroupsButton, isGroupsDone );
}
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 );
QCheckBox* myBuildFieldsCheckBox;
QPushButton* myBuildFieldsButton;
+ QCheckBox* myBuildMinMaxCheckBox;
+ QPushButton* myBuildMinMaxButton;
+
QCheckBox* myBuildGroupsCheckBox;
QPushButton* myBuildGroupsButton;
TDialog* aDlg = new TDialog(theModule);
TPrs3d* aPrs3d = dynamic_cast<TPrs3d*>(theData.myPrs[0]);
aDlg->initFromPrsObject(aPrs3d, true);
- if (aDlg->exec() && aDlg->storeToPrsObject(dynamic_cast<TPrs3d*>(theData.myPrs[0]))) {
+ if (aDlg->exec() && aDlg->storeToPrsObject(dynamic_cast<TPrs3d*>(aPrs3d))) {
for (long aFrameId = 1; aFrameId < theData.myNbFrames; aFrameId++){
- VISU::ColoredPrs3d_i* aPrs3d = theData.myPrs[aFrameId];
- aPrs3d->SameAs(theData.myPrs[0]);
+ VISU::ColoredPrs3d_i* aColoredPrs3d = theData.myPrs[aFrameId];
+ aColoredPrs3d->SameAs(aPrs3d);
}
if ( theAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE ) {
for (int aFieldId = 1; aFieldId < theAnimator->getNbFields(); aFieldId++) {
FieldData& aFieldData = theAnimator->getFieldData(aFieldId);
for (long aFrameId = 0; aFrameId < aFieldData.myNbFrames; aFrameId++) {
- VISU::ColoredPrs3d_i* aPrs3d = aFieldData.myPrs[aFrameId];
- std::string aTitle = aPrs3d->GetCTitle();
- aPrs3d->SameAs(theData.myPrs[0]);
- aPrs3d->SetTitle(aTitle.c_str());
+ VISU::ColoredPrs3d_i* aColoredPrs3d = aFieldData.myPrs[aFrameId];
+ std::string aTitle = aColoredPrs3d->GetCTitle();
+ aColoredPrs3d->SameAs(aPrs3d);
+ aColoredPrs3d->SetTitle(aTitle.c_str());
}
}
}
//---------------------------------------------------------------
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
//---------------------------------------------------------------
struct TSimpleMinMaxController: virtual TVTKMinMaxController
{
+ VISU::Result_i* myResult;
VISU::PField myField;
- TSimpleMinMaxController(VISU::PField theField)
- {
- myField = theField;
- }
+ TSimpleMinMaxController(VISU::ColoredPrs3d_i* theColoredPrs3d):
+ myResult(theColoredPrs3d->GetCResult()),
+ 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);
GetComponentMax(vtkIdType theCompID)
{
if(myField){
- TMinMax aMinMax = myField->GetMinMax(theCompID);
+ TMinMax aMinMax = GetMinMax(myResult, myField, theCompID);
return aMinMax.second;
}
return TMinMaxController::GetComponentMax(theCompID);
PMinMaxController
CreateDefaultMinMaxController(VISU::ColoredPrs3d_i* theColoredPrs3d)
{
- PField aField = theColoredPrs3d->GetScalarField();
- return PMinMaxController(new TSimpleMinMaxController(aField));
+ return PMinMaxController(new TSimpleMinMaxController(theColoredPrs3d));
}
if(PMinMaxController aMinMaxController = GetMinMaxController())
return aMinMaxController->GetComponentMin(theCompID);
- TMinMax aTMinMax = GetField()->GetMinMax(theCompID);
+ TMinMax aTMinMax = GetMinMax(GetCResult(), GetField(), theCompID);
return aTMinMax.first;
}
if(PMinMaxController aMinMaxController = GetMinMaxController())
return aMinMaxController->GetComponentMax(theCompID);
- TMinMax aTMinMax = GetField()->GetMinMax(theCompID);
+ TMinMax aTMinMax = GetMinMax(GetCResult(), GetField(), theCompID);
return aTMinMax.second;
}
#include "SALOMEDSClient_AttributeName.hxx"
#include "CASCatch.hxx"
+#include "Utils_ExceptHandlers.hxx"
+
#include <qpixmap.h>
#include <qimage.h>
#include <qstrlist.h>
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<VISU::ColoredPrs3d_i*>(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 == VISU::Animation::PARALLEL ) { // 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->GetCResult() != aData.myPrs[0]->GetCResult() )
- 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;
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]->SameAs(aPrs_i);