1 // Copyright (C) 2011-2015 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 CBOutputLevel->setChecked(false);
78 CBOutputQuality->setChecked(false);
79 CBOutputDiameter->setChecked(false);
85 // ------------------------------------------------------------------------
86 MonCreateHypothesis::~MonCreateHypothesis()
87 // ------------------------------------------------------------------------
89 // no need to delete child widgets, Qt does it all for us
91 // ------------------------------------------------------------------------
92 void MonCreateHypothesis::InitConnect()
93 // ------------------------------------------------------------------------
95 connect( RBUniforme, SIGNAL(clicked()), this, SLOT(SetUniforme()));
96 connect( RBChamp, SIGNAL(clicked()), this, SLOT(SetChamp()));
97 connect( RBZone, SIGNAL(clicked()), this, SLOT(SetZone()));
98 connect( RBUniRaff, SIGNAL(clicked()), this, SLOT(SetUniRaff()));
99 connect( RBUniDera, SIGNAL(clicked()), this, SLOT(SetUniDera()));
101 connect( CBFieldName, SIGNAL(activated(int)), this, SLOT( SetFieldName()));
102 connect( RBRPE, SIGNAL(clicked()), this, SLOT(SetRPE()));
103 connect( RBRRel, SIGNAL(clicked()), this, SLOT(SetRRel()));
104 connect( RBRMuSigma, SIGNAL(clicked()), this, SLOT(SetRMS()));
105 connect( RBRAbs, SIGNAL(clicked()), this, SLOT(SetRAbs()));
106 connect( RBRNo, SIGNAL(clicked()), this, SLOT(SetRNo()));
107 connect( RBCPE, SIGNAL(clicked()), this, SLOT(SetCPE()));
108 connect( RBCRel, SIGNAL(clicked()), this, SLOT(SetCRel()));
109 connect( RBCMuSigma, SIGNAL(clicked()), this, SLOT(SetCMS()));
110 connect( RBCAbs, SIGNAL(clicked()), this, SLOT(SetCAbs()));
111 connect( RBCNo, SIGNAL(clicked()), this, SLOT(SetCNo()));
112 connect( RBL2, SIGNAL(clicked()), this, SLOT(SetUCL2()));
113 connect( RBInf, SIGNAL(clicked()), this, SLOT(SetUCInf()));
114 connect( CBJump, SIGNAL(stateChanged(int)), this, SLOT(SetUseField()));
115 connect( PBZoneNew, SIGNAL(pressed()), this, SLOT(PushZoneNew()));
116 connect( PBZoneEdit, SIGNAL(pressed()), this, SLOT(PushZoneEdit()) );
117 connect( PBZoneDelete, SIGNAL(pressed()), this, SLOT(PushZoneDelete()) );
118 connect( CBGroupe, SIGNAL(stateChanged(int)), this, SLOT(SetFiltrage()));
120 connect( RBFieldNo, SIGNAL(clicked()), this, SLOT(SetFieldNo()));
121 connect( RBFieldAll, SIGNAL(clicked()), this, SLOT(SetFieldAll()));
122 connect( RBFieldChosen,SIGNAL(clicked()), this, SLOT(SetFieldChosen()));
124 connect( CBAdvanced, SIGNAL(stateChanged(int)), this, SLOT(SetAdvanced()));
125 connect( RBAIN, SIGNAL(clicked()), this, SLOT(SetAIN()));
126 connect( RBAIR, SIGNAL(clicked()), this, SLOT(SetAIR()));
127 connect( RBAID, SIGNAL(clicked()), this, SLOT(SetAID()));
129 connect( buttonOk, SIGNAL(pressed()), this, SLOT( PushOnOK()));
130 connect( buttonApply, SIGNAL(pressed()), this, SLOT( PushOnApply()));
131 connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close()));
132 connect( buttonHelp, SIGNAL(pressed()), this, SLOT( PushOnHelp()));
135 // ------------------------------------------------------------------------
136 bool MonCreateHypothesis::PushOnApply()
137 // ------------------------------------------------------------------------
138 // Appele lorsque l'un des boutons Ok ou Apply est presse
144 if (LEName->text().trimmed()=="") {
145 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
146 QObject::tr("HOM_HYPO_NAME") );
150 if (VerifieZone() == false) return false;
151 if (VerifieComposant() == false) return false;
153 // Creation de l'objet CORBA si ce n'est pas deja fait sous le meme nom
154 if (LEName->text().trimmed() != _Name)
156 _Name=LEName->text().trimmed();
159 aHypothesis=myHomardGen->CreateHypothesis(CORBA::string_dup(_Name.toStdString().c_str()) );
160 _parent->addHypothese(_Name);
162 catch( SALOME::SALOME_Exception& S_ex )
164 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
165 QString(CORBA::string_dup(S_ex.details.text)) );
170 // Mise en place des attributs
171 if ( _aTypeAdap == -1 )
174 if ( _aTypeRaff == 1 ) { TypeRaffDera = 1 ; }
175 else { TypeRaffDera = -1 ; }
176 aHypothesis->SetUnifRefinUnRef(TypeRaffDera);
178 aHypothesis->SetTypeFieldInterp(_TypeFieldInterp);
179 aHypothesis->SetCaseCreation(_aCaseName.toStdString().c_str());
184 AssocieFieldInterp();
187 if (CBAdvanced->isChecked())
189 // Enregistrement du niveau maximal
190 _NivMax = SpinBoxNivMax->value() ;
191 aHypothesis->SetNivMax(_NivMax);
192 // Enregistrement du diametre minimal
193 _DiamMin = doubleSpinBoxDiamMin->value() ;
194 aHypothesis->SetDiamMin(_DiamMin);
195 // Enregistrement de l'intialisation de l'adaptation
196 aHypothesis->SetAdapInit(_AdapInit);
197 // Sortie optionnelle des niveaux de raffinement, des diametres, des qualites
199 if (CBOutputLevel->isChecked()) { _ExtraOutput = 2 ; }
200 if (CBOutputQuality->isChecked()) { _ExtraOutput = 3*_ExtraOutput ; }
201 if (CBOutputDiameter->isChecked()) { _ExtraOutput = 5*_ExtraOutput ; }
202 aHypothesis->SetExtraOutput(_ExtraOutput);
205 HOMARD_UTILS::updateObjBrowser() ;
211 // ------------------------------------------------------------------------
212 void MonCreateHypothesis::PushOnOK()
213 // ------------------------------------------------------------------------
215 if (PushOnApply()) this->close();
216 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
218 // ------------------------------------------------------------------------
219 void MonCreateHypothesis::PushOnHelp()
220 // ------------------------------------------------------------------------
222 std::string LanguageShort = myHomardGen->GetLanguageShort();
223 HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"), QString(""), QString(LanguageShort.c_str()));
225 // -------------------------------------------------
226 void MonCreateHypothesis::SetNewName()
227 // --------------------------------------------------
230 HOMARD::listeHypotheses_var MyObjects = myHomardGen->GetAllHypothesesName();
235 aName.setNum(num+1) ;
236 aName.insert(0, QString("Hypo_")) ;
237 for ( int i=0; i<MyObjects->length(); i++)
239 if ( aName == QString(MyObjects[i]))
247 LEName->setText(aName);
251 // ------------------------------------------------------------------------
252 void MonCreateHypothesis::SetUniforme()
253 // ------------------------------------------------------------------------
255 GBFieldManagement->setVisible(0);
256 if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
257 else { GBFieldFile->setVisible(1); }
258 GBAreaManagement->setVisible(0);
259 GBUniform->setVisible(1);
265 // ------------------------------------------------------------------------
266 void MonCreateHypothesis::SetChamp()
267 // ------------------------------------------------------------------------
269 if (_aFieldFile == QString(""))
271 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
272 QObject::tr("HOM_HYPO_FIELD_FILE") );
274 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
277 LEFieldFile->setText(_aFieldFile);
278 LEFieldFile->setReadOnly(1);
280 GBUniform->setVisible(0);
281 GBAreaManagement->setVisible(0);
282 GBFieldManagement->setVisible(1);
283 GBFieldFile->setVisible(1);
285 GBUniform->adjustSize();
286 GBAreaManagement->adjustSize();
287 GBFieldManagement->adjustSize();
288 GBFieldFile->adjustSize();
294 // ------------------------------------------------------------------------
295 void MonCreateHypothesis::SetZone()
296 // ------------------------------------------------------------------------
299 GBUniform->setVisible(0);
300 GBFieldManagement->setVisible(0);
301 if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
302 else { GBFieldFile->setVisible(1); }
303 GBAreaManagement->setVisible(1);
312 // ------------------------------------------------------------------------
313 void MonCreateHypothesis::PushZoneNew()
314 // ------------------------------------------------------------------------
316 MESSAGE("Debut de MonCreateHypothesis::PushZoneNew")
317 MonCreateZone *aDlg = new MonCreateZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName) ;
321 // ------------------------------------------------------------------------
322 void MonCreateHypothesis::PushZoneEdit()
323 // ------------------------------------------------------------------------
325 MESSAGE("Debut de MonCreateHypothesis::PushZoneEdit")
326 int colonne = TWZone->currentColumn();
327 QTableWidgetItem * monItem = TWZone->currentItem();
328 if (colonne !=2 || monItem == NULL)
330 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
331 QObject::tr("HOM_HYPO_ZONE_1") );
334 QString zoneName = monItem->text().trimmed();
335 MonEditZone *aDlg = new MonEditZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, zoneName) ;
338 // ------------------------------------------------------------------------
339 void MonCreateHypothesis::PushZoneDelete()
340 // ------------------------------------------------------------------------
342 MESSAGE("Debut de MonCreateHypothesis::PushZoneDelete")
343 QMessageBox::warning( 0, QObject::tr("HOM_WARNING"),
344 QObject::tr("HOM_INACTIVE_BUTTON") );
348 // ------------------------------------------------------------------------
349 void MonCreateHypothesis::GetAllZones()
350 // ------------------------------------------------------------------------
351 // Recuperation de toutes les zones enregistrees dans l'arbre d'etude
352 // et affichage dans le tableau
353 // Par defaut, aucune n'est selectionnee
355 MESSAGE("Debut de GetAllZones") ;
356 HOMARD::listeZones_var mesZones = myHomardGen->GetAllZonesName();
357 int nbrow=TWZone->rowCount();
358 for ( int row=0; row< nbrow; row++)
360 TWZone->removeRow(row);
362 TWZone->setRowCount(0);
364 for (int i=0; i<mesZones->length(); i++)
366 TWZone->insertRow(row);
368 TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
369 TWZone->item( row, 0 )->setFlags( 0 );
370 TWZone->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
371 TWZone->item( row, 0 )->setCheckState( Qt::Unchecked );
373 TWZone->setItem( row, 1, new QTableWidgetItem( QString ("") ) );
374 TWZone->item( row, 1 )->setFlags( 0 );
375 TWZone->item( row, 1 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
376 TWZone->item( row, 1 )->setCheckState( Qt::Unchecked );
378 TWZone->setItem( row, 2, new QTableWidgetItem(QString(mesZones[i]).trimmed()));
379 TWZone->item( row, 2 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
383 TWZone->resizeColumnsToContents();
384 TWZone->resizeRowsToContents();
385 TWZone->clearSelection();
387 // ------------------------------------------------------------------------
388 void MonCreateHypothesis::addZoneinTWZone(QString newZone)
389 // ------------------------------------------------------------------------
391 MESSAGE("Debut de addZoneinTWZone") ;
392 int row = TWZone->rowCount() ;
393 // Par defaut, on suppose qu'une nouvelle zone est destinee au raffinement
394 TWZone->setRowCount( row+1 );
396 TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
397 TWZone->item( row, 0 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
398 TWZone->item( row, 0 )->setCheckState( Qt::Checked );
400 TWZone->setItem( row, 1, new QTableWidgetItem( QString ("") ) );
401 TWZone->item( row, 1 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
402 TWZone->item( row, 1 )->setCheckState( Qt::Unchecked );
404 TWZone->setItem( row, 2, new QTableWidgetItem( newZone ) );
405 TWZone->scrollToItem( TWZone->item( row, 2 ) );
407 TWZone->resizeRowsToContents();
408 TWZone->resizeColumnToContents(1);
409 TWZone->clearSelection();
411 TWZone->item( row, 2 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
413 // ------------------------------------------------------------------------
414 QStringList MonCreateHypothesis::GetZonesChecked()
415 // ------------------------------------------------------------------------
416 // Retourne les zones enregistrees
418 MESSAGE("Debut de GetZonesChecked") ;
419 QStringList ListeZone ;
420 // On ne peut pas avoir selectionne les deux options
422 for ( int row=0; row< TWZone->rowCount(); row++)
424 if ( ( TWZone->item( row, 0 )->checkState() == Qt::Checked ) && ( TWZone->item( row, 1 )->checkState() == Qt::Checked ) )
426 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
427 QObject::tr("HOM_HYPO_ZONE_3") );
431 // Si tout va bien, on affecte
432 // Attention, on insere en tete, donc on commence d'inserer le type, psui le nom de la zone
436 QString Dera = "-1" ;
437 for ( int row=0; row< TWZone->rowCount(); row++)
439 // MESSAGE ("row "<<row<<", zone : "<<TWZone->item(row, 2)->text().toStdString());
441 if ( TWZone->item(row,0)->checkState() == Qt::Checked )
442 { ListeZone.insert(0, Raff) ;
443 ListeZone.insert(0, QString(TWZone->item(row, 2)->text()) ) ; }
444 // En deraffinement :
445 if ( TWZone->item(row,1)->checkState() == Qt::Checked )
446 { ListeZone.insert(0, Dera) ;
447 ListeZone.insert(0, QString(TWZone->item(row, 2)->text()) ) ; }
449 MESSAGE("Fin de GetZonesChecked ; longueur de ListeZone : "<<ListeZone.count()) ;
454 // ------------------------------------------------------------------------
455 QStringList MonCreateHypothesis::GetListCompChecked()
456 // ------------------------------------------------------------------------
457 // Retourne les composantes retenues
459 MESSAGE( "Debut de GetListCompChecked" );
460 QStringList ListeComposant ;
462 ListeComposant.clear();
463 for ( int row=0; row< TWCMP->rowCount(); row++)
464 if ( TWCMP->item( row, 0 )->checkState() == Qt::Checked )
465 ListeComposant.insert(0, QString(TWCMP->item(row, 1)->text()) ) ;
466 // Choix du texte des radio-boutons selon 1 ou plusieurs composantes
467 if ( ListeComposant.count() < 2 )
468 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS"));
469 RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL"));
472 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2"));
473 RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF"));
475 return ListeComposant ;
478 // ------------------------------------------------------------------------
479 void MonCreateHypothesis::AssocieFieldInterp()
480 // ------------------------------------------------------------------------
482 if ( _TypeFieldInterp != 2 ) return;
483 for ( int row=0; row< TWField->rowCount(); row++)
485 if ( TWField->item( row, 0 )->checkState() == Qt::Checked )
487 aHypothesis->AddFieldInterp(TWField->item(row, 1)->text().toStdString().c_str());
491 // ------------------------------------------------------------------------
492 void MonCreateHypothesis::SetUniRaff()
493 // ------------------------------------------------------------------------
498 // ------------------------------------------------------------------------
499 void MonCreateHypothesis::SetUniDera()
500 // ------------------------------------------------------------------------
506 // ------------------------------------------------------------------------
507 void MonCreateHypothesis::InitFields()
508 // ------------------------------------------------------------------------
510 CBFieldName->clear();
511 std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
512 // Mise en place de la liste dans le menu pour l'indicateur d'erreur
513 std:: list<QString>::const_iterator it;
514 for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
516 CBFieldName->insertItem(0,QString(*it));
520 // ---------------------------------------
521 void MonCreateHypothesis::SetFieldName()
522 // -------------------------------------------
524 MESSAGE("Debut de SetFieldName");
525 _aFieldName=CBFieldName->currentText();
526 if (QString(_aFieldFile) == QString("") || QString(_aFieldName) == QString("") ) { return; }
528 int nbrow= TWCMP->rowCount() ;
529 for ( int row=0; row < nbrow ; row++)
531 TWCMP->removeRow(row);
533 TWCMP->setRowCount(0);
534 //TWCMP->resizeRowsToContents();
536 std::list<QString> maListe =HOMARD_QT_COMMUN::GetListeComposants(_aFieldFile, _aFieldName);
537 std::list<QString>::const_iterator it;
538 for ( it=maListe.begin() ; it != maListe.end(); it++)
541 TWCMP->setItem( 0, 0, new QTableWidgetItem( QString ("") ) );
542 TWCMP->item( 0, 0 )->setFlags( 0 );
543 TWCMP->item( 0, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
544 TWCMP->item( 0, 0 )->setCheckState( Qt::Checked );
545 TWCMP->setItem( 0, 1, new QTableWidgetItem(QString((*it)).trimmed()));
546 TWCMP->item( 0, 1 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
548 TWCMP->resizeColumnsToContents();
549 TWCMP->resizeRowsToContents();
550 TWCMP->clearSelection();
551 // Choix du texte des radio-boutons selon 1 ou plusieurs composantes
552 if ( TWCMP->rowCount() == 1 )
553 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS"));
554 RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL"));
557 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2"));
558 RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF"));
560 // Par defaut, on propose la valeur absolue / norme L2
563 // ------------------------------------------------------------------------
564 void MonCreateHypothesis::SetRPE()
565 // ------------------------------------------------------------------------
569 RBRPE->setChecked(true);
570 SpinBox_RPE->setEnabled(true);
571 SpinBox_RRel->setEnabled(false);
572 SpinBox_RAbs->setEnabled(false);
573 SpinBox_RMuSigma->setEnabled(false);
575 // ------------------------------------------------------------------------
576 void MonCreateHypothesis::SetRRel()
577 // ------------------------------------------------------------------------
581 RBRRel->setChecked(true);
582 SpinBox_RPE->setEnabled(false);
583 SpinBox_RRel->setEnabled(true);
584 SpinBox_RAbs->setEnabled(false);
585 SpinBox_RMuSigma->setEnabled(false);
587 // ------------------------------------------------------------------------
588 void MonCreateHypothesis::SetRAbs()
589 // ------------------------------------------------------------------------
593 RBRAbs->setChecked(true);
594 SpinBox_RPE->setEnabled(false);
595 SpinBox_RRel->setEnabled(false);
596 SpinBox_RAbs->setEnabled(true);
597 SpinBox_RMuSigma->setEnabled(false);
599 // ------------------------------------------------------------------------
600 void MonCreateHypothesis::SetRMS()
601 // ------------------------------------------------------------------------
605 RBRMuSigma->setChecked(true);
606 SpinBox_RPE->setEnabled(false);
607 SpinBox_RRel->setEnabled(false);
608 SpinBox_RAbs->setEnabled(false);
609 SpinBox_RMuSigma->setEnabled(true);
611 // ------------------------------------------------------------------------
612 void MonCreateHypothesis::SetRNo()
613 // ------------------------------------------------------------------------
617 RBRNo->setChecked(true);
618 SpinBox_RPE->setEnabled(false);
619 SpinBox_RRel->setEnabled(false);
620 SpinBox_RAbs->setEnabled(false);
621 SpinBox_RMuSigma->setEnabled(false);
623 // ------------------------------------------------------------------------
624 void MonCreateHypothesis::SetCPE()
625 // ------------------------------------------------------------------------
629 RBCPE->setChecked(true);
630 SpinBox_CPE->setEnabled(true);
631 SpinBox_CRel->setEnabled(false);
632 SpinBox_CAbs->setEnabled(false);
633 SpinBox_CMuSigma->setEnabled(false);
635 // ------------------------------------------------------------------------
636 void MonCreateHypothesis::SetCRel()
637 // ------------------------------------------------------------------------
641 RBCRel->setChecked(true);
642 SpinBox_CPE->setEnabled(false);
643 SpinBox_CRel->setEnabled(true);
644 SpinBox_CAbs->setEnabled(false);
645 SpinBox_CMuSigma->setEnabled(false);
647 // ------------------------------------------------------------------------
648 void MonCreateHypothesis::SetCAbs()
649 // ------------------------------------------------------------------------
653 RBCAbs->setChecked(true);
654 SpinBox_CPE->setEnabled(false);
655 SpinBox_CRel->setEnabled(false);
656 SpinBox_CAbs->setEnabled(true);
657 SpinBox_CMuSigma->setEnabled(false);
659 // ------------------------------------------------------------------------
660 void MonCreateHypothesis::SetCMS()
661 // ------------------------------------------------------------------------
665 RBCMuSigma->setChecked(true);
666 SpinBox_CPE->setEnabled(false);
667 SpinBox_CRel->setEnabled(false);
668 SpinBox_CAbs->setEnabled(false);
669 SpinBox_CMuSigma->setEnabled(true);
671 // ------------------------------------------------------------------------
672 void MonCreateHypothesis::SetCNo()
673 // ------------------------------------------------------------------------
677 RBCNo->setChecked(true);
678 SpinBox_CPE->setEnabled(false);
679 SpinBox_CRel->setEnabled(false);
680 SpinBox_CAbs->setEnabled(false);
681 SpinBox_CMuSigma->setEnabled(false);
683 // ------------------------------------------------------------------------
684 void MonCreateHypothesis::SetUCL2()
685 // ------------------------------------------------------------------------
688 RBL2->setChecked(true);
690 // ------------------------------------------------------------------------
691 void MonCreateHypothesis::SetUCInf()
692 // ------------------------------------------------------------------------
694 if ( TWCMP->rowCount() == 1 ) { _UsCmpI = 2 ; }
695 else { _UsCmpI = 1 ; }
696 RBInf->setChecked(true);
698 // ------------------------------------------------------------------------
699 void MonCreateHypothesis::SetUseField()
700 // ------------------------------------------------------------------------
702 if ( CBJump->isChecked() ) { _UsField = 1 ; }
703 else { _UsField = 0 ; }
705 // ------------------------------------------------------------------------
706 void MonCreateHypothesis::SetFiltrage()
707 // ------------------------------------------------------------------------
709 if (!CBGroupe->isChecked()) return;
710 MonCreateListGroup *aDlg = new MonCreateListGroup(this, NULL, TRUE, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),_aCaseName, _aListeGroupes) ;
714 // ------------------------------------------------------------------------
715 void MonCreateHypothesis::setGroups(QStringList listGroup)
716 // ------------------------------------------------------------------------
718 _aListeGroupes=listGroup;
720 // ------------------------------------------------------------------------
721 bool MonCreateHypothesis::VerifieZone()
722 // ------------------------------------------------------------------------
724 if ( _aTypeAdap != 0 ) return true;
725 MESSAGE("Debut de VerifieZone") ;
726 _aListeZone = GetZonesChecked() ;
727 MESSAGE(". Longueur de _aListeZone : "<<_aListeZone.count()) ;
728 if (_aListeZone.count() == 0)
730 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
731 QObject::tr("HOM_HYPO_ZONE_2") );
734 MESSAGE("Fin de VerifieZone") ;
737 // ------------------------------------------------------------------------
738 bool MonCreateHypothesis::VerifieComposant()
739 // ------------------------------------------------------------------------
741 if ( _aTypeAdap != 1 ) return true;
742 _aListeComposant = GetListCompChecked() ;
743 if (_aListeComposant.count() == 0)
745 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
746 QObject::tr("HOM_HYPO_COMP") );
752 // ------------------------------------------------------------------------
753 void MonCreateHypothesis::AssocieLesZones()
754 // ------------------------------------------------------------------------
756 MESSAGE( "Debut de AssocieLesZones" );
757 if ( _aTypeAdap != 0 ) return;
758 _aListeZone = GetZonesChecked() ;
759 MESSAGE(". Longueur de _aListeZone : "<<_aListeZone.count()) ;
762 for ( int i=0 ; i< _aListeZone.count() ; i++ )
763 { if ( _aListeZone[i+1] == Raff ) { TypeUse = 1 ; }
764 else { TypeUse = -1 ; }
765 aHypothesis->AddZone(_aListeZone[i].toStdString().c_str(), TypeUse);
768 MESSAGE( "Fin de AssocieLesZones" );
770 // ------------------------------------------------------------------------
771 void MonCreateHypothesis::AssocieComposants()
772 // ------------------------------------------------------------------------
774 if ( _aTypeAdap != 1 ) return;
775 MESSAGE( "Dans AssocieComposants, _TypeThC : " << _TypeThC );
776 MESSAGE( "Dans AssocieComposants, _TypeThR : " << _TypeThR );
779 if ( _TypeThR == 1 ) { _ThreshR = SpinBox_RAbs->value();}
780 if ( _TypeThR == 2 ) { _ThreshR = SpinBox_RRel->value();}
781 if ( _TypeThR == 3 ) { _ThreshR = SpinBox_RPE->value(); }
782 if ( _TypeThR == 4 ) { _ThreshR = SpinBox_RMuSigma->value(); }
785 if ( _TypeThC == 1 ) { _ThreshC = SpinBox_CAbs->value();}
786 if ( _TypeThC == 2 ) { _ThreshC = SpinBox_CRel->value();}
787 if ( _TypeThC == 3 ) { _ThreshC = SpinBox_CPE->value(); }
788 if ( _TypeThC == 4 ) { _ThreshC = SpinBox_CMuSigma->value(); }
790 _aFieldName=CBFieldName->currentText();
791 aHypothesis->SetField(CORBA::string_dup(_aFieldName.toStdString().c_str()) ) ;
792 if ( _TypeThR > 0 ) { aHypothesis->SetRefinThr( _TypeThR, _ThreshR ) ; }
793 if ( _TypeThC > 0 ) { aHypothesis->SetUnRefThr( _TypeThC, _ThreshC ) ; }
794 aHypothesis->SetUseField( _UsField ) ;
795 aHypothesis->SetUseComp( _UsCmpI ) ;
796 _aListeComposant = GetListCompChecked() ;
797 for ( int i=0 ; i< _aListeComposant.count() ; i++ )
798 { aHypothesis->AddComp(_aListeComposant[i].toStdString().c_str()); }
800 // ------------------------------------------------------------------------
801 void MonCreateHypothesis::AssocieLesGroupes()
802 // ------------------------------------------------------------------------
804 HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::ListGroupType;
805 aSeqGroupe->length(_aListeGroupes.size());
806 QStringList::const_iterator it;
808 for (it = _aListeGroupes.constBegin(); it != _aListeGroupes.constEnd(); it++)
809 aSeqGroupe[i++]=(*it).toStdString().c_str();
810 aHypothesis->SetGroups(aSeqGroupe);
813 // ------------------------------------------------------------------------
814 void MonCreateHypothesis::SetFieldNo()
815 // ------------------------------------------------------------------------
816 // Par defaut, on n'interpole rien
818 if ( _aTypeAdap == 1 ) { GBFieldFile->setVisible(1); }
819 else { GBFieldFile->setVisible(0); }
820 TWField->setVisible(0);
822 _TypeFieldInterp = 0 ;
826 // ------------------------------------------------------------------------
827 void MonCreateHypothesis::SetFieldAll()
828 // ------------------------------------------------------------------------
829 // Par defaut, on interpole tout
831 if (_aFieldFile == QString(""))
833 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
834 QObject::tr("HOM_HYPO_FIELD_FILE") );
836 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
839 LEFieldFile->setText(_aFieldFile);
840 LEFieldFile->setReadOnly(1);
841 GBFieldFile->setVisible(1);
842 TWField->setVisible(0);
844 _TypeFieldInterp = 1 ;
848 // ------------------------------------------------------------------------
849 void MonCreateHypothesis::SetFieldChosen()
850 // ------------------------------------------------------------------------
852 if (_aFieldFile == QString(""))
854 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
855 QObject::tr("HOM_HYPO_FIELD_FILE") );
857 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
860 LEFieldFile->setText(_aFieldFile);
861 LEFieldFile->setReadOnly(1);
862 GBFieldFile->setVisible(1);
863 // Recuperation de la liste des champs contenus dans le fichier _aFieldFile
864 std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
866 // Initialisation de la table
868 int nbrow=TWField->rowCount();
869 for ( int row=0; row< nbrow; row++)
871 TWField->removeRow(row);
873 TWField->setRowCount(0);
874 std:: list<QString>::const_iterator it;
876 for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
878 TWField->insertRow(row);
879 TWField->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
880 TWField->item( row, 0 )->setFlags( 0 );
881 TWField->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
882 TWField->item( row, 0 )->setCheckState( Qt::Unchecked );
883 TWField->setItem( row, 1, new QTableWidgetItem(QString(*it).trimmed()));
884 TWField->item( row, 1 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
887 TWField->resizeColumnsToContents();
888 TWField->resizeRowsToContents();
889 TWField->clearSelection();
890 TWField->setVisible(1);
892 _TypeFieldInterp = 2 ;
896 // ------------------------------------------------------------------------
897 void MonCreateHypothesis::SetAdvanced()
898 // ------------------------------------------------------------------------
900 MESSAGE("Debut de SetAdvanced ");
901 if (CBAdvanced->isChecked())
902 { GBAdvancedOptions->setVisible(1);
903 if (_aFieldFile != QString("")) { GBAdapInit->setVisible(1) ; }
904 else { GBAdapInit->setVisible(0) ; }
907 { GBAdvancedOptions->setVisible(0);
911 CBOutputLevel->setChecked(false);
912 CBOutputQuality->setChecked(false);
913 CBOutputDiameter->setChecked(false);
919 // ------------------------------------------------------------------------
920 void MonCreateHypothesis::SetAIN()
921 // ------------------------------------------------------------------------
923 MESSAGE("Debut de SetAIN ");
926 // ------------------------------------------------------------------------
927 void MonCreateHypothesis::SetAIR()
928 // ------------------------------------------------------------------------
930 MESSAGE("Debut de SetAIR ");
933 // ------------------------------------------------------------------------
934 void MonCreateHypothesis::SetAID()
935 // ------------------------------------------------------------------------
937 MESSAGE("Debut de SetAID ");