3 #include "MonCreateHypothesis.h"
4 #include "MonCreateListGroup.h"
5 #include "MonCreateIteration.h"
6 #include "MonCreateZone.h"
7 #include "MonEditZone.h"
10 #include <QMessageBox>
12 #include "SalomeApp_Tools.h"
13 #include "HOMARDGUI_Utils.h"
14 #include "HomardQtCommun.h"
15 #include <utilities.h>
17 // -------------------------------------------------------------------------------
18 MonCreateHypothesis::MonCreateHypothesis(MonCreateIteration* parent, bool modal,
19 HOMARD::HOMARD_Gen_var myHomardGen,
20 QString aHypothesisName,
21 QString caseName, QString aFieldFile)
22 // ---------------------------------------------------------------------------------
23 /* Constructs a MonCreateHypothesis */
25 QDialog(0), Ui_CreateHypothesis(),
26 _parent(parent), _aHypothesisName(aHypothesisName),
27 _aCaseName(caseName), _aFieldFile(aFieldFile),
29 _aTypeAdap(-2), _aTypeRaff(1), _aTypeDera(0),
30 _TypeThR(3), _ThreshR(0),
31 _TypeThC(0), _ThreshC(0),
32 _UsCmpI(0), _TypeFieldInterp(0)
34 MESSAGE("Constructeur") ;
35 _myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen);
40 SetNewHypothesisName();
41 if (_aFieldFile != QString("")) {
42 RBChamp->setChecked(1);
45 RBUniforme->setChecked(1);
51 // ------------------------------------------------------------------------
52 MonCreateHypothesis::~MonCreateHypothesis()
53 // ------------------------------------------------------------------------
55 // no need to delete child widgets, Qt does it all for us
57 // ------------------------------------------------------------------------
58 void MonCreateHypothesis::InitConnect()
59 // ------------------------------------------------------------------------
61 connect( RBUniforme, SIGNAL(clicked()), this, SLOT(SetUniforme()));
62 connect( RBChamp, SIGNAL(clicked()), this, SLOT(SetChamp()));
63 connect( RBZone, SIGNAL(clicked()), this, SLOT(SetZone()));
64 connect( RBUniRaff, SIGNAL(clicked()), this, SLOT(SetUniRaff()));
65 connect( RBUniDera, SIGNAL(clicked()), this, SLOT(SetUniDera()));
66 connect( CBFieldName, SIGNAL(activated(int)), this, SLOT( SetFieldName()));
67 connect( RBRPE, SIGNAL(clicked()), this, SLOT(SetRPE()));
68 connect( RBRRel, SIGNAL(clicked()), this, SLOT(SetRRel()));
69 connect( RBRAbs, SIGNAL(clicked()), this, SLOT(SetRAbs()));
70 connect( RBRNo, SIGNAL(clicked()), this, SLOT(SetRNo()));
71 connect( RBCPE, SIGNAL(clicked()), this, SLOT(SetCPE()));
72 connect( RBCRel, SIGNAL(clicked()), this, SLOT(SetCRel()));
73 connect( RBCAbs, SIGNAL(clicked()), this, SLOT(SetCAbs()));
74 connect( RBCNo, SIGNAL(clicked()), this, SLOT(SetCNo()));
75 connect( RBL2, SIGNAL(clicked()), this, SLOT(SetUCL2()));
76 connect( RBInf, SIGNAL(clicked()), this, SLOT(SetUCInf()));
77 connect( PBZoneNew, SIGNAL(pressed()), this, SLOT(PushZoneNew()));
78 connect( PBZoneEdit, SIGNAL(pressed()), this, SLOT(PushZoneEdit()) );
79 connect( PBZoneDelete, SIGNAL(pressed()), this, SLOT(PushZoneDelete()) );
80 connect( CBGroupe, SIGNAL(stateChanged(int)), this, SLOT(SetFiltrage()));
81 connect( RBFieldNo, SIGNAL(clicked()), this, SLOT(SetFieldNo()));
82 connect( RBFieldAll, SIGNAL(clicked()), this, SLOT(SetFieldAll()));
83 connect( RBFieldChosen,SIGNAL(clicked()), this, SLOT(SetFieldChosen()));
84 connect( buttonOk, SIGNAL(pressed()), this, SLOT( PushOnOK()));
85 connect( buttonApply, SIGNAL(pressed()), this, SLOT( PushOnApply()));
86 connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close()));
87 connect( buttonHelp, SIGNAL(pressed()), this, SLOT( PushOnHelp()));
90 // ------------------------------------------------------------------------
91 bool MonCreateHypothesis::PushOnApply()
92 // ------------------------------------------------------------------------
93 // Appele lorsque l'un des boutons Ok ou Apply est presse
99 if (LEHypothesisName->text().trimmed()=="") {
100 QMessageBox::information( 0, "Error",
101 "The hypothesis must be named.",
102 QMessageBox::Ok + QMessageBox::Default );
106 if (VerifieZone() == false) return false;
107 if (VerifieComposant() == false) return false;
109 // Creation de l'objet CORBA si ce n'est pas deja fait sous le meme nom
110 if (LEHypothesisName->text().trimmed() != _aHypothesisName)
112 _aHypothesisName=LEHypothesisName->text().trimmed();
115 _aHypothesis=_myHomardGen->CreateHypothesis(CORBA::string_dup(_aHypothesisName.toStdString().c_str()) );
116 _parent->addHypothese(_aHypothesisName);
118 catch( SALOME::SALOME_Exception& S_ex )
120 QMessageBox::information( 0, "Error",
121 QString(CORBA::string_dup(S_ex.details.text)),
122 QMessageBox::Ok + QMessageBox::Default );
127 // Mise en place des attributs
128 _aHypothesis->SetAdapRefinUnRef(_aTypeAdap,_aTypeRaff,_aTypeDera);
129 _aHypothesis->SetTypeFieldInterp(_TypeFieldInterp);
130 _aHypothesis->SetCaseCreation(_aCaseName.toStdString().c_str());
135 AssocieFieldInterp();
137 HOMARD_UTILS::updateObjBrowser();
142 // ------------------------------------------------------------------------
143 void MonCreateHypothesis::PushOnOK()
144 // ------------------------------------------------------------------------
146 if (PushOnApply()) this->close();
147 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
149 // ------------------------------------------------------------------------
150 void MonCreateHypothesis::PushOnHelp()
151 // ------------------------------------------------------------------------
153 HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"));
155 // -------------------------------------------------
156 void MonCreateHypothesis::SetNewHypothesisName()
157 // --------------------------------------------------
160 HOMARD::listeHypotheses_var MyHypos = _myHomardGen->GetAllHypotheses();
162 QString aHypothesisName="";
163 while (aHypothesisName=="" )
165 aHypothesisName.setNum(num+1) ;
166 aHypothesisName.insert(0, QString("Hypo_")) ;
167 for ( int i=0; i<MyHypos->length(); i++)
169 if ( aHypothesisName == QString(MyHypos[i]))
177 LEHypothesisName->setText(aHypothesisName);
181 // ------------------------------------------------------------------------
182 void MonCreateHypothesis::SetUniforme()
183 // ------------------------------------------------------------------------
185 GBFieldManagement->setVisible(0);
186 if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
187 else { GBFieldFile->setVisible(1); }
188 GBAreaManagement->setVisible(0);
189 GBUniform->setVisible(1);
193 // ------------------------------------------------------------------------
194 void MonCreateHypothesis::SetChamp()
195 // ------------------------------------------------------------------------
197 if (_aFieldFile == QString(""))
199 QMessageBox::information( 0, "Error",
200 QString("Enter FieldFile please "),
201 QMessageBox::Ok + QMessageBox::Default );
203 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
206 LEFieldFile->setText(_aFieldFile);
207 LEFieldFile->setReadOnly(1);
209 GBUniform->setVisible(0);
210 GBAreaManagement->setVisible(0);
211 GBFieldManagement->setVisible(1);
212 GBFieldFile->setVisible(1);
214 GBUniform->adjustSize();
215 GBAreaManagement->adjustSize();
216 GBFieldManagement->adjustSize();
217 GBFieldFile->adjustSize();
222 // ------------------------------------------------------------------------
223 void MonCreateHypothesis::SetZone()
224 // ------------------------------------------------------------------------
227 GBUniform->setVisible(0);
228 GBFieldManagement->setVisible(0);
229 if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
230 else { GBFieldFile->setVisible(1); }
231 GBAreaManagement->setVisible(1);
238 // ------------------------------------------------------------------------
239 void MonCreateHypothesis::PushZoneNew()
240 // ------------------------------------------------------------------------
242 MESSAGE("Debut de PushZoneNew")
243 MonCreateZone *aDlg = new MonCreateZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(_myHomardGen), _aCaseName) ;
247 // ------------------------------------------------------------------------
248 void MonCreateHypothesis::PushZoneEdit()
249 // ------------------------------------------------------------------------
251 MESSAGE("Debut de PushZoneEdit")
252 int colonne = TWZone->currentColumn();
253 QTableWidgetItem * monItem = TWZone->currentItem();
254 if (colonne !=1 or monItem == NULL)
256 QMessageBox::information( 0, "Error",
257 "Please, Select a Zone",
258 QMessageBox::Ok + QMessageBox::Default );
261 QString zoneName = monItem->text().trimmed();
262 MonEditZone *aDlg = new MonEditZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(_myHomardGen), _aCaseName, zoneName) ;
265 // ------------------------------------------------------------------------
266 void MonCreateHypothesis::PushZoneDelete()
267 // ------------------------------------------------------------------------
269 MESSAGE("Debut de PushZoneDelete")
270 QMessageBox::information( 0, "Error",
272 QMessageBox::Ok + QMessageBox::Default );
276 // ------------------------------------------------------------------------
277 void MonCreateHypothesis::GetAllZones()
278 // ------------------------------------------------------------------------
279 // Recuperation de toutes les zones enregistrees dans l'arbre d'etude
281 HOMARD::listeZones_var mesZones = _myHomardGen->GetAllZones();
283 int stop=TWZone->rowCount();
284 for ( int row=0; row< stop; row++)
286 TWZone->removeRow(row);
288 TWZone->setRowCount(0);
290 for (int i=0; i<mesZones->length(); i++)
292 TWZone->insertRow(row);
293 TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
294 TWZone->item( row, 0 )->setFlags( 0 );
295 TWZone->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
296 TWZone->item( row, 0 )->setCheckState( Qt::Unchecked );
297 TWZone->setItem( row, 1, new QTableWidgetItem(QString(mesZones[i])));
298 TWZone->item( row, 1 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
301 TWZone->resizeColumnsToContents();
302 TWZone->resizeRowsToContents();
303 TWZone->clearSelection();
306 // ------------------------------------------------------------------------
307 void MonCreateHypothesis::addZone(QString newZone)
308 // ------------------------------------------------------------------------
310 int row = TWZone->rowCount() ;
311 TWZone->setRowCount( row+1 );
312 TWZone->setItem( row, 0, new QTableWidgetItem( 0 ) );
313 TWZone->item( row, 0 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
314 TWZone->item( row, 0 )->setCheckState( Qt::Checked );
315 TWZone->setItem( row, 1, new QTableWidgetItem( newZone ) );
316 TWZone->scrollToItem( TWZone->item( row, 1 ) );
317 TWZone->resizeRowsToContents();
318 TWZone->resizeColumnToContents(1);
319 TWZone->clearSelection();
320 TWZone->item( row, 1 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
323 // ------------------------------------------------------------------------
324 QStringList MonCreateHypothesis::GetZonesChecked()
325 // ------------------------------------------------------------------------
326 // Retourne les zones enregistrees
328 QStringList ListeZone ;
329 for ( int row=0; row< TWZone->rowCount(); row++)
331 if ( TWZone->item( row, 0 )->checkState() == Qt::Checked )
332 ListeZone.insert(0, QString(TWZone->item(row, 1)->text()) ) ;
337 // ------------------------------------------------------------------------
338 QStringList MonCreateHypothesis::GetListCompChecked()
339 // ------------------------------------------------------------------------
340 // Retourne les composantes retenues
342 MESSAGE( "Dans GetListCompChecked" );
343 QStringList ListeComposant ;
345 ListeComposant.clear();
346 for ( int row=0; row< TWCMP->rowCount(); row++)
347 if ( TWCMP->item( row, 0 )->checkState() == Qt::Checked )
348 ListeComposant.insert(0, QString(TWCMP->item(row, 1)->text()) ) ;
349 // Choix du texte des radio-boutons selon 1 ou plusieurs composantes
350 if ( ListeComposant.count() < 2 )
351 { RBL2->setText(QString("Absolute value"));
352 RBInf->setText(QString("Relative value"));
355 { RBL2->setText(QString("L2 norm"));
356 RBInf->setText(QString("Infinite Norm"));
358 return ListeComposant ;
361 // ------------------------------------------------------------------------
362 void MonCreateHypothesis::AssocieFieldInterp()
363 // ------------------------------------------------------------------------
365 if ( _TypeFieldInterp != 2 ) return;
366 for ( int row=0; row< TWField->rowCount(); row++)
367 if ( TWField->item( row, 0 )->checkState() == Qt::Checked )
368 { _aHypothesis->AddFieldInterp(TWField->item(row, 1)->text().toStdString().c_str()); }
370 // ------------------------------------------------------------------------
371 void MonCreateHypothesis::SetUniRaff()
372 // ------------------------------------------------------------------------
377 // ------------------------------------------------------------------------
378 void MonCreateHypothesis::SetUniDera()
379 // ------------------------------------------------------------------------
385 // ------------------------------------------------------------------------
386 void MonCreateHypothesis::InitFields()
387 // ------------------------------------------------------------------------
389 CBFieldName->clear();
390 std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
391 // Mise en place de la liste dans le menu pour l'indicateur d'erreur
392 std:: list<QString>::const_iterator it;
393 for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
395 CBFieldName->insertItem(0,QString(*it));
399 // ---------------------------------------
400 void MonCreateHypothesis::SetFieldName()
401 // -------------------------------------------
403 _aFieldName=CBFieldName->currentText();
404 if (QString(_aFieldFile) == QString("") or QString(_aFieldName) == QString("") ) { return; }
406 for ( int row=0; row < TWCMP->rowCount() ; row++)
408 TWCMP->removeRow(row);
410 //TWCMP->setRowCount(0);
411 //TWCMP->resizeRowsToContents();
413 std::list<QString> maListe =HOMARD_QT_COMMUN::GetListeComposants(_aFieldFile, _aFieldName);
414 std::list<QString>::const_iterator it;
415 for ( it=maListe.begin() ; it != maListe.end(); it++)
418 TWCMP->setItem( 0, 0, new QTableWidgetItem( QString ("") ) );
419 TWCMP->item( 0, 0 )->setFlags( 0 );
420 TWCMP->item( 0, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
421 TWCMP->item( 0, 0 )->setCheckState( Qt::Checked );
422 TWCMP->setItem( 0, 1, new QTableWidgetItem(QString((*it))));
423 TWCMP->item( 0, 1 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
425 TWCMP->resizeColumnsToContents();
426 TWCMP->resizeRowsToContents();
427 TWCMP->clearSelection();
428 // Choix du texte des radio-boutons selon 1 ou plusieurs composantes
429 if ( TWCMP->rowCount() == 1 )
430 { RBL2->setText(QString("Absolute value"));
431 RBInf->setText(QString("Relative value"));
434 { RBL2->setText(QString("L2 norm"));
435 RBInf->setText(QString("Infinite Norm"));
437 // Par defaut, on propose la valeur absolue / norme L2
440 // ------------------------------------------------------------------------
441 void MonCreateHypothesis::SetRPE()
442 // ------------------------------------------------------------------------
446 RBRPE->setChecked(true);
447 SpinBox_RPE->setEnabled(true);
448 SpinBox_RRel->setEnabled(false);
449 SpinBox_RAbs->setEnabled(false);
451 // ------------------------------------------------------------------------
452 void MonCreateHypothesis::SetRRel()
453 // ------------------------------------------------------------------------
457 RBRRel->setChecked(true);
458 SpinBox_RPE->setEnabled(false);
459 SpinBox_RRel->setEnabled(true);
460 SpinBox_RAbs->setEnabled(false);
462 // ------------------------------------------------------------------------
463 void MonCreateHypothesis::SetRAbs()
464 // ------------------------------------------------------------------------
468 RBRAbs->setChecked(true);
469 SpinBox_RPE->setEnabled(false);
470 SpinBox_RRel->setEnabled(false);
471 SpinBox_RAbs->setEnabled(true);
473 // ------------------------------------------------------------------------
474 void MonCreateHypothesis::SetRNo()
475 // ------------------------------------------------------------------------
479 RBRNo->setChecked(true);
480 SpinBox_RPE->setEnabled(false);
481 SpinBox_RRel->setEnabled(false);
482 SpinBox_RAbs->setEnabled(false);
484 // ------------------------------------------------------------------------
485 void MonCreateHypothesis::SetCPE()
486 // ------------------------------------------------------------------------
490 RBCPE->setChecked(true);
491 SpinBox_CPE->setEnabled(true);
492 SpinBox_CRel->setEnabled(false);
493 SpinBox_CAbs->setEnabled(false);
495 // ------------------------------------------------------------------------
496 void MonCreateHypothesis::SetCRel()
497 // ------------------------------------------------------------------------
501 RBCRel->setChecked(true);
502 SpinBox_CPE->setEnabled(false);
503 SpinBox_CRel->setEnabled(true);
504 SpinBox_CAbs->setEnabled(false);
506 // ------------------------------------------------------------------------
507 void MonCreateHypothesis::SetCAbs()
508 // ------------------------------------------------------------------------
512 RBCAbs->setChecked(true);
513 SpinBox_CPE->setEnabled(false);
514 SpinBox_CRel->setEnabled(false);
515 SpinBox_CAbs->setEnabled(true);
517 // ------------------------------------------------------------------------
518 void MonCreateHypothesis::SetCNo()
519 // ------------------------------------------------------------------------
523 RBCNo->setChecked(true);
524 SpinBox_CPE->setEnabled(false);
525 SpinBox_CRel->setEnabled(false);
526 SpinBox_CAbs->setEnabled(false);
528 // ------------------------------------------------------------------------
529 void MonCreateHypothesis::SetUCL2()
530 // ------------------------------------------------------------------------
533 RBL2->setChecked(true);
535 // ------------------------------------------------------------------------
536 void MonCreateHypothesis::SetUCInf()
537 // ------------------------------------------------------------------------
540 RBInf->setChecked(true);
542 // ------------------------------------------------------------------------
543 void MonCreateHypothesis::SetFiltrage()
544 // ------------------------------------------------------------------------
546 if (!CBGroupe->isChecked()) return;
547 MonCreateListGroup *aDlg = new MonCreateListGroup(this, NULL, TRUE, HOMARD::HOMARD_Gen::_duplicate(_myHomardGen),_aCaseName, _aListeGroupes) ;
551 // ------------------------------------------------------------------------
552 void MonCreateHypothesis::setGroups(QStringList listGroup)
553 // ------------------------------------------------------------------------
555 _aListeGroupes=listGroup;
557 // ------------------------------------------------------------------------
558 bool MonCreateHypothesis::VerifieZone()
559 // ------------------------------------------------------------------------
561 if ( _aTypeAdap != 0 ) return true;
562 _aListeZone = GetZonesChecked() ;
563 if (_aListeZone.count() == 0)
565 QMessageBox::information( 0, "Error",
566 QString("At least, one zone must be given."),
567 QMessageBox::Ok + QMessageBox::Default );
572 // ------------------------------------------------------------------------
573 bool MonCreateHypothesis::VerifieComposant()
574 // ------------------------------------------------------------------------
576 if ( _aTypeAdap != 1 ) return true;
577 _aListeComposant = GetListCompChecked() ;
578 if (_aListeComposant.count() == 0)
580 QMessageBox::information( 0, "Error",
581 QString("At least, one composant must be given."),
582 QMessageBox::Ok + QMessageBox::Default );
588 // ------------------------------------------------------------------------
589 void MonCreateHypothesis::AssocieLesZones()
590 // ------------------------------------------------------------------------
592 if ( _aTypeAdap != 0 ) return;
593 _aListeZone = GetZonesChecked() ;
594 for ( int i=0 ; i< _aListeZone.count() ; i++ )
595 { _myHomardGen->AssociateHypoZone(_aListeZone[i].toStdString().c_str(),_aHypothesisName.toStdString().c_str()); }
597 // ------------------------------------------------------------------------
598 void MonCreateHypothesis::AssocieComposants()
599 // ------------------------------------------------------------------------
601 if ( _aTypeAdap != 1 ) return;
602 MESSAGE( "Dans AssocieComposants, _TypeThC : " << _TypeThC );
603 MESSAGE( "Dans AssocieComposants, _TypeThR : " << _TypeThR );
606 if ( _TypeThR == 1 ) { _ThreshR = SpinBox_RAbs->value();}
607 if ( _TypeThR == 2 ) { _ThreshR = SpinBox_RRel->value();}
608 if ( _TypeThR == 3 ) { _ThreshR = SpinBox_RPE->value(); }
611 if ( _TypeThC == 1 ) { _ThreshC = SpinBox_CAbs->value();}
612 if ( _TypeThC == 2 ) { _ThreshC = SpinBox_CRel->value();}
613 if ( _TypeThC == 3 ) { _ThreshC = SpinBox_CPE->value(); }
615 _aFieldName=CBFieldName->currentText();
616 _aHypothesis->SetField(CORBA::string_dup(_aFieldName.toStdString().c_str()) ) ;
617 _aHypothesis->SetRefinThr( _TypeThR, _ThreshR ) ;
618 _aHypothesis->SetUnRefThr( _TypeThC, _ThreshC ) ;
619 _aHypothesis->SetUseComp( _UsCmpI ) ;
620 _aListeComposant = GetListCompChecked() ;
621 for ( int i=0 ; i< _aListeComposant.count() ; i++ )
622 { _aHypothesis->AddComp(_aListeComposant[i].toStdString().c_str()); }
624 // ------------------------------------------------------------------------
625 void MonCreateHypothesis::AssocieLesGroupes()
626 // ------------------------------------------------------------------------
628 HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::ListGroupType;
629 aSeqGroupe->length(_aListeGroupes.size());
630 QStringList::const_iterator it;
632 for (it = _aListeGroupes.constBegin(); it != _aListeGroupes.constEnd(); it++)
633 aSeqGroupe[i++]=(*it).toStdString().c_str();
634 _aHypothesis->SetGroups(aSeqGroupe);
637 // ------------------------------------------------------------------------
638 void MonCreateHypothesis::SetFieldNo()
639 // ------------------------------------------------------------------------
640 // Par defaut, on n'interpole rien
642 if ( _aTypeAdap == 1 ) { GBFieldFile->setVisible(1); }
643 else { GBFieldFile->setVisible(0); }
644 TWField->setVisible(0);
647 _TypeFieldInterp = 0 ;
649 // ------------------------------------------------------------------------
650 void MonCreateHypothesis::SetFieldAll()
651 // ------------------------------------------------------------------------
652 // Par defaut, on interpole tout
654 if (_aFieldFile == QString(""))
656 QMessageBox::information( 0, "Error",
657 QString("Enter FieldFile please "),
658 QMessageBox::Ok + QMessageBox::Default );
660 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
663 LEFieldFile->setText(_aFieldFile);
664 LEFieldFile->setReadOnly(1);
665 GBFieldFile->setVisible(1);
666 TWField->setVisible(0);
668 _TypeFieldInterp = 1 ;
671 // ------------------------------------------------------------------------
672 void MonCreateHypothesis::SetFieldChosen()
673 // ------------------------------------------------------------------------
675 if (_aFieldFile == QString(""))
677 QMessageBox::information( 0, "Error",
678 QString("Enter FieldFile please "),
679 QMessageBox::Ok + QMessageBox::Default );
681 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
684 LEFieldFile->setText(_aFieldFile);
685 LEFieldFile->setReadOnly(1);
686 GBFieldFile->setVisible(1);
687 // Recuperation de la liste des champs contenus dans le fichier _aFieldFile
688 std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
690 // Initialisation de la table
692 for ( int row=0; row< TWField->rowCount(); row++)
693 TWField->removeRow(row);
695 TWField->setRowCount(0);
696 std:: list<QString>::const_iterator it;
698 for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
700 TWField->insertRow(row);
701 TWField->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
702 TWField->item( row, 0 )->setFlags( 0 );
703 TWField->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
704 TWField->item( row, 0 )->setCheckState( Qt::Unchecked );
705 TWField->setItem( row, 1, new QTableWidgetItem(QString(*it)));
706 TWField->item( row, 1 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
709 TWField->resizeColumnsToContents();
710 TWField->resizeRowsToContents();
711 TWField->clearSelection();
712 TWField->setVisible(1);
714 _TypeFieldInterp = 2 ;