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
22 #include "MonCreateHypothesis.h"
23 #include "MonCreateListGroup.h"
24 #include "MonCreateIteration.h"
25 #include "MonCreateZone.h"
26 #include "MonEditZone.h"
28 #include <QFileDialog>
29 #include <QMessageBox>
31 #include "SalomeApp_Tools.h"
32 #include "HOMARDGUI_Utils.h"
33 #include "HomardQtCommun.h"
34 #include <utilities.h>
36 // -------------------------------------------------------------------------------
37 MonCreateHypothesis::MonCreateHypothesis(MonCreateIteration* parent, bool modal,
38 HOMARD::HOMARD_Gen_var 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 HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"), QString(""));
208 // -------------------------------------------------
209 void MonCreateHypothesis::SetNewName()
210 // --------------------------------------------------
213 HOMARD::listeHypotheses_var MyObjects = myHomardGen->GetAllHypothesesName();
218 aName.setNum(num+1) ;
219 aName.insert(0, QString("Hypo_")) ;
220 for ( int i=0; i<MyObjects->length(); i++)
222 if ( aName == QString(MyObjects[i]))
230 LEName->setText(aName);
234 // ------------------------------------------------------------------------
235 void MonCreateHypothesis::SetUniforme()
236 // ------------------------------------------------------------------------
238 GBFieldManagement->setVisible(0);
239 if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
240 else { GBFieldFile->setVisible(1); }
241 GBAreaManagement->setVisible(0);
242 GBUniform->setVisible(1);
246 // ------------------------------------------------------------------------
247 void MonCreateHypothesis::SetChamp()
248 // ------------------------------------------------------------------------
250 if (_aFieldFile == QString(""))
252 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
253 QObject::tr("HOM_HYPO_FIELD_FILE") );
255 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
258 LEFieldFile->setText(_aFieldFile);
259 LEFieldFile->setReadOnly(1);
261 GBUniform->setVisible(0);
262 GBAreaManagement->setVisible(0);
263 GBFieldManagement->setVisible(1);
264 GBFieldFile->setVisible(1);
266 GBUniform->adjustSize();
267 GBAreaManagement->adjustSize();
268 GBFieldManagement->adjustSize();
269 GBFieldFile->adjustSize();
274 // ------------------------------------------------------------------------
275 void MonCreateHypothesis::SetZone()
276 // ------------------------------------------------------------------------
279 GBUniform->setVisible(0);
280 GBFieldManagement->setVisible(0);
281 if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
282 else { GBFieldFile->setVisible(1); }
283 GBAreaManagement->setVisible(1);
290 // ------------------------------------------------------------------------
291 void MonCreateHypothesis::PushZoneNew()
292 // ------------------------------------------------------------------------
294 MESSAGE("Debut de MonCreateHypothesis::PushZoneNew")
295 MonCreateZone *aDlg = new MonCreateZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName) ;
299 // ------------------------------------------------------------------------
300 void MonCreateHypothesis::PushZoneEdit()
301 // ------------------------------------------------------------------------
303 MESSAGE("Debut de MonCreateHypothesis::PushZoneEdit")
304 int colonne = TWZone->currentColumn();
305 QTableWidgetItem * monItem = TWZone->currentItem();
306 if (colonne !=2 or monItem == NULL)
308 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
309 QObject::tr("HOM_HYPO_ZONE_1") );
312 QString zoneName = monItem->text().trimmed();
313 MonEditZone *aDlg = new MonEditZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, zoneName) ;
316 // ------------------------------------------------------------------------
317 void MonCreateHypothesis::PushZoneDelete()
318 // ------------------------------------------------------------------------
320 MESSAGE("Debut de MonCreateHypothesis::PushZoneDelete")
321 QMessageBox::warning( 0, QObject::tr("HOM_WARNING"),
322 QObject::tr("HOM_INACTIVE_BUTTON") );
326 // ------------------------------------------------------------------------
327 void MonCreateHypothesis::GetAllZones()
328 // ------------------------------------------------------------------------
329 // Recuperation de toutes les zones enregistrees dans l'arbre d'etude
330 // et affichage dans le tableau
331 // Par defaut, aucune n'est selectionnee
333 MESSAGE("Debut de GetAllZones") ;
334 HOMARD::listeZones_var mesZones = myHomardGen->GetAllZonesName();
335 int nbrow=TWZone->rowCount();
336 for ( int row=0; row< nbrow; row++)
338 TWZone->removeRow(row);
340 TWZone->setRowCount(0);
342 for (int i=0; i<mesZones->length(); i++)
344 TWZone->insertRow(row);
346 TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
347 TWZone->item( row, 0 )->setFlags( 0 );
348 TWZone->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
349 TWZone->item( row, 0 )->setCheckState( Qt::Unchecked );
351 TWZone->setItem( row, 1, new QTableWidgetItem( QString ("") ) );
352 TWZone->item( row, 1 )->setFlags( 0 );
353 TWZone->item( row, 1 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
354 TWZone->item( row, 1 )->setCheckState( Qt::Unchecked );
356 TWZone->setItem( row, 2, new QTableWidgetItem(QString(mesZones[i]).trimmed()));
357 TWZone->item( row, 2 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
361 TWZone->resizeColumnsToContents();
362 TWZone->resizeRowsToContents();
363 TWZone->clearSelection();
365 // ------------------------------------------------------------------------
366 void MonCreateHypothesis::addZoneinTWZone(QString newZone)
367 // ------------------------------------------------------------------------
369 MESSAGE("Debut de addZoneinTWZone") ;
370 int row = TWZone->rowCount() ;
371 // Par defaut, on suppose qu'une nouvelle zone est destinee au raffinement
372 TWZone->setRowCount( row+1 );
374 TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
375 TWZone->item( row, 0 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
376 TWZone->item( row, 0 )->setCheckState( Qt::Checked );
378 TWZone->setItem( row, 1, new QTableWidgetItem( QString ("") ) );
379 TWZone->item( row, 1 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
380 TWZone->item( row, 1 )->setCheckState( Qt::Unchecked );
382 TWZone->setItem( row, 2, new QTableWidgetItem( newZone ) );
383 TWZone->scrollToItem( TWZone->item( row, 2 ) );
385 TWZone->resizeRowsToContents();
386 TWZone->resizeColumnToContents(1);
387 TWZone->clearSelection();
389 TWZone->item( row, 2 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
391 // ------------------------------------------------------------------------
392 QStringList MonCreateHypothesis::GetZonesChecked()
393 // ------------------------------------------------------------------------
394 // Retourne les zones enregistrees
396 MESSAGE("Debut de GetZonesChecked") ;
397 QStringList ListeZone ;
398 // On ne peut pas avoir selectionne les deux options
400 for ( int row=0; row< TWZone->rowCount(); row++)
402 if ( ( TWZone->item( row, 0 )->checkState() == Qt::Checked ) and ( TWZone->item( row, 1 )->checkState() == Qt::Checked ) )
404 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
405 QObject::tr("HOM_HYPO_ZONE_3") );
409 // Si tout va bien, on affecte
410 // Attention, on insere en tete, donc on commence d'inserer le type, psui le nom de la zone
414 QString Dera = "-1" ;
415 for ( int row=0; row< TWZone->rowCount(); row++)
417 // MESSAGE ("row "<<row<<", zone : "<<TWZone->item(row, 2)->text().toStdString());
419 if ( TWZone->item(row,0)->checkState() == Qt::Checked )
420 { ListeZone.insert(0, Raff) ;
421 ListeZone.insert(0, QString(TWZone->item(row, 2)->text()) ) ; }
422 // En deraffinement :
423 if ( TWZone->item(row,1)->checkState() == Qt::Checked )
424 { ListeZone.insert(0, Dera) ;
425 ListeZone.insert(0, QString(TWZone->item(row, 2)->text()) ) ; }
427 MESSAGE("Fin de GetZonesChecked ; longueur de ListeZone : "<<ListeZone.count()) ;
432 // ------------------------------------------------------------------------
433 QStringList MonCreateHypothesis::GetListCompChecked()
434 // ------------------------------------------------------------------------
435 // Retourne les composantes retenues
437 MESSAGE( "Debut de GetListCompChecked" );
438 QStringList ListeComposant ;
440 ListeComposant.clear();
441 for ( int row=0; row< TWCMP->rowCount(); row++)
442 if ( TWCMP->item( row, 0 )->checkState() == Qt::Checked )
443 ListeComposant.insert(0, QString(TWCMP->item(row, 1)->text()) ) ;
444 // Choix du texte des radio-boutons selon 1 ou plusieurs composantes
445 if ( ListeComposant.count() < 2 )
446 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS"));
447 RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL"));
450 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2"));
451 RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF"));
453 return ListeComposant ;
456 // ------------------------------------------------------------------------
457 void MonCreateHypothesis::AssocieFieldInterp()
458 // ------------------------------------------------------------------------
460 if ( _TypeFieldInterp != 2 ) return;
461 for ( int row=0; row< TWField->rowCount(); row++)
462 if ( TWField->item( row, 0 )->checkState() == Qt::Checked )
463 { aHypothesis->AddFieldInterp(TWField->item(row, 1)->text().toStdString().c_str()); }
465 // ------------------------------------------------------------------------
466 void MonCreateHypothesis::SetUniRaff()
467 // ------------------------------------------------------------------------
472 // ------------------------------------------------------------------------
473 void MonCreateHypothesis::SetUniDera()
474 // ------------------------------------------------------------------------
480 // ------------------------------------------------------------------------
481 void MonCreateHypothesis::InitFields()
482 // ------------------------------------------------------------------------
484 CBFieldName->clear();
485 std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
486 // Mise en place de la liste dans le menu pour l'indicateur d'erreur
487 std:: list<QString>::const_iterator it;
488 for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
490 CBFieldName->insertItem(0,QString(*it));
494 // ---------------------------------------
495 void MonCreateHypothesis::SetFieldName()
496 // -------------------------------------------
498 MESSAGE("Debut de SetFieldName");
499 _aFieldName=CBFieldName->currentText();
500 if (QString(_aFieldFile) == QString("") or QString(_aFieldName) == QString("") ) { return; }
502 int nbrow= TWCMP->rowCount() ;
503 for ( int row=0; row < nbrow ; row++)
505 TWCMP->removeRow(row);
507 TWCMP->setRowCount(0);
508 //TWCMP->resizeRowsToContents();
510 std::list<QString> maListe =HOMARD_QT_COMMUN::GetListeComposants(_aFieldFile, _aFieldName);
511 std::list<QString>::const_iterator it;
512 for ( it=maListe.begin() ; it != maListe.end(); it++)
515 TWCMP->setItem( 0, 0, new QTableWidgetItem( QString ("") ) );
516 TWCMP->item( 0, 0 )->setFlags( 0 );
517 TWCMP->item( 0, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
518 TWCMP->item( 0, 0 )->setCheckState( Qt::Checked );
519 TWCMP->setItem( 0, 1, new QTableWidgetItem(QString((*it)).trimmed()));
520 TWCMP->item( 0, 1 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
522 TWCMP->resizeColumnsToContents();
523 TWCMP->resizeRowsToContents();
524 TWCMP->clearSelection();
525 // Choix du texte des radio-boutons selon 1 ou plusieurs composantes
526 if ( TWCMP->rowCount() == 1 )
527 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS"));
528 RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL"));
531 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2"));
532 RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF"));
534 // Par defaut, on propose la valeur absolue / norme L2
537 // ------------------------------------------------------------------------
538 void MonCreateHypothesis::SetRPE()
539 // ------------------------------------------------------------------------
543 RBRPE->setChecked(true);
544 SpinBox_RPE->setEnabled(true);
545 SpinBox_RRel->setEnabled(false);
546 SpinBox_RAbs->setEnabled(false);
547 SpinBox_RMuSigma->setEnabled(false);
549 // ------------------------------------------------------------------------
550 void MonCreateHypothesis::SetRRel()
551 // ------------------------------------------------------------------------
555 RBRRel->setChecked(true);
556 SpinBox_RPE->setEnabled(false);
557 SpinBox_RRel->setEnabled(true);
558 SpinBox_RAbs->setEnabled(false);
559 SpinBox_RMuSigma->setEnabled(false);
561 // ------------------------------------------------------------------------
562 void MonCreateHypothesis::SetRAbs()
563 // ------------------------------------------------------------------------
567 RBRAbs->setChecked(true);
568 SpinBox_RPE->setEnabled(false);
569 SpinBox_RRel->setEnabled(false);
570 SpinBox_RAbs->setEnabled(true);
571 SpinBox_RMuSigma->setEnabled(false);
573 // ------------------------------------------------------------------------
574 void MonCreateHypothesis::SetRMS()
575 // ------------------------------------------------------------------------
579 RBRMuSigma->setChecked(true);
580 SpinBox_RPE->setEnabled(false);
581 SpinBox_RRel->setEnabled(false);
582 SpinBox_RAbs->setEnabled(false);
583 SpinBox_RMuSigma->setEnabled(true);
585 // ------------------------------------------------------------------------
586 void MonCreateHypothesis::SetRNo()
587 // ------------------------------------------------------------------------
591 RBRNo->setChecked(true);
592 SpinBox_RPE->setEnabled(false);
593 SpinBox_RRel->setEnabled(false);
594 SpinBox_RAbs->setEnabled(false);
595 SpinBox_RMuSigma->setEnabled(false);
597 // ------------------------------------------------------------------------
598 void MonCreateHypothesis::SetCPE()
599 // ------------------------------------------------------------------------
603 RBCPE->setChecked(true);
604 SpinBox_CPE->setEnabled(true);
605 SpinBox_CRel->setEnabled(false);
606 SpinBox_CAbs->setEnabled(false);
607 SpinBox_CMuSigma->setEnabled(false);
609 // ------------------------------------------------------------------------
610 void MonCreateHypothesis::SetCRel()
611 // ------------------------------------------------------------------------
615 RBCRel->setChecked(true);
616 SpinBox_CPE->setEnabled(false);
617 SpinBox_CRel->setEnabled(true);
618 SpinBox_CAbs->setEnabled(false);
619 SpinBox_CMuSigma->setEnabled(false);
621 // ------------------------------------------------------------------------
622 void MonCreateHypothesis::SetCAbs()
623 // ------------------------------------------------------------------------
627 RBCAbs->setChecked(true);
628 SpinBox_CPE->setEnabled(false);
629 SpinBox_CRel->setEnabled(false);
630 SpinBox_CAbs->setEnabled(true);
631 SpinBox_CMuSigma->setEnabled(false);
633 // ------------------------------------------------------------------------
634 void MonCreateHypothesis::SetCMS()
635 // ------------------------------------------------------------------------
639 RBCMuSigma->setChecked(true);
640 SpinBox_CPE->setEnabled(false);
641 SpinBox_CRel->setEnabled(false);
642 SpinBox_CAbs->setEnabled(false);
643 SpinBox_CMuSigma->setEnabled(true);
645 // ------------------------------------------------------------------------
646 void MonCreateHypothesis::SetCNo()
647 // ------------------------------------------------------------------------
651 RBCNo->setChecked(true);
652 SpinBox_CPE->setEnabled(false);
653 SpinBox_CRel->setEnabled(false);
654 SpinBox_CAbs->setEnabled(false);
655 SpinBox_CMuSigma->setEnabled(false);
657 // ------------------------------------------------------------------------
658 void MonCreateHypothesis::SetUCL2()
659 // ------------------------------------------------------------------------
662 RBL2->setChecked(true);
664 // ------------------------------------------------------------------------
665 void MonCreateHypothesis::SetUCInf()
666 // ------------------------------------------------------------------------
669 RBInf->setChecked(true);
671 // ------------------------------------------------------------------------
672 void MonCreateHypothesis::SetUseField()
673 // ------------------------------------------------------------------------
675 if ( CBJump->isChecked() ) { _UsField = 1 ; }
676 else { _UsField = 0 ; }
678 // ------------------------------------------------------------------------
679 void MonCreateHypothesis::SetFiltrage()
680 // ------------------------------------------------------------------------
682 if (!CBGroupe->isChecked()) return;
683 MonCreateListGroup *aDlg = new MonCreateListGroup(this, NULL, TRUE, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),_aCaseName, _aListeGroupes) ;
687 // ------------------------------------------------------------------------
688 void MonCreateHypothesis::setGroups(QStringList listGroup)
689 // ------------------------------------------------------------------------
691 _aListeGroupes=listGroup;
693 // ------------------------------------------------------------------------
694 bool MonCreateHypothesis::VerifieZone()
695 // ------------------------------------------------------------------------
697 if ( _aTypeAdap != 0 ) return true;
698 MESSAGE("Debut de VerifieZone") ;
699 _aListeZone = GetZonesChecked() ;
700 MESSAGE(". Longueur de _aListeZone : "<<_aListeZone.count()) ;
701 if (_aListeZone.count() == 0)
703 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
704 QObject::tr("HOM_HYPO_ZONE_2") );
707 MESSAGE("Fin de VerifieZone") ;
710 // ------------------------------------------------------------------------
711 bool MonCreateHypothesis::VerifieComposant()
712 // ------------------------------------------------------------------------
714 if ( _aTypeAdap != 1 ) return true;
715 _aListeComposant = GetListCompChecked() ;
716 if (_aListeComposant.count() == 0)
718 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
719 QObject::tr("HOM_HYPO_COMP") );
725 // ------------------------------------------------------------------------
726 void MonCreateHypothesis::AssocieLesZones()
727 // ------------------------------------------------------------------------
729 MESSAGE( "Debut de AssocieLesZones" );
730 if ( _aTypeAdap != 0 ) return;
731 _aListeZone = GetZonesChecked() ;
732 MESSAGE(". Longueur de _aListeZone : "<<_aListeZone.count()) ;
735 for ( int i=0 ; i< _aListeZone.count() ; i++ )
736 { if ( _aListeZone[i+1] == Raff ) { TypeUse = 1 ; }
737 else { TypeUse = -1 ; }
738 aHypothesis->AddZone(_aListeZone[i].toStdString().c_str(), TypeUse);
741 MESSAGE( "Fin de AssocieLesZones" );
743 // ------------------------------------------------------------------------
744 void MonCreateHypothesis::AssocieComposants()
745 // ------------------------------------------------------------------------
747 if ( _aTypeAdap != 1 ) return;
748 MESSAGE( "Dans AssocieComposants, _TypeThC : " << _TypeThC );
749 MESSAGE( "Dans AssocieComposants, _TypeThR : " << _TypeThR );
752 if ( _TypeThR == 1 ) { _ThreshR = SpinBox_RAbs->value();}
753 if ( _TypeThR == 2 ) { _ThreshR = SpinBox_RRel->value();}
754 if ( _TypeThR == 3 ) { _ThreshR = SpinBox_RPE->value(); }
755 if ( _TypeThR == 4 ) { _ThreshR = SpinBox_RMuSigma->value(); }
758 if ( _TypeThC == 1 ) { _ThreshC = SpinBox_CAbs->value();}
759 if ( _TypeThC == 2 ) { _ThreshC = SpinBox_CRel->value();}
760 if ( _TypeThC == 3 ) { _ThreshC = SpinBox_CPE->value(); }
761 if ( _TypeThC == 4 ) { _ThreshC = SpinBox_CMuSigma->value(); }
763 _aFieldName=CBFieldName->currentText();
764 aHypothesis->SetField(CORBA::string_dup(_aFieldName.toStdString().c_str()) ) ;
765 aHypothesis->SetRefinThr( _TypeThR, _ThreshR ) ;
766 aHypothesis->SetUnRefThr( _TypeThC, _ThreshC ) ;
767 aHypothesis->SetUseField( _UsField ) ;
768 aHypothesis->SetUseComp( _UsCmpI ) ;
769 _aListeComposant = GetListCompChecked() ;
770 for ( int i=0 ; i< _aListeComposant.count() ; i++ )
771 { aHypothesis->AddComp(_aListeComposant[i].toStdString().c_str()); }
773 // ------------------------------------------------------------------------
774 void MonCreateHypothesis::AssocieLesGroupes()
775 // ------------------------------------------------------------------------
777 HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::ListGroupType;
778 aSeqGroupe->length(_aListeGroupes.size());
779 QStringList::const_iterator it;
781 for (it = _aListeGroupes.constBegin(); it != _aListeGroupes.constEnd(); it++)
782 aSeqGroupe[i++]=(*it).toStdString().c_str();
783 aHypothesis->SetGroups(aSeqGroupe);
786 // ------------------------------------------------------------------------
787 void MonCreateHypothesis::SetFieldNo()
788 // ------------------------------------------------------------------------
789 // Par defaut, on n'interpole rien
791 if ( _aTypeAdap == 1 ) { GBFieldFile->setVisible(1); }
792 else { GBFieldFile->setVisible(0); }
793 TWField->setVisible(0);
796 _TypeFieldInterp = 0 ;
798 // ------------------------------------------------------------------------
799 void MonCreateHypothesis::SetFieldAll()
800 // ------------------------------------------------------------------------
801 // Par defaut, on interpole tout
803 if (_aFieldFile == QString(""))
805 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
806 QObject::tr("HOM_HYPO_FIELD_FILE") );
808 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
811 LEFieldFile->setText(_aFieldFile);
812 LEFieldFile->setReadOnly(1);
813 GBFieldFile->setVisible(1);
814 TWField->setVisible(0);
816 _TypeFieldInterp = 1 ;
819 // ------------------------------------------------------------------------
820 void MonCreateHypothesis::SetFieldChosen()
821 // ------------------------------------------------------------------------
823 if (_aFieldFile == QString(""))
825 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
826 QObject::tr("HOM_HYPO_FIELD_FILE") );
828 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
831 LEFieldFile->setText(_aFieldFile);
832 LEFieldFile->setReadOnly(1);
833 GBFieldFile->setVisible(1);
834 // Recuperation de la liste des champs contenus dans le fichier _aFieldFile
835 std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
837 // Initialisation de la table
839 int nbrow=TWField->rowCount();
840 for ( int row=0; row< nbrow; row++)
842 TWField->removeRow(row);
844 TWField->setRowCount(0);
845 std:: list<QString>::const_iterator it;
847 for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
849 TWField->insertRow(row);
850 TWField->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
851 TWField->item( row, 0 )->setFlags( 0 );
852 TWField->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
853 TWField->item( row, 0 )->setCheckState( Qt::Unchecked );
854 TWField->setItem( row, 1, new QTableWidgetItem(QString(*it).trimmed()));
855 TWField->item( row, 1 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
858 TWField->resizeColumnsToContents();
859 TWField->resizeRowsToContents();
860 TWField->clearSelection();
861 TWField->setVisible(1);
863 _TypeFieldInterp = 2 ;
866 // ------------------------------------------------------------------------
867 void MonCreateHypothesis::SetAdvanced()
868 // ------------------------------------------------------------------------
870 MESSAGE("Debut de SetAdvanced ");
871 if (CBAdvanced->isChecked())
872 { GBAdvancedOptions->setVisible(1);
873 if (_aFieldFile != QString(""))
874 { GBAdapInit->setVisible(1) ;
877 { GBAdapInit->setVisible(0) ;
881 { GBAdvancedOptions->setVisible(0);
885 CBLevelOutput->setChecked(false);
890 // ------------------------------------------------------------------------
891 void MonCreateHypothesis::SetAIN()
892 // ------------------------------------------------------------------------
894 MESSAGE("Debut de SetAIN ");
897 // ------------------------------------------------------------------------
898 void MonCreateHypothesis::SetAIR()
899 // ------------------------------------------------------------------------
901 MESSAGE("Debut de SetAIR ");
904 // ------------------------------------------------------------------------
905 void MonCreateHypothesis::SetAID()
906 // ------------------------------------------------------------------------
908 MESSAGE("Debut de SetAID ");