1 // Copyright (C) 2011-2013 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
20 #include "MonCreateHypothesis.h"
21 #include "MonCreateListGroup.h"
22 #include "MonCreateIteration.h"
23 #include "MonCreateZone.h"
24 #include "MonEditZone.h"
26 #include <QFileDialog>
27 #include <QMessageBox>
29 #include "SalomeApp_Tools.h"
30 #include "HOMARDGUI_Utils.h"
31 #include "HomardQtCommun.h"
32 #include <utilities.h>
36 // -------------------------------------------------------------------------------
37 MonCreateHypothesis::MonCreateHypothesis(MonCreateIteration* parent, bool modal,
38 HOMARD::HOMARD_Gen_var myHomardGen0,
40 QString caseName, QString aFieldFile)
41 // ---------------------------------------------------------------------------------
42 /* Constructs a MonCreateHypothesis */
44 QDialog(0), Ui_CreateHypothesis(),
45 _parent(parent), _Name(Name),
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(myHomardGen0);
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 (LEName->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 (LEName->text().trimmed() != _Name)
149 _Name=LEName->text().trimmed();
152 aHypothesis=myHomardGen->CreateHypothesis(CORBA::string_dup(_Name.toStdString().c_str()) );
153 _parent->addHypothese(_Name);
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() ;
195 // ------------------------------------------------------------------------
196 void MonCreateHypothesis::PushOnOK()
197 // ------------------------------------------------------------------------
199 if (PushOnApply()) this->close();
200 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
202 // ------------------------------------------------------------------------
203 void MonCreateHypothesis::PushOnHelp()
204 // ------------------------------------------------------------------------
206 char* LanguageShort = myHomardGen->GetLanguageShort();
207 HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"), QString(""), QString(LanguageShort));
209 // -------------------------------------------------
210 void MonCreateHypothesis::SetNewName()
211 // --------------------------------------------------
214 HOMARD::listeHypotheses_var MyObjects = myHomardGen->GetAllHypothesesName();
219 aName.setNum(num+1) ;
220 aName.insert(0, QString("Hypo_")) ;
221 for ( int i=0; i<MyObjects->length(); i++)
223 if ( aName == QString(MyObjects[i]))
231 LEName->setText(aName);
235 // ------------------------------------------------------------------------
236 void MonCreateHypothesis::SetUniforme()
237 // ------------------------------------------------------------------------
239 GBFieldManagement->setVisible(0);
240 if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
241 else { GBFieldFile->setVisible(1); }
242 GBAreaManagement->setVisible(0);
243 GBUniform->setVisible(1);
247 // ------------------------------------------------------------------------
248 void MonCreateHypothesis::SetChamp()
249 // ------------------------------------------------------------------------
251 if (_aFieldFile == QString(""))
253 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
254 QObject::tr("HOM_HYPO_FIELD_FILE") );
256 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
259 LEFieldFile->setText(_aFieldFile);
260 LEFieldFile->setReadOnly(1);
262 GBUniform->setVisible(0);
263 GBAreaManagement->setVisible(0);
264 GBFieldManagement->setVisible(1);
265 GBFieldFile->setVisible(1);
267 GBUniform->adjustSize();
268 GBAreaManagement->adjustSize();
269 GBFieldManagement->adjustSize();
270 GBFieldFile->adjustSize();
275 // ------------------------------------------------------------------------
276 void MonCreateHypothesis::SetZone()
277 // ------------------------------------------------------------------------
280 GBUniform->setVisible(0);
281 GBFieldManagement->setVisible(0);
282 if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
283 else { GBFieldFile->setVisible(1); }
284 GBAreaManagement->setVisible(1);
291 // ------------------------------------------------------------------------
292 void MonCreateHypothesis::PushZoneNew()
293 // ------------------------------------------------------------------------
295 MESSAGE("Debut de MonCreateHypothesis::PushZoneNew")
296 MonCreateZone *aDlg = new MonCreateZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName) ;
300 // ------------------------------------------------------------------------
301 void MonCreateHypothesis::PushZoneEdit()
302 // ------------------------------------------------------------------------
304 MESSAGE("Debut de MonCreateHypothesis::PushZoneEdit")
305 int colonne = TWZone->currentColumn();
306 QTableWidgetItem * monItem = TWZone->currentItem();
307 if (colonne !=2 || monItem == NULL)
309 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
310 QObject::tr("HOM_HYPO_ZONE_1") );
313 QString zoneName = monItem->text().trimmed();
314 MonEditZone *aDlg = new MonEditZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, zoneName) ;
317 // ------------------------------------------------------------------------
318 void MonCreateHypothesis::PushZoneDelete()
319 // ------------------------------------------------------------------------
321 MESSAGE("Debut de MonCreateHypothesis::PushZoneDelete")
322 QMessageBox::warning( 0, QObject::tr("HOM_WARNING"),
323 QObject::tr("HOM_INACTIVE_BUTTON") );
327 // ------------------------------------------------------------------------
328 void MonCreateHypothesis::GetAllZones()
329 // ------------------------------------------------------------------------
330 // Recuperation de toutes les zones enregistrees dans l'arbre d'etude
331 // et affichage dans le tableau
332 // Par defaut, aucune n'est selectionnee
334 MESSAGE("Debut de GetAllZones") ;
335 HOMARD::listeZones_var mesZones = myHomardGen->GetAllZonesName();
336 int nbrow=TWZone->rowCount();
337 for ( int row=0; row< nbrow; row++)
339 TWZone->removeRow(row);
341 TWZone->setRowCount(0);
343 for (int i=0; i<mesZones->length(); i++)
345 TWZone->insertRow(row);
347 TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
348 TWZone->item( row, 0 )->setFlags( 0 );
349 TWZone->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
350 TWZone->item( row, 0 )->setCheckState( Qt::Unchecked );
352 TWZone->setItem( row, 1, new QTableWidgetItem( QString ("") ) );
353 TWZone->item( row, 1 )->setFlags( 0 );
354 TWZone->item( row, 1 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
355 TWZone->item( row, 1 )->setCheckState( Qt::Unchecked );
357 TWZone->setItem( row, 2, new QTableWidgetItem(QString(mesZones[i]).trimmed()));
358 TWZone->item( row, 2 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
362 TWZone->resizeColumnsToContents();
363 TWZone->resizeRowsToContents();
364 TWZone->clearSelection();
366 // ------------------------------------------------------------------------
367 void MonCreateHypothesis::addZoneinTWZone(QString newZone)
368 // ------------------------------------------------------------------------
370 MESSAGE("Debut de addZoneinTWZone") ;
371 int row = TWZone->rowCount() ;
372 // Par defaut, on suppose qu'une nouvelle zone est destinee au raffinement
373 TWZone->setRowCount( row+1 );
375 TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
376 TWZone->item( row, 0 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
377 TWZone->item( row, 0 )->setCheckState( Qt::Checked );
379 TWZone->setItem( row, 1, new QTableWidgetItem( QString ("") ) );
380 TWZone->item( row, 1 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
381 TWZone->item( row, 1 )->setCheckState( Qt::Unchecked );
383 TWZone->setItem( row, 2, new QTableWidgetItem( newZone ) );
384 TWZone->scrollToItem( TWZone->item( row, 2 ) );
386 TWZone->resizeRowsToContents();
387 TWZone->resizeColumnToContents(1);
388 TWZone->clearSelection();
390 TWZone->item( row, 2 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
392 // ------------------------------------------------------------------------
393 QStringList MonCreateHypothesis::GetZonesChecked()
394 // ------------------------------------------------------------------------
395 // Retourne les zones enregistrees
397 MESSAGE("Debut de GetZonesChecked") ;
398 QStringList ListeZone ;
399 // On ne peut pas avoir selectionne les deux options
401 for ( int row=0; row< TWZone->rowCount(); row++)
403 if ( ( TWZone->item( row, 0 )->checkState() == Qt::Checked ) && ( TWZone->item( row, 1 )->checkState() == Qt::Checked ) )
405 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
406 QObject::tr("HOM_HYPO_ZONE_3") );
410 // Si tout va bien, on affecte
411 // Attention, on insere en tete, donc on commence d'inserer le type, psui le nom de la zone
415 QString Dera = "-1" ;
416 for ( int row=0; row< TWZone->rowCount(); row++)
418 // MESSAGE ("row "<<row<<", zone : "<<TWZone->item(row, 2)->text().toStdString());
420 if ( TWZone->item(row,0)->checkState() == Qt::Checked )
421 { ListeZone.insert(0, Raff) ;
422 ListeZone.insert(0, QString(TWZone->item(row, 2)->text()) ) ; }
423 // En deraffinement :
424 if ( TWZone->item(row,1)->checkState() == Qt::Checked )
425 { ListeZone.insert(0, Dera) ;
426 ListeZone.insert(0, QString(TWZone->item(row, 2)->text()) ) ; }
428 MESSAGE("Fin de GetZonesChecked ; longueur de ListeZone : "<<ListeZone.count()) ;
433 // ------------------------------------------------------------------------
434 QStringList MonCreateHypothesis::GetListCompChecked()
435 // ------------------------------------------------------------------------
436 // Retourne les composantes retenues
438 MESSAGE( "Debut de GetListCompChecked" );
439 QStringList ListeComposant ;
441 ListeComposant.clear();
442 for ( int row=0; row< TWCMP->rowCount(); row++)
443 if ( TWCMP->item( row, 0 )->checkState() == Qt::Checked )
444 ListeComposant.insert(0, QString(TWCMP->item(row, 1)->text()) ) ;
445 // Choix du texte des radio-boutons selon 1 ou plusieurs composantes
446 if ( ListeComposant.count() < 2 )
447 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS"));
448 RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL"));
451 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2"));
452 RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF"));
454 return ListeComposant ;
457 // ------------------------------------------------------------------------
458 void MonCreateHypothesis::AssocieFieldInterp()
459 // ------------------------------------------------------------------------
461 if ( _TypeFieldInterp != 2 ) return;
462 for ( int row=0; row< TWField->rowCount(); row++)
464 if ( TWField->item( row, 0 )->checkState() == Qt::Checked )
466 aHypothesis->AddFieldInterp(TWField->item(row, 1)->text().toStdString().c_str());
470 // ------------------------------------------------------------------------
471 void MonCreateHypothesis::SetUniRaff()
472 // ------------------------------------------------------------------------
477 // ------------------------------------------------------------------------
478 void MonCreateHypothesis::SetUniDera()
479 // ------------------------------------------------------------------------
485 // ------------------------------------------------------------------------
486 void MonCreateHypothesis::InitFields()
487 // ------------------------------------------------------------------------
489 CBFieldName->clear();
490 std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
491 // Mise en place de la liste dans le menu pour l'indicateur d'erreur
492 std:: list<QString>::const_iterator it;
493 for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
495 CBFieldName->insertItem(0,QString(*it));
499 // ---------------------------------------
500 void MonCreateHypothesis::SetFieldName()
501 // -------------------------------------------
503 MESSAGE("Debut de SetFieldName");
504 _aFieldName=CBFieldName->currentText();
505 if (QString(_aFieldFile) == QString("") || QString(_aFieldName) == QString("") ) { return; }
507 int nbrow= TWCMP->rowCount() ;
508 for ( int row=0; row < nbrow ; row++)
510 TWCMP->removeRow(row);
512 TWCMP->setRowCount(0);
513 //TWCMP->resizeRowsToContents();
515 std::list<QString> maListe =HOMARD_QT_COMMUN::GetListeComposants(_aFieldFile, _aFieldName);
516 std::list<QString>::const_iterator it;
517 for ( it=maListe.begin() ; it != maListe.end(); it++)
520 TWCMP->setItem( 0, 0, new QTableWidgetItem( QString ("") ) );
521 TWCMP->item( 0, 0 )->setFlags( 0 );
522 TWCMP->item( 0, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
523 TWCMP->item( 0, 0 )->setCheckState( Qt::Checked );
524 TWCMP->setItem( 0, 1, new QTableWidgetItem(QString((*it)).trimmed()));
525 TWCMP->item( 0, 1 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
527 TWCMP->resizeColumnsToContents();
528 TWCMP->resizeRowsToContents();
529 TWCMP->clearSelection();
530 // Choix du texte des radio-boutons selon 1 ou plusieurs composantes
531 if ( TWCMP->rowCount() == 1 )
532 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS"));
533 RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL"));
536 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2"));
537 RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF"));
539 // Par defaut, on propose la valeur absolue / norme L2
542 // ------------------------------------------------------------------------
543 void MonCreateHypothesis::SetRPE()
544 // ------------------------------------------------------------------------
548 RBRPE->setChecked(true);
549 SpinBox_RPE->setEnabled(true);
550 SpinBox_RRel->setEnabled(false);
551 SpinBox_RAbs->setEnabled(false);
552 SpinBox_RMuSigma->setEnabled(false);
554 // ------------------------------------------------------------------------
555 void MonCreateHypothesis::SetRRel()
556 // ------------------------------------------------------------------------
560 RBRRel->setChecked(true);
561 SpinBox_RPE->setEnabled(false);
562 SpinBox_RRel->setEnabled(true);
563 SpinBox_RAbs->setEnabled(false);
564 SpinBox_RMuSigma->setEnabled(false);
566 // ------------------------------------------------------------------------
567 void MonCreateHypothesis::SetRAbs()
568 // ------------------------------------------------------------------------
572 RBRAbs->setChecked(true);
573 SpinBox_RPE->setEnabled(false);
574 SpinBox_RRel->setEnabled(false);
575 SpinBox_RAbs->setEnabled(true);
576 SpinBox_RMuSigma->setEnabled(false);
578 // ------------------------------------------------------------------------
579 void MonCreateHypothesis::SetRMS()
580 // ------------------------------------------------------------------------
584 RBRMuSigma->setChecked(true);
585 SpinBox_RPE->setEnabled(false);
586 SpinBox_RRel->setEnabled(false);
587 SpinBox_RAbs->setEnabled(false);
588 SpinBox_RMuSigma->setEnabled(true);
590 // ------------------------------------------------------------------------
591 void MonCreateHypothesis::SetRNo()
592 // ------------------------------------------------------------------------
596 RBRNo->setChecked(true);
597 SpinBox_RPE->setEnabled(false);
598 SpinBox_RRel->setEnabled(false);
599 SpinBox_RAbs->setEnabled(false);
600 SpinBox_RMuSigma->setEnabled(false);
602 // ------------------------------------------------------------------------
603 void MonCreateHypothesis::SetCPE()
604 // ------------------------------------------------------------------------
608 RBCPE->setChecked(true);
609 SpinBox_CPE->setEnabled(true);
610 SpinBox_CRel->setEnabled(false);
611 SpinBox_CAbs->setEnabled(false);
612 SpinBox_CMuSigma->setEnabled(false);
614 // ------------------------------------------------------------------------
615 void MonCreateHypothesis::SetCRel()
616 // ------------------------------------------------------------------------
620 RBCRel->setChecked(true);
621 SpinBox_CPE->setEnabled(false);
622 SpinBox_CRel->setEnabled(true);
623 SpinBox_CAbs->setEnabled(false);
624 SpinBox_CMuSigma->setEnabled(false);
626 // ------------------------------------------------------------------------
627 void MonCreateHypothesis::SetCAbs()
628 // ------------------------------------------------------------------------
632 RBCAbs->setChecked(true);
633 SpinBox_CPE->setEnabled(false);
634 SpinBox_CRel->setEnabled(false);
635 SpinBox_CAbs->setEnabled(true);
636 SpinBox_CMuSigma->setEnabled(false);
638 // ------------------------------------------------------------------------
639 void MonCreateHypothesis::SetCMS()
640 // ------------------------------------------------------------------------
644 RBCMuSigma->setChecked(true);
645 SpinBox_CPE->setEnabled(false);
646 SpinBox_CRel->setEnabled(false);
647 SpinBox_CAbs->setEnabled(false);
648 SpinBox_CMuSigma->setEnabled(true);
650 // ------------------------------------------------------------------------
651 void MonCreateHypothesis::SetCNo()
652 // ------------------------------------------------------------------------
656 RBCNo->setChecked(true);
657 SpinBox_CPE->setEnabled(false);
658 SpinBox_CRel->setEnabled(false);
659 SpinBox_CAbs->setEnabled(false);
660 SpinBox_CMuSigma->setEnabled(false);
662 // ------------------------------------------------------------------------
663 void MonCreateHypothesis::SetUCL2()
664 // ------------------------------------------------------------------------
667 RBL2->setChecked(true);
669 // ------------------------------------------------------------------------
670 void MonCreateHypothesis::SetUCInf()
671 // ------------------------------------------------------------------------
674 RBInf->setChecked(true);
676 // ------------------------------------------------------------------------
677 void MonCreateHypothesis::SetUseField()
678 // ------------------------------------------------------------------------
680 if ( CBJump->isChecked() ) { _UsField = 1 ; }
681 else { _UsField = 0 ; }
683 // ------------------------------------------------------------------------
684 void MonCreateHypothesis::SetFiltrage()
685 // ------------------------------------------------------------------------
687 if (!CBGroupe->isChecked()) return;
688 MonCreateListGroup *aDlg = new MonCreateListGroup(this, NULL, TRUE, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),_aCaseName, _aListeGroupes) ;
692 // ------------------------------------------------------------------------
693 void MonCreateHypothesis::setGroups(QStringList listGroup)
694 // ------------------------------------------------------------------------
696 _aListeGroupes=listGroup;
698 // ------------------------------------------------------------------------
699 bool MonCreateHypothesis::VerifieZone()
700 // ------------------------------------------------------------------------
702 if ( _aTypeAdap != 0 ) return true;
703 MESSAGE("Debut de VerifieZone") ;
704 _aListeZone = GetZonesChecked() ;
705 MESSAGE(". Longueur de _aListeZone : "<<_aListeZone.count()) ;
706 if (_aListeZone.count() == 0)
708 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
709 QObject::tr("HOM_HYPO_ZONE_2") );
712 MESSAGE("Fin de VerifieZone") ;
715 // ------------------------------------------------------------------------
716 bool MonCreateHypothesis::VerifieComposant()
717 // ------------------------------------------------------------------------
719 if ( _aTypeAdap != 1 ) return true;
720 _aListeComposant = GetListCompChecked() ;
721 if (_aListeComposant.count() == 0)
723 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
724 QObject::tr("HOM_HYPO_COMP") );
730 // ------------------------------------------------------------------------
731 void MonCreateHypothesis::AssocieLesZones()
732 // ------------------------------------------------------------------------
734 MESSAGE( "Debut de AssocieLesZones" );
735 if ( _aTypeAdap != 0 ) return;
736 _aListeZone = GetZonesChecked() ;
737 MESSAGE(". Longueur de _aListeZone : "<<_aListeZone.count()) ;
740 for ( int i=0 ; i< _aListeZone.count() ; i++ )
741 { if ( _aListeZone[i+1] == Raff ) { TypeUse = 1 ; }
742 else { TypeUse = -1 ; }
743 aHypothesis->AddZone(_aListeZone[i].toStdString().c_str(), TypeUse);
746 MESSAGE( "Fin de AssocieLesZones" );
748 // ------------------------------------------------------------------------
749 void MonCreateHypothesis::AssocieComposants()
750 // ------------------------------------------------------------------------
752 if ( _aTypeAdap != 1 ) return;
753 MESSAGE( "Dans AssocieComposants, _TypeThC : " << _TypeThC );
754 MESSAGE( "Dans AssocieComposants, _TypeThR : " << _TypeThR );
757 if ( _TypeThR == 1 ) { _ThreshR = SpinBox_RAbs->value();}
758 if ( _TypeThR == 2 ) { _ThreshR = SpinBox_RRel->value();}
759 if ( _TypeThR == 3 ) { _ThreshR = SpinBox_RPE->value(); }
760 if ( _TypeThR == 4 ) { _ThreshR = SpinBox_RMuSigma->value(); }
763 if ( _TypeThC == 1 ) { _ThreshC = SpinBox_CAbs->value();}
764 if ( _TypeThC == 2 ) { _ThreshC = SpinBox_CRel->value();}
765 if ( _TypeThC == 3 ) { _ThreshC = SpinBox_CPE->value(); }
766 if ( _TypeThC == 4 ) { _ThreshC = SpinBox_CMuSigma->value(); }
768 _aFieldName=CBFieldName->currentText();
769 aHypothesis->SetField(CORBA::string_dup(_aFieldName.toStdString().c_str()) ) ;
770 aHypothesis->SetRefinThr( _TypeThR, _ThreshR ) ;
771 aHypothesis->SetUnRefThr( _TypeThC, _ThreshC ) ;
772 aHypothesis->SetUseField( _UsField ) ;
773 aHypothesis->SetUseComp( _UsCmpI ) ;
774 _aListeComposant = GetListCompChecked() ;
775 for ( int i=0 ; i< _aListeComposant.count() ; i++ )
776 { aHypothesis->AddComp(_aListeComposant[i].toStdString().c_str()); }
778 // ------------------------------------------------------------------------
779 void MonCreateHypothesis::AssocieLesGroupes()
780 // ------------------------------------------------------------------------
782 HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::ListGroupType;
783 aSeqGroupe->length(_aListeGroupes.size());
784 QStringList::const_iterator it;
786 for (it = _aListeGroupes.constBegin(); it != _aListeGroupes.constEnd(); it++)
787 aSeqGroupe[i++]=(*it).toStdString().c_str();
788 aHypothesis->SetGroups(aSeqGroupe);
791 // ------------------------------------------------------------------------
792 void MonCreateHypothesis::SetFieldNo()
793 // ------------------------------------------------------------------------
794 // Par defaut, on n'interpole rien
796 if ( _aTypeAdap == 1 ) { GBFieldFile->setVisible(1); }
797 else { GBFieldFile->setVisible(0); }
798 TWField->setVisible(0);
801 _TypeFieldInterp = 0 ;
803 // ------------------------------------------------------------------------
804 void MonCreateHypothesis::SetFieldAll()
805 // ------------------------------------------------------------------------
806 // Par defaut, on interpole tout
808 if (_aFieldFile == QString(""))
810 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
811 QObject::tr("HOM_HYPO_FIELD_FILE") );
813 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
816 LEFieldFile->setText(_aFieldFile);
817 LEFieldFile->setReadOnly(1);
818 GBFieldFile->setVisible(1);
819 TWField->setVisible(0);
821 _TypeFieldInterp = 1 ;
824 // ------------------------------------------------------------------------
825 void MonCreateHypothesis::SetFieldChosen()
826 // ------------------------------------------------------------------------
828 if (_aFieldFile == QString(""))
830 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
831 QObject::tr("HOM_HYPO_FIELD_FILE") );
833 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
836 LEFieldFile->setText(_aFieldFile);
837 LEFieldFile->setReadOnly(1);
838 GBFieldFile->setVisible(1);
839 // Recuperation de la liste des champs contenus dans le fichier _aFieldFile
840 std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
842 // Initialisation de la table
844 int nbrow=TWField->rowCount();
845 for ( int row=0; row< nbrow; row++)
847 TWField->removeRow(row);
849 TWField->setRowCount(0);
850 std:: list<QString>::const_iterator it;
852 for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
854 TWField->insertRow(row);
855 TWField->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
856 TWField->item( row, 0 )->setFlags( 0 );
857 TWField->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
858 TWField->item( row, 0 )->setCheckState( Qt::Unchecked );
859 TWField->setItem( row, 1, new QTableWidgetItem(QString(*it).trimmed()));
860 TWField->item( row, 1 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
863 TWField->resizeColumnsToContents();
864 TWField->resizeRowsToContents();
865 TWField->clearSelection();
866 TWField->setVisible(1);
868 _TypeFieldInterp = 2 ;
871 // ------------------------------------------------------------------------
872 void MonCreateHypothesis::SetAdvanced()
873 // ------------------------------------------------------------------------
875 MESSAGE("Debut de SetAdvanced ");
876 if (CBAdvanced->isChecked())
877 { GBAdvancedOptions->setVisible(1);
878 if (_aFieldFile != QString(""))
879 { GBAdapInit->setVisible(1) ;
882 { GBAdapInit->setVisible(0) ;
886 { GBAdvancedOptions->setVisible(0);
890 CBLevelOutput->setChecked(false);
895 // ------------------------------------------------------------------------
896 void MonCreateHypothesis::SetAIN()
897 // ------------------------------------------------------------------------
899 MESSAGE("Debut de SetAIN ");
902 // ------------------------------------------------------------------------
903 void MonCreateHypothesis::SetAIR()
904 // ------------------------------------------------------------------------
906 MESSAGE("Debut de SetAIR ");
909 // ------------------------------------------------------------------------
910 void MonCreateHypothesis::SetAID()
911 // ------------------------------------------------------------------------
913 MESSAGE("Debut de SetAID ");