]> SALOME platform Git repositories - modules/multipr.git/blob - src/MULTIPRGUI/MULTIPR_GUI_Dlg.cxx
Salome HOME
*** empty log message ***
[modules/multipr.git] / src / MULTIPRGUI / MULTIPR_GUI_Dlg.cxx
1 // Project MULTIPR, IOLS WP1.2.1 - EDF/CS
2 // Partitioning/decimation module for the SALOME v3.2 platform
3
4 /**
5  * \file    MULTIPR_GUI_Dlg.cxx
6  *
7  * \brief   see MULTIPR_GUI_Dlg.h
8  *
9  * \author  Olivier LE ROUX - CS, Virtual Reality Dpt
10  * 
11  * \date    01/2007
12  */
13   
14 //*****************************************************************************
15 // Includes section
16 //*****************************************************************************
17
18 #include "MULTIPR_GUI_Dlg.h"
19 #include "MULTIPR_GUI.h"
20
21 // Salome Includes
22 #include <SUIT_MessageBox.h>
23 #include <SUIT_ResourceMgr.h>
24 #include <SUIT_Session.h>
25 #include <SalomeApp_Application.h>
26 #include <SalomeApp_CheckFileDlg.h>
27 #include <LightApp_SelectionMgr.h>
28
29 #include <SALOME_LifeCycleCORBA.hxx>
30
31 // QT Includes
32 #include <qapplication.h>
33 #include <qinputdialog.h>
34 #include <qlayout.h>
35 #include <qpushbutton.h>
36 #include <qgroupbox.h>
37 #include <qvbox.h>
38 #include <qbuttongroup.h>
39 #include <qlabel.h>
40 #include <qcombobox.h>
41 #include <qvariant.h>
42 #include <qlineedit.h>
43 #include <qspinbox.h>
44 #include <qtooltip.h>
45 #include <qwhatsthis.h>
46 #include <qimage.h>
47 #include <qpixmap.h>
48
49
50 using namespace std;
51
52
53 MULTIPR_GUI_Partition1Dlg::MULTIPR_GUI_Partition1Dlg(MULTIPR_GUI* theModule) : 
54         QDialog(
55                 theModule->application()->desktop(), 
56                 0, 
57                 false, 
58                 WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
59 {
60         mModule = theModule;
61         
62     buttonGroupProcess = new QButtonGroup( this, "buttonGroupProcess" );
63     buttonGroupProcess->setGeometry( QRect( 10, 110, 450, 60 ) );
64
65     pushButtonCancel = new QPushButton( buttonGroupProcess, "pushButtonCancel" );
66     pushButtonCancel->setGeometry( QRect( 321, 10, 110, 41 ) );
67
68     pushButtonOK = new QPushButton( buttonGroupProcess, "pushButtonOK" );
69     pushButtonOK->setGeometry( QRect( 10, 10, 110, 41 ) );
70
71     buttonGroupSelectMesh = new QButtonGroup( this, "buttonGroupSelectMesh" );
72     buttonGroupSelectMesh->setGeometry( QRect( 10, 10, 450, 91 ) );
73
74     comboBoxSelectMesh = new QComboBox( FALSE, buttonGroupSelectMesh, "comboBoxSelectMesh" );
75     comboBoxSelectMesh->setGeometry( QRect( 160, 30, 280, 40 ) );
76         MULTIPR_ORB::string_array* listMeshes = theModule->getMULTIPRObj()->getMeshes();
77         for (int i=0; i<listMeshes->length() ; i++)
78         {
79                 const char* strItem = (*listMeshes)[i];
80                 comboBoxSelectMesh->insertItem(strItem);
81         }
82         comboBoxSelectMesh->setEditable(false);
83
84     textLabelSelectMesh = new QLabel( buttonGroupSelectMesh, "textLabelSelectMesh" );
85     textLabelSelectMesh->setGeometry( QRect( 20, 30, 110, 40 ) );
86     
87         setCaption( tr( "Extract groups from sequential MED file" ) );
88     buttonGroupProcess->setTitle( QString::null );
89     pushButtonCancel->setText( tr( "Cancel" ) );
90     pushButtonOK->setText( tr("OK") );
91     buttonGroupSelectMesh->setTitle( tr( "Select mesh" ) );
92     textLabelSelectMesh->setText( tr( "Mesh name" ) );
93         
94     resize( QSize(471, 185).expandedTo(minimumSizeHint()) );
95     clearWState( WState_Polished );
96         
97         connect(pushButtonOK,     SIGNAL(clicked()), this, SLOT(accept()));
98         connect(pushButtonCancel, SIGNAL(clicked()), this, SLOT(reject()));
99 }
100
101
102 /*
103  *  Destroys the object and frees any allocated resources
104  */
105 MULTIPR_GUI_Partition1Dlg::~MULTIPR_GUI_Partition1Dlg()
106 {
107     // no need to delete child widgets, Qt does it all for us
108 }
109
110
111 void MULTIPR_GUI_Partition1Dlg::accept()
112 {
113         const char* meshName = comboBoxSelectMesh->currentText().latin1();
114         
115         try
116         {
117                 mModule->getMULTIPRObj()->setMesh(meshName);
118                 
119                 QApplication::setOverrideCursor(Qt::waitCursor);
120                 mModule->getMULTIPRObj()->partitionneDomaine();
121                 QApplication::restoreOverrideCursor();
122                 
123         }
124         catch(...)
125         {
126                 SUIT_MessageBox::error1( 
127                         mModule->getAppli()->desktop(),
128                         "Import MED file error", 
129                         "Unable to set mesh", 
130                         tr("OK") );
131         }
132
133         QDialog::accept();
134 }
135
136
137 void MULTIPR_GUI_Partition1Dlg::reject()
138 {
139         QDialog::reject();
140 }
141
142
143 MULTIPR_GUI_Partition2Dlg::MULTIPR_GUI_Partition2Dlg(MULTIPR_GUI* theModule) : 
144         QDialog(
145                 theModule->application()->desktop(), 
146                 0, 
147                 false, 
148                 WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
149 {
150         mModule = theModule;
151         
152     buttonGroupSplitParameters = new QButtonGroup( this, "buttonGroupSplitParameters" );
153     buttonGroupSplitParameters->setGeometry( QRect( 10, 10, 380, 140 ) );
154
155     textLabelSelectNbParts = new QLabel( buttonGroupSplitParameters, "textLabelSelectNbParts" );
156     textLabelSelectNbParts->setGeometry( QRect( 30, 30, 160, 31 ) );
157
158     textLabelSelectSplitter = new QLabel( buttonGroupSplitParameters, "textLabelSelectSplitter" );
159     textLabelSelectSplitter->setGeometry( QRect( 30, 80, 111, 31 ) );
160
161     comboBoxSelectSplitter = new QComboBox( FALSE, buttonGroupSplitParameters, "comboBoxSelectSplitter" );
162     comboBoxSelectSplitter->setGeometry( QRect( 210, 80, 150, 40 ) );
163         comboBoxSelectSplitter->insertItem("METIS");
164         comboBoxSelectSplitter->insertItem("SCOTCH");
165         comboBoxSelectSplitter->setEditable(false);
166
167     spinBoxNbParts = new QSpinBox( buttonGroupSplitParameters, "spinBoxNbParts" );
168     spinBoxNbParts->setGeometry( QRect( 210, 30, 150, 30 ) );
169     spinBoxNbParts->setMaxValue( 1000 );
170     spinBoxNbParts->setMinValue( 2 );
171     spinBoxNbParts->setValue( 2 );
172
173     buttonGroupProcess = new QButtonGroup( this, "buttonGroupProcess" );
174     buttonGroupProcess->setGeometry( QRect( 10, 160, 380, 60 ) );
175
176     pushButtonOK = new QPushButton( buttonGroupProcess, "pushButtonOK" );
177     pushButtonOK->setGeometry( QRect( 10, 10, 110, 41 ) );
178
179     pushButtonCancel = new QPushButton( buttonGroupProcess, "pushButtonCancel" );
180     pushButtonCancel->setGeometry( QRect( 250, 10, 110, 41 ) );
181     
182         setCaption( tr( "Split selected part" ) );
183     buttonGroupSplitParameters->setTitle( tr( "Split parameters" ) );
184     textLabelSelectNbParts->setText( tr( "Number of sub-parts" ) );
185     textLabelSelectSplitter->setText( tr( "Splitter" ) );
186     buttonGroupProcess->setTitle( QString::null );
187     pushButtonOK->setText( tr("OK") );
188     pushButtonCancel->setText( tr( "Cancel" ) );
189         
190     resize( QSize(403, 234).expandedTo(minimumSizeHint()) );
191     clearWState( WState_Polished );
192         
193         connect(pushButtonOK,     SIGNAL(clicked()), this, SLOT(accept()));
194         connect(pushButtonCancel, SIGNAL(clicked()), this, SLOT(reject()));
195 }
196
197
198 /*
199  *  Destroys the object and frees any allocated resources
200  */
201 MULTIPR_GUI_Partition2Dlg::~MULTIPR_GUI_Partition2Dlg()
202 {
203     // no need to delete child widgets, Qt does it all for us
204 }
205
206
207 void MULTIPR_GUI_Partition2Dlg::accept()
208 {
209         const char* strSplitter = comboBoxSelectSplitter->currentText().latin1();
210         int nbParts = spinBoxNbParts->value();
211         int partitionner = -1;
212         if (strcmp(strSplitter, "METIS") == 0)
213         {
214                 partitionner = 0;
215         }
216         else if (strcmp(strSplitter, "SCOTCH") == 0)
217         {
218                 partitionner = 1;
219         }
220         
221         QApplication::setOverrideCursor(Qt::waitCursor);
222         
223         try
224         {
225                 const QStringList& partsList = mModule->getSelectedParts();
226                 for (QStringList::const_iterator it = partsList.begin(), last = partsList.end(); it != last; it++)
227                 {
228                         const QString& partName = (*it);
229                         cout << "Split " << partName.latin1() << " #parts=" << nbParts << " splitter=" << strSplitter << endl;
230                         mModule->getMULTIPRObj()->partitionneGrain(partName.latin1(), nbParts, partitionner);
231                 }
232                 
233         }
234         catch(...)
235         {
236                 SUIT_MessageBox::error1( 
237                         mModule->getAppli()->desktop(),
238                         "Split error", 
239                         "Error while splitting selected part(s)", 
240                         tr("OK") );
241         }
242         
243         QApplication::restoreOverrideCursor();
244         QDialog::accept();
245 }
246
247
248 void MULTIPR_GUI_Partition2Dlg::reject()
249 {
250         QDialog::reject();
251 }
252
253
254 MULTIPR_GUI_DecimateDlg::MULTIPR_GUI_DecimateDlg(MULTIPR_GUI* theModule) :
255         QDialog(
256                 theModule->application()->desktop(), 
257                 0, 
258                 false, 
259                 WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
260 {
261         mModule = theModule;
262         
263     buttonGroupSelectField = new QButtonGroup( this, "buttonGroupSelectField" );
264     buttonGroupSelectField->setGeometry( QRect( 10, 10, 450, 140 ) );
265
266     textLabelSelectFieldName = new QLabel( buttonGroupSelectField, "textLabelSelectFieldName" );
267     textLabelSelectFieldName->setGeometry( QRect( 30, 30, 141, 31 ) );
268
269     textLabelSelectFieldIteration = new QLabel( buttonGroupSelectField, "textLabelSelectFieldIteration" );
270     textLabelSelectFieldIteration->setGeometry( QRect( 30, 80, 111, 31 ) );
271
272         MULTIPR_ORB::string_array* listFields = theModule->getMULTIPRObj()->getFields();
273         int maxIteration = 0;
274         for (int i=0 ; i<listFields->length() ; i++)
275         {
276                 const char* strItem = (*listFields)[i];
277                 CORBA::Long nbIteration = theModule->getMULTIPRObj()->getTimeStamps(strItem);
278                 if (nbIteration > maxIteration) 
279                 {
280                         maxIteration = nbIteration;
281                 }
282         }
283         
284     comboBoxSelectFieldIteration = new QComboBox( FALSE, buttonGroupSelectField, "comboBoxSelectFieldIteration" );
285     comboBoxSelectFieldIteration->setGeometry( QRect( 150, 80, 280, 40 ) );
286         for (int i=1 ; i<=maxIteration ; i++)
287         {
288                 comboBoxSelectFieldIteration->insertItem(QString::number(i));
289         }
290
291     comboBoxSelectFieldName = new QComboBox( FALSE, buttonGroupSelectField, "comboBoxSelectFieldName" );
292     comboBoxSelectFieldName->setGeometry( QRect( 150, 30, 280, 40 ) );
293         for (int i=0 ; i<listFields->length() ; i++)
294         {
295                 const char* strItem = (*listFields)[i];
296                 comboBoxSelectFieldName->insertItem(strItem);
297         }
298         comboBoxSelectFieldName->setEditable(false);
299         QToolTip::add( comboBoxSelectFieldName, tr( "only scalar fields are listed (multi-component fields are not displayed)" ) );
300
301     buttonGroupSelectFilter = new QButtonGroup( this, "buttonGroupSelectFilter" );
302     buttonGroupSelectFilter->setGeometry( QRect( 10, 160, 450, 90 ) );
303
304     textLabelSelectFilter = new QLabel( buttonGroupSelectFilter, "textLabelSelectFilter" );
305     textLabelSelectFilter->setGeometry( QRect( 30, 30, 101, 31 ) );
306
307     comboBoxSelectFilter = new QComboBox( FALSE, buttonGroupSelectFilter, "comboBoxSelectFilter" );
308     comboBoxSelectFilter->setGeometry( QRect( 150, 30, 280, 40 ) );
309         comboBoxSelectFilter->insertItem("Filtre_GradientMoyen");
310
311     buttonGroupParameters = new QButtonGroup( this, "buttonGroupParameters" );
312     buttonGroupParameters->setGeometry( QRect( 10, 260, 450, 210 ) );
313
314     textLabelTMed = new QLabel( buttonGroupParameters, "textLabelTMed" );
315     textLabelTMed->setGeometry( QRect( 20, 40, 242, 30 ) );
316
317     textLabelTLow = new QLabel( buttonGroupParameters, "textLabelTLow" );
318     textLabelTLow->setGeometry( QRect( 20, 80, 208, 30 ) );
319
320     textLabelRadius = new QLabel( buttonGroupParameters, "textLabelRadius" );
321     textLabelRadius->setGeometry( QRect( 20, 120, 211, 30 ) );
322
323     textLabelBoxing = new QLabel( buttonGroupParameters, "textLabelBoxing" );
324     textLabelBoxing->setGeometry( QRect( 20, 160, 241, 30 ) );
325
326     lineEditTMed = new QLineEdit( buttonGroupParameters, "lineEditTMed" );
327     lineEditTMed->setGeometry( QRect( 320, 40, 111, 30 ) );
328
329     lineEditTLow = new QLineEdit( buttonGroupParameters, "lineEditTLow" );
330     lineEditTLow->setGeometry( QRect( 320, 80, 111, 30 ) );
331
332     lineEditRadius = new QLineEdit( buttonGroupParameters, "lineEditRadius" );
333     lineEditRadius->setGeometry( QRect( 320, 120, 111, 30 ) );
334
335     spinBoxBoxing = new QSpinBox( buttonGroupParameters, "spinBoxBoxing" );
336     spinBoxBoxing->setGeometry( QRect( 320, 160, 111, 30 ) );
337     spinBoxBoxing->setMaxValue( 200 );
338     spinBoxBoxing->setMinValue( 2 );
339     spinBoxBoxing->setValue( 100 );
340         QToolTip::add( spinBoxBoxing, tr( "grid: number of cells along each axis" ) );
341
342     buttonGroupProcess = new QButtonGroup( this, "buttonGroupProcess" );
343     buttonGroupProcess->setGeometry( QRect( 10, 480, 450, 60 ) );
344
345     pushButtonCancel = new QPushButton( buttonGroupProcess, "pushButtonCancel" );
346     pushButtonCancel->setGeometry( QRect( 321, 10, 110, 41 ) );
347         pushButtonCancel->setAccel( QKeySequence( tr( "Esc" ) ) );
348         
349     pushButtonOK = new QPushButton( buttonGroupProcess, "pushButtonOK" );
350     pushButtonOK->setGeometry( QRect( 10, 10, 110, 41 ) );
351         pushButtonOK->setAccel( QKeySequence( tr( "Return" ) ) );
352     
353         setCaption( tr( "Decimation" ) );
354     buttonGroupSelectField->setTitle( tr( "Select field" ) );
355     textLabelSelectFieldName->setText( tr( "Field name" ) );
356     textLabelSelectFieldIteration->setText( tr( "Field iteration" ) );
357     buttonGroupSelectFilter->setTitle( tr( "Select filter" ) );
358     textLabelSelectFilter->setText( tr( "Filter name" ) );
359     buttonGroupParameters->setTitle( tr( "Set parameters" ) );
360     textLabelTMed->setText( tr( "Threshold for medium resolution" ) );
361     textLabelTLow->setText( tr( "Threshold for low resolution" ) );
362     textLabelRadius->setText( tr( "Radius (neighborhood)" ) );
363     textLabelBoxing->setText( tr( "Acceleration structure (boxing)" ) );
364     lineEditTMed->setText( tr( "0.1" ) );
365     lineEditTLow->setText( tr( "0.2" ) );
366
367         float defaultRadius = 0.5f;
368     lineEditRadius->setText( QString::number(defaultRadius) );
369     buttonGroupProcess->setTitle( QString::null );
370     pushButtonCancel->setText( tr( "Cancel" ) );
371     pushButtonOK->setText( tr("OK") );
372         
373         pushButtonThresholdAuto = new QPushButton( buttonGroupParameters, "pushButtonThresholdAuto" );
374     pushButtonThresholdAuto->setGeometry( QRect( 260, 80, 50, 30 ) );
375     QFont pushButtonThresholdAuto_font(  pushButtonThresholdAuto->font() );
376     pushButtonThresholdAuto_font.setPointSize( 11 );
377     pushButtonThresholdAuto->setFont( pushButtonThresholdAuto_font ); 
378         pushButtonThresholdAuto->setText( tr( "auto" ) );
379     QToolTip::add( pushButtonThresholdAuto, tr( "compute extremum for gradient (set medium=MIN and low=MAX)" ) );
380
381     pushButtonRadiusAuto = new QPushButton( buttonGroupParameters, "pushButtonRadiusAuto" );
382     pushButtonRadiusAuto->setGeometry( QRect( 260, 120, 50, 30 ) );
383     QFont pushButtonRadiusAuto_font(  pushButtonRadiusAuto->font() );
384     pushButtonRadiusAuto_font.setPointSize( 11 );
385     pushButtonRadiusAuto->setFont( pushButtonRadiusAuto_font ); 
386     pushButtonRadiusAuto->setText( tr( "auto" ) );
387     QToolTip::add( pushButtonRadiusAuto, tr( "set radius automatically (average #neighbours equal to 8)" ) );
388         
389     resize( QSize(470, 554).expandedTo(minimumSizeHint()) );
390     clearWState( WState_Polished );
391         
392         connect(pushButtonOK,            SIGNAL(clicked()), this, SLOT(accept()));
393         connect(pushButtonCancel,        SIGNAL(clicked()), this, SLOT(reject()));
394         connect(pushButtonRadiusAuto,    SIGNAL(clicked()), this, SLOT(OnRadiusAuto()));
395         connect(pushButtonThresholdAuto, SIGNAL(clicked()), this, SLOT(OnThresholdAuto()));
396 }
397
398
399 /*
400  *  Destroys the object and frees any allocated resources
401  */
402 MULTIPR_GUI_DecimateDlg::~MULTIPR_GUI_DecimateDlg()
403 {
404     // no need to delete child widgets, Qt does it all for us
405 }
406
407
408 void MULTIPR_GUI_DecimateDlg::accept()
409 {       
410         const char* strFieldName = comboBoxSelectFieldName->currentText().latin1();
411         const char* strFieldIt   = comboBoxSelectFieldIteration->currentText().latin1();
412         int fieldIteration = atoi(strFieldIt);
413         
414         double thresholdMed;
415         int ret = sscanf(lineEditTMed->text().latin1(), "%lf", &thresholdMed);
416         if ((ret != 1) || (thresholdMed <= 0.0f))
417         {
418                 SUIT_MessageBox::error1( 
419                         mModule->getAppli()->desktop(),
420                         "Decimation parameters error", 
421                         "Invalid medium threshold (should be > 0.0)", 
422                         tr("OK") );
423                         
424                 return;
425         }
426
427         double thresholdLow;
428         ret = sscanf(lineEditTLow->text().latin1(), "%lf", &thresholdLow);
429         if ((ret != 1) || (thresholdLow <= 0.0f))
430         {
431                 SUIT_MessageBox::error1( 
432                         mModule->getAppli()->desktop(),
433                         "Decimation parameters error", 
434                         "Invalid low threshold (should be > 0.0)", 
435                         tr("OK") );
436                         
437                 return;
438         }
439         
440         if (thresholdMed >= thresholdLow)
441         {
442                 SUIT_MessageBox::error1( 
443                         mModule->getAppli()->desktop(),
444                         "Decimation parameters error", 
445                         "Medium threshold must be < low threshold", 
446                         tr("OK") );
447                         
448                 return;
449         }
450
451         double radius;
452         ret = sscanf(lineEditRadius->text().latin1(), "%lf", &radius);
453         if ((ret != 1) || (radius <= 0.0f))
454         {
455                 SUIT_MessageBox::error1( 
456                         mModule->getAppli()->desktop(),
457                         "Decimation parameters error", 
458                         "Invalid radius (should be > 0.0)", 
459                         tr("OK") );
460                         
461                 return;
462         }
463         
464         QApplication::setOverrideCursor(Qt::waitCursor);
465         
466         try
467         {
468                 const QStringList& partsList = mModule->getSelectedParts();
469                 for (QStringList::const_iterator it = partsList.begin(), last = partsList.end(); it != last; it++)
470                 {
471                         const QString& partName = (*it);
472                         
473                         mModule->getMULTIPRObj()->setBoxing(spinBoxBoxing->value());
474                         
475                         mModule->getMULTIPRObj()->decimePartition(
476                                 partName.latin1(),
477                                 strFieldName,
478                                 fieldIteration,
479                                 comboBoxSelectFilter->currentText().latin1(),
480                                 thresholdMed,
481                                 thresholdLow,
482                                 radius);
483                 }
484         }
485         catch(...)
486         {
487                 SUIT_MessageBox::error1( 
488                         mModule->getAppli()->desktop(),
489                         "Decimation error", 
490                         "Error while decimating selected part(s)", 
491                         tr("OK") );
492         }
493         
494         QApplication::restoreOverrideCursor();
495         QDialog::accept();
496 }
497
498
499 void MULTIPR_GUI_DecimateDlg::reject()
500 {
501         QDialog::reject();
502 }
503
504
505 void MULTIPR_GUI_DecimateDlg::OnRadiusAuto()
506 {
507         // evaluates default radius for the first selected part
508         const QStringList& partsList = mModule->getSelectedParts();
509         const char* strFieldIt   = comboBoxSelectFieldIteration->currentText().latin1();
510         int fieldIteration = atoi(strFieldIt);
511         char* strPartInfo0 = mModule->getMULTIPRObj()->getPartInfo(partsList[0].latin1());
512         
513         char   lMeshName[256];
514         int    lId;
515         char   lPartName[256];
516         char   lPath[256];
517         char   lMEDFileName[256];
518         
519         // parse infos
520         int ret = sscanf(strPartInfo0, "%s %d %s %s %s", 
521                 lMeshName,
522                 &lId,
523                 lPartName,
524                 lPath,
525                 lMEDFileName);
526                 
527         if (ret != 5)
528         {
529                 return;
530         }
531         
532         QApplication::setOverrideCursor(Qt::waitCursor);
533         float defaultRadius = 0.5f;
534         try
535         {
536                 char strParams[256];
537                 sprintf(strParams, "2");
538                 
539                 char* res = mModule->getMULTIPRObj()->evalDecimationParams(
540                         lPartName,
541                         comboBoxSelectFieldName->currentText().latin1(),
542                         fieldIteration,
543                         comboBoxSelectFilter->currentText().latin1(),
544                         strParams);
545                 
546                 sscanf(res, "%f", &defaultRadius);
547         }
548         catch (...)
549         {
550         }
551         QApplication::restoreOverrideCursor();
552         
553     lineEditRadius->setText( QString::number(defaultRadius) );
554 }
555
556
557 void MULTIPR_GUI_DecimateDlg::OnThresholdAuto()
558 {
559         // evaluates default radius for the first selected part
560         const QStringList& partsList = mModule->getSelectedParts();
561         const char* strFieldIt  = comboBoxSelectFieldIteration->currentText().latin1();
562         int fieldIteration = atoi(strFieldIt);
563         char* strPartInfo0 = mModule->getMULTIPRObj()->getPartInfo(partsList[0].latin1());
564         
565         char   lMeshName[256];
566         int    lId;
567         char   lPartName[256];
568         char   lPath[256];
569         char   lMEDFileName[256];
570         
571         // parse infos
572         int ret = sscanf(strPartInfo0, "%s %d %s %s %s", 
573                 lMeshName,
574                 &lId,
575                 lPartName,
576                 lPath,
577                 lMEDFileName);
578         
579         QApplication::setOverrideCursor(Qt::waitCursor);
580
581         try
582         {
583                 float radius;
584                 ret = sscanf(lineEditRadius->text().latin1(), "%f", &radius);
585                 if ((ret != 1) || (radius <= 0.0f))
586                 {
587                         SUIT_MessageBox::error1( 
588                                 mModule->getAppli()->desktop(),
589                                 "Decimation parameters error", 
590                                 "Invalid radius (should be > 0.0)", 
591                                 tr("OK") );
592                                 
593                         return;
594                 }
595                 
596                 char strParams[256];            
597                 sprintf(strParams, "1 %f %d", radius, spinBoxBoxing->value());
598                 
599                 char* res = mModule->getMULTIPRObj()->evalDecimationParams(
600                         lPartName,
601                         comboBoxSelectFieldName->currentText().latin1(),
602                         fieldIteration,
603                         comboBoxSelectFilter->currentText().latin1(),
604                         strParams);
605                 
606                 float gradMin, gradAvg, gradMax;
607                 sscanf(res, "%f %f %f", &gradMin, &gradAvg, &gradMax);
608                 
609                 lineEditTMed->setText( QString::number(gradMin) );
610                 lineEditTLow->setText( QString::number(gradMax) );
611         }
612         catch (...)
613         {
614         }
615         
616         QApplication::restoreOverrideCursor();
617 }
618
619
620 //*****************************************************************************
621 // MULTIPR_GUI_ProgressCallbackDlg
622 // QT dialog box used to display progress in time consuming task (e.g. save)
623 //*****************************************************************************
624
625 MULTIPR_GUI_ProgressCallbackDlg::MULTIPR_GUI_ProgressCallbackDlg(QWidget* parent) :
626         QProgressDialog(
627                 parent, 
628                 0, 
629                 false, 
630                 WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
631 {
632         setLabel(new QLabel(this, "Please wait"));
633         setLabelText("Please wait");
634         setTotalSteps(100);
635 }
636
637
638 MULTIPR_GUI_ProgressCallbackDlg::~MULTIPR_GUI_ProgressCallbackDlg()
639 {
640         // do nothing
641 }
642
643
644 void MULTIPR_GUI_ProgressCallbackDlg::start(const char* pTaskTitle, int pNumStep)
645 {
646         setCaption(pTaskTitle);
647         MULTIPR_ProgressCallback::init(pNumStep);
648 }
649
650
651 void MULTIPR_GUI_ProgressCallbackDlg::done()
652 {
653         setProgress(100);
654 }
655
656         
657 void MULTIPR_GUI_ProgressCallbackDlg::progress(float pPercent)
658 {
659         setProgress(int(pPercent));
660 }
661
662 // EOF