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);
80 // CBOutputParent->setChecked(false);
86 // ------------------------------------------------------------------------
87 MonCreateHypothesis::~MonCreateHypothesis()
88 // ------------------------------------------------------------------------
90 // no need to delete child widgets, Qt does it all for us
92 // ------------------------------------------------------------------------
93 void MonCreateHypothesis::InitConnect()
94 // ------------------------------------------------------------------------
96 connect( RBUniforme, SIGNAL(clicked()), this, SLOT(SetUniforme()));
97 connect( RBChamp, SIGNAL(clicked()), this, SLOT(SetChamp()));
98 connect( RBZone, SIGNAL(clicked()), this, SLOT(SetZone()));
99 connect( RBUniRaff, SIGNAL(clicked()), this, SLOT(SetUniRaff()));
100 connect( RBUniDera, SIGNAL(clicked()), this, SLOT(SetUniDera()));
102 connect( CBFieldName, SIGNAL(activated(int)), this, SLOT( SetFieldName()));
103 connect( RBRPE, SIGNAL(clicked()), this, SLOT(SetRPE()));
104 connect( RBRRel, SIGNAL(clicked()), this, SLOT(SetRRel()));
105 connect( RBRMuSigma, SIGNAL(clicked()), this, SLOT(SetRMS()));
106 connect( RBRAbs, SIGNAL(clicked()), this, SLOT(SetRAbs()));
107 connect( RBRNo, SIGNAL(clicked()), this, SLOT(SetRNo()));
108 connect( RBCPE, SIGNAL(clicked()), this, SLOT(SetCPE()));
109 connect( RBCRel, SIGNAL(clicked()), this, SLOT(SetCRel()));
110 connect( RBCMuSigma, SIGNAL(clicked()), this, SLOT(SetCMS()));
111 connect( RBCAbs, SIGNAL(clicked()), this, SLOT(SetCAbs()));
112 connect( RBCNo, SIGNAL(clicked()), this, SLOT(SetCNo()));
113 connect( RBL2, SIGNAL(clicked()), this, SLOT(SetUCL2()));
114 connect( RBInf, SIGNAL(clicked()), this, SLOT(SetUCInf()));
115 connect( CBJump, SIGNAL(stateChanged(int)), this, SLOT(SetUseField()));
116 connect( PBZoneNew, SIGNAL(pressed()), this, SLOT(PushZoneNew()));
117 connect( PBZoneEdit, SIGNAL(pressed()), this, SLOT(PushZoneEdit()) );
118 connect( PBZoneDelete, SIGNAL(pressed()), this, SLOT(PushZoneDelete()) );
119 connect( CBGroupe, SIGNAL(stateChanged(int)), this, SLOT(SetFiltrage()));
121 connect( RBFieldNo, SIGNAL(clicked()), this, SLOT(SetFieldNo()));
122 connect( RBFieldAll, SIGNAL(clicked()), this, SLOT(SetFieldAll()));
123 connect( RBFieldChosen,SIGNAL(clicked()), this, SLOT(SetFieldChosen()));
125 connect( CBAdvanced, SIGNAL(stateChanged(int)), this, SLOT(SetAdvanced()));
126 connect( RBAIN, SIGNAL(clicked()), this, SLOT(SetAIN()));
127 connect( RBAIR, SIGNAL(clicked()), this, SLOT(SetAIR()));
128 connect( RBAID, SIGNAL(clicked()), this, SLOT(SetAID()));
130 connect( buttonOk, SIGNAL(pressed()), this, SLOT( PushOnOK()));
131 connect( buttonApply, SIGNAL(pressed()), this, SLOT( PushOnApply()));
132 connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close()));
133 connect( buttonHelp, SIGNAL(pressed()), this, SLOT( PushOnHelp()));
136 // ------------------------------------------------------------------------
137 bool MonCreateHypothesis::PushOnApply()
138 // ------------------------------------------------------------------------
139 // Appele lorsque l'un des boutons Ok ou Apply est presse
145 if (LEName->text().trimmed()=="") {
146 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
147 QObject::tr("HOM_HYPO_NAME") );
151 if (VerifieZone() == false) return false;
152 if (VerifieComposant() == false) return false;
154 // Creation de l'objet CORBA si ce n'est pas deja fait sous le meme nom
155 if (LEName->text().trimmed() != _Name)
157 _Name=LEName->text().trimmed();
160 aHypothesis=myHomardGen->CreateHypothesis(CORBA::string_dup(_Name.toStdString().c_str()) );
161 _parent->addHypothese(_Name);
163 catch( SALOME::SALOME_Exception& S_ex )
165 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
166 QString(CORBA::string_dup(S_ex.details.text)) );
171 // Mise en place des attributs
172 if ( _aTypeAdap == -1 )
175 if ( _aTypeRaff == 1 ) { TypeRaffDera = 1 ; }
176 else { TypeRaffDera = -1 ; }
177 aHypothesis->SetUnifRefinUnRef(TypeRaffDera);
179 aHypothesis->SetTypeFieldInterp(_TypeFieldInterp);
180 aHypothesis->SetCaseCreation(_aCaseName.toStdString().c_str());
185 AssocieFieldInterp();
188 if (CBAdvanced->isChecked())
190 // Enregistrement du niveau maximal
191 _NivMax = SpinBoxNivMax->value() ;
192 aHypothesis->SetNivMax(_NivMax);
193 // Enregistrement du diametre minimal
194 _DiamMin = doubleSpinBoxDiamMin->value() ;
195 aHypothesis->SetDiamMin(_DiamMin);
196 // Enregistrement de l'intialisation de l'adaptation
197 aHypothesis->SetAdapInit(_AdapInit);
198 // Sortie optionnelle des niveaux de raffinement, des diametres, des qualites
200 if (CBOutputLevel->isChecked()) { _ExtraOutput = 2 ; }
201 if (CBOutputQuality->isChecked()) { _ExtraOutput = 3*_ExtraOutput ; }
202 if (CBOutputDiameter->isChecked()) { _ExtraOutput = 5*_ExtraOutput ; }
203 // if (CBOutputParent->isChecked()) { _ExtraOutput = 7*_ExtraOutput ; }
204 aHypothesis->SetExtraOutput(_ExtraOutput);
207 HOMARD_UTILS::updateObjBrowser() ;
213 // ------------------------------------------------------------------------
214 void MonCreateHypothesis::PushOnOK()
215 // ------------------------------------------------------------------------
217 if (PushOnApply()) this->close();
218 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
220 // ------------------------------------------------------------------------
221 void MonCreateHypothesis::PushOnHelp()
222 // ------------------------------------------------------------------------
224 std::string LanguageShort = myHomardGen->GetLanguageShort();
225 HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"), QString(""), QString(LanguageShort.c_str()));
227 // -------------------------------------------------
228 void MonCreateHypothesis::SetNewName()
229 // --------------------------------------------------
232 HOMARD::listeHypotheses_var MyObjects = myHomardGen->GetAllHypothesesName();
237 aName.setNum(num+1) ;
238 aName.insert(0, QString("Hypo_")) ;
239 for ( int i=0; i<MyObjects->length(); i++)
241 if ( aName == QString(MyObjects[i]))
249 LEName->setText(aName);
253 // ------------------------------------------------------------------------
254 void MonCreateHypothesis::SetUniforme()
255 // ------------------------------------------------------------------------
257 GBFieldManagement->setVisible(0);
258 if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
259 else { GBFieldFile->setVisible(1); }
260 GBAreaManagement->setVisible(0);
261 GBUniform->setVisible(1);
267 // ------------------------------------------------------------------------
268 void MonCreateHypothesis::SetChamp()
269 // ------------------------------------------------------------------------
271 if (_aFieldFile == QString(""))
273 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
274 QObject::tr("HOM_HYPO_FIELD_FILE") );
276 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
279 LEFieldFile->setText(_aFieldFile);
280 LEFieldFile->setReadOnly(1);
282 GBUniform->setVisible(0);
283 GBAreaManagement->setVisible(0);
284 GBFieldManagement->setVisible(1);
285 GBFieldFile->setVisible(1);
287 GBUniform->adjustSize();
288 GBAreaManagement->adjustSize();
289 GBFieldManagement->adjustSize();
290 GBFieldFile->adjustSize();
296 // ------------------------------------------------------------------------
297 void MonCreateHypothesis::SetZone()
298 // ------------------------------------------------------------------------
301 GBUniform->setVisible(0);
302 GBFieldManagement->setVisible(0);
303 if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
304 else { GBFieldFile->setVisible(1); }
305 GBAreaManagement->setVisible(1);
314 // ------------------------------------------------------------------------
315 void MonCreateHypothesis::PushZoneNew()
316 // ------------------------------------------------------------------------
318 MESSAGE("Debut de MonCreateHypothesis::PushZoneNew")
319 MonCreateZone *aDlg = new MonCreateZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName) ;
323 // ------------------------------------------------------------------------
324 void MonCreateHypothesis::PushZoneEdit()
325 // ------------------------------------------------------------------------
327 MESSAGE("Debut de MonCreateHypothesis::PushZoneEdit")
328 int colonne = TWZone->currentColumn();
329 QTableWidgetItem * monItem = TWZone->currentItem();
330 if (colonne !=2 || monItem == NULL)
332 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
333 QObject::tr("HOM_HYPO_ZONE_1") );
336 QString zoneName = monItem->text().trimmed();
337 MonEditZone *aDlg = new MonEditZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, zoneName) ;
340 // ------------------------------------------------------------------------
341 void MonCreateHypothesis::PushZoneDelete()
342 // ------------------------------------------------------------------------
344 MESSAGE("Debut de MonCreateHypothesis::PushZoneDelete")
345 QMessageBox::warning( 0, QObject::tr("HOM_WARNING"),
346 QObject::tr("HOM_INACTIVE_BUTTON") );
350 // ------------------------------------------------------------------------
351 void MonCreateHypothesis::GetAllZones()
352 // ------------------------------------------------------------------------
353 // Recuperation de toutes les zones enregistrees dans l'arbre d'etude
354 // et affichage dans le tableau
355 // Par defaut, aucune n'est selectionnee
357 MESSAGE("Debut de GetAllZones") ;
358 HOMARD::listeZones_var mesZones = myHomardGen->GetAllZonesName();
359 int nbrow=TWZone->rowCount();
360 for ( int row=0; row< nbrow; row++)
362 TWZone->removeRow(row);
364 TWZone->setRowCount(0);
366 for (int i=0; i<mesZones->length(); i++)
368 TWZone->insertRow(row);
370 TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
371 TWZone->item( row, 0 )->setFlags( 0 );
372 TWZone->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
373 TWZone->item( row, 0 )->setCheckState( Qt::Unchecked );
375 TWZone->setItem( row, 1, new QTableWidgetItem( QString ("") ) );
376 TWZone->item( row, 1 )->setFlags( 0 );
377 TWZone->item( row, 1 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
378 TWZone->item( row, 1 )->setCheckState( Qt::Unchecked );
380 TWZone->setItem( row, 2, new QTableWidgetItem(QString(mesZones[i]).trimmed()));
381 TWZone->item( row, 2 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
385 TWZone->resizeColumnsToContents();
386 TWZone->resizeRowsToContents();
387 TWZone->clearSelection();
389 // ------------------------------------------------------------------------
390 void MonCreateHypothesis::addZoneinTWZone(QString newZone)
391 // ------------------------------------------------------------------------
393 MESSAGE("Debut de addZoneinTWZone") ;
394 int row = TWZone->rowCount() ;
395 // Par defaut, on suppose qu'une nouvelle zone est destinee au raffinement
396 TWZone->setRowCount( row+1 );
398 TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
399 TWZone->item( row, 0 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
400 TWZone->item( row, 0 )->setCheckState( Qt::Checked );
402 TWZone->setItem( row, 1, new QTableWidgetItem( QString ("") ) );
403 TWZone->item( row, 1 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
404 TWZone->item( row, 1 )->setCheckState( Qt::Unchecked );
406 TWZone->setItem( row, 2, new QTableWidgetItem( newZone ) );
407 TWZone->scrollToItem( TWZone->item( row, 2 ) );
409 TWZone->resizeRowsToContents();
410 TWZone->resizeColumnToContents(1);
411 TWZone->clearSelection();
413 TWZone->item( row, 2 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
415 // ------------------------------------------------------------------------
416 QStringList MonCreateHypothesis::GetZonesChecked()
417 // ------------------------------------------------------------------------
418 // Retourne les zones enregistrees
420 MESSAGE("Debut de GetZonesChecked") ;
421 QStringList ListeZone ;
422 // On ne peut pas avoir selectionne les deux options
424 for ( int row=0; row< TWZone->rowCount(); row++)
426 if ( ( TWZone->item( row, 0 )->checkState() == Qt::Checked ) && ( TWZone->item( row, 1 )->checkState() == Qt::Checked ) )
428 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
429 QObject::tr("HOM_HYPO_ZONE_3") );
433 // Si tout va bien, on affecte
434 // Attention, on insere en tete, donc on commence d'inserer le type, psui le nom de la zone
438 QString Dera = "-1" ;
439 for ( int row=0; row< TWZone->rowCount(); row++)
441 // MESSAGE ("row "<<row<<", zone : "<<TWZone->item(row, 2)->text().toStdString());
443 if ( TWZone->item(row,0)->checkState() == Qt::Checked )
444 { ListeZone.insert(0, Raff) ;
445 ListeZone.insert(0, QString(TWZone->item(row, 2)->text()) ) ; }
446 // En deraffinement :
447 if ( TWZone->item(row,1)->checkState() == Qt::Checked )
448 { ListeZone.insert(0, Dera) ;
449 ListeZone.insert(0, QString(TWZone->item(row, 2)->text()) ) ; }
451 MESSAGE("Fin de GetZonesChecked ; longueur de ListeZone : "<<ListeZone.count()) ;
456 // ------------------------------------------------------------------------
457 QStringList MonCreateHypothesis::GetListCompChecked()
458 // ------------------------------------------------------------------------
459 // Retourne les composantes retenues
461 MESSAGE( "Debut de GetListCompChecked" );
462 QStringList ListeComposant ;
464 ListeComposant.clear();
465 for ( int row=0; row< TWCMP->rowCount(); row++)
466 if ( TWCMP->item( row, 0 )->checkState() == Qt::Checked )
467 ListeComposant.insert(0, QString(TWCMP->item(row, 1)->text()) ) ;
468 // Choix du texte des radio-boutons selon 1 ou plusieurs composantes
469 if ( ListeComposant.count() < 2 )
470 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS"));
471 RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL"));
474 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2"));
475 RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF"));
477 return ListeComposant ;
480 // ------------------------------------------------------------------------
481 void MonCreateHypothesis::AssocieFieldInterp()
482 // ------------------------------------------------------------------------
484 if ( _TypeFieldInterp != 2 ) return;
485 for ( int row=0; row< TWField->rowCount(); row++)
487 if ( TWField->item( row, 0 )->checkState() == Qt::Checked )
489 aHypothesis->AddFieldInterp(TWField->item(row, 1)->text().toStdString().c_str());
493 // ------------------------------------------------------------------------
494 void MonCreateHypothesis::SetUniRaff()
495 // ------------------------------------------------------------------------
500 // ------------------------------------------------------------------------
501 void MonCreateHypothesis::SetUniDera()
502 // ------------------------------------------------------------------------
508 // ------------------------------------------------------------------------
509 void MonCreateHypothesis::InitFields()
510 // ------------------------------------------------------------------------
512 CBFieldName->clear();
513 std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
514 // Mise en place de la liste dans le menu pour l'indicateur d'erreur
515 std:: list<QString>::const_iterator it;
516 for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
518 CBFieldName->insertItem(0,QString(*it));
522 // ---------------------------------------
523 void MonCreateHypothesis::SetFieldName()
524 // -------------------------------------------
526 MESSAGE("Debut de SetFieldName");
527 _aFieldName=CBFieldName->currentText();
528 if (QString(_aFieldFile) == QString("") || QString(_aFieldName) == QString("") ) { return; }
530 int nbrow= TWCMP->rowCount() ;
531 for ( int row=0; row < nbrow ; row++)
533 TWCMP->removeRow(row);
535 TWCMP->setRowCount(0);
536 //TWCMP->resizeRowsToContents();
538 std::list<QString> maListe =HOMARD_QT_COMMUN::GetListeComposants(_aFieldFile, _aFieldName);
539 std::list<QString>::const_iterator it;
540 for ( it=maListe.begin() ; it != maListe.end(); it++)
543 TWCMP->setItem( 0, 0, new QTableWidgetItem( QString ("") ) );
544 TWCMP->item( 0, 0 )->setFlags( 0 );
545 TWCMP->item( 0, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
546 TWCMP->item( 0, 0 )->setCheckState( Qt::Checked );
547 TWCMP->setItem( 0, 1, new QTableWidgetItem(QString((*it)).trimmed()));
548 TWCMP->item( 0, 1 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
550 TWCMP->resizeColumnsToContents();
551 TWCMP->resizeRowsToContents();
552 TWCMP->clearSelection();
553 // Choix du texte des radio-boutons selon 1 ou plusieurs composantes
554 if ( TWCMP->rowCount() == 1 )
555 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS"));
556 RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL"));
559 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2"));
560 RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF"));
562 // Par defaut, on propose la valeur absolue / norme L2
565 // ------------------------------------------------------------------------
566 void MonCreateHypothesis::SetRPE()
567 // ------------------------------------------------------------------------
571 RBRPE->setChecked(true);
572 SpinBox_RPE->setEnabled(true);
573 SpinBox_RRel->setEnabled(false);
574 SpinBox_RAbs->setEnabled(false);
575 SpinBox_RMuSigma->setEnabled(false);
577 // ------------------------------------------------------------------------
578 void MonCreateHypothesis::SetRRel()
579 // ------------------------------------------------------------------------
583 RBRRel->setChecked(true);
584 SpinBox_RPE->setEnabled(false);
585 SpinBox_RRel->setEnabled(true);
586 SpinBox_RAbs->setEnabled(false);
587 SpinBox_RMuSigma->setEnabled(false);
589 // ------------------------------------------------------------------------
590 void MonCreateHypothesis::SetRAbs()
591 // ------------------------------------------------------------------------
595 RBRAbs->setChecked(true);
596 SpinBox_RPE->setEnabled(false);
597 SpinBox_RRel->setEnabled(false);
598 SpinBox_RAbs->setEnabled(true);
599 SpinBox_RMuSigma->setEnabled(false);
601 // ------------------------------------------------------------------------
602 void MonCreateHypothesis::SetRMS()
603 // ------------------------------------------------------------------------
607 RBRMuSigma->setChecked(true);
608 SpinBox_RPE->setEnabled(false);
609 SpinBox_RRel->setEnabled(false);
610 SpinBox_RAbs->setEnabled(false);
611 SpinBox_RMuSigma->setEnabled(true);
613 // ------------------------------------------------------------------------
614 void MonCreateHypothesis::SetRNo()
615 // ------------------------------------------------------------------------
619 RBRNo->setChecked(true);
620 SpinBox_RPE->setEnabled(false);
621 SpinBox_RRel->setEnabled(false);
622 SpinBox_RAbs->setEnabled(false);
623 SpinBox_RMuSigma->setEnabled(false);
625 // ------------------------------------------------------------------------
626 void MonCreateHypothesis::SetCPE()
627 // ------------------------------------------------------------------------
631 RBCPE->setChecked(true);
632 SpinBox_CPE->setEnabled(true);
633 SpinBox_CRel->setEnabled(false);
634 SpinBox_CAbs->setEnabled(false);
635 SpinBox_CMuSigma->setEnabled(false);
637 // ------------------------------------------------------------------------
638 void MonCreateHypothesis::SetCRel()
639 // ------------------------------------------------------------------------
643 RBCRel->setChecked(true);
644 SpinBox_CPE->setEnabled(false);
645 SpinBox_CRel->setEnabled(true);
646 SpinBox_CAbs->setEnabled(false);
647 SpinBox_CMuSigma->setEnabled(false);
649 // ------------------------------------------------------------------------
650 void MonCreateHypothesis::SetCAbs()
651 // ------------------------------------------------------------------------
655 RBCAbs->setChecked(true);
656 SpinBox_CPE->setEnabled(false);
657 SpinBox_CRel->setEnabled(false);
658 SpinBox_CAbs->setEnabled(true);
659 SpinBox_CMuSigma->setEnabled(false);
661 // ------------------------------------------------------------------------
662 void MonCreateHypothesis::SetCMS()
663 // ------------------------------------------------------------------------
667 RBCMuSigma->setChecked(true);
668 SpinBox_CPE->setEnabled(false);
669 SpinBox_CRel->setEnabled(false);
670 SpinBox_CAbs->setEnabled(false);
671 SpinBox_CMuSigma->setEnabled(true);
673 // ------------------------------------------------------------------------
674 void MonCreateHypothesis::SetCNo()
675 // ------------------------------------------------------------------------
679 RBCNo->setChecked(true);
680 SpinBox_CPE->setEnabled(false);
681 SpinBox_CRel->setEnabled(false);
682 SpinBox_CAbs->setEnabled(false);
683 SpinBox_CMuSigma->setEnabled(false);
685 // ------------------------------------------------------------------------
686 void MonCreateHypothesis::SetUCL2()
687 // ------------------------------------------------------------------------
690 RBL2->setChecked(true);
692 // ------------------------------------------------------------------------
693 void MonCreateHypothesis::SetUCInf()
694 // ------------------------------------------------------------------------
696 if ( TWCMP->rowCount() == 1 ) { _UsCmpI = 2 ; }
697 else { _UsCmpI = 1 ; }
698 RBInf->setChecked(true);
700 // ------------------------------------------------------------------------
701 void MonCreateHypothesis::SetUseField()
702 // ------------------------------------------------------------------------
704 if ( CBJump->isChecked() ) { _UsField = 1 ; }
705 else { _UsField = 0 ; }
707 // ------------------------------------------------------------------------
708 void MonCreateHypothesis::SetFiltrage()
709 // ------------------------------------------------------------------------
711 if (!CBGroupe->isChecked()) return;
712 MonCreateListGroup *aDlg = new MonCreateListGroup(this, NULL, TRUE, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),_aCaseName, _aListeGroupes) ;
716 // ------------------------------------------------------------------------
717 void MonCreateHypothesis::setGroups(QStringList listGroup)
718 // ------------------------------------------------------------------------
720 _aListeGroupes=listGroup;
722 // ------------------------------------------------------------------------
723 bool MonCreateHypothesis::VerifieZone()
724 // ------------------------------------------------------------------------
726 if ( _aTypeAdap != 0 ) return true;
727 MESSAGE("Debut de VerifieZone") ;
728 _aListeZone = GetZonesChecked() ;
729 MESSAGE(". Longueur de _aListeZone : "<<_aListeZone.count()) ;
730 if (_aListeZone.count() == 0)
732 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
733 QObject::tr("HOM_HYPO_ZONE_2") );
736 MESSAGE("Fin de VerifieZone") ;
739 // ------------------------------------------------------------------------
740 bool MonCreateHypothesis::VerifieComposant()
741 // ------------------------------------------------------------------------
743 if ( _aTypeAdap != 1 ) return true;
744 _aListeComposant = GetListCompChecked() ;
745 if (_aListeComposant.count() == 0)
747 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
748 QObject::tr("HOM_HYPO_COMP") );
754 // ------------------------------------------------------------------------
755 void MonCreateHypothesis::AssocieLesZones()
756 // ------------------------------------------------------------------------
758 MESSAGE( "Debut de AssocieLesZones" );
759 if ( _aTypeAdap != 0 ) return;
760 _aListeZone = GetZonesChecked() ;
761 MESSAGE(". Longueur de _aListeZone : "<<_aListeZone.count()) ;
764 for ( int i=0 ; i< _aListeZone.count() ; i++ )
765 { if ( _aListeZone[i+1] == Raff ) { TypeUse = 1 ; }
766 else { TypeUse = -1 ; }
767 aHypothesis->AddZone(_aListeZone[i].toStdString().c_str(), TypeUse);
770 MESSAGE( "Fin de AssocieLesZones" );
772 // ------------------------------------------------------------------------
773 void MonCreateHypothesis::AssocieComposants()
774 // ------------------------------------------------------------------------
776 if ( _aTypeAdap != 1 ) return;
777 MESSAGE( "Dans AssocieComposants, _TypeThC : " << _TypeThC );
778 MESSAGE( "Dans AssocieComposants, _TypeThR : " << _TypeThR );
781 if ( _TypeThR == 1 ) { _ThreshR = SpinBox_RAbs->value();}
782 if ( _TypeThR == 2 ) { _ThreshR = SpinBox_RRel->value();}
783 if ( _TypeThR == 3 ) { _ThreshR = SpinBox_RPE->value(); }
784 if ( _TypeThR == 4 ) { _ThreshR = SpinBox_RMuSigma->value(); }
787 if ( _TypeThC == 1 ) { _ThreshC = SpinBox_CAbs->value();}
788 if ( _TypeThC == 2 ) { _ThreshC = SpinBox_CRel->value();}
789 if ( _TypeThC == 3 ) { _ThreshC = SpinBox_CPE->value(); }
790 if ( _TypeThC == 4 ) { _ThreshC = SpinBox_CMuSigma->value(); }
792 _aFieldName=CBFieldName->currentText();
793 aHypothesis->SetField(CORBA::string_dup(_aFieldName.toStdString().c_str()) ) ;
794 if ( _TypeThR > 0 ) { aHypothesis->SetRefinThr( _TypeThR, _ThreshR ) ; }
795 if ( _TypeThC > 0 ) { aHypothesis->SetUnRefThr( _TypeThC, _ThreshC ) ; }
796 aHypothesis->SetUseField( _UsField ) ;
797 aHypothesis->SetUseComp( _UsCmpI ) ;
798 _aListeComposant = GetListCompChecked() ;
799 for ( int i=0 ; i< _aListeComposant.count() ; i++ )
800 { aHypothesis->AddComp(_aListeComposant[i].toStdString().c_str()); }
802 // ------------------------------------------------------------------------
803 void MonCreateHypothesis::AssocieLesGroupes()
804 // ------------------------------------------------------------------------
806 HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::ListGroupType;
807 aSeqGroupe->length(_aListeGroupes.size());
808 QStringList::const_iterator it;
810 for (it = _aListeGroupes.constBegin(); it != _aListeGroupes.constEnd(); it++)
811 aSeqGroupe[i++]=(*it).toStdString().c_str();
812 aHypothesis->SetGroups(aSeqGroupe);
815 // ------------------------------------------------------------------------
816 void MonCreateHypothesis::SetFieldNo()
817 // ------------------------------------------------------------------------
818 // Par defaut, on n'interpole rien
820 if ( _aTypeAdap == 1 ) { GBFieldFile->setVisible(1); }
821 else { GBFieldFile->setVisible(0); }
822 TWField->setVisible(0);
824 _TypeFieldInterp = 0 ;
828 // ------------------------------------------------------------------------
829 void MonCreateHypothesis::SetFieldAll()
830 // ------------------------------------------------------------------------
831 // Par defaut, on interpole tout
833 if (_aFieldFile == QString(""))
835 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
836 QObject::tr("HOM_HYPO_FIELD_FILE") );
838 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
841 LEFieldFile->setText(_aFieldFile);
842 LEFieldFile->setReadOnly(1);
843 GBFieldFile->setVisible(1);
844 TWField->setVisible(0);
846 _TypeFieldInterp = 1 ;
850 // ------------------------------------------------------------------------
851 void MonCreateHypothesis::SetFieldChosen()
852 // ------------------------------------------------------------------------
854 if (_aFieldFile == QString(""))
856 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
857 QObject::tr("HOM_HYPO_FIELD_FILE") );
859 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
862 LEFieldFile->setText(_aFieldFile);
863 LEFieldFile->setReadOnly(1);
864 GBFieldFile->setVisible(1);
865 // Recuperation de la liste des champs contenus dans le fichier _aFieldFile
866 std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
868 // Initialisation de la table
870 int nbrow=TWField->rowCount();
871 for ( int row=0; row< nbrow; row++)
873 TWField->removeRow(row);
875 TWField->setRowCount(0);
876 std:: list<QString>::const_iterator it;
878 for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
880 TWField->insertRow(row);
881 TWField->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
882 TWField->item( row, 0 )->setFlags( 0 );
883 TWField->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
884 TWField->item( row, 0 )->setCheckState( Qt::Unchecked );
885 TWField->setItem( row, 1, new QTableWidgetItem(QString(*it).trimmed()));
886 TWField->item( row, 1 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
889 TWField->resizeColumnsToContents();
890 TWField->resizeRowsToContents();
891 TWField->clearSelection();
892 TWField->setVisible(1);
894 _TypeFieldInterp = 2 ;
898 // ------------------------------------------------------------------------
899 void MonCreateHypothesis::SetAdvanced()
900 // ------------------------------------------------------------------------
902 MESSAGE("Debut de SetAdvanced ");
903 if (CBAdvanced->isChecked())
904 { GBAdvancedOptions->setVisible(1);
905 if (_aFieldFile != QString("")) { GBAdapInit->setVisible(1) ; }
906 else { GBAdapInit->setVisible(0) ; }
909 { GBAdvancedOptions->setVisible(0);
913 CBOutputLevel->setChecked(false);
914 CBOutputQuality->setChecked(false);
915 CBOutputDiameter->setChecked(false);
916 // CBOutputParent->setChecked(false);
922 // ------------------------------------------------------------------------
923 void MonCreateHypothesis::SetAIN()
924 // ------------------------------------------------------------------------
926 MESSAGE("Debut de SetAIN ");
929 // ------------------------------------------------------------------------
930 void MonCreateHypothesis::SetAIR()
931 // ------------------------------------------------------------------------
933 MESSAGE("Debut de SetAIR ");
936 // ------------------------------------------------------------------------
937 void MonCreateHypothesis::SetAID()
938 // ------------------------------------------------------------------------
940 MESSAGE("Debut de SetAID ");