1 // Copyright (C) 2011-2012 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #include "MonCreateHypothesis.h"
23 #include "MonCreateListGroup.h"
24 #include "MonCreateIteration.h"
25 #include "MonCreateZone.h"
26 #include "MonEditZone.h"
28 #include <QFileDialog>
29 #include <QMessageBox>
31 #include "SalomeApp_Tools.h"
32 #include "HOMARDGUI_Utils.h"
33 #include "HomardQtCommun.h"
34 #include <utilities.h>
36 // -------------------------------------------------------------------------------
37 MonCreateHypothesis::MonCreateHypothesis(MonCreateIteration* parent, bool modal,
38 HOMARD::HOMARD_Gen_var myHomardGen,
39 QString aHypothesisName,
40 QString caseName, QString aFieldFile)
41 // ---------------------------------------------------------------------------------
42 /* Constructs a MonCreateHypothesis */
44 QDialog(0), Ui_CreateHypothesis(),
45 _parent(parent), _aHypothesisName(aHypothesisName),
46 _aCaseName(caseName), _aFieldFile(aFieldFile),
48 _aTypeAdap(-2), _aTypeRaff(1), _aTypeDera(0),
49 _TypeThR(3), _ThreshR(0),
50 _TypeThC(0), _ThreshC(0),
51 _UsField(0), _UsCmpI(0), _TypeFieldInterp(0),
58 MESSAGE("Constructeur") ;
59 _myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen);
64 SetNewHypothesisName();
65 if (_aFieldFile != QString(""))
66 { RBChamp->setChecked(1);
70 { RBUniforme->setChecked(1);
74 GBAdvancedOptions->setVisible(0);
75 CBLevelOutput->setChecked(false);
78 // ------------------------------------------------------------------------
79 MonCreateHypothesis::~MonCreateHypothesis()
80 // ------------------------------------------------------------------------
82 // no need to delete child widgets, Qt does it all for us
84 // ------------------------------------------------------------------------
85 void MonCreateHypothesis::InitConnect()
86 // ------------------------------------------------------------------------
88 connect( RBUniforme, SIGNAL(clicked()), this, SLOT(SetUniforme()));
89 connect( RBChamp, SIGNAL(clicked()), this, SLOT(SetChamp()));
90 connect( RBZone, SIGNAL(clicked()), this, SLOT(SetZone()));
91 connect( RBUniRaff, SIGNAL(clicked()), this, SLOT(SetUniRaff()));
92 connect( RBUniDera, SIGNAL(clicked()), this, SLOT(SetUniDera()));
94 connect( CBFieldName, SIGNAL(activated(int)), this, SLOT( SetFieldName()));
95 connect( RBRPE, SIGNAL(clicked()), this, SLOT(SetRPE()));
96 connect( RBRRel, SIGNAL(clicked()), this, SLOT(SetRRel()));
97 connect( RBRMuSigma, SIGNAL(clicked()), this, SLOT(SetRMS()));
98 connect( RBRAbs, SIGNAL(clicked()), this, SLOT(SetRAbs()));
99 connect( RBRNo, SIGNAL(clicked()), this, SLOT(SetRNo()));
100 connect( RBCPE, SIGNAL(clicked()), this, SLOT(SetCPE()));
101 connect( RBCRel, SIGNAL(clicked()), this, SLOT(SetCRel()));
102 connect( RBCMuSigma, SIGNAL(clicked()), this, SLOT(SetCMS()));
103 connect( RBCAbs, SIGNAL(clicked()), this, SLOT(SetCAbs()));
104 connect( RBCNo, SIGNAL(clicked()), this, SLOT(SetCNo()));
105 connect( RBL2, SIGNAL(clicked()), this, SLOT(SetUCL2()));
106 connect( RBInf, SIGNAL(clicked()), this, SLOT(SetUCInf()));
107 connect( CBJump, SIGNAL(stateChanged(int)), this, SLOT(SetUseField()));
108 connect( PBZoneNew, SIGNAL(pressed()), this, SLOT(PushZoneNew()));
109 connect( PBZoneEdit, SIGNAL(pressed()), this, SLOT(PushZoneEdit()) );
110 connect( PBZoneDelete, SIGNAL(pressed()), this, SLOT(PushZoneDelete()) );
111 connect( CBGroupe, SIGNAL(stateChanged(int)), this, SLOT(SetFiltrage()));
113 connect( RBFieldNo, SIGNAL(clicked()), this, SLOT(SetFieldNo()));
114 connect( RBFieldAll, SIGNAL(clicked()), this, SLOT(SetFieldAll()));
115 connect( RBFieldChosen,SIGNAL(clicked()), this, SLOT(SetFieldChosen()));
117 connect( CBAdvanced, SIGNAL(stateChanged(int)), this, SLOT(SetAdvanced()));
118 connect( RBAIN, SIGNAL(clicked()), this, SLOT(SetAIN()));
119 connect( RBAIR, SIGNAL(clicked()), this, SLOT(SetAIR()));
120 connect( RBAID, SIGNAL(clicked()), this, SLOT(SetAID()));
122 connect( buttonOk, SIGNAL(pressed()), this, SLOT( PushOnOK()));
123 connect( buttonApply, SIGNAL(pressed()), this, SLOT( PushOnApply()));
124 connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close()));
125 connect( buttonHelp, SIGNAL(pressed()), this, SLOT( PushOnHelp()));
128 // ------------------------------------------------------------------------
129 bool MonCreateHypothesis::PushOnApply()
130 // ------------------------------------------------------------------------
131 // Appele lorsque l'un des boutons Ok ou Apply est presse
137 if (LEHypothesisName->text().trimmed()=="") {
138 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
139 QObject::tr("HOM_HYPO_NAME") );
143 if (VerifieZone() == false) return false;
144 if (VerifieComposant() == false) return false;
146 // Creation de l'objet CORBA si ce n'est pas deja fait sous le meme nom
147 if (LEHypothesisName->text().trimmed() != _aHypothesisName)
149 _aHypothesisName=LEHypothesisName->text().trimmed();
152 _aHypothesis=_myHomardGen->CreateHypothesis(CORBA::string_dup(_aHypothesisName.toStdString().c_str()) );
153 _parent->addHypothese(_aHypothesisName);
155 catch( SALOME::SALOME_Exception& S_ex )
157 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
158 QString(CORBA::string_dup(S_ex.details.text)) );
163 // Mise en place des attributs
164 _aHypothesis->SetAdapRefinUnRef(_aTypeAdap,_aTypeRaff,_aTypeDera);
165 _aHypothesis->SetTypeFieldInterp(_TypeFieldInterp);
166 _aHypothesis->SetCaseCreation(_aCaseName.toStdString().c_str());
171 AssocieFieldInterp();
174 if (CBAdvanced->isChecked())
176 // Enregistrement du niveau maximal
177 _NivMax = spinBoxNivMax->value() ;
178 _aHypothesis->SetNivMax(_NivMax);
179 // Enregistrement du diametre minimal
180 _DiamMin = doubleSpinBoxDiamMin->value() ;
181 _aHypothesis->SetDiamMin(_DiamMin);
182 // Enregistrement de l'intialisation de l'adaptation
183 _aHypothesis->SetAdapInit(_AdapInit);
184 // Sortie des niveaux de raffinement
185 if (CBLevelOutput->isChecked()) { _LevelOutput = 1 ; }
186 _aHypothesis->SetLevelOutput(_LevelOutput);
189 HOMARD_UTILS::updateObjBrowser();
194 // ------------------------------------------------------------------------
195 void MonCreateHypothesis::PushOnOK()
196 // ------------------------------------------------------------------------
198 if (PushOnApply()) this->close();
199 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
201 // ------------------------------------------------------------------------
202 void MonCreateHypothesis::PushOnHelp()
203 // ------------------------------------------------------------------------
205 HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"));
207 // -------------------------------------------------
208 void MonCreateHypothesis::SetNewHypothesisName()
209 // --------------------------------------------------
212 HOMARD::listeHypotheses_var MyHypos = _myHomardGen->GetAllHypothesesName();
214 QString aHypothesisName="";
215 while (aHypothesisName=="" )
217 aHypothesisName.setNum(num+1) ;
218 aHypothesisName.insert(0, QString("Hypo_")) ;
219 for ( int i=0; i<MyHypos->length(); i++)
221 if ( aHypothesisName == QString(MyHypos[i]))
229 LEHypothesisName->setText(aHypothesisName);
233 // ------------------------------------------------------------------------
234 void MonCreateHypothesis::SetUniforme()
235 // ------------------------------------------------------------------------
237 GBFieldManagement->setVisible(0);
238 if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
239 else { GBFieldFile->setVisible(1); }
240 GBAreaManagement->setVisible(0);
241 GBUniform->setVisible(1);
245 // ------------------------------------------------------------------------
246 void MonCreateHypothesis::SetChamp()
247 // ------------------------------------------------------------------------
249 if (_aFieldFile == QString(""))
251 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
252 QObject::tr("HOM_HYPO_FIELD_FILE") );
254 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
257 LEFieldFile->setText(_aFieldFile);
258 LEFieldFile->setReadOnly(1);
260 GBUniform->setVisible(0);
261 GBAreaManagement->setVisible(0);
262 GBFieldManagement->setVisible(1);
263 GBFieldFile->setVisible(1);
265 GBUniform->adjustSize();
266 GBAreaManagement->adjustSize();
267 GBFieldManagement->adjustSize();
268 GBFieldFile->adjustSize();
273 // ------------------------------------------------------------------------
274 void MonCreateHypothesis::SetZone()
275 // ------------------------------------------------------------------------
278 GBUniform->setVisible(0);
279 GBFieldManagement->setVisible(0);
280 if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
281 else { GBFieldFile->setVisible(1); }
282 GBAreaManagement->setVisible(1);
289 // ------------------------------------------------------------------------
290 void MonCreateHypothesis::PushZoneNew()
291 // ------------------------------------------------------------------------
293 MESSAGE("Debut de MonCreateHypothesis::PushZoneNew")
294 MonCreateZone *aDlg = new MonCreateZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(_myHomardGen), _aCaseName) ;
298 // ------------------------------------------------------------------------
299 void MonCreateHypothesis::PushZoneEdit()
300 // ------------------------------------------------------------------------
302 MESSAGE("Debut de MonCreateHypothesis::PushZoneEdit")
303 int colonne = TWZone->currentColumn();
304 QTableWidgetItem * monItem = TWZone->currentItem();
305 if (colonne !=2 or monItem == NULL)
307 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
308 QObject::tr("HOM_HYPO_ZONE_1") );
311 QString zoneName = monItem->text().trimmed();
312 MonEditZone *aDlg = new MonEditZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(_myHomardGen), _aCaseName, zoneName) ;
315 // ------------------------------------------------------------------------
316 void MonCreateHypothesis::PushZoneDelete()
317 // ------------------------------------------------------------------------
319 MESSAGE("Debut de MonCreateHypothesis::PushZoneDelete")
320 QMessageBox::warning( 0, QObject::tr("HOM_WARNING"),
321 QObject::tr("HOM_INACTIVE_BUTTON") );
325 // ------------------------------------------------------------------------
326 void MonCreateHypothesis::GetAllZones()
327 // ------------------------------------------------------------------------
328 // Recuperation de toutes les zones enregistrees dans l'arbre d'etude
329 // et affichage dans le tableau
330 // Par defaut, aucune n'est selectionnee
332 MESSAGE("Debut de GetAllZones") ;
333 HOMARD::listeZones_var mesZones = _myHomardGen->GetAllZonesName();
334 int nbrow=TWZone->rowCount();
335 for ( int row=0; row< nbrow; row++)
337 TWZone->removeRow(row);
339 TWZone->setRowCount(0);
341 for (int i=0; i<mesZones->length(); i++)
343 TWZone->insertRow(row);
345 TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
346 TWZone->item( row, 0 )->setFlags( 0 );
347 TWZone->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
348 TWZone->item( row, 0 )->setCheckState( Qt::Unchecked );
350 TWZone->setItem( row, 1, new QTableWidgetItem( QString ("") ) );
351 TWZone->item( row, 1 )->setFlags( 0 );
352 TWZone->item( row, 1 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
353 TWZone->item( row, 1 )->setCheckState( Qt::Unchecked );
355 TWZone->setItem( row, 2, new QTableWidgetItem(QString(mesZones[i]).trimmed()));
356 TWZone->item( row, 2 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
360 TWZone->resizeColumnsToContents();
361 TWZone->resizeRowsToContents();
362 TWZone->clearSelection();
364 // ------------------------------------------------------------------------
365 void MonCreateHypothesis::addZoneinTWZone(QString newZone)
366 // ------------------------------------------------------------------------
368 MESSAGE("Debut de addZoneinTWZone") ;
369 int row = TWZone->rowCount() ;
370 // Par defaut, on suppose qu'une nouvelle zone est destinee au raffinement
371 TWZone->setRowCount( row+1 );
373 TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
374 TWZone->item( row, 0 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
375 TWZone->item( row, 0 )->setCheckState( Qt::Checked );
377 TWZone->setItem( row, 1, new QTableWidgetItem( QString ("") ) );
378 TWZone->item( row, 1 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
379 TWZone->item( row, 1 )->setCheckState( Qt::Unchecked );
381 TWZone->setItem( row, 2, new QTableWidgetItem( newZone ) );
382 TWZone->scrollToItem( TWZone->item( row, 2 ) );
384 TWZone->resizeRowsToContents();
385 TWZone->resizeColumnToContents(1);
386 TWZone->clearSelection();
388 TWZone->item( row, 2 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
390 // ------------------------------------------------------------------------
391 QStringList MonCreateHypothesis::GetZonesChecked()
392 // ------------------------------------------------------------------------
393 // Retourne les zones enregistrees
395 MESSAGE("Debut de GetZonesChecked") ;
396 QStringList ListeZone ;
397 // On ne peut pas avoir selectionne les deux options
399 for ( int row=0; row< TWZone->rowCount(); row++)
401 if ( ( TWZone->item( row, 0 )->checkState() == Qt::Checked ) and ( TWZone->item( row, 1 )->checkState() == Qt::Checked ) )
403 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
404 QObject::tr("HOM_HYPO_ZONE_3") );
408 // Si tout va bien, on affecte
409 // Attention, on insere en tete, donc on commence d'inserer le type, psui le nom de la zone
413 QString Dera = "-1" ;
414 for ( int row=0; row< TWZone->rowCount(); row++)
416 // MESSAGE ("row "<<row<<", zone : "<<TWZone->item(row, 2)->text().toStdString());
418 if ( TWZone->item(row,0)->checkState() == Qt::Checked )
419 { ListeZone.insert(0, Raff) ;
420 ListeZone.insert(0, QString(TWZone->item(row, 2)->text()) ) ; }
421 // En deraffinement :
422 if ( TWZone->item(row,1)->checkState() == Qt::Checked )
423 { ListeZone.insert(0, Dera) ;
424 ListeZone.insert(0, QString(TWZone->item(row, 2)->text()) ) ; }
426 MESSAGE("Fin de GetZonesChecked ; longueur de ListeZone : "<<ListeZone.count()) ;
431 // ------------------------------------------------------------------------
432 QStringList MonCreateHypothesis::GetListCompChecked()
433 // ------------------------------------------------------------------------
434 // Retourne les composantes retenues
436 MESSAGE( "Debut de GetListCompChecked" );
437 QStringList ListeComposant ;
439 ListeComposant.clear();
440 for ( int row=0; row< TWCMP->rowCount(); row++)
441 if ( TWCMP->item( row, 0 )->checkState() == Qt::Checked )
442 ListeComposant.insert(0, QString(TWCMP->item(row, 1)->text()) ) ;
443 // Choix du texte des radio-boutons selon 1 ou plusieurs composantes
444 if ( ListeComposant.count() < 2 )
445 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS"));
446 RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL"));
449 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2"));
450 RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF"));
452 return ListeComposant ;
455 // ------------------------------------------------------------------------
456 void MonCreateHypothesis::AssocieFieldInterp()
457 // ------------------------------------------------------------------------
459 if ( _TypeFieldInterp != 2 ) return;
460 for ( int row=0; row< TWField->rowCount(); row++)
461 if ( TWField->item( row, 0 )->checkState() == Qt::Checked )
462 { _aHypothesis->AddFieldInterp(TWField->item(row, 1)->text().toStdString().c_str()); }
464 // ------------------------------------------------------------------------
465 void MonCreateHypothesis::SetUniRaff()
466 // ------------------------------------------------------------------------
471 // ------------------------------------------------------------------------
472 void MonCreateHypothesis::SetUniDera()
473 // ------------------------------------------------------------------------
479 // ------------------------------------------------------------------------
480 void MonCreateHypothesis::InitFields()
481 // ------------------------------------------------------------------------
483 CBFieldName->clear();
484 std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
485 // Mise en place de la liste dans le menu pour l'indicateur d'erreur
486 std:: list<QString>::const_iterator it;
487 for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
489 CBFieldName->insertItem(0,QString(*it));
493 // ---------------------------------------
494 void MonCreateHypothesis::SetFieldName()
495 // -------------------------------------------
497 MESSAGE("Debut de SetFieldName");
498 _aFieldName=CBFieldName->currentText();
499 if (QString(_aFieldFile) == QString("") or QString(_aFieldName) == QString("") ) { return; }
501 int nbrow= TWCMP->rowCount() ;
502 for ( int row=0; row < nbrow ; row++)
504 TWCMP->removeRow(row);
506 TWCMP->setRowCount(0);
507 //TWCMP->resizeRowsToContents();
509 std::list<QString> maListe =HOMARD_QT_COMMUN::GetListeComposants(_aFieldFile, _aFieldName);
510 std::list<QString>::const_iterator it;
511 for ( it=maListe.begin() ; it != maListe.end(); it++)
514 TWCMP->setItem( 0, 0, new QTableWidgetItem( QString ("") ) );
515 TWCMP->item( 0, 0 )->setFlags( 0 );
516 TWCMP->item( 0, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
517 TWCMP->item( 0, 0 )->setCheckState( Qt::Checked );
518 TWCMP->setItem( 0, 1, new QTableWidgetItem(QString((*it)).trimmed()));
519 TWCMP->item( 0, 1 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
521 TWCMP->resizeColumnsToContents();
522 TWCMP->resizeRowsToContents();
523 TWCMP->clearSelection();
524 // Choix du texte des radio-boutons selon 1 ou plusieurs composantes
525 if ( TWCMP->rowCount() == 1 )
526 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS"));
527 RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL"));
530 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2"));
531 RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF"));
533 // Par defaut, on propose la valeur absolue / norme L2
536 // ------------------------------------------------------------------------
537 void MonCreateHypothesis::SetRPE()
538 // ------------------------------------------------------------------------
542 RBRPE->setChecked(true);
543 SpinBox_RPE->setEnabled(true);
544 SpinBox_RRel->setEnabled(false);
545 SpinBox_RAbs->setEnabled(false);
546 SpinBox_RMuSigma->setEnabled(false);
548 // ------------------------------------------------------------------------
549 void MonCreateHypothesis::SetRRel()
550 // ------------------------------------------------------------------------
554 RBRRel->setChecked(true);
555 SpinBox_RPE->setEnabled(false);
556 SpinBox_RRel->setEnabled(true);
557 SpinBox_RAbs->setEnabled(false);
558 SpinBox_RMuSigma->setEnabled(false);
560 // ------------------------------------------------------------------------
561 void MonCreateHypothesis::SetRAbs()
562 // ------------------------------------------------------------------------
566 RBRAbs->setChecked(true);
567 SpinBox_RPE->setEnabled(false);
568 SpinBox_RRel->setEnabled(false);
569 SpinBox_RAbs->setEnabled(true);
570 SpinBox_RMuSigma->setEnabled(false);
572 // ------------------------------------------------------------------------
573 void MonCreateHypothesis::SetRMS()
574 // ------------------------------------------------------------------------
578 RBRMuSigma->setChecked(true);
579 SpinBox_RPE->setEnabled(false);
580 SpinBox_RRel->setEnabled(false);
581 SpinBox_RAbs->setEnabled(false);
582 SpinBox_RMuSigma->setEnabled(true);
584 // ------------------------------------------------------------------------
585 void MonCreateHypothesis::SetRNo()
586 // ------------------------------------------------------------------------
590 RBRNo->setChecked(true);
591 SpinBox_RPE->setEnabled(false);
592 SpinBox_RRel->setEnabled(false);
593 SpinBox_RAbs->setEnabled(false);
594 SpinBox_RMuSigma->setEnabled(false);
596 // ------------------------------------------------------------------------
597 void MonCreateHypothesis::SetCPE()
598 // ------------------------------------------------------------------------
602 RBCPE->setChecked(true);
603 SpinBox_CPE->setEnabled(true);
604 SpinBox_CRel->setEnabled(false);
605 SpinBox_CAbs->setEnabled(false);
606 SpinBox_CMuSigma->setEnabled(false);
608 // ------------------------------------------------------------------------
609 void MonCreateHypothesis::SetCRel()
610 // ------------------------------------------------------------------------
614 RBCRel->setChecked(true);
615 SpinBox_CPE->setEnabled(false);
616 SpinBox_CRel->setEnabled(true);
617 SpinBox_CAbs->setEnabled(false);
618 SpinBox_CMuSigma->setEnabled(false);
620 // ------------------------------------------------------------------------
621 void MonCreateHypothesis::SetCAbs()
622 // ------------------------------------------------------------------------
626 RBCAbs->setChecked(true);
627 SpinBox_CPE->setEnabled(false);
628 SpinBox_CRel->setEnabled(false);
629 SpinBox_CAbs->setEnabled(true);
630 SpinBox_CMuSigma->setEnabled(false);
632 // ------------------------------------------------------------------------
633 void MonCreateHypothesis::SetCMS()
634 // ------------------------------------------------------------------------
638 RBCMuSigma->setChecked(true);
639 SpinBox_CPE->setEnabled(false);
640 SpinBox_CRel->setEnabled(false);
641 SpinBox_CAbs->setEnabled(false);
642 SpinBox_CMuSigma->setEnabled(true);
644 // ------------------------------------------------------------------------
645 void MonCreateHypothesis::SetCNo()
646 // ------------------------------------------------------------------------
650 RBCNo->setChecked(true);
651 SpinBox_CPE->setEnabled(false);
652 SpinBox_CRel->setEnabled(false);
653 SpinBox_CAbs->setEnabled(false);
654 SpinBox_CMuSigma->setEnabled(false);
656 // ------------------------------------------------------------------------
657 void MonCreateHypothesis::SetUCL2()
658 // ------------------------------------------------------------------------
661 RBL2->setChecked(true);
663 // ------------------------------------------------------------------------
664 void MonCreateHypothesis::SetUCInf()
665 // ------------------------------------------------------------------------
668 RBInf->setChecked(true);
670 // ------------------------------------------------------------------------
671 void MonCreateHypothesis::SetUseField()
672 // ------------------------------------------------------------------------
674 if ( CBJump->isChecked() ) { _UsField = 1 ; }
675 else { _UsField = 0 ; }
677 // ------------------------------------------------------------------------
678 void MonCreateHypothesis::SetFiltrage()
679 // ------------------------------------------------------------------------
681 if (!CBGroupe->isChecked()) return;
682 MonCreateListGroup *aDlg = new MonCreateListGroup(this, NULL, TRUE, HOMARD::HOMARD_Gen::_duplicate(_myHomardGen),_aCaseName, _aListeGroupes) ;
686 // ------------------------------------------------------------------------
687 void MonCreateHypothesis::setGroups(QStringList listGroup)
688 // ------------------------------------------------------------------------
690 _aListeGroupes=listGroup;
692 // ------------------------------------------------------------------------
693 bool MonCreateHypothesis::VerifieZone()
694 // ------------------------------------------------------------------------
696 if ( _aTypeAdap != 0 ) return true;
697 MESSAGE("Debut de VerifieZone") ;
698 _aListeZone = GetZonesChecked() ;
699 MESSAGE(". Longueur de _aListeZone : "<<_aListeZone.count()) ;
700 if (_aListeZone.count() == 0)
702 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
703 QObject::tr("HOM_HYPO_ZONE_2") );
706 MESSAGE("Fin de VerifieZone") ;
709 // ------------------------------------------------------------------------
710 bool MonCreateHypothesis::VerifieComposant()
711 // ------------------------------------------------------------------------
713 if ( _aTypeAdap != 1 ) return true;
714 _aListeComposant = GetListCompChecked() ;
715 if (_aListeComposant.count() == 0)
717 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
718 QObject::tr("HOM_HYPO_COMP") );
724 // ------------------------------------------------------------------------
725 void MonCreateHypothesis::AssocieLesZones()
726 // ------------------------------------------------------------------------
728 MESSAGE( "Debut de AssocieLesZones" );
729 if ( _aTypeAdap != 0 ) return;
730 _aListeZone = GetZonesChecked() ;
731 MESSAGE(". Longueur de _aListeZone : "<<_aListeZone.count()) ;
734 for ( int i=0 ; i< _aListeZone.count() ; i++ )
735 { if ( _aListeZone[i+1] == Raff ) { TypeUse = 1 ; }
736 else { TypeUse = -1 ; }
737 _aHypothesis->AddZone(_aListeZone[i].toStdString().c_str(), TypeUse);
740 MESSAGE( "Fin de AssocieLesZones" );
742 // ------------------------------------------------------------------------
743 void MonCreateHypothesis::AssocieComposants()
744 // ------------------------------------------------------------------------
746 if ( _aTypeAdap != 1 ) return;
747 MESSAGE( "Dans AssocieComposants, _TypeThC : " << _TypeThC );
748 MESSAGE( "Dans AssocieComposants, _TypeThR : " << _TypeThR );
751 if ( _TypeThR == 1 ) { _ThreshR = SpinBox_RAbs->value();}
752 if ( _TypeThR == 2 ) { _ThreshR = SpinBox_RRel->value();}
753 if ( _TypeThR == 3 ) { _ThreshR = SpinBox_RPE->value(); }
754 if ( _TypeThR == 4 ) { _ThreshR = SpinBox_RMuSigma->value(); }
757 if ( _TypeThC == 1 ) { _ThreshC = SpinBox_CAbs->value();}
758 if ( _TypeThC == 2 ) { _ThreshC = SpinBox_CRel->value();}
759 if ( _TypeThC == 3 ) { _ThreshC = SpinBox_CPE->value(); }
760 if ( _TypeThC == 4 ) { _ThreshC = SpinBox_CMuSigma->value(); }
762 _aFieldName=CBFieldName->currentText();
763 _aHypothesis->SetField(CORBA::string_dup(_aFieldName.toStdString().c_str()) ) ;
764 _aHypothesis->SetRefinThr( _TypeThR, _ThreshR ) ;
765 _aHypothesis->SetUnRefThr( _TypeThC, _ThreshC ) ;
766 _aHypothesis->SetUseField( _UsField ) ;
767 _aHypothesis->SetUseComp( _UsCmpI ) ;
768 _aListeComposant = GetListCompChecked() ;
769 for ( int i=0 ; i< _aListeComposant.count() ; i++ )
770 { _aHypothesis->AddComp(_aListeComposant[i].toStdString().c_str()); }
772 // ------------------------------------------------------------------------
773 void MonCreateHypothesis::AssocieLesGroupes()
774 // ------------------------------------------------------------------------
776 HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::ListGroupType;
777 aSeqGroupe->length(_aListeGroupes.size());
778 QStringList::const_iterator it;
780 for (it = _aListeGroupes.constBegin(); it != _aListeGroupes.constEnd(); it++)
781 aSeqGroupe[i++]=(*it).toStdString().c_str();
782 _aHypothesis->SetGroups(aSeqGroupe);
785 // ------------------------------------------------------------------------
786 void MonCreateHypothesis::SetFieldNo()
787 // ------------------------------------------------------------------------
788 // Par defaut, on n'interpole rien
790 if ( _aTypeAdap == 1 ) { GBFieldFile->setVisible(1); }
791 else { GBFieldFile->setVisible(0); }
792 TWField->setVisible(0);
795 _TypeFieldInterp = 0 ;
797 // ------------------------------------------------------------------------
798 void MonCreateHypothesis::SetFieldAll()
799 // ------------------------------------------------------------------------
800 // Par defaut, on interpole tout
802 if (_aFieldFile == QString(""))
804 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
805 QObject::tr("HOM_HYPO_FIELD_FILE") );
807 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
810 LEFieldFile->setText(_aFieldFile);
811 LEFieldFile->setReadOnly(1);
812 GBFieldFile->setVisible(1);
813 TWField->setVisible(0);
815 _TypeFieldInterp = 1 ;
818 // ------------------------------------------------------------------------
819 void MonCreateHypothesis::SetFieldChosen()
820 // ------------------------------------------------------------------------
822 if (_aFieldFile == QString(""))
824 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
825 QObject::tr("HOM_HYPO_FIELD_FILE") );
827 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
830 LEFieldFile->setText(_aFieldFile);
831 LEFieldFile->setReadOnly(1);
832 GBFieldFile->setVisible(1);
833 // Recuperation de la liste des champs contenus dans le fichier _aFieldFile
834 std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
836 // Initialisation de la table
838 int nbrow=TWField->rowCount();
839 for ( int row=0; row< nbrow; row++)
841 TWField->removeRow(row);
843 TWField->setRowCount(0);
844 std:: list<QString>::const_iterator it;
846 for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
848 TWField->insertRow(row);
849 TWField->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
850 TWField->item( row, 0 )->setFlags( 0 );
851 TWField->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
852 TWField->item( row, 0 )->setCheckState( Qt::Unchecked );
853 TWField->setItem( row, 1, new QTableWidgetItem(QString(*it).trimmed()));
854 TWField->item( row, 1 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
857 TWField->resizeColumnsToContents();
858 TWField->resizeRowsToContents();
859 TWField->clearSelection();
860 TWField->setVisible(1);
862 _TypeFieldInterp = 2 ;
865 // ------------------------------------------------------------------------
866 void MonCreateHypothesis::SetAdvanced()
867 // ------------------------------------------------------------------------
869 MESSAGE("Debut de SetAdvanced ");
870 if (CBAdvanced->isChecked())
871 { GBAdvancedOptions->setVisible(1);
872 if (_aFieldFile != QString(""))
873 { GBAdapInit->setVisible(1) ;
876 { GBAdapInit->setVisible(0) ;
880 { GBAdvancedOptions->setVisible(0);
884 CBLevelOutput->setChecked(false);
889 // ------------------------------------------------------------------------
890 void MonCreateHypothesis::SetAIN()
891 // ------------------------------------------------------------------------
893 MESSAGE("Debut de SetAIN ");
896 // ------------------------------------------------------------------------
897 void MonCreateHypothesis::SetAIR()
898 // ------------------------------------------------------------------------
900 MESSAGE("Debut de SetAIR ");
903 // ------------------------------------------------------------------------
904 void MonCreateHypothesis::SetAID()
905 // ------------------------------------------------------------------------
907 MESSAGE("Debut de SetAID ");