1 // Copyright (C) 2011-2014 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, or (at your option) any later version.
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 QScrollArea(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);
61 if ( modal ) { setWindowModality(Qt::WindowModal); }
62 else { setWindowModality(Qt::NonModal); }
63 setWindowFlags( Qt::WindowStaysOnTopHint ) ;
67 if (_aFieldFile != QString(""))
68 { RBChamp->setChecked(1);
72 { RBUniforme->setChecked(1);
76 GBAdvancedOptions->setVisible(0);
77 CBLevelOutput->setChecked(false);
82 // ------------------------------------------------------------------------
83 MonCreateHypothesis::~MonCreateHypothesis()
84 // ------------------------------------------------------------------------
86 // no need to delete child widgets, Qt does it all for us
88 // ------------------------------------------------------------------------
89 void MonCreateHypothesis::InitConnect()
90 // ------------------------------------------------------------------------
92 connect( RBUniforme, SIGNAL(clicked()), this, SLOT(SetUniforme()));
93 connect( RBChamp, SIGNAL(clicked()), this, SLOT(SetChamp()));
94 connect( RBZone, SIGNAL(clicked()), this, SLOT(SetZone()));
95 connect( RBUniRaff, SIGNAL(clicked()), this, SLOT(SetUniRaff()));
96 connect( RBUniDera, SIGNAL(clicked()), this, SLOT(SetUniDera()));
98 connect( CBFieldName, SIGNAL(activated(int)), this, SLOT( SetFieldName()));
99 connect( RBRPE, SIGNAL(clicked()), this, SLOT(SetRPE()));
100 connect( RBRRel, SIGNAL(clicked()), this, SLOT(SetRRel()));
101 connect( RBRMuSigma, SIGNAL(clicked()), this, SLOT(SetRMS()));
102 connect( RBRAbs, SIGNAL(clicked()), this, SLOT(SetRAbs()));
103 connect( RBRNo, SIGNAL(clicked()), this, SLOT(SetRNo()));
104 connect( RBCPE, SIGNAL(clicked()), this, SLOT(SetCPE()));
105 connect( RBCRel, SIGNAL(clicked()), this, SLOT(SetCRel()));
106 connect( RBCMuSigma, SIGNAL(clicked()), this, SLOT(SetCMS()));
107 connect( RBCAbs, SIGNAL(clicked()), this, SLOT(SetCAbs()));
108 connect( RBCNo, SIGNAL(clicked()), this, SLOT(SetCNo()));
109 connect( RBL2, SIGNAL(clicked()), this, SLOT(SetUCL2()));
110 connect( RBInf, SIGNAL(clicked()), this, SLOT(SetUCInf()));
111 connect( CBJump, SIGNAL(stateChanged(int)), this, SLOT(SetUseField()));
112 connect( PBZoneNew, SIGNAL(pressed()), this, SLOT(PushZoneNew()));
113 connect( PBZoneEdit, SIGNAL(pressed()), this, SLOT(PushZoneEdit()) );
114 connect( PBZoneDelete, SIGNAL(pressed()), this, SLOT(PushZoneDelete()) );
115 connect( CBGroupe, SIGNAL(stateChanged(int)), this, SLOT(SetFiltrage()));
117 connect( RBFieldNo, SIGNAL(clicked()), this, SLOT(SetFieldNo()));
118 connect( RBFieldAll, SIGNAL(clicked()), this, SLOT(SetFieldAll()));
119 connect( RBFieldChosen,SIGNAL(clicked()), this, SLOT(SetFieldChosen()));
121 connect( CBAdvanced, SIGNAL(stateChanged(int)), this, SLOT(SetAdvanced()));
122 connect( RBAIN, SIGNAL(clicked()), this, SLOT(SetAIN()));
123 connect( RBAIR, SIGNAL(clicked()), this, SLOT(SetAIR()));
124 connect( RBAID, SIGNAL(clicked()), this, SLOT(SetAID()));
126 connect( buttonOk, SIGNAL(pressed()), this, SLOT( PushOnOK()));
127 connect( buttonApply, SIGNAL(pressed()), this, SLOT( PushOnApply()));
128 connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close()));
129 connect( buttonHelp, SIGNAL(pressed()), this, SLOT( PushOnHelp()));
132 // ------------------------------------------------------------------------
133 bool MonCreateHypothesis::PushOnApply()
134 // ------------------------------------------------------------------------
135 // Appele lorsque l'un des boutons Ok ou Apply est presse
141 if (LEName->text().trimmed()=="") {
142 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
143 QObject::tr("HOM_HYPO_NAME") );
147 if (VerifieZone() == false) return false;
148 if (VerifieComposant() == false) return false;
150 // Creation de l'objet CORBA si ce n'est pas deja fait sous le meme nom
151 if (LEName->text().trimmed() != _Name)
153 _Name=LEName->text().trimmed();
156 aHypothesis=myHomardGen->CreateHypothesis(CORBA::string_dup(_Name.toStdString().c_str()) );
157 _parent->addHypothese(_Name);
159 catch( SALOME::SALOME_Exception& S_ex )
161 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
162 QString(CORBA::string_dup(S_ex.details.text)) );
167 // Mise en place des attributs
168 if ( _aTypeAdap == -1 )
171 if ( _aTypeRaff == 1 ) { TypeRaffDera = 1 ; }
172 else { TypeRaffDera = -1 ; }
173 aHypothesis->SetUnifRefinUnRef(TypeRaffDera);
175 aHypothesis->SetTypeFieldInterp(_TypeFieldInterp);
176 aHypothesis->SetCaseCreation(_aCaseName.toStdString().c_str());
181 AssocieFieldInterp();
184 if (CBAdvanced->isChecked())
186 // Enregistrement du niveau maximal
187 _NivMax = SpinBoxNivMax->value() ;
188 aHypothesis->SetNivMax(_NivMax);
189 // Enregistrement du diametre minimal
190 _DiamMin = doubleSpinBoxDiamMin->value() ;
191 aHypothesis->SetDiamMin(_DiamMin);
192 // Enregistrement de l'intialisation de l'adaptation
193 aHypothesis->SetAdapInit(_AdapInit);
194 // Sortie des niveaux de raffinement
195 if (CBLevelOutput->isChecked()) { _LevelOutput = 1 ; }
196 aHypothesis->SetLevelOutput(_LevelOutput);
199 HOMARD_UTILS::updateObjBrowser() ;
205 // ------------------------------------------------------------------------
206 void MonCreateHypothesis::PushOnOK()
207 // ------------------------------------------------------------------------
209 if (PushOnApply()) this->close();
210 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
212 // ------------------------------------------------------------------------
213 void MonCreateHypothesis::PushOnHelp()
214 // ------------------------------------------------------------------------
216 std::string LanguageShort = myHomardGen->GetLanguageShort();
217 HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"), QString(""), QString(LanguageShort.c_str()));
219 // -------------------------------------------------
220 void MonCreateHypothesis::SetNewName()
221 // --------------------------------------------------
224 HOMARD::listeHypotheses_var MyObjects = myHomardGen->GetAllHypothesesName();
229 aName.setNum(num+1) ;
230 aName.insert(0, QString("Hypo_")) ;
231 for ( int i=0; i<MyObjects->length(); i++)
233 if ( aName == QString(MyObjects[i]))
241 LEName->setText(aName);
245 // ------------------------------------------------------------------------
246 void MonCreateHypothesis::SetUniforme()
247 // ------------------------------------------------------------------------
249 GBFieldManagement->setVisible(0);
250 if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
251 else { GBFieldFile->setVisible(1); }
252 GBAreaManagement->setVisible(0);
253 GBUniform->setVisible(1);
259 // ------------------------------------------------------------------------
260 void MonCreateHypothesis::SetChamp()
261 // ------------------------------------------------------------------------
263 if (_aFieldFile == QString(""))
265 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
266 QObject::tr("HOM_HYPO_FIELD_FILE") );
268 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
271 LEFieldFile->setText(_aFieldFile);
272 LEFieldFile->setReadOnly(1);
274 GBUniform->setVisible(0);
275 GBAreaManagement->setVisible(0);
276 GBFieldManagement->setVisible(1);
277 GBFieldFile->setVisible(1);
279 GBUniform->adjustSize();
280 GBAreaManagement->adjustSize();
281 GBFieldManagement->adjustSize();
282 GBFieldFile->adjustSize();
288 // ------------------------------------------------------------------------
289 void MonCreateHypothesis::SetZone()
290 // ------------------------------------------------------------------------
293 GBUniform->setVisible(0);
294 GBFieldManagement->setVisible(0);
295 if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
296 else { GBFieldFile->setVisible(1); }
297 GBAreaManagement->setVisible(1);
306 // ------------------------------------------------------------------------
307 void MonCreateHypothesis::PushZoneNew()
308 // ------------------------------------------------------------------------
310 MESSAGE("Debut de MonCreateHypothesis::PushZoneNew")
311 MonCreateZone *aDlg = new MonCreateZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName) ;
315 // ------------------------------------------------------------------------
316 void MonCreateHypothesis::PushZoneEdit()
317 // ------------------------------------------------------------------------
319 MESSAGE("Debut de MonCreateHypothesis::PushZoneEdit")
320 int colonne = TWZone->currentColumn();
321 QTableWidgetItem * monItem = TWZone->currentItem();
322 if (colonne !=2 || monItem == NULL)
324 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
325 QObject::tr("HOM_HYPO_ZONE_1") );
328 QString zoneName = monItem->text().trimmed();
329 MonEditZone *aDlg = new MonEditZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, zoneName) ;
332 // ------------------------------------------------------------------------
333 void MonCreateHypothesis::PushZoneDelete()
334 // ------------------------------------------------------------------------
336 MESSAGE("Debut de MonCreateHypothesis::PushZoneDelete")
337 QMessageBox::warning( 0, QObject::tr("HOM_WARNING"),
338 QObject::tr("HOM_INACTIVE_BUTTON") );
342 // ------------------------------------------------------------------------
343 void MonCreateHypothesis::GetAllZones()
344 // ------------------------------------------------------------------------
345 // Recuperation de toutes les zones enregistrees dans l'arbre d'etude
346 // et affichage dans le tableau
347 // Par defaut, aucune n'est selectionnee
349 MESSAGE("Debut de GetAllZones") ;
350 HOMARD::listeZones_var mesZones = myHomardGen->GetAllZonesName();
351 int nbrow=TWZone->rowCount();
352 for ( int row=0; row< nbrow; row++)
354 TWZone->removeRow(row);
356 TWZone->setRowCount(0);
358 for (int i=0; i<mesZones->length(); i++)
360 TWZone->insertRow(row);
362 TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
363 TWZone->item( row, 0 )->setFlags( 0 );
364 TWZone->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
365 TWZone->item( row, 0 )->setCheckState( Qt::Unchecked );
367 TWZone->setItem( row, 1, new QTableWidgetItem( QString ("") ) );
368 TWZone->item( row, 1 )->setFlags( 0 );
369 TWZone->item( row, 1 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
370 TWZone->item( row, 1 )->setCheckState( Qt::Unchecked );
372 TWZone->setItem( row, 2, new QTableWidgetItem(QString(mesZones[i]).trimmed()));
373 TWZone->item( row, 2 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
377 TWZone->resizeColumnsToContents();
378 TWZone->resizeRowsToContents();
379 TWZone->clearSelection();
381 // ------------------------------------------------------------------------
382 void MonCreateHypothesis::addZoneinTWZone(QString newZone)
383 // ------------------------------------------------------------------------
385 MESSAGE("Debut de addZoneinTWZone") ;
386 int row = TWZone->rowCount() ;
387 // Par defaut, on suppose qu'une nouvelle zone est destinee au raffinement
388 TWZone->setRowCount( row+1 );
390 TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
391 TWZone->item( row, 0 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
392 TWZone->item( row, 0 )->setCheckState( Qt::Checked );
394 TWZone->setItem( row, 1, new QTableWidgetItem( QString ("") ) );
395 TWZone->item( row, 1 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
396 TWZone->item( row, 1 )->setCheckState( Qt::Unchecked );
398 TWZone->setItem( row, 2, new QTableWidgetItem( newZone ) );
399 TWZone->scrollToItem( TWZone->item( row, 2 ) );
401 TWZone->resizeRowsToContents();
402 TWZone->resizeColumnToContents(1);
403 TWZone->clearSelection();
405 TWZone->item( row, 2 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
407 // ------------------------------------------------------------------------
408 QStringList MonCreateHypothesis::GetZonesChecked()
409 // ------------------------------------------------------------------------
410 // Retourne les zones enregistrees
412 MESSAGE("Debut de GetZonesChecked") ;
413 QStringList ListeZone ;
414 // On ne peut pas avoir selectionne les deux options
416 for ( int row=0; row< TWZone->rowCount(); row++)
418 if ( ( TWZone->item( row, 0 )->checkState() == Qt::Checked ) && ( TWZone->item( row, 1 )->checkState() == Qt::Checked ) )
420 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
421 QObject::tr("HOM_HYPO_ZONE_3") );
425 // Si tout va bien, on affecte
426 // Attention, on insere en tete, donc on commence d'inserer le type, psui le nom de la zone
430 QString Dera = "-1" ;
431 for ( int row=0; row< TWZone->rowCount(); row++)
433 // MESSAGE ("row "<<row<<", zone : "<<TWZone->item(row, 2)->text().toStdString());
435 if ( TWZone->item(row,0)->checkState() == Qt::Checked )
436 { ListeZone.insert(0, Raff) ;
437 ListeZone.insert(0, QString(TWZone->item(row, 2)->text()) ) ; }
438 // En deraffinement :
439 if ( TWZone->item(row,1)->checkState() == Qt::Checked )
440 { ListeZone.insert(0, Dera) ;
441 ListeZone.insert(0, QString(TWZone->item(row, 2)->text()) ) ; }
443 MESSAGE("Fin de GetZonesChecked ; longueur de ListeZone : "<<ListeZone.count()) ;
448 // ------------------------------------------------------------------------
449 QStringList MonCreateHypothesis::GetListCompChecked()
450 // ------------------------------------------------------------------------
451 // Retourne les composantes retenues
453 MESSAGE( "Debut de GetListCompChecked" );
454 QStringList ListeComposant ;
456 ListeComposant.clear();
457 for ( int row=0; row< TWCMP->rowCount(); row++)
458 if ( TWCMP->item( row, 0 )->checkState() == Qt::Checked )
459 ListeComposant.insert(0, QString(TWCMP->item(row, 1)->text()) ) ;
460 // Choix du texte des radio-boutons selon 1 ou plusieurs composantes
461 if ( ListeComposant.count() < 2 )
462 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS"));
463 RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL"));
466 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2"));
467 RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF"));
469 return ListeComposant ;
472 // ------------------------------------------------------------------------
473 void MonCreateHypothesis::AssocieFieldInterp()
474 // ------------------------------------------------------------------------
476 if ( _TypeFieldInterp != 2 ) return;
477 for ( int row=0; row< TWField->rowCount(); row++)
479 if ( TWField->item( row, 0 )->checkState() == Qt::Checked )
481 aHypothesis->AddFieldInterp(TWField->item(row, 1)->text().toStdString().c_str());
485 // ------------------------------------------------------------------------
486 void MonCreateHypothesis::SetUniRaff()
487 // ------------------------------------------------------------------------
492 // ------------------------------------------------------------------------
493 void MonCreateHypothesis::SetUniDera()
494 // ------------------------------------------------------------------------
500 // ------------------------------------------------------------------------
501 void MonCreateHypothesis::InitFields()
502 // ------------------------------------------------------------------------
504 CBFieldName->clear();
505 std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
506 // Mise en place de la liste dans le menu pour l'indicateur d'erreur
507 std:: list<QString>::const_iterator it;
508 for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
510 CBFieldName->insertItem(0,QString(*it));
514 // ---------------------------------------
515 void MonCreateHypothesis::SetFieldName()
516 // -------------------------------------------
518 MESSAGE("Debut de SetFieldName");
519 _aFieldName=CBFieldName->currentText();
520 if (QString(_aFieldFile) == QString("") || QString(_aFieldName) == QString("") ) { return; }
522 int nbrow= TWCMP->rowCount() ;
523 for ( int row=0; row < nbrow ; row++)
525 TWCMP->removeRow(row);
527 TWCMP->setRowCount(0);
528 //TWCMP->resizeRowsToContents();
530 std::list<QString> maListe =HOMARD_QT_COMMUN::GetListeComposants(_aFieldFile, _aFieldName);
531 std::list<QString>::const_iterator it;
532 for ( it=maListe.begin() ; it != maListe.end(); it++)
535 TWCMP->setItem( 0, 0, new QTableWidgetItem( QString ("") ) );
536 TWCMP->item( 0, 0 )->setFlags( 0 );
537 TWCMP->item( 0, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
538 TWCMP->item( 0, 0 )->setCheckState( Qt::Checked );
539 TWCMP->setItem( 0, 1, new QTableWidgetItem(QString((*it)).trimmed()));
540 TWCMP->item( 0, 1 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
542 TWCMP->resizeColumnsToContents();
543 TWCMP->resizeRowsToContents();
544 TWCMP->clearSelection();
545 // Choix du texte des radio-boutons selon 1 ou plusieurs composantes
546 if ( TWCMP->rowCount() == 1 )
547 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS"));
548 RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL"));
551 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2"));
552 RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF"));
554 // Par defaut, on propose la valeur absolue / norme L2
557 // ------------------------------------------------------------------------
558 void MonCreateHypothesis::SetRPE()
559 // ------------------------------------------------------------------------
563 RBRPE->setChecked(true);
564 SpinBox_RPE->setEnabled(true);
565 SpinBox_RRel->setEnabled(false);
566 SpinBox_RAbs->setEnabled(false);
567 SpinBox_RMuSigma->setEnabled(false);
569 // ------------------------------------------------------------------------
570 void MonCreateHypothesis::SetRRel()
571 // ------------------------------------------------------------------------
575 RBRRel->setChecked(true);
576 SpinBox_RPE->setEnabled(false);
577 SpinBox_RRel->setEnabled(true);
578 SpinBox_RAbs->setEnabled(false);
579 SpinBox_RMuSigma->setEnabled(false);
581 // ------------------------------------------------------------------------
582 void MonCreateHypothesis::SetRAbs()
583 // ------------------------------------------------------------------------
587 RBRAbs->setChecked(true);
588 SpinBox_RPE->setEnabled(false);
589 SpinBox_RRel->setEnabled(false);
590 SpinBox_RAbs->setEnabled(true);
591 SpinBox_RMuSigma->setEnabled(false);
593 // ------------------------------------------------------------------------
594 void MonCreateHypothesis::SetRMS()
595 // ------------------------------------------------------------------------
599 RBRMuSigma->setChecked(true);
600 SpinBox_RPE->setEnabled(false);
601 SpinBox_RRel->setEnabled(false);
602 SpinBox_RAbs->setEnabled(false);
603 SpinBox_RMuSigma->setEnabled(true);
605 // ------------------------------------------------------------------------
606 void MonCreateHypothesis::SetRNo()
607 // ------------------------------------------------------------------------
611 RBRNo->setChecked(true);
612 SpinBox_RPE->setEnabled(false);
613 SpinBox_RRel->setEnabled(false);
614 SpinBox_RAbs->setEnabled(false);
615 SpinBox_RMuSigma->setEnabled(false);
617 // ------------------------------------------------------------------------
618 void MonCreateHypothesis::SetCPE()
619 // ------------------------------------------------------------------------
623 RBCPE->setChecked(true);
624 SpinBox_CPE->setEnabled(true);
625 SpinBox_CRel->setEnabled(false);
626 SpinBox_CAbs->setEnabled(false);
627 SpinBox_CMuSigma->setEnabled(false);
629 // ------------------------------------------------------------------------
630 void MonCreateHypothesis::SetCRel()
631 // ------------------------------------------------------------------------
635 RBCRel->setChecked(true);
636 SpinBox_CPE->setEnabled(false);
637 SpinBox_CRel->setEnabled(true);
638 SpinBox_CAbs->setEnabled(false);
639 SpinBox_CMuSigma->setEnabled(false);
641 // ------------------------------------------------------------------------
642 void MonCreateHypothesis::SetCAbs()
643 // ------------------------------------------------------------------------
647 RBCAbs->setChecked(true);
648 SpinBox_CPE->setEnabled(false);
649 SpinBox_CRel->setEnabled(false);
650 SpinBox_CAbs->setEnabled(true);
651 SpinBox_CMuSigma->setEnabled(false);
653 // ------------------------------------------------------------------------
654 void MonCreateHypothesis::SetCMS()
655 // ------------------------------------------------------------------------
659 RBCMuSigma->setChecked(true);
660 SpinBox_CPE->setEnabled(false);
661 SpinBox_CRel->setEnabled(false);
662 SpinBox_CAbs->setEnabled(false);
663 SpinBox_CMuSigma->setEnabled(true);
665 // ------------------------------------------------------------------------
666 void MonCreateHypothesis::SetCNo()
667 // ------------------------------------------------------------------------
671 RBCNo->setChecked(true);
672 SpinBox_CPE->setEnabled(false);
673 SpinBox_CRel->setEnabled(false);
674 SpinBox_CAbs->setEnabled(false);
675 SpinBox_CMuSigma->setEnabled(false);
677 // ------------------------------------------------------------------------
678 void MonCreateHypothesis::SetUCL2()
679 // ------------------------------------------------------------------------
682 RBL2->setChecked(true);
684 // ------------------------------------------------------------------------
685 void MonCreateHypothesis::SetUCInf()
686 // ------------------------------------------------------------------------
689 RBInf->setChecked(true);
691 // ------------------------------------------------------------------------
692 void MonCreateHypothesis::SetUseField()
693 // ------------------------------------------------------------------------
695 if ( CBJump->isChecked() ) { _UsField = 1 ; }
696 else { _UsField = 0 ; }
698 // ------------------------------------------------------------------------
699 void MonCreateHypothesis::SetFiltrage()
700 // ------------------------------------------------------------------------
702 if (!CBGroupe->isChecked()) return;
703 MonCreateListGroup *aDlg = new MonCreateListGroup(this, NULL, TRUE, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),_aCaseName, _aListeGroupes) ;
707 // ------------------------------------------------------------------------
708 void MonCreateHypothesis::setGroups(QStringList listGroup)
709 // ------------------------------------------------------------------------
711 _aListeGroupes=listGroup;
713 // ------------------------------------------------------------------------
714 bool MonCreateHypothesis::VerifieZone()
715 // ------------------------------------------------------------------------
717 if ( _aTypeAdap != 0 ) return true;
718 MESSAGE("Debut de VerifieZone") ;
719 _aListeZone = GetZonesChecked() ;
720 MESSAGE(". Longueur de _aListeZone : "<<_aListeZone.count()) ;
721 if (_aListeZone.count() == 0)
723 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
724 QObject::tr("HOM_HYPO_ZONE_2") );
727 MESSAGE("Fin de VerifieZone") ;
730 // ------------------------------------------------------------------------
731 bool MonCreateHypothesis::VerifieComposant()
732 // ------------------------------------------------------------------------
734 if ( _aTypeAdap != 1 ) return true;
735 _aListeComposant = GetListCompChecked() ;
736 if (_aListeComposant.count() == 0)
738 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
739 QObject::tr("HOM_HYPO_COMP") );
745 // ------------------------------------------------------------------------
746 void MonCreateHypothesis::AssocieLesZones()
747 // ------------------------------------------------------------------------
749 MESSAGE( "Debut de AssocieLesZones" );
750 if ( _aTypeAdap != 0 ) return;
751 _aListeZone = GetZonesChecked() ;
752 MESSAGE(". Longueur de _aListeZone : "<<_aListeZone.count()) ;
755 for ( int i=0 ; i< _aListeZone.count() ; i++ )
756 { if ( _aListeZone[i+1] == Raff ) { TypeUse = 1 ; }
757 else { TypeUse = -1 ; }
758 aHypothesis->AddZone(_aListeZone[i].toStdString().c_str(), TypeUse);
761 MESSAGE( "Fin de AssocieLesZones" );
763 // ------------------------------------------------------------------------
764 void MonCreateHypothesis::AssocieComposants()
765 // ------------------------------------------------------------------------
767 if ( _aTypeAdap != 1 ) return;
768 MESSAGE( "Dans AssocieComposants, _TypeThC : " << _TypeThC );
769 MESSAGE( "Dans AssocieComposants, _TypeThR : " << _TypeThR );
772 if ( _TypeThR == 1 ) { _ThreshR = SpinBox_RAbs->value();}
773 if ( _TypeThR == 2 ) { _ThreshR = SpinBox_RRel->value();}
774 if ( _TypeThR == 3 ) { _ThreshR = SpinBox_RPE->value(); }
775 if ( _TypeThR == 4 ) { _ThreshR = SpinBox_RMuSigma->value(); }
778 if ( _TypeThC == 1 ) { _ThreshC = SpinBox_CAbs->value();}
779 if ( _TypeThC == 2 ) { _ThreshC = SpinBox_CRel->value();}
780 if ( _TypeThC == 3 ) { _ThreshC = SpinBox_CPE->value(); }
781 if ( _TypeThC == 4 ) { _ThreshC = SpinBox_CMuSigma->value(); }
783 _aFieldName=CBFieldName->currentText();
784 aHypothesis->SetField(CORBA::string_dup(_aFieldName.toStdString().c_str()) ) ;
785 aHypothesis->SetRefinThr( _TypeThR, _ThreshR ) ;
786 aHypothesis->SetUnRefThr( _TypeThC, _ThreshC ) ;
787 aHypothesis->SetUseField( _UsField ) ;
788 aHypothesis->SetUseComp( _UsCmpI ) ;
789 _aListeComposant = GetListCompChecked() ;
790 for ( int i=0 ; i< _aListeComposant.count() ; i++ )
791 { aHypothesis->AddComp(_aListeComposant[i].toStdString().c_str()); }
793 // ------------------------------------------------------------------------
794 void MonCreateHypothesis::AssocieLesGroupes()
795 // ------------------------------------------------------------------------
797 HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::ListGroupType;
798 aSeqGroupe->length(_aListeGroupes.size());
799 QStringList::const_iterator it;
801 for (it = _aListeGroupes.constBegin(); it != _aListeGroupes.constEnd(); it++)
802 aSeqGroupe[i++]=(*it).toStdString().c_str();
803 aHypothesis->SetGroups(aSeqGroupe);
806 // ------------------------------------------------------------------------
807 void MonCreateHypothesis::SetFieldNo()
808 // ------------------------------------------------------------------------
809 // Par defaut, on n'interpole rien
811 if ( _aTypeAdap == 1 ) { GBFieldFile->setVisible(1); }
812 else { GBFieldFile->setVisible(0); }
813 TWField->setVisible(0);
815 _TypeFieldInterp = 0 ;
819 // ------------------------------------------------------------------------
820 void MonCreateHypothesis::SetFieldAll()
821 // ------------------------------------------------------------------------
822 // Par defaut, on interpole tout
824 if (_aFieldFile == QString(""))
826 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
827 QObject::tr("HOM_HYPO_FIELD_FILE") );
829 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
832 LEFieldFile->setText(_aFieldFile);
833 LEFieldFile->setReadOnly(1);
834 GBFieldFile->setVisible(1);
835 TWField->setVisible(0);
837 _TypeFieldInterp = 1 ;
841 // ------------------------------------------------------------------------
842 void MonCreateHypothesis::SetFieldChosen()
843 // ------------------------------------------------------------------------
845 if (_aFieldFile == QString(""))
847 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
848 QObject::tr("HOM_HYPO_FIELD_FILE") );
850 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
853 LEFieldFile->setText(_aFieldFile);
854 LEFieldFile->setReadOnly(1);
855 GBFieldFile->setVisible(1);
856 // Recuperation de la liste des champs contenus dans le fichier _aFieldFile
857 std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
859 // Initialisation de la table
861 int nbrow=TWField->rowCount();
862 for ( int row=0; row< nbrow; row++)
864 TWField->removeRow(row);
866 TWField->setRowCount(0);
867 std:: list<QString>::const_iterator it;
869 for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
871 TWField->insertRow(row);
872 TWField->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
873 TWField->item( row, 0 )->setFlags( 0 );
874 TWField->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
875 TWField->item( row, 0 )->setCheckState( Qt::Unchecked );
876 TWField->setItem( row, 1, new QTableWidgetItem(QString(*it).trimmed()));
877 TWField->item( row, 1 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
880 TWField->resizeColumnsToContents();
881 TWField->resizeRowsToContents();
882 TWField->clearSelection();
883 TWField->setVisible(1);
885 _TypeFieldInterp = 2 ;
889 // ------------------------------------------------------------------------
890 void MonCreateHypothesis::SetAdvanced()
891 // ------------------------------------------------------------------------
893 MESSAGE("Debut de SetAdvanced ");
894 if (CBAdvanced->isChecked())
895 { GBAdvancedOptions->setVisible(1);
896 if (_aFieldFile != QString(""))
897 { GBAdapInit->setVisible(1) ;
900 { GBAdapInit->setVisible(0) ;
904 { GBAdvancedOptions->setVisible(0);
908 CBLevelOutput->setChecked(false);
914 // ------------------------------------------------------------------------
915 void MonCreateHypothesis::SetAIN()
916 // ------------------------------------------------------------------------
918 MESSAGE("Debut de SetAIN ");
921 // ------------------------------------------------------------------------
922 void MonCreateHypothesis::SetAIR()
923 // ------------------------------------------------------------------------
925 MESSAGE("Debut de SetAIR ");
928 // ------------------------------------------------------------------------
929 void MonCreateHypothesis::SetAID()
930 // ------------------------------------------------------------------------
932 MESSAGE("Debut de SetAID ");