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(128)
+ : 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()
_myGroupLayout->addWidget( _myFunc, row, 0 );
row++;
+ // 01) histogram size (line edit)
+ _myHSize = new QButtonGroup( tr(""), _GroupC1 );
+ _myHSize->setExclusive( true );
+ _myHSize->setColumnLayout( 0, Qt::Horizontal );
+ QGridLayout* shLay = new QGridLayout( _myHSize->layout() );
+ shLay->addWidget( _myLSH = new QLabel( tr("FILTER_SIZE_HISTO") , _myHSize ), 0, 0 );
+ shLay->addWidget( _myLESH = new QLineEdit( "1024", _myHSize ), 0, 1 );
+ _myGroupLayout->addWidget( _myHSize, row, 0 );
+ row++;
+
// 1) display histogram button (pushbutton)
_myHisto = new QPushButton( "", _GroupC1 );
_myHisto->setText(tr("FILTER_DISPLAY_HISTO"));
_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++;
_myHistoSThresh = _myPlot->insertCurve( QString() );
_myPlot->setCurvePen( _myHistoSThresh, QPen( Qt::black, 1 ) );
+ connect( _myLESH, SIGNAL(returnPressed()), this, SLOT(enterSHisto()));
connect( _myHisto, SIGNAL(clicked()), this, SLOT(updateHisto()));
connect( _myLinear, SIGNAL(clicked()), this, SLOT(scaleSelected()));
connect( _myLog, SIGNAL(clicked()), this, SLOT(scaleSelected()));
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()
+{
+ // Deallocate old histogram arrays
+ delete _x;
+ delete _y;
+
+ // get new histogram size
+ _size = atoi(_myLESH->text());
+
+ // Allocate new histogram arrays
+ _x = new double[_size];
+ _y = new double[_size];
}
void SelectParams::scaleSelected()
void SelectParams::displayHisto()
{
+ // associate values to curve
+ _myPlot->setCurveData( _myHistoCurve, _x, _y, _size );
// give extrema values for each axis
_myPlot->setAxisScale( _myPlot->curveXAxis( _myHistoCurve ), _xmin, _xmax );
_myPlot->setAxisScale( _myPlot->curveYAxis( _myHistoCurve ), _ymin, _ymax );
- // associate values to curve
- _myPlot->setCurveData( _myHistoCurve, _x, _y, _size );
if( _myLinear->isChecked() )
_myPlot->setAxisOptions(_myPlot->curveYAxis( _myHistoCurve ), QwtAutoScale::None );
else
// 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();