#-------------------------------------------------------------------------
#Close
-msgid "FILTER_BUT_CLOSE"
-msgstr "&Close"
+msgid "FILTER_BUT_CANCEL"
+msgstr "&Cancel"
+
+#Help
+msgid "FILTER_BUT_OK"
+msgstr "&Ok"
#Help
msgid "FILTER_BUT_HELP"
{
MESSAGE("command " << theCommandID << " activated");
- try {
- SelectParams *filter = new SelectParams(this,_sel);
- }
- catch ( SALOME_Exception& S_ex ) {
+ if(_sel){
+ SelectParams *filter;
+ try {
+ filter = new SelectParams(this,_sel);
+ filter->exec();
+ _sel = NULL;
+ }
+ catch ( SALOME_Exception& S_ex ) {
+ }
}
+ else
+ MESSAGE("Select an input Field in MED file before filtering!!");
break;
}
case 111:
filtersList,
tr("FILTER_MEN_IMPORT"),
true);
- if (!file.isEmpty() )
+ if (!file.isEmpty() ){
_sel = new SelectField(this,file);
+ if ( _sel->exec() == QDialog::Rejected ){
+ delete _sel;
+ _sel = NULL;
+ }
+ }
break;
}
SelectField::SelectField(FilterGUI* theModule,const QString& file,
const char* name,
bool modal, WFlags fl)
- : QDialog(FILTER::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
+ : QDialog(FILTER::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
myFilterGUI( theModule ),
_file(file),
_mesh(0),
_buttonHelp = new QPushButton(_GroupButtons, "buttonHelp");
_buttonHelp->setText(tr("FILTER_BUT_HELP" ));
_buttonHelp->setAutoDefault(TRUE);
- _GroupButtonsLayout->addWidget(_buttonHelp, 0, 1);
- _buttonClose = new QPushButton(_GroupButtons, "buttonClose");
- _buttonClose->setText(tr("FILTER_BUT_CLOSE" ));
- _buttonClose->setAutoDefault(TRUE);
- _GroupButtonsLayout->addWidget(_buttonClose, 0, 0);
+ _GroupButtonsLayout->addWidget(_buttonHelp, 0, 2);
+ _buttonCancel = new QPushButton(_GroupButtons, "buttonClose");
+ _buttonCancel->setText(tr("FILTER_BUT_CANCEL" ));
+ _buttonCancel->setAutoDefault(TRUE);
+ _GroupButtonsLayout->addWidget(_buttonCancel, 0, 1);
+ _buttonOk = new QPushButton(_GroupButtons, "buttonOk");
+ _buttonOk->setText(tr("FILTER_BUT_OK" ));
+ _buttonOk->setAutoDefault(TRUE);
+ _GroupButtonsLayout->addWidget(_buttonOk, 0, 0);
_myGroupLayout->addWidget( _GroupButtons, row, 0 );
row++;
connect( _myList, SIGNAL(clicked(QListViewItem *)), this, SLOT(fieldSelected(QListViewItem *)));
connect( _mySlider, SIGNAL(sliderReleased()), this, SLOT(tsSelected()));
- connect(_buttonClose, SIGNAL(clicked()), this, SLOT(ClickOnClose()));
+ connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
+ connect(_buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(_buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
- this->show(); /* displays Dialog */
}
SelectField::~SelectField()
MESSAGE("Time step " << _ts );
}
-void SelectField::ClickOnClose()
+void SelectField::ClickOnOk()
+{
+ MESSAGE("click on Ok");
+ accept();
+}
+
+void SelectField::ClickOnCancel()
{
MESSAGE("click on Cancel");
reject();
protected slots:
virtual void fieldSelected(QListViewItem *lvi);
virtual void tsSelected();
- virtual void ClickOnClose();
+ virtual void ClickOnOk();
+ virtual void ClickOnCancel();
virtual void ClickOnHelp();
private:
QListView *_myList;
QLabel *_myLab;
QSlider *_mySlider;
- QPushButton* _buttonClose, * _buttonHelp;
+ QPushButton* _buttonCancel, * _buttonHelp, * _buttonOk;
::MEDMEM::MED *_med;
};
SelectParams::SelectParams(FilterGUI* theModule,SelectField *sel,
const char* name,
bool modal, WFlags fl)
- : QDialog(FILTER::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), _size(1024)
+ : QDialog(FILTER::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), _size(1024),_sel(sel)
{
- // Allocate histogram arrays
- _x = new double[_size];
- _y = new double[_size];
-
if(sel){
+
// read reference field values
::MEDMEM::MED *med = sel->getMED();
_inputMesh = sel->getMesh();
_inputField = sel->getField();
_inputTS = sel->getTimeStep();
+
// if no reference field selection: throw exception
if( _inputMesh.isNull() || _inputField.isNull() ){
MESSAGE("Select an input Field in MED file before filtering!!");
+ delete sel;
throw SALOME_Exception("Salome Exception");
}
throw SALOME_Exception("Salome Exception");
}
+ // Allocate histogram arrays
+ _x = new double[_size];
+ _y = new double[_size];
+
}
SelectParams::~SelectParams()
delete _myDField->getSupport();
delete _myDField;
}
+ delete _sel;
}
void SelectParams::buildFrame()
_buttonHelp->setText(tr("FILTER_BUT_HELP" ));
_buttonHelp->setAutoDefault(TRUE);
_GroupButtonsLayout->addWidget(_buttonHelp, 0, 2);
- _buttonClose = new QPushButton(_GroupButtons, "buttonClose");
- _buttonClose->setText(tr("FILTER_BUT_CLOSE" ));
- _buttonClose->setAutoDefault(TRUE);
- _GroupButtonsLayout->addWidget(_buttonClose, 0, 1);
+ _buttonCancel = new QPushButton(_GroupButtons, "buttonCancel");
+ _buttonCancel->setText(tr("FILTER_BUT_CANCEL" ));
+ _buttonCancel->setAutoDefault(TRUE);
+ _GroupButtonsLayout->addWidget(_buttonCancel, 0, 1);
_myGroupLayout->addWidget( _GroupButtons, row, 0 );
_GroupButtons->setDisabled(true);
row++;
connect( _myPlot, SIGNAL(plotMouseMoved(const QMouseEvent &)), this, SLOT(moveThresh(const QMouseEvent &)));
connect( _myOFB, SIGNAL(clicked()), this, SLOT(getOutFileName()));
connect( _myProc, SIGNAL(clicked()), this, SLOT(process()));
- connect(_buttonClose, SIGNAL(clicked()), this, SLOT(ClickOnClose()));
+ connect(_buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
connect(_buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
_GroupC2->setMinimumSize( 500, 500 );
_GroupC2->setMaximumSize( 500, 500 );
setMinimumSize( 750, 500 );
setMaximumSize( 750, 500 );
- this->show(); /* displays Dialog */
+// this->show(); /* displays Dialog */
}
void SelectParams::enterSHisto()
// have to call ensight driver MED to generate output MED file from filtoo output
+ // close the window
+ accept();
+
}
void SelectParams::calcRateRed()
int i1, i2, i;
int atot=0, asel=0, atot1;
double rateRed=0.0;
- char strth[128];
// calculate reduction rate depend on reference area defined by threshold values
i1 = (int)((double)_size * ( _fthresh - _xmin ) / ( _xmax - _xmin ));
}
-void SelectParams::ClickOnClose()
+void SelectParams::ClickOnCancel()
{
MESSAGE("click on Cancel");
reject();
virtual void moveThresh(const QMouseEvent &e);
virtual void getOutFileName();
virtual void process();
- virtual void ClickOnClose();
+ virtual void ClickOnCancel();
virtual void ClickOnHelp();
private:
QButtonGroup *_myHSize, *_myFunc, *_myFScale, *_myNbThresh, *_myArea, *_myVThresh, *_myOutFile;
QGridLayout *_myGroupLayout, *_myGroupLayout2, *_lay, *_GroupButtonsLayout;
QRadioButton *_myCutNeg, *_myInt, *_myExt, *_myOneThresh, *_myTwoThresh, *_myFieldB, *_myLinear, *_myLog;
- QPushButton *_myHisto, *_myOFB, *_myProc, * _buttonClose, * _buttonHelp;
+ QPushButton *_myHisto, *_myOFB, *_myProc, * _buttonCancel, * _buttonHelp;
QGroupBox* _GroupC1, *_GroupC2, *_GroupButtons;
QwtPlot *_myPlot;
QLabel *_myLSH, *_myLFT, *_myLST, *_myLRR;
FIELD<double> * _myDField;
FIELD<int> * _myIField;
int _inputTS;
+ SelectField *_sel;
};