1 // Copyright (C) 2011-2012 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 myHomardGen,
39 QString aHypothesisName,
40 QString caseName, QString aFieldFile)
41 // ---------------------------------------------------------------------------------
42 /* Constructs a MonCreateHypothesis */
44 QDialog(0), Ui_CreateHypothesis(),
45 _parent(parent), _aHypothesisName(aHypothesisName),
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(myHomardGen);
64 SetNewHypothesisName();
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( RBRAbs, SIGNAL(clicked()), this, SLOT(SetRAbs()));
98 connect( RBRNo, SIGNAL(clicked()), this, SLOT(SetRNo()));
99 connect( RBCPE, SIGNAL(clicked()), this, SLOT(SetCPE()));
100 connect( RBCRel, SIGNAL(clicked()), this, SLOT(SetCRel()));
101 connect( RBCAbs, SIGNAL(clicked()), this, SLOT(SetCAbs()));
102 connect( RBCNo, SIGNAL(clicked()), this, SLOT(SetCNo()));
103 connect( RBL2, SIGNAL(clicked()), this, SLOT(SetUCL2()));
104 connect( RBInf, SIGNAL(clicked()), this, SLOT(SetUCInf()));
105 connect( CBJump, SIGNAL(stateChanged(int)), this, SLOT(SetUseField()));
106 connect( PBZoneNew, SIGNAL(pressed()), this, SLOT(PushZoneNew()));
107 connect( PBZoneEdit, SIGNAL(pressed()), this, SLOT(PushZoneEdit()) );
108 connect( PBZoneDelete, SIGNAL(pressed()), this, SLOT(PushZoneDelete()) );
109 connect( CBGroupe, SIGNAL(stateChanged(int)), this, SLOT(SetFiltrage()));
111 connect( RBFieldNo, SIGNAL(clicked()), this, SLOT(SetFieldNo()));
112 connect( RBFieldAll, SIGNAL(clicked()), this, SLOT(SetFieldAll()));
113 connect( RBFieldChosen,SIGNAL(clicked()), this, SLOT(SetFieldChosen()));
115 connect( CBAdvanced, SIGNAL(stateChanged(int)), this, SLOT(SetAdvanced()));
116 connect( RBAIN, SIGNAL(clicked()), this, SLOT(SetAIN()));
117 connect( RBAIR, SIGNAL(clicked()), this, SLOT(SetAIR()));
118 connect( RBAID, SIGNAL(clicked()), this, SLOT(SetAID()));
120 connect( buttonOk, SIGNAL(pressed()), this, SLOT( PushOnOK()));
121 connect( buttonApply, SIGNAL(pressed()), this, SLOT( PushOnApply()));
122 connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close()));
123 connect( buttonHelp, SIGNAL(pressed()), this, SLOT( PushOnHelp()));
126 // ------------------------------------------------------------------------
127 bool MonCreateHypothesis::PushOnApply()
128 // ------------------------------------------------------------------------
129 // Appele lorsque l'un des boutons Ok ou Apply est presse
135 if (LEHypothesisName->text().trimmed()=="") {
136 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
137 QObject::tr("HOM_HYPO_NAME") );
141 if (VerifieZone() == false) return false;
142 if (VerifieComposant() == false) return false;
144 // Creation de l'objet CORBA si ce n'est pas deja fait sous le meme nom
145 if (LEHypothesisName->text().trimmed() != _aHypothesisName)
147 _aHypothesisName=LEHypothesisName->text().trimmed();
150 _aHypothesis=_myHomardGen->CreateHypothesis(CORBA::string_dup(_aHypothesisName.toStdString().c_str()) );
151 _parent->addHypothese(_aHypothesisName);
153 catch( SALOME::SALOME_Exception& S_ex )
155 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
156 QString(CORBA::string_dup(S_ex.details.text)) );
161 // Mise en place des attributs
162 _aHypothesis->SetAdapRefinUnRef(_aTypeAdap,_aTypeRaff,_aTypeDera);
163 _aHypothesis->SetTypeFieldInterp(_TypeFieldInterp);
164 _aHypothesis->SetCaseCreation(_aCaseName.toStdString().c_str());
169 AssocieFieldInterp();
172 if (CBAdvanced->isChecked())
174 // Enregistrement du niveau maximal
175 _NivMax = spinBoxNivMax->value() ;
176 _aHypothesis->SetNivMax(_NivMax);
177 // Enregistrement du diametre minimal
178 _DiamMin = doubleSpinBoxDiamMin->value() ;
179 _aHypothesis->SetDiamMin(_DiamMin);
180 // Enregistrement de l'intialisation de l'adaptation
181 _aHypothesis->SetAdapInit(_AdapInit);
182 // Sortie des niveaux de raffinement
183 if (CBLevelOutput->isChecked()) { _LevelOutput = 1 ; }
184 _aHypothesis->SetLevelOutput(_LevelOutput);
187 HOMARD_UTILS::updateObjBrowser();
192 // ------------------------------------------------------------------------
193 void MonCreateHypothesis::PushOnOK()
194 // ------------------------------------------------------------------------
196 if (PushOnApply()) this->close();
197 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
199 // ------------------------------------------------------------------------
200 void MonCreateHypothesis::PushOnHelp()
201 // ------------------------------------------------------------------------
203 HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"));
205 // -------------------------------------------------
206 void MonCreateHypothesis::SetNewHypothesisName()
207 // --------------------------------------------------
210 HOMARD::listeHypotheses_var MyHypos = _myHomardGen->GetAllHypotheses();
212 QString aHypothesisName="";
213 while (aHypothesisName=="" )
215 aHypothesisName.setNum(num+1) ;
216 aHypothesisName.insert(0, QString("Hypo_")) ;
217 for ( int i=0; i<MyHypos->length(); i++)
219 if ( aHypothesisName == QString(MyHypos[i]))
227 LEHypothesisName->setText(aHypothesisName);
231 // ------------------------------------------------------------------------
232 void MonCreateHypothesis::SetUniforme()
233 // ------------------------------------------------------------------------
235 GBFieldManagement->setVisible(0);
236 if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
237 else { GBFieldFile->setVisible(1); }
238 GBAreaManagement->setVisible(0);
239 GBUniform->setVisible(1);
243 // ------------------------------------------------------------------------
244 void MonCreateHypothesis::SetChamp()
245 // ------------------------------------------------------------------------
247 if (_aFieldFile == QString(""))
249 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
250 QObject::tr("HOM_HYPO_FIELD_FILE") );
252 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
255 LEFieldFile->setText(_aFieldFile);
256 LEFieldFile->setReadOnly(1);
258 GBUniform->setVisible(0);
259 GBAreaManagement->setVisible(0);
260 GBFieldManagement->setVisible(1);
261 GBFieldFile->setVisible(1);
263 GBUniform->adjustSize();
264 GBAreaManagement->adjustSize();
265 GBFieldManagement->adjustSize();
266 GBFieldFile->adjustSize();
271 // ------------------------------------------------------------------------
272 void MonCreateHypothesis::SetZone()
273 // ------------------------------------------------------------------------
276 GBUniform->setVisible(0);
277 GBFieldManagement->setVisible(0);
278 if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
279 else { GBFieldFile->setVisible(1); }
280 GBAreaManagement->setVisible(1);
287 // ------------------------------------------------------------------------
288 void MonCreateHypothesis::PushZoneNew()
289 // ------------------------------------------------------------------------
291 MESSAGE("Debut de MonCreateHypothesis::PushZoneNew")
292 MonCreateZone *aDlg = new MonCreateZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(_myHomardGen), _aCaseName) ;
296 // ------------------------------------------------------------------------
297 void MonCreateHypothesis::PushZoneEdit()
298 // ------------------------------------------------------------------------
300 MESSAGE("Debut de MonCreateHypothesis::PushZoneEdit")
301 int colonne = TWZone->currentColumn();
302 QTableWidgetItem * monItem = TWZone->currentItem();
303 if (colonne !=2 or monItem == NULL)
305 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
306 QObject::tr("HOM_HYPO_ZONE_1") );
309 QString zoneName = monItem->text().trimmed();
310 MonEditZone *aDlg = new MonEditZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(_myHomardGen), _aCaseName, zoneName) ;
313 // ------------------------------------------------------------------------
314 void MonCreateHypothesis::PushZoneDelete()
315 // ------------------------------------------------------------------------
317 MESSAGE("Debut de MonCreateHypothesis::PushZoneDelete")
318 QMessageBox::warning( 0, QObject::tr("HOM_WARNING"),
319 QObject::tr("HOM_INACTIVE_BUTTON") );
323 // ------------------------------------------------------------------------
324 void MonCreateHypothesis::GetAllZones()
325 // ------------------------------------------------------------------------
326 // Recuperation de toutes les zones enregistrees dans l'arbre d'etude
327 // et affichage dans le tableau
328 // Par defaut, aucune n'est selectionnee
330 MESSAGE("Debut de GetAllZones") ;
331 HOMARD::listeZones_var mesZones = _myHomardGen->GetAllZones();
332 int nbrow=TWZone->rowCount();
333 for ( int row=0; row< nbrow; row++)
335 TWZone->removeRow(row);
337 TWZone->setRowCount(0);
339 for (int i=0; i<mesZones->length(); i++)
341 TWZone->insertRow(row);
343 TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
344 TWZone->item( row, 0 )->setFlags( 0 );
345 TWZone->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
346 TWZone->item( row, 0 )->setCheckState( Qt::Unchecked );
348 TWZone->setItem( row, 1, new QTableWidgetItem( QString ("") ) );
349 TWZone->item( row, 1 )->setFlags( 0 );
350 TWZone->item( row, 1 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
351 TWZone->item( row, 1 )->setCheckState( Qt::Unchecked );
353 TWZone->setItem( row, 2, new QTableWidgetItem(QString(mesZones[i]).trimmed()));
354 TWZone->item( row, 2 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
358 TWZone->resizeColumnsToContents();
359 TWZone->resizeRowsToContents();
360 TWZone->clearSelection();
362 // ------------------------------------------------------------------------
363 void MonCreateHypothesis::addZoneinTWZone(QString newZone)
364 // ------------------------------------------------------------------------
366 MESSAGE("Debut de addZoneinTWZone") ;
367 int row = TWZone->rowCount() ;
368 // Par defaut, on suppose qu'une nouvelle zone est destinee au raffinement
369 TWZone->setRowCount( row+1 );
371 TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
372 TWZone->item( row, 0 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
373 TWZone->item( row, 0 )->setCheckState( Qt::Checked );
375 TWZone->setItem( row, 1, new QTableWidgetItem( QString ("") ) );
376 TWZone->item( row, 1 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
377 TWZone->item( row, 1 )->setCheckState( Qt::Unchecked );
379 TWZone->setItem( row, 2, new QTableWidgetItem( newZone ) );
380 TWZone->scrollToItem( TWZone->item( row, 2 ) );
382 TWZone->resizeRowsToContents();
383 TWZone->resizeColumnToContents(1);
384 TWZone->clearSelection();
386 TWZone->item( row, 2 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
388 // ------------------------------------------------------------------------
389 QStringList MonCreateHypothesis::GetZonesChecked()
390 // ------------------------------------------------------------------------
391 // Retourne les zones enregistrees
393 MESSAGE("Debut de GetZonesChecked") ;
394 QStringList ListeZone ;
395 // On ne peut pas avoir selectionne les deux options
397 for ( int row=0; row< TWZone->rowCount(); row++)
399 if ( ( TWZone->item( row, 0 )->checkState() == Qt::Checked ) and ( TWZone->item( row, 1 )->checkState() == Qt::Checked ) )
401 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
402 QObject::tr("HOM_HYPO_ZONE_3") );
406 // Si tout va bien, on affecte
407 // Attention, on insere en tete, donc on commence d'inserer le type, psui le nom de la zone
411 QString Dera = "-1" ;
412 for ( int row=0; row< TWZone->rowCount(); row++)
414 // MESSAGE ("row "<<row<<", zone : "<<TWZone->item(row, 2)->text().toStdString());
416 if ( TWZone->item(row,0)->checkState() == Qt::Checked )
417 { ListeZone.insert(0, Raff) ;
418 ListeZone.insert(0, QString(TWZone->item(row, 2)->text()) ) ; }
419 // En deraffinement :
420 if ( TWZone->item(row,1)->checkState() == Qt::Checked )
421 { ListeZone.insert(0, Dera) ;
422 ListeZone.insert(0, QString(TWZone->item(row, 2)->text()) ) ; }
424 MESSAGE("Fin de GetZonesChecked ; longueur de ListeZone : "<<ListeZone.count()) ;
429 // ------------------------------------------------------------------------
430 QStringList MonCreateHypothesis::GetListCompChecked()
431 // ------------------------------------------------------------------------
432 // Retourne les composantes retenues
434 MESSAGE( "Debut de GetListCompChecked" );
435 QStringList ListeComposant ;
437 ListeComposant.clear();
438 for ( int row=0; row< TWCMP->rowCount(); row++)
439 if ( TWCMP->item( row, 0 )->checkState() == Qt::Checked )
440 ListeComposant.insert(0, QString(TWCMP->item(row, 1)->text()) ) ;
441 // Choix du texte des radio-boutons selon 1 ou plusieurs composantes
442 if ( ListeComposant.count() < 2 )
443 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS"));
444 RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL"));
447 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2"));
448 RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF"));
450 return ListeComposant ;
453 // ------------------------------------------------------------------------
454 void MonCreateHypothesis::AssocieFieldInterp()
455 // ------------------------------------------------------------------------
457 if ( _TypeFieldInterp != 2 ) return;
458 for ( int row=0; row< TWField->rowCount(); row++)
459 if ( TWField->item( row, 0 )->checkState() == Qt::Checked )
460 { _aHypothesis->AddFieldInterp(TWField->item(row, 1)->text().toStdString().c_str()); }
462 // ------------------------------------------------------------------------
463 void MonCreateHypothesis::SetUniRaff()
464 // ------------------------------------------------------------------------
469 // ------------------------------------------------------------------------
470 void MonCreateHypothesis::SetUniDera()
471 // ------------------------------------------------------------------------
477 // ------------------------------------------------------------------------
478 void MonCreateHypothesis::InitFields()
479 // ------------------------------------------------------------------------
481 CBFieldName->clear();
482 std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
483 // Mise en place de la liste dans le menu pour l'indicateur d'erreur
484 std:: list<QString>::const_iterator it;
485 for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
487 CBFieldName->insertItem(0,QString(*it));
491 // ---------------------------------------
492 void MonCreateHypothesis::SetFieldName()
493 // -------------------------------------------
495 MESSAGE("Debut de SetFieldName");
496 _aFieldName=CBFieldName->currentText();
497 if (QString(_aFieldFile) == QString("") or QString(_aFieldName) == QString("") ) { return; }
499 int nbrow= TWCMP->rowCount() ;
500 for ( int row=0; row < nbrow ; row++)
502 TWCMP->removeRow(row);
504 TWCMP->setRowCount(0);
505 //TWCMP->resizeRowsToContents();
507 std::list<QString> maListe =HOMARD_QT_COMMUN::GetListeComposants(_aFieldFile, _aFieldName);
508 std::list<QString>::const_iterator it;
509 for ( it=maListe.begin() ; it != maListe.end(); it++)
512 TWCMP->setItem( 0, 0, new QTableWidgetItem( QString ("") ) );
513 TWCMP->item( 0, 0 )->setFlags( 0 );
514 TWCMP->item( 0, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
515 TWCMP->item( 0, 0 )->setCheckState( Qt::Checked );
516 TWCMP->setItem( 0, 1, new QTableWidgetItem(QString((*it)).trimmed()));
517 TWCMP->item( 0, 1 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
519 TWCMP->resizeColumnsToContents();
520 TWCMP->resizeRowsToContents();
521 TWCMP->clearSelection();
522 // Choix du texte des radio-boutons selon 1 ou plusieurs composantes
523 if ( TWCMP->rowCount() == 1 )
524 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS"));
525 RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL"));
528 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2"));
529 RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF"));
531 // Par defaut, on propose la valeur absolue / norme L2
534 // ------------------------------------------------------------------------
535 void MonCreateHypothesis::SetRPE()
536 // ------------------------------------------------------------------------
540 RBRPE->setChecked(true);
541 SpinBox_RPE->setEnabled(true);
542 SpinBox_RRel->setEnabled(false);
543 SpinBox_RAbs->setEnabled(false);
545 // ------------------------------------------------------------------------
546 void MonCreateHypothesis::SetRRel()
547 // ------------------------------------------------------------------------
551 RBRRel->setChecked(true);
552 SpinBox_RPE->setEnabled(false);
553 SpinBox_RRel->setEnabled(true);
554 SpinBox_RAbs->setEnabled(false);
556 // ------------------------------------------------------------------------
557 void MonCreateHypothesis::SetRAbs()
558 // ------------------------------------------------------------------------
562 RBRAbs->setChecked(true);
563 SpinBox_RPE->setEnabled(false);
564 SpinBox_RRel->setEnabled(false);
565 SpinBox_RAbs->setEnabled(true);
567 // ------------------------------------------------------------------------
568 void MonCreateHypothesis::SetRNo()
569 // ------------------------------------------------------------------------
573 RBRNo->setChecked(true);
574 SpinBox_RPE->setEnabled(false);
575 SpinBox_RRel->setEnabled(false);
576 SpinBox_RAbs->setEnabled(false);
578 // ------------------------------------------------------------------------
579 void MonCreateHypothesis::SetCPE()
580 // ------------------------------------------------------------------------
584 RBCPE->setChecked(true);
585 SpinBox_CPE->setEnabled(true);
586 SpinBox_CRel->setEnabled(false);
587 SpinBox_CAbs->setEnabled(false);
589 // ------------------------------------------------------------------------
590 void MonCreateHypothesis::SetCRel()
591 // ------------------------------------------------------------------------
595 RBCRel->setChecked(true);
596 SpinBox_CPE->setEnabled(false);
597 SpinBox_CRel->setEnabled(true);
598 SpinBox_CAbs->setEnabled(false);
600 // ------------------------------------------------------------------------
601 void MonCreateHypothesis::SetCAbs()
602 // ------------------------------------------------------------------------
606 RBCAbs->setChecked(true);
607 SpinBox_CPE->setEnabled(false);
608 SpinBox_CRel->setEnabled(false);
609 SpinBox_CAbs->setEnabled(true);
611 // ------------------------------------------------------------------------
612 void MonCreateHypothesis::SetCNo()
613 // ------------------------------------------------------------------------
617 RBCNo->setChecked(true);
618 SpinBox_CPE->setEnabled(false);
619 SpinBox_CRel->setEnabled(false);
620 SpinBox_CAbs->setEnabled(false);
622 // ------------------------------------------------------------------------
623 void MonCreateHypothesis::SetUCL2()
624 // ------------------------------------------------------------------------
627 RBL2->setChecked(true);
629 // ------------------------------------------------------------------------
630 void MonCreateHypothesis::SetUCInf()
631 // ------------------------------------------------------------------------
634 RBInf->setChecked(true);
636 // ------------------------------------------------------------------------
637 void MonCreateHypothesis::SetUseField()
638 // ------------------------------------------------------------------------
640 if ( CBJump->isChecked() ) { _UsField = 1 ; }
641 else { _UsField = 0 ; }
643 // ------------------------------------------------------------------------
644 void MonCreateHypothesis::SetFiltrage()
645 // ------------------------------------------------------------------------
647 if (!CBGroupe->isChecked()) return;
648 MonCreateListGroup *aDlg = new MonCreateListGroup(this, NULL, TRUE, HOMARD::HOMARD_Gen::_duplicate(_myHomardGen),_aCaseName, _aListeGroupes) ;
652 // ------------------------------------------------------------------------
653 void MonCreateHypothesis::setGroups(QStringList listGroup)
654 // ------------------------------------------------------------------------
656 _aListeGroupes=listGroup;
658 // ------------------------------------------------------------------------
659 bool MonCreateHypothesis::VerifieZone()
660 // ------------------------------------------------------------------------
662 if ( _aTypeAdap != 0 ) return true;
663 MESSAGE("Debut de VerifieZone") ;
664 _aListeZone = GetZonesChecked() ;
665 MESSAGE(". Longueur de _aListeZone : "<<_aListeZone.count()) ;
666 if (_aListeZone.count() == 0)
668 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
669 QObject::tr("HOM_HYPO_ZONE_2") );
672 MESSAGE("Fin de VerifieZone") ;
675 // ------------------------------------------------------------------------
676 bool MonCreateHypothesis::VerifieComposant()
677 // ------------------------------------------------------------------------
679 if ( _aTypeAdap != 1 ) return true;
680 _aListeComposant = GetListCompChecked() ;
681 if (_aListeComposant.count() == 0)
683 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
684 QObject::tr("HOM_HYPO_COMP") );
690 // ------------------------------------------------------------------------
691 void MonCreateHypothesis::AssocieLesZones()
692 // ------------------------------------------------------------------------
694 MESSAGE( "Debut de AssocieLesZones" );
695 if ( _aTypeAdap != 0 ) return;
696 _aListeZone = GetZonesChecked() ;
697 MESSAGE(". Longueur de _aListeZone : "<<_aListeZone.count()) ;
700 for ( int i=0 ; i< _aListeZone.count() ; i++ )
701 { if ( _aListeZone[i+1] == Raff ) { TypeUse = 1 ; }
702 else { TypeUse = -1 ; }
703 _myHomardGen->AssociateHypoZone(_aHypothesisName.toStdString().c_str(), _aListeZone[i].toStdString().c_str(), TypeUse);
706 MESSAGE( "Fin de AssocieLesZones" );
708 // ------------------------------------------------------------------------
709 void MonCreateHypothesis::AssocieComposants()
710 // ------------------------------------------------------------------------
712 if ( _aTypeAdap != 1 ) return;
713 MESSAGE( "Dans AssocieComposants, _TypeThC : " << _TypeThC );
714 MESSAGE( "Dans AssocieComposants, _TypeThR : " << _TypeThR );
717 if ( _TypeThR == 1 ) { _ThreshR = SpinBox_RAbs->value();}
718 if ( _TypeThR == 2 ) { _ThreshR = SpinBox_RRel->value();}
719 if ( _TypeThR == 3 ) { _ThreshR = SpinBox_RPE->value(); }
722 if ( _TypeThC == 1 ) { _ThreshC = SpinBox_CAbs->value();}
723 if ( _TypeThC == 2 ) { _ThreshC = SpinBox_CRel->value();}
724 if ( _TypeThC == 3 ) { _ThreshC = SpinBox_CPE->value(); }
726 _aFieldName=CBFieldName->currentText();
727 _aHypothesis->SetField(CORBA::string_dup(_aFieldName.toStdString().c_str()) ) ;
728 _aHypothesis->SetRefinThr( _TypeThR, _ThreshR ) ;
729 _aHypothesis->SetUnRefThr( _TypeThC, _ThreshC ) ;
730 _aHypothesis->SetUseField( _UsField ) ;
731 _aHypothesis->SetUseComp( _UsCmpI ) ;
732 _aListeComposant = GetListCompChecked() ;
733 for ( int i=0 ; i< _aListeComposant.count() ; i++ )
734 { _aHypothesis->AddComp(_aListeComposant[i].toStdString().c_str()); }
736 // ------------------------------------------------------------------------
737 void MonCreateHypothesis::AssocieLesGroupes()
738 // ------------------------------------------------------------------------
740 HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::ListGroupType;
741 aSeqGroupe->length(_aListeGroupes.size());
742 QStringList::const_iterator it;
744 for (it = _aListeGroupes.constBegin(); it != _aListeGroupes.constEnd(); it++)
745 aSeqGroupe[i++]=(*it).toStdString().c_str();
746 _aHypothesis->SetGroups(aSeqGroupe);
749 // ------------------------------------------------------------------------
750 void MonCreateHypothesis::SetFieldNo()
751 // ------------------------------------------------------------------------
752 // Par defaut, on n'interpole rien
754 if ( _aTypeAdap == 1 ) { GBFieldFile->setVisible(1); }
755 else { GBFieldFile->setVisible(0); }
756 TWField->setVisible(0);
759 _TypeFieldInterp = 0 ;
761 // ------------------------------------------------------------------------
762 void MonCreateHypothesis::SetFieldAll()
763 // ------------------------------------------------------------------------
764 // Par defaut, on interpole tout
766 if (_aFieldFile == QString(""))
768 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
769 QObject::tr("HOM_HYPO_FIELD_FILE") );
771 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
774 LEFieldFile->setText(_aFieldFile);
775 LEFieldFile->setReadOnly(1);
776 GBFieldFile->setVisible(1);
777 TWField->setVisible(0);
779 _TypeFieldInterp = 1 ;
782 // ------------------------------------------------------------------------
783 void MonCreateHypothesis::SetFieldChosen()
784 // ------------------------------------------------------------------------
786 if (_aFieldFile == QString(""))
788 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
789 QObject::tr("HOM_HYPO_FIELD_FILE") );
791 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
794 LEFieldFile->setText(_aFieldFile);
795 LEFieldFile->setReadOnly(1);
796 GBFieldFile->setVisible(1);
797 // Recuperation de la liste des champs contenus dans le fichier _aFieldFile
798 std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
800 // Initialisation de la table
802 int nbrow=TWField->rowCount();
803 for ( int row=0; row< nbrow; row++)
805 TWField->removeRow(row);
807 TWField->setRowCount(0);
808 std:: list<QString>::const_iterator it;
810 for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
812 TWField->insertRow(row);
813 TWField->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
814 TWField->item( row, 0 )->setFlags( 0 );
815 TWField->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
816 TWField->item( row, 0 )->setCheckState( Qt::Unchecked );
817 TWField->setItem( row, 1, new QTableWidgetItem(QString(*it).trimmed()));
818 TWField->item( row, 1 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
821 TWField->resizeColumnsToContents();
822 TWField->resizeRowsToContents();
823 TWField->clearSelection();
824 TWField->setVisible(1);
826 _TypeFieldInterp = 2 ;
829 // ------------------------------------------------------------------------
830 void MonCreateHypothesis::SetAdvanced()
831 // ------------------------------------------------------------------------
833 MESSAGE("Debut de SetAdvanced ");
834 if (CBAdvanced->isChecked())
835 { GBAdvancedOptions->setVisible(1);
836 if (_aFieldFile != QString(""))
837 { GBAdapInit->setVisible(1) ;
840 { GBAdapInit->setVisible(0) ;
844 { GBAdvancedOptions->setVisible(0);
848 CBLevelOutput->setChecked(false);
853 // ------------------------------------------------------------------------
854 void MonCreateHypothesis::SetAIN()
855 // ------------------------------------------------------------------------
857 MESSAGE("Debut de SetAIN ");
860 // ------------------------------------------------------------------------
861 void MonCreateHypothesis::SetAIR()
862 // ------------------------------------------------------------------------
864 MESSAGE("Debut de SetAIR ");
867 // ------------------------------------------------------------------------
868 void MonCreateHypothesis::SetAID()
869 // ------------------------------------------------------------------------
871 MESSAGE("Debut de SetAID ");