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 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 aHypothesis->SetAdapRefinUnRef(_aTypeAdap,_aTypeRaff,_aTypeDera);
169 aHypothesis->SetTypeFieldInterp(_TypeFieldInterp);
170 aHypothesis->SetCaseCreation(_aCaseName.toStdString().c_str());
175 AssocieFieldInterp();
178 if (CBAdvanced->isChecked())
180 // Enregistrement du niveau maximal
181 _NivMax = SpinBoxNivMax->value() ;
182 aHypothesis->SetNivMax(_NivMax);
183 // Enregistrement du diametre minimal
184 _DiamMin = doubleSpinBoxDiamMin->value() ;
185 aHypothesis->SetDiamMin(_DiamMin);
186 // Enregistrement de l'intialisation de l'adaptation
187 aHypothesis->SetAdapInit(_AdapInit);
188 // Sortie des niveaux de raffinement
189 if (CBLevelOutput->isChecked()) { _LevelOutput = 1 ; }
190 aHypothesis->SetLevelOutput(_LevelOutput);
193 HOMARD_UTILS::updateObjBrowser() ;
199 // ------------------------------------------------------------------------
200 void MonCreateHypothesis::PushOnOK()
201 // ------------------------------------------------------------------------
203 if (PushOnApply()) this->close();
204 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
206 // ------------------------------------------------------------------------
207 void MonCreateHypothesis::PushOnHelp()
208 // ------------------------------------------------------------------------
210 std::string LanguageShort = myHomardGen->GetLanguageShort();
211 HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"), QString(""), QString(LanguageShort.c_str()));
213 // -------------------------------------------------
214 void MonCreateHypothesis::SetNewName()
215 // --------------------------------------------------
218 HOMARD::listeHypotheses_var MyObjects = myHomardGen->GetAllHypothesesName();
223 aName.setNum(num+1) ;
224 aName.insert(0, QString("Hypo_")) ;
225 for ( int i=0; i<MyObjects->length(); i++)
227 if ( aName == QString(MyObjects[i]))
235 LEName->setText(aName);
239 // ------------------------------------------------------------------------
240 void MonCreateHypothesis::SetUniforme()
241 // ------------------------------------------------------------------------
243 GBFieldManagement->setVisible(0);
244 if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
245 else { GBFieldFile->setVisible(1); }
246 GBAreaManagement->setVisible(0);
247 GBUniform->setVisible(1);
253 // ------------------------------------------------------------------------
254 void MonCreateHypothesis::SetChamp()
255 // ------------------------------------------------------------------------
257 if (_aFieldFile == QString(""))
259 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
260 QObject::tr("HOM_HYPO_FIELD_FILE") );
262 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
265 LEFieldFile->setText(_aFieldFile);
266 LEFieldFile->setReadOnly(1);
268 GBUniform->setVisible(0);
269 GBAreaManagement->setVisible(0);
270 GBFieldManagement->setVisible(1);
271 GBFieldFile->setVisible(1);
273 GBUniform->adjustSize();
274 GBAreaManagement->adjustSize();
275 GBFieldManagement->adjustSize();
276 GBFieldFile->adjustSize();
282 // ------------------------------------------------------------------------
283 void MonCreateHypothesis::SetZone()
284 // ------------------------------------------------------------------------
287 GBUniform->setVisible(0);
288 GBFieldManagement->setVisible(0);
289 if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
290 else { GBFieldFile->setVisible(1); }
291 GBAreaManagement->setVisible(1);
300 // ------------------------------------------------------------------------
301 void MonCreateHypothesis::PushZoneNew()
302 // ------------------------------------------------------------------------
304 MESSAGE("Debut de MonCreateHypothesis::PushZoneNew")
305 MonCreateZone *aDlg = new MonCreateZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName) ;
309 // ------------------------------------------------------------------------
310 void MonCreateHypothesis::PushZoneEdit()
311 // ------------------------------------------------------------------------
313 MESSAGE("Debut de MonCreateHypothesis::PushZoneEdit")
314 int colonne = TWZone->currentColumn();
315 QTableWidgetItem * monItem = TWZone->currentItem();
316 if (colonne !=2 || monItem == NULL)
318 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
319 QObject::tr("HOM_HYPO_ZONE_1") );
322 QString zoneName = monItem->text().trimmed();
323 MonEditZone *aDlg = new MonEditZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, zoneName) ;
326 // ------------------------------------------------------------------------
327 void MonCreateHypothesis::PushZoneDelete()
328 // ------------------------------------------------------------------------
330 MESSAGE("Debut de MonCreateHypothesis::PushZoneDelete")
331 QMessageBox::warning( 0, QObject::tr("HOM_WARNING"),
332 QObject::tr("HOM_INACTIVE_BUTTON") );
336 // ------------------------------------------------------------------------
337 void MonCreateHypothesis::GetAllZones()
338 // ------------------------------------------------------------------------
339 // Recuperation de toutes les zones enregistrees dans l'arbre d'etude
340 // et affichage dans le tableau
341 // Par defaut, aucune n'est selectionnee
343 MESSAGE("Debut de GetAllZones") ;
344 HOMARD::listeZones_var mesZones = myHomardGen->GetAllZonesName();
345 int nbrow=TWZone->rowCount();
346 for ( int row=0; row< nbrow; row++)
348 TWZone->removeRow(row);
350 TWZone->setRowCount(0);
352 for (int i=0; i<mesZones->length(); i++)
354 TWZone->insertRow(row);
356 TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
357 TWZone->item( row, 0 )->setFlags( 0 );
358 TWZone->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
359 TWZone->item( row, 0 )->setCheckState( Qt::Unchecked );
361 TWZone->setItem( row, 1, new QTableWidgetItem( QString ("") ) );
362 TWZone->item( row, 1 )->setFlags( 0 );
363 TWZone->item( row, 1 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
364 TWZone->item( row, 1 )->setCheckState( Qt::Unchecked );
366 TWZone->setItem( row, 2, new QTableWidgetItem(QString(mesZones[i]).trimmed()));
367 TWZone->item( row, 2 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
371 TWZone->resizeColumnsToContents();
372 TWZone->resizeRowsToContents();
373 TWZone->clearSelection();
375 // ------------------------------------------------------------------------
376 void MonCreateHypothesis::addZoneinTWZone(QString newZone)
377 // ------------------------------------------------------------------------
379 MESSAGE("Debut de addZoneinTWZone") ;
380 int row = TWZone->rowCount() ;
381 // Par defaut, on suppose qu'une nouvelle zone est destinee au raffinement
382 TWZone->setRowCount( row+1 );
384 TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
385 TWZone->item( row, 0 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
386 TWZone->item( row, 0 )->setCheckState( Qt::Checked );
388 TWZone->setItem( row, 1, new QTableWidgetItem( QString ("") ) );
389 TWZone->item( row, 1 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
390 TWZone->item( row, 1 )->setCheckState( Qt::Unchecked );
392 TWZone->setItem( row, 2, new QTableWidgetItem( newZone ) );
393 TWZone->scrollToItem( TWZone->item( row, 2 ) );
395 TWZone->resizeRowsToContents();
396 TWZone->resizeColumnToContents(1);
397 TWZone->clearSelection();
399 TWZone->item( row, 2 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
401 // ------------------------------------------------------------------------
402 QStringList MonCreateHypothesis::GetZonesChecked()
403 // ------------------------------------------------------------------------
404 // Retourne les zones enregistrees
406 MESSAGE("Debut de GetZonesChecked") ;
407 QStringList ListeZone ;
408 // On ne peut pas avoir selectionne les deux options
410 for ( int row=0; row< TWZone->rowCount(); row++)
412 if ( ( TWZone->item( row, 0 )->checkState() == Qt::Checked ) && ( TWZone->item( row, 1 )->checkState() == Qt::Checked ) )
414 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
415 QObject::tr("HOM_HYPO_ZONE_3") );
419 // Si tout va bien, on affecte
420 // Attention, on insere en tete, donc on commence d'inserer le type, psui le nom de la zone
424 QString Dera = "-1" ;
425 for ( int row=0; row< TWZone->rowCount(); row++)
427 // MESSAGE ("row "<<row<<", zone : "<<TWZone->item(row, 2)->text().toStdString());
429 if ( TWZone->item(row,0)->checkState() == Qt::Checked )
430 { ListeZone.insert(0, Raff) ;
431 ListeZone.insert(0, QString(TWZone->item(row, 2)->text()) ) ; }
432 // En deraffinement :
433 if ( TWZone->item(row,1)->checkState() == Qt::Checked )
434 { ListeZone.insert(0, Dera) ;
435 ListeZone.insert(0, QString(TWZone->item(row, 2)->text()) ) ; }
437 MESSAGE("Fin de GetZonesChecked ; longueur de ListeZone : "<<ListeZone.count()) ;
442 // ------------------------------------------------------------------------
443 QStringList MonCreateHypothesis::GetListCompChecked()
444 // ------------------------------------------------------------------------
445 // Retourne les composantes retenues
447 MESSAGE( "Debut de GetListCompChecked" );
448 QStringList ListeComposant ;
450 ListeComposant.clear();
451 for ( int row=0; row< TWCMP->rowCount(); row++)
452 if ( TWCMP->item( row, 0 )->checkState() == Qt::Checked )
453 ListeComposant.insert(0, QString(TWCMP->item(row, 1)->text()) ) ;
454 // Choix du texte des radio-boutons selon 1 ou plusieurs composantes
455 if ( ListeComposant.count() < 2 )
456 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS"));
457 RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL"));
460 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2"));
461 RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF"));
463 return ListeComposant ;
466 // ------------------------------------------------------------------------
467 void MonCreateHypothesis::AssocieFieldInterp()
468 // ------------------------------------------------------------------------
470 if ( _TypeFieldInterp != 2 ) return;
471 for ( int row=0; row< TWField->rowCount(); row++)
473 if ( TWField->item( row, 0 )->checkState() == Qt::Checked )
475 aHypothesis->AddFieldInterp(TWField->item(row, 1)->text().toStdString().c_str());
479 // ------------------------------------------------------------------------
480 void MonCreateHypothesis::SetUniRaff()
481 // ------------------------------------------------------------------------
486 // ------------------------------------------------------------------------
487 void MonCreateHypothesis::SetUniDera()
488 // ------------------------------------------------------------------------
494 // ------------------------------------------------------------------------
495 void MonCreateHypothesis::InitFields()
496 // ------------------------------------------------------------------------
498 CBFieldName->clear();
499 std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
500 // Mise en place de la liste dans le menu pour l'indicateur d'erreur
501 std:: list<QString>::const_iterator it;
502 for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
504 CBFieldName->insertItem(0,QString(*it));
508 // ---------------------------------------
509 void MonCreateHypothesis::SetFieldName()
510 // -------------------------------------------
512 MESSAGE("Debut de SetFieldName");
513 _aFieldName=CBFieldName->currentText();
514 if (QString(_aFieldFile) == QString("") || QString(_aFieldName) == QString("") ) { return; }
516 int nbrow= TWCMP->rowCount() ;
517 for ( int row=0; row < nbrow ; row++)
519 TWCMP->removeRow(row);
521 TWCMP->setRowCount(0);
522 //TWCMP->resizeRowsToContents();
524 std::list<QString> maListe =HOMARD_QT_COMMUN::GetListeComposants(_aFieldFile, _aFieldName);
525 std::list<QString>::const_iterator it;
526 for ( it=maListe.begin() ; it != maListe.end(); it++)
529 TWCMP->setItem( 0, 0, new QTableWidgetItem( QString ("") ) );
530 TWCMP->item( 0, 0 )->setFlags( 0 );
531 TWCMP->item( 0, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
532 TWCMP->item( 0, 0 )->setCheckState( Qt::Checked );
533 TWCMP->setItem( 0, 1, new QTableWidgetItem(QString((*it)).trimmed()));
534 TWCMP->item( 0, 1 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
536 TWCMP->resizeColumnsToContents();
537 TWCMP->resizeRowsToContents();
538 TWCMP->clearSelection();
539 // Choix du texte des radio-boutons selon 1 ou plusieurs composantes
540 if ( TWCMP->rowCount() == 1 )
541 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS"));
542 RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL"));
545 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2"));
546 RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF"));
548 // Par defaut, on propose la valeur absolue / norme L2
551 // ------------------------------------------------------------------------
552 void MonCreateHypothesis::SetRPE()
553 // ------------------------------------------------------------------------
557 RBRPE->setChecked(true);
558 SpinBox_RPE->setEnabled(true);
559 SpinBox_RRel->setEnabled(false);
560 SpinBox_RAbs->setEnabled(false);
561 SpinBox_RMuSigma->setEnabled(false);
563 // ------------------------------------------------------------------------
564 void MonCreateHypothesis::SetRRel()
565 // ------------------------------------------------------------------------
569 RBRRel->setChecked(true);
570 SpinBox_RPE->setEnabled(false);
571 SpinBox_RRel->setEnabled(true);
572 SpinBox_RAbs->setEnabled(false);
573 SpinBox_RMuSigma->setEnabled(false);
575 // ------------------------------------------------------------------------
576 void MonCreateHypothesis::SetRAbs()
577 // ------------------------------------------------------------------------
581 RBRAbs->setChecked(true);
582 SpinBox_RPE->setEnabled(false);
583 SpinBox_RRel->setEnabled(false);
584 SpinBox_RAbs->setEnabled(true);
585 SpinBox_RMuSigma->setEnabled(false);
587 // ------------------------------------------------------------------------
588 void MonCreateHypothesis::SetRMS()
589 // ------------------------------------------------------------------------
593 RBRMuSigma->setChecked(true);
594 SpinBox_RPE->setEnabled(false);
595 SpinBox_RRel->setEnabled(false);
596 SpinBox_RAbs->setEnabled(false);
597 SpinBox_RMuSigma->setEnabled(true);
599 // ------------------------------------------------------------------------
600 void MonCreateHypothesis::SetRNo()
601 // ------------------------------------------------------------------------
605 RBRNo->setChecked(true);
606 SpinBox_RPE->setEnabled(false);
607 SpinBox_RRel->setEnabled(false);
608 SpinBox_RAbs->setEnabled(false);
609 SpinBox_RMuSigma->setEnabled(false);
611 // ------------------------------------------------------------------------
612 void MonCreateHypothesis::SetCPE()
613 // ------------------------------------------------------------------------
617 RBCPE->setChecked(true);
618 SpinBox_CPE->setEnabled(true);
619 SpinBox_CRel->setEnabled(false);
620 SpinBox_CAbs->setEnabled(false);
621 SpinBox_CMuSigma->setEnabled(false);
623 // ------------------------------------------------------------------------
624 void MonCreateHypothesis::SetCRel()
625 // ------------------------------------------------------------------------
629 RBCRel->setChecked(true);
630 SpinBox_CPE->setEnabled(false);
631 SpinBox_CRel->setEnabled(true);
632 SpinBox_CAbs->setEnabled(false);
633 SpinBox_CMuSigma->setEnabled(false);
635 // ------------------------------------------------------------------------
636 void MonCreateHypothesis::SetCAbs()
637 // ------------------------------------------------------------------------
641 RBCAbs->setChecked(true);
642 SpinBox_CPE->setEnabled(false);
643 SpinBox_CRel->setEnabled(false);
644 SpinBox_CAbs->setEnabled(true);
645 SpinBox_CMuSigma->setEnabled(false);
647 // ------------------------------------------------------------------------
648 void MonCreateHypothesis::SetCMS()
649 // ------------------------------------------------------------------------
653 RBCMuSigma->setChecked(true);
654 SpinBox_CPE->setEnabled(false);
655 SpinBox_CRel->setEnabled(false);
656 SpinBox_CAbs->setEnabled(false);
657 SpinBox_CMuSigma->setEnabled(true);
659 // ------------------------------------------------------------------------
660 void MonCreateHypothesis::SetCNo()
661 // ------------------------------------------------------------------------
665 RBCNo->setChecked(true);
666 SpinBox_CPE->setEnabled(false);
667 SpinBox_CRel->setEnabled(false);
668 SpinBox_CAbs->setEnabled(false);
669 SpinBox_CMuSigma->setEnabled(false);
671 // ------------------------------------------------------------------------
672 void MonCreateHypothesis::SetUCL2()
673 // ------------------------------------------------------------------------
676 RBL2->setChecked(true);
678 // ------------------------------------------------------------------------
679 void MonCreateHypothesis::SetUCInf()
680 // ------------------------------------------------------------------------
683 RBInf->setChecked(true);
685 // ------------------------------------------------------------------------
686 void MonCreateHypothesis::SetUseField()
687 // ------------------------------------------------------------------------
689 if ( CBJump->isChecked() ) { _UsField = 1 ; }
690 else { _UsField = 0 ; }
692 // ------------------------------------------------------------------------
693 void MonCreateHypothesis::SetFiltrage()
694 // ------------------------------------------------------------------------
696 if (!CBGroupe->isChecked()) return;
697 MonCreateListGroup *aDlg = new MonCreateListGroup(this, NULL, TRUE, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),_aCaseName, _aListeGroupes) ;
701 // ------------------------------------------------------------------------
702 void MonCreateHypothesis::setGroups(QStringList listGroup)
703 // ------------------------------------------------------------------------
705 _aListeGroupes=listGroup;
707 // ------------------------------------------------------------------------
708 bool MonCreateHypothesis::VerifieZone()
709 // ------------------------------------------------------------------------
711 if ( _aTypeAdap != 0 ) return true;
712 MESSAGE("Debut de VerifieZone") ;
713 _aListeZone = GetZonesChecked() ;
714 MESSAGE(". Longueur de _aListeZone : "<<_aListeZone.count()) ;
715 if (_aListeZone.count() == 0)
717 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
718 QObject::tr("HOM_HYPO_ZONE_2") );
721 MESSAGE("Fin de VerifieZone") ;
724 // ------------------------------------------------------------------------
725 bool MonCreateHypothesis::VerifieComposant()
726 // ------------------------------------------------------------------------
728 if ( _aTypeAdap != 1 ) return true;
729 _aListeComposant = GetListCompChecked() ;
730 if (_aListeComposant.count() == 0)
732 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
733 QObject::tr("HOM_HYPO_COMP") );
739 // ------------------------------------------------------------------------
740 void MonCreateHypothesis::AssocieLesZones()
741 // ------------------------------------------------------------------------
743 MESSAGE( "Debut de AssocieLesZones" );
744 if ( _aTypeAdap != 0 ) return;
745 _aListeZone = GetZonesChecked() ;
746 MESSAGE(". Longueur de _aListeZone : "<<_aListeZone.count()) ;
749 for ( int i=0 ; i< _aListeZone.count() ; i++ )
750 { if ( _aListeZone[i+1] == Raff ) { TypeUse = 1 ; }
751 else { TypeUse = -1 ; }
752 aHypothesis->AddZone(_aListeZone[i].toStdString().c_str(), TypeUse);
755 MESSAGE( "Fin de AssocieLesZones" );
757 // ------------------------------------------------------------------------
758 void MonCreateHypothesis::AssocieComposants()
759 // ------------------------------------------------------------------------
761 if ( _aTypeAdap != 1 ) return;
762 MESSAGE( "Dans AssocieComposants, _TypeThC : " << _TypeThC );
763 MESSAGE( "Dans AssocieComposants, _TypeThR : " << _TypeThR );
766 if ( _TypeThR == 1 ) { _ThreshR = SpinBox_RAbs->value();}
767 if ( _TypeThR == 2 ) { _ThreshR = SpinBox_RRel->value();}
768 if ( _TypeThR == 3 ) { _ThreshR = SpinBox_RPE->value(); }
769 if ( _TypeThR == 4 ) { _ThreshR = SpinBox_RMuSigma->value(); }
772 if ( _TypeThC == 1 ) { _ThreshC = SpinBox_CAbs->value();}
773 if ( _TypeThC == 2 ) { _ThreshC = SpinBox_CRel->value();}
774 if ( _TypeThC == 3 ) { _ThreshC = SpinBox_CPE->value(); }
775 if ( _TypeThC == 4 ) { _ThreshC = SpinBox_CMuSigma->value(); }
777 _aFieldName=CBFieldName->currentText();
778 aHypothesis->SetField(CORBA::string_dup(_aFieldName.toStdString().c_str()) ) ;
779 aHypothesis->SetRefinThr( _TypeThR, _ThreshR ) ;
780 aHypothesis->SetUnRefThr( _TypeThC, _ThreshC ) ;
781 aHypothesis->SetUseField( _UsField ) ;
782 aHypothesis->SetUseComp( _UsCmpI ) ;
783 _aListeComposant = GetListCompChecked() ;
784 for ( int i=0 ; i< _aListeComposant.count() ; i++ )
785 { aHypothesis->AddComp(_aListeComposant[i].toStdString().c_str()); }
787 // ------------------------------------------------------------------------
788 void MonCreateHypothesis::AssocieLesGroupes()
789 // ------------------------------------------------------------------------
791 HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::ListGroupType;
792 aSeqGroupe->length(_aListeGroupes.size());
793 QStringList::const_iterator it;
795 for (it = _aListeGroupes.constBegin(); it != _aListeGroupes.constEnd(); it++)
796 aSeqGroupe[i++]=(*it).toStdString().c_str();
797 aHypothesis->SetGroups(aSeqGroupe);
800 // ------------------------------------------------------------------------
801 void MonCreateHypothesis::SetFieldNo()
802 // ------------------------------------------------------------------------
803 // Par defaut, on n'interpole rien
805 if ( _aTypeAdap == 1 ) { GBFieldFile->setVisible(1); }
806 else { GBFieldFile->setVisible(0); }
807 TWField->setVisible(0);
809 _TypeFieldInterp = 0 ;
813 // ------------------------------------------------------------------------
814 void MonCreateHypothesis::SetFieldAll()
815 // ------------------------------------------------------------------------
816 // Par defaut, on interpole tout
818 if (_aFieldFile == QString(""))
820 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
821 QObject::tr("HOM_HYPO_FIELD_FILE") );
823 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
826 LEFieldFile->setText(_aFieldFile);
827 LEFieldFile->setReadOnly(1);
828 GBFieldFile->setVisible(1);
829 TWField->setVisible(0);
831 _TypeFieldInterp = 1 ;
835 // ------------------------------------------------------------------------
836 void MonCreateHypothesis::SetFieldChosen()
837 // ------------------------------------------------------------------------
839 if (_aFieldFile == QString(""))
841 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
842 QObject::tr("HOM_HYPO_FIELD_FILE") );
844 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
847 LEFieldFile->setText(_aFieldFile);
848 LEFieldFile->setReadOnly(1);
849 GBFieldFile->setVisible(1);
850 // Recuperation de la liste des champs contenus dans le fichier _aFieldFile
851 std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
853 // Initialisation de la table
855 int nbrow=TWField->rowCount();
856 for ( int row=0; row< nbrow; row++)
858 TWField->removeRow(row);
860 TWField->setRowCount(0);
861 std:: list<QString>::const_iterator it;
863 for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
865 TWField->insertRow(row);
866 TWField->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
867 TWField->item( row, 0 )->setFlags( 0 );
868 TWField->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
869 TWField->item( row, 0 )->setCheckState( Qt::Unchecked );
870 TWField->setItem( row, 1, new QTableWidgetItem(QString(*it).trimmed()));
871 TWField->item( row, 1 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
874 TWField->resizeColumnsToContents();
875 TWField->resizeRowsToContents();
876 TWField->clearSelection();
877 TWField->setVisible(1);
879 _TypeFieldInterp = 2 ;
883 // ------------------------------------------------------------------------
884 void MonCreateHypothesis::SetAdvanced()
885 // ------------------------------------------------------------------------
887 MESSAGE("Debut de SetAdvanced ");
888 if (CBAdvanced->isChecked())
889 { GBAdvancedOptions->setVisible(1);
890 if (_aFieldFile != QString(""))
891 { GBAdapInit->setVisible(1) ;
894 { GBAdapInit->setVisible(0) ;
898 { GBAdvancedOptions->setVisible(0);
902 CBLevelOutput->setChecked(false);
908 // ------------------------------------------------------------------------
909 void MonCreateHypothesis::SetAIN()
910 // ------------------------------------------------------------------------
912 MESSAGE("Debut de SetAIN ");
915 // ------------------------------------------------------------------------
916 void MonCreateHypothesis::SetAIR()
917 // ------------------------------------------------------------------------
919 MESSAGE("Debut de SetAIR ");
922 // ------------------------------------------------------------------------
923 void MonCreateHypothesis::SetAID()
924 // ------------------------------------------------------------------------
926 MESSAGE("Debut de SetAID ");