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::critical( 0, QObject::tr("HOM_ERROR"),
101 QObject::tr("HOM_HYPO_NAME") );
105 if (VerifieZone() == false) return false;
106 if (VerifieComposant() == false) return false;
108 // Creation de l'objet CORBA si ce n'est pas deja fait sous le meme nom
109 if (LEHypothesisName->text().trimmed() != _aHypothesisName)
111 _aHypothesisName=LEHypothesisName->text().trimmed();
114 _aHypothesis=_myHomardGen->CreateHypothesis(CORBA::string_dup(_aHypothesisName.toStdString().c_str()) );
115 _parent->addHypothese(_aHypothesisName);
117 catch( SALOME::SALOME_Exception& S_ex )
119 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
120 QString(CORBA::string_dup(S_ex.details.text)) );
125 // Mise en place des attributs
126 _aHypothesis->SetAdapRefinUnRef(_aTypeAdap,_aTypeRaff,_aTypeDera);
127 _aHypothesis->SetTypeFieldInterp(_TypeFieldInterp);
128 _aHypothesis->SetCaseCreation(_aCaseName.toStdString().c_str());
133 AssocieFieldInterp();
135 HOMARD_UTILS::updateObjBrowser();
140 // ------------------------------------------------------------------------
141 void MonCreateHypothesis::PushOnOK()
142 // ------------------------------------------------------------------------
144 if (PushOnApply()) this->close();
145 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
147 // ------------------------------------------------------------------------
148 void MonCreateHypothesis::PushOnHelp()
149 // ------------------------------------------------------------------------
151 HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"));
153 // -------------------------------------------------
154 void MonCreateHypothesis::SetNewHypothesisName()
155 // --------------------------------------------------
158 HOMARD::listeHypotheses_var MyHypos = _myHomardGen->GetAllHypotheses();
160 QString aHypothesisName="";
161 while (aHypothesisName=="" )
163 aHypothesisName.setNum(num+1) ;
164 aHypothesisName.insert(0, QString("Hypo_")) ;
165 for ( int i=0; i<MyHypos->length(); i++)
167 if ( aHypothesisName == QString(MyHypos[i]))
175 LEHypothesisName->setText(aHypothesisName);
179 // ------------------------------------------------------------------------
180 void MonCreateHypothesis::SetUniforme()
181 // ------------------------------------------------------------------------
183 GBFieldManagement->setVisible(0);
184 if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
185 else { GBFieldFile->setVisible(1); }
186 GBAreaManagement->setVisible(0);
187 GBUniform->setVisible(1);
191 // ------------------------------------------------------------------------
192 void MonCreateHypothesis::SetChamp()
193 // ------------------------------------------------------------------------
195 if (_aFieldFile == QString(""))
197 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
198 QObject::tr("HOM_HYPO_FIELD_FILE") );
200 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
203 LEFieldFile->setText(_aFieldFile);
204 LEFieldFile->setReadOnly(1);
206 GBUniform->setVisible(0);
207 GBAreaManagement->setVisible(0);
208 GBFieldManagement->setVisible(1);
209 GBFieldFile->setVisible(1);
211 GBUniform->adjustSize();
212 GBAreaManagement->adjustSize();
213 GBFieldManagement->adjustSize();
214 GBFieldFile->adjustSize();
219 // ------------------------------------------------------------------------
220 void MonCreateHypothesis::SetZone()
221 // ------------------------------------------------------------------------
224 GBUniform->setVisible(0);
225 GBFieldManagement->setVisible(0);
226 if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
227 else { GBFieldFile->setVisible(1); }
228 GBAreaManagement->setVisible(1);
235 // ------------------------------------------------------------------------
236 void MonCreateHypothesis::PushZoneNew()
237 // ------------------------------------------------------------------------
239 MESSAGE("Debut de MonCreateHypothesis::PushZoneNew")
240 MonCreateZone *aDlg = new MonCreateZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(_myHomardGen), _aCaseName) ;
244 // ------------------------------------------------------------------------
245 void MonCreateHypothesis::PushZoneEdit()
246 // ------------------------------------------------------------------------
248 MESSAGE("Debut de MonCreateHypothesis::PushZoneEdit")
249 int colonne = TWZone->currentColumn();
250 QTableWidgetItem * monItem = TWZone->currentItem();
251 if (colonne !=1 or monItem == NULL)
253 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
254 QObject::tr("HOM_HYPO_ZONE_1") );
257 QString zoneName = monItem->text().trimmed();
258 MonEditZone *aDlg = new MonEditZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(_myHomardGen), _aCaseName, zoneName) ;
261 // ------------------------------------------------------------------------
262 void MonCreateHypothesis::PushZoneDelete()
263 // ------------------------------------------------------------------------
265 MESSAGE("Debut de MonCreateHypothesis::PushZoneDelete")
266 QMessageBox::warning( 0, QObject::tr("HOM_WARNING"),
267 QObject::tr("HOM_INACTIVE_BUTTON") );
271 // ------------------------------------------------------------------------
272 void MonCreateHypothesis::GetAllZones()
273 // ------------------------------------------------------------------------
274 // Recuperation de toutes les zones enregistrees dans l'arbre d'etude
276 HOMARD::listeZones_var mesZones = _myHomardGen->GetAllZones();
277 int nbrow=TWZone->rowCount();
278 for ( int row=0; row< nbrow; row++)
280 TWZone->removeRow(row);
282 TWZone->setRowCount(0);
284 for (int i=0; i<mesZones->length(); i++)
286 TWZone->insertRow(row);
287 TWZone->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
288 TWZone->item( row, 0 )->setFlags( 0 );
289 TWZone->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
290 TWZone->item( row, 0 )->setCheckState( Qt::Unchecked );
291 TWZone->setItem( row, 1, new QTableWidgetItem(QString(mesZones[i]).trimmed()));
292 TWZone->item( row, 1 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
295 TWZone->resizeColumnsToContents();
296 TWZone->resizeRowsToContents();
297 TWZone->clearSelection();
300 // ------------------------------------------------------------------------
301 void MonCreateHypothesis::addZone(QString newZone)
302 // ------------------------------------------------------------------------
304 int row = TWZone->rowCount() ;
305 TWZone->setRowCount( row+1 );
306 TWZone->setItem( row, 0, new QTableWidgetItem( 0 ) );
307 TWZone->item( row, 0 )->setFlags( Qt::ItemIsEditable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
308 TWZone->item( row, 0 )->setCheckState( Qt::Checked );
309 TWZone->setItem( row, 1, new QTableWidgetItem( newZone ) );
310 TWZone->scrollToItem( TWZone->item( row, 1 ) );
311 TWZone->resizeRowsToContents();
312 TWZone->resizeColumnToContents(1);
313 TWZone->clearSelection();
314 TWZone->item( row, 1 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
317 // ------------------------------------------------------------------------
318 QStringList MonCreateHypothesis::GetZonesChecked()
319 // ------------------------------------------------------------------------
320 // Retourne les zones enregistrees
322 QStringList ListeZone ;
323 for ( int row=0; row< TWZone->rowCount(); row++)
325 if ( TWZone->item( row, 0 )->checkState() == Qt::Checked )
326 ListeZone.insert(0, QString(TWZone->item(row, 1)->text()) ) ;
331 // ------------------------------------------------------------------------
332 QStringList MonCreateHypothesis::GetListCompChecked()
333 // ------------------------------------------------------------------------
334 // Retourne les composantes retenues
336 MESSAGE( "Dans MonCreateHypothesis::GetListCompChecked" );
337 QStringList ListeComposant ;
339 ListeComposant.clear();
340 for ( int row=0; row< TWCMP->rowCount(); row++)
341 if ( TWCMP->item( row, 0 )->checkState() == Qt::Checked )
342 ListeComposant.insert(0, QString(TWCMP->item(row, 1)->text()) ) ;
343 // Choix du texte des radio-boutons selon 1 ou plusieurs composantes
344 if ( ListeComposant.count() < 2 )
345 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS"));
346 RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL"));
349 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2"));
350 RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF"));
352 return ListeComposant ;
355 // ------------------------------------------------------------------------
356 void MonCreateHypothesis::AssocieFieldInterp()
357 // ------------------------------------------------------------------------
359 if ( _TypeFieldInterp != 2 ) return;
360 for ( int row=0; row< TWField->rowCount(); row++)
361 if ( TWField->item( row, 0 )->checkState() == Qt::Checked )
362 { _aHypothesis->AddFieldInterp(TWField->item(row, 1)->text().toStdString().c_str()); }
364 // ------------------------------------------------------------------------
365 void MonCreateHypothesis::SetUniRaff()
366 // ------------------------------------------------------------------------
371 // ------------------------------------------------------------------------
372 void MonCreateHypothesis::SetUniDera()
373 // ------------------------------------------------------------------------
379 // ------------------------------------------------------------------------
380 void MonCreateHypothesis::InitFields()
381 // ------------------------------------------------------------------------
383 CBFieldName->clear();
384 std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
385 // Mise en place de la liste dans le menu pour l'indicateur d'erreur
386 std:: list<QString>::const_iterator it;
387 for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
389 CBFieldName->insertItem(0,QString(*it));
393 // ---------------------------------------
394 void MonCreateHypothesis::SetFieldName()
395 // -------------------------------------------
397 MESSAGE("MonCreateHypothesis::SetFieldName");
398 _aFieldName=CBFieldName->currentText();
399 if (QString(_aFieldFile) == QString("") or QString(_aFieldName) == QString("") ) { return; }
401 int nbrow= TWCMP->rowCount() ;
402 for ( int row=0; row < nbrow ; row++)
404 TWCMP->removeRow(row);
406 TWCMP->setRowCount(0);
407 //TWCMP->resizeRowsToContents();
409 std::list<QString> maListe =HOMARD_QT_COMMUN::GetListeComposants(_aFieldFile, _aFieldName);
410 std::list<QString>::const_iterator it;
411 for ( it=maListe.begin() ; it != maListe.end(); it++)
414 TWCMP->setItem( 0, 0, new QTableWidgetItem( QString ("") ) );
415 TWCMP->item( 0, 0 )->setFlags( 0 );
416 TWCMP->item( 0, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
417 TWCMP->item( 0, 0 )->setCheckState( Qt::Checked );
418 TWCMP->setItem( 0, 1, new QTableWidgetItem(QString((*it)).trimmed()));
419 TWCMP->item( 0, 1 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
421 TWCMP->resizeColumnsToContents();
422 TWCMP->resizeRowsToContents();
423 TWCMP->clearSelection();
424 // Choix du texte des radio-boutons selon 1 ou plusieurs composantes
425 if ( TWCMP->rowCount() == 1 )
426 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_ABS"));
427 RBInf->setText(QObject::tr("HOM_HYPO_NORM_REL"));
430 { RBL2->setText(QObject::tr("HOM_HYPO_NORM_L2"));
431 RBInf->setText(QObject::tr("HOM_HYPO_NORM_INF"));
433 // Par defaut, on propose la valeur absolue / norme L2
436 // ------------------------------------------------------------------------
437 void MonCreateHypothesis::SetRPE()
438 // ------------------------------------------------------------------------
442 RBRPE->setChecked(true);
443 SpinBox_RPE->setEnabled(true);
444 SpinBox_RRel->setEnabled(false);
445 SpinBox_RAbs->setEnabled(false);
447 // ------------------------------------------------------------------------
448 void MonCreateHypothesis::SetRRel()
449 // ------------------------------------------------------------------------
453 RBRRel->setChecked(true);
454 SpinBox_RPE->setEnabled(false);
455 SpinBox_RRel->setEnabled(true);
456 SpinBox_RAbs->setEnabled(false);
458 // ------------------------------------------------------------------------
459 void MonCreateHypothesis::SetRAbs()
460 // ------------------------------------------------------------------------
464 RBRAbs->setChecked(true);
465 SpinBox_RPE->setEnabled(false);
466 SpinBox_RRel->setEnabled(false);
467 SpinBox_RAbs->setEnabled(true);
469 // ------------------------------------------------------------------------
470 void MonCreateHypothesis::SetRNo()
471 // ------------------------------------------------------------------------
475 RBRNo->setChecked(true);
476 SpinBox_RPE->setEnabled(false);
477 SpinBox_RRel->setEnabled(false);
478 SpinBox_RAbs->setEnabled(false);
480 // ------------------------------------------------------------------------
481 void MonCreateHypothesis::SetCPE()
482 // ------------------------------------------------------------------------
486 RBCPE->setChecked(true);
487 SpinBox_CPE->setEnabled(true);
488 SpinBox_CRel->setEnabled(false);
489 SpinBox_CAbs->setEnabled(false);
491 // ------------------------------------------------------------------------
492 void MonCreateHypothesis::SetCRel()
493 // ------------------------------------------------------------------------
497 RBCRel->setChecked(true);
498 SpinBox_CPE->setEnabled(false);
499 SpinBox_CRel->setEnabled(true);
500 SpinBox_CAbs->setEnabled(false);
502 // ------------------------------------------------------------------------
503 void MonCreateHypothesis::SetCAbs()
504 // ------------------------------------------------------------------------
508 RBCAbs->setChecked(true);
509 SpinBox_CPE->setEnabled(false);
510 SpinBox_CRel->setEnabled(false);
511 SpinBox_CAbs->setEnabled(true);
513 // ------------------------------------------------------------------------
514 void MonCreateHypothesis::SetCNo()
515 // ------------------------------------------------------------------------
519 RBCNo->setChecked(true);
520 SpinBox_CPE->setEnabled(false);
521 SpinBox_CRel->setEnabled(false);
522 SpinBox_CAbs->setEnabled(false);
524 // ------------------------------------------------------------------------
525 void MonCreateHypothesis::SetUCL2()
526 // ------------------------------------------------------------------------
529 RBL2->setChecked(true);
531 // ------------------------------------------------------------------------
532 void MonCreateHypothesis::SetUCInf()
533 // ------------------------------------------------------------------------
536 RBInf->setChecked(true);
538 // ------------------------------------------------------------------------
539 void MonCreateHypothesis::SetFiltrage()
540 // ------------------------------------------------------------------------
542 if (!CBGroupe->isChecked()) return;
543 MonCreateListGroup *aDlg = new MonCreateListGroup(this, NULL, TRUE, HOMARD::HOMARD_Gen::_duplicate(_myHomardGen),_aCaseName, _aListeGroupes) ;
547 // ------------------------------------------------------------------------
548 void MonCreateHypothesis::setGroups(QStringList listGroup)
549 // ------------------------------------------------------------------------
551 _aListeGroupes=listGroup;
553 // ------------------------------------------------------------------------
554 bool MonCreateHypothesis::VerifieZone()
555 // ------------------------------------------------------------------------
557 if ( _aTypeAdap != 0 ) return true;
558 _aListeZone = GetZonesChecked() ;
559 if (_aListeZone.count() == 0)
561 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
562 QObject::tr("HOM_HYPO_ZONE_2") );
567 // ------------------------------------------------------------------------
568 bool MonCreateHypothesis::VerifieComposant()
569 // ------------------------------------------------------------------------
571 if ( _aTypeAdap != 1 ) return true;
572 _aListeComposant = GetListCompChecked() ;
573 if (_aListeComposant.count() == 0)
575 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
576 QObject::tr("HOM_HYPO_COMP") );
582 // ------------------------------------------------------------------------
583 void MonCreateHypothesis::AssocieLesZones()
584 // ------------------------------------------------------------------------
586 if ( _aTypeAdap != 0 ) return;
587 _aListeZone = GetZonesChecked() ;
588 for ( int i=0 ; i< _aListeZone.count() ; i++ )
589 { _myHomardGen->AssociateHypoZone(_aListeZone[i].toStdString().c_str(),_aHypothesisName.toStdString().c_str()); }
591 // ------------------------------------------------------------------------
592 void MonCreateHypothesis::AssocieComposants()
593 // ------------------------------------------------------------------------
595 if ( _aTypeAdap != 1 ) return;
596 MESSAGE( "Dans AssocieComposants, _TypeThC : " << _TypeThC );
597 MESSAGE( "Dans AssocieComposants, _TypeThR : " << _TypeThR );
600 if ( _TypeThR == 1 ) { _ThreshR = SpinBox_RAbs->value();}
601 if ( _TypeThR == 2 ) { _ThreshR = SpinBox_RRel->value();}
602 if ( _TypeThR == 3 ) { _ThreshR = SpinBox_RPE->value(); }
605 if ( _TypeThC == 1 ) { _ThreshC = SpinBox_CAbs->value();}
606 if ( _TypeThC == 2 ) { _ThreshC = SpinBox_CRel->value();}
607 if ( _TypeThC == 3 ) { _ThreshC = SpinBox_CPE->value(); }
609 _aFieldName=CBFieldName->currentText();
610 _aHypothesis->SetField(CORBA::string_dup(_aFieldName.toStdString().c_str()) ) ;
611 _aHypothesis->SetRefinThr( _TypeThR, _ThreshR ) ;
612 _aHypothesis->SetUnRefThr( _TypeThC, _ThreshC ) ;
613 _aHypothesis->SetUseComp( _UsCmpI ) ;
614 _aListeComposant = GetListCompChecked() ;
615 for ( int i=0 ; i< _aListeComposant.count() ; i++ )
616 { _aHypothesis->AddComp(_aListeComposant[i].toStdString().c_str()); }
618 // ------------------------------------------------------------------------
619 void MonCreateHypothesis::AssocieLesGroupes()
620 // ------------------------------------------------------------------------
622 HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::ListGroupType;
623 aSeqGroupe->length(_aListeGroupes.size());
624 QStringList::const_iterator it;
626 for (it = _aListeGroupes.constBegin(); it != _aListeGroupes.constEnd(); it++)
627 aSeqGroupe[i++]=(*it).toStdString().c_str();
628 _aHypothesis->SetGroups(aSeqGroupe);
631 // ------------------------------------------------------------------------
632 void MonCreateHypothesis::SetFieldNo()
633 // ------------------------------------------------------------------------
634 // Par defaut, on n'interpole rien
636 if ( _aTypeAdap == 1 ) { GBFieldFile->setVisible(1); }
637 else { GBFieldFile->setVisible(0); }
638 TWField->setVisible(0);
641 _TypeFieldInterp = 0 ;
643 // ------------------------------------------------------------------------
644 void MonCreateHypothesis::SetFieldAll()
645 // ------------------------------------------------------------------------
646 // Par defaut, on interpole tout
648 if (_aFieldFile == QString(""))
650 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
651 QObject::tr("HOM_HYPO_FIELD_FILE") );
653 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
656 LEFieldFile->setText(_aFieldFile);
657 LEFieldFile->setReadOnly(1);
658 GBFieldFile->setVisible(1);
659 TWField->setVisible(0);
661 _TypeFieldInterp = 1 ;
664 // ------------------------------------------------------------------------
665 void MonCreateHypothesis::SetFieldChosen()
666 // ------------------------------------------------------------------------
668 if (_aFieldFile == QString(""))
670 QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
671 QObject::tr("HOM_HYPO_FIELD_FILE") );
673 if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
676 LEFieldFile->setText(_aFieldFile);
677 LEFieldFile->setReadOnly(1);
678 GBFieldFile->setVisible(1);
679 // Recuperation de la liste des champs contenus dans le fichier _aFieldFile
680 std::list<QString> listeChamp = HOMARD_QT_COMMUN::GetListeChamps(QString(_aFieldFile) );
682 // Initialisation de la table
684 int nbrow=TWField->rowCount();
685 for ( int row=0; row< nbrow; row++)
687 TWField->removeRow(row);
689 TWField->setRowCount(0);
690 std:: list<QString>::const_iterator it;
692 for ( it=listeChamp.begin() ; it != listeChamp.end(); it++)
694 TWField->insertRow(row);
695 TWField->setItem( row, 0, new QTableWidgetItem( QString ("") ) );
696 TWField->item( row, 0 )->setFlags( 0 );
697 TWField->item( row, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
698 TWField->item( row, 0 )->setCheckState( Qt::Unchecked );
699 TWField->setItem( row, 1, new QTableWidgetItem(QString(*it).trimmed()));
700 TWField->item( row, 1 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
703 TWField->resizeColumnsToContents();
704 TWField->resizeRowsToContents();
705 TWField->clearSelection();
706 TWField->setVisible(1);
708 _TypeFieldInterp = 2 ;