X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHOMARDGUI%2FMonCreateHypothesis.cxx;h=77441cf79e39c323ed0f78e740cae6bf4d2cfc98;hb=2c82da385bf3d7b6a045dfe7620d4b9bdc154fe6;hp=560a41bba4d3e2eaa5563ecd2639963431262548;hpb=76a5f649c23c08c9cbdc0bfaafa5cf6ef792713a;p=modules%2Fhomard.git diff --git a/src/HOMARDGUI/MonCreateHypothesis.cxx b/src/HOMARDGUI/MonCreateHypothesis.cxx index 560a41bb..77441cf7 100644 --- a/src/HOMARDGUI/MonCreateHypothesis.cxx +++ b/src/HOMARDGUI/MonCreateHypothesis.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2011-2013 CEA/DEN, EDF R&D +// Copyright (C) 2011-2016 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,8 +17,6 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -using namespace std; - #include "MonCreateHypothesis.h" #include "MonCreateListGroup.h" #include "MonCreateIteration.h" @@ -33,6 +31,8 @@ using namespace std; #include "HomardQtCommun.h" #include +using namespace std; + // ------------------------------------------------------------------------------- MonCreateHypothesis::MonCreateHypothesis(MonCreateIteration* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen0, @@ -41,7 +41,7 @@ MonCreateHypothesis::MonCreateHypothesis(MonCreateIteration* parent, bool modal, // --------------------------------------------------------------------------------- /* Constructs a MonCreateHypothesis */ : - QDialog(0), Ui_CreateHypothesis(), + QScrollArea(0), Ui_CreateHypothesis(), _parent(parent), _Name(Name), _aCaseName(caseName), _aFieldFile(aFieldFile), _aFieldName(""), @@ -52,13 +52,15 @@ MonCreateHypothesis::MonCreateHypothesis(MonCreateIteration* parent, bool modal, _NivMax(-1), _DiamMin(-1.), _AdapInit(0), - _LevelOutput(0) + _ExtraOutput(1) { MESSAGE("Constructeur") ; myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); setupUi(this); - setModal(modal); + if ( modal ) { setWindowModality(Qt::WindowModal); } + else { setWindowModality(Qt::NonModal); } + setWindowFlags( Qt::WindowStaysOnTopHint ) ; InitConnect(); SetNewName(); @@ -72,7 +74,13 @@ MonCreateHypothesis::MonCreateHypothesis(MonCreateIteration* parent, bool modal, } SetFieldNo(); GBAdvancedOptions->setVisible(0); - CBLevelOutput->setChecked(false); + CBOutputLevel->setChecked(false); + CBOutputQuality->setChecked(false); + CBOutputDiameter->setChecked(false); +// CBOutputParent->setChecked(false); + _ExtraOutput = 1 ; +// + adjustSize(); } // ------------------------------------------------------------------------ @@ -161,7 +169,13 @@ bool MonCreateHypothesis::PushOnApply() } // Mise en place des attributs - aHypothesis->SetAdapRefinUnRef(_aTypeAdap,_aTypeRaff,_aTypeDera); + if ( _aTypeAdap == -1 ) + { + int TypeRaffDera ; + if ( _aTypeRaff == 1 ) { TypeRaffDera = 1 ; } + else { TypeRaffDera = -1 ; } + aHypothesis->SetUnifRefinUnRef(TypeRaffDera); + } aHypothesis->SetTypeFieldInterp(_TypeFieldInterp); aHypothesis->SetCaseCreation(_aCaseName.toStdString().c_str()); @@ -174,16 +188,20 @@ bool MonCreateHypothesis::PushOnApply() if (CBAdvanced->isChecked()) { // Enregistrement du niveau maximal - _NivMax = spinBoxNivMax->value() ; + _NivMax = SpinBoxNivMax->value() ; aHypothesis->SetNivMax(_NivMax); // Enregistrement du diametre minimal _DiamMin = doubleSpinBoxDiamMin->value() ; aHypothesis->SetDiamMin(_DiamMin); // Enregistrement de l'intialisation de l'adaptation aHypothesis->SetAdapInit(_AdapInit); -// Sortie des niveaux de raffinement - if (CBLevelOutput->isChecked()) { _LevelOutput = 1 ; } - aHypothesis->SetLevelOutput(_LevelOutput); +// Sortie optionnelle des niveaux de raffinement, des diametres, des qualites + _ExtraOutput = 1 ; + if (CBOutputLevel->isChecked()) { _ExtraOutput = 2 ; } + if (CBOutputQuality->isChecked()) { _ExtraOutput = 3*_ExtraOutput ; } + if (CBOutputDiameter->isChecked()) { _ExtraOutput = 5*_ExtraOutput ; } +// if (CBOutputParent->isChecked()) { _ExtraOutput = 7*_ExtraOutput ; } + aHypothesis->SetExtraOutput(_ExtraOutput); } HOMARD_UTILS::updateObjBrowser() ; @@ -203,8 +221,8 @@ void MonCreateHypothesis::PushOnOK() void MonCreateHypothesis::PushOnHelp() // ------------------------------------------------------------------------ { - char* LanguageShort = myHomardGen->GetLanguageShort(); - HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"), QString(""), QString(LanguageShort)); + std::string LanguageShort = myHomardGen->GetLanguageShort(); + HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"), QString(""), QString(LanguageShort.c_str())); } // ------------------------------------------------- void MonCreateHypothesis::SetNewName() @@ -222,9 +240,9 @@ void MonCreateHypothesis::SetNewName() { if ( aName == QString(MyObjects[i])) { - num=num+1; - aName=""; - break; + num ++ ; + aName = "" ; + break ; } } } @@ -241,8 +259,10 @@ void MonCreateHypothesis::SetUniforme() else { GBFieldFile->setVisible(1); } GBAreaManagement->setVisible(0); GBUniform->setVisible(1); - adjustSize(); + _aTypeAdap = -1 ; +// + adjustSize(); } // ------------------------------------------------------------------------ void MonCreateHypothesis::SetChamp() @@ -268,9 +288,10 @@ void MonCreateHypothesis::SetChamp() GBAreaManagement->adjustSize(); GBFieldManagement->adjustSize(); GBFieldFile->adjustSize(); - adjustSize(); _aTypeAdap = 1 ; +// + adjustSize(); } // ------------------------------------------------------------------------ void MonCreateHypothesis::SetZone() @@ -282,10 +303,12 @@ void MonCreateHypothesis::SetZone() if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); } else { GBFieldFile->setVisible(1); } GBAreaManagement->setVisible(1); - adjustSize(); + _aTypeRaff = 1 ; _aTypeDera = 0 ; _aTypeAdap = 0 ; +// + adjustSize(); } // ------------------------------------------------------------------------ @@ -293,7 +316,7 @@ void MonCreateHypothesis::PushZoneNew() // ------------------------------------------------------------------------ { MESSAGE("Debut de MonCreateHypothesis::PushZoneNew") - MonCreateZone *aDlg = new MonCreateZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName) ; + MonCreateZone *aDlg = new MonCreateZone(this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName) ; aDlg->show(); } @@ -304,14 +327,14 @@ void MonCreateHypothesis::PushZoneEdit() MESSAGE("Debut de MonCreateHypothesis::PushZoneEdit") int colonne = TWZone->currentColumn(); QTableWidgetItem * monItem = TWZone->currentItem(); - if (colonne !=2 or monItem == NULL) + if (colonne !=2 || monItem == NULL) { QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), QObject::tr("HOM_HYPO_ZONE_1") ); return; } QString zoneName = monItem->text().trimmed(); - MonEditZone *aDlg = new MonEditZone(this, TRUE, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, zoneName) ; + MonEditZone *aDlg = new MonEditZone(this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, zoneName) ; aDlg->show(); } // ------------------------------------------------------------------------ @@ -400,7 +423,7 @@ QStringList MonCreateHypothesis::GetZonesChecked() int Pbm = 0 ; for ( int row=0; row< TWZone->rowCount(); row++) { - if ( ( TWZone->item( row, 0 )->checkState() == Qt::Checked ) and ( TWZone->item( row, 1 )->checkState() == Qt::Checked ) ) + if ( ( TWZone->item( row, 0 )->checkState() == Qt::Checked ) && ( TWZone->item( row, 1 )->checkState() == Qt::Checked ) ) { QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), QObject::tr("HOM_HYPO_ZONE_3") ); @@ -460,8 +483,12 @@ void MonCreateHypothesis::AssocieFieldInterp() { if ( _TypeFieldInterp != 2 ) return; for ( int row=0; row< TWField->rowCount(); row++) - if ( TWField->item( row, 0 )->checkState() == Qt::Checked ) - { aHypothesis->AddFieldInterp(TWField->item(row, 1)->text().toStdString().c_str()); } + { + if ( TWField->item( row, 0 )->checkState() == Qt::Checked ) + { + aHypothesis->AddFieldInterp(TWField->item(row, 1)->text().toStdString().c_str()); + } + } } // ------------------------------------------------------------------------ void MonCreateHypothesis::SetUniRaff() @@ -498,7 +525,7 @@ void MonCreateHypothesis::SetFieldName() { MESSAGE("Debut de SetFieldName"); _aFieldName=CBFieldName->currentText(); - if (QString(_aFieldFile) == QString("") or QString(_aFieldName) == QString("") ) { return; } + if (QString(_aFieldFile) == QString("") || QString(_aFieldName) == QString("") ) { return; } int nbrow= TWCMP->rowCount() ; for ( int row=0; row < nbrow ; row++) @@ -666,7 +693,8 @@ void MonCreateHypothesis::SetUCL2() void MonCreateHypothesis::SetUCInf() // ------------------------------------------------------------------------ { - _UsCmpI = 1 ; + if ( TWCMP->rowCount() == 1 ) { _UsCmpI = 2 ; } + else { _UsCmpI = 1 ; } RBInf->setChecked(true); } // ------------------------------------------------------------------------ @@ -681,7 +709,7 @@ void MonCreateHypothesis::SetFiltrage() // ------------------------------------------------------------------------ { if (!CBGroupe->isChecked()) return; - MonCreateListGroup *aDlg = new MonCreateListGroup(this, NULL, TRUE, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),_aCaseName, _aListeGroupes) ; + MonCreateListGroup *aDlg = new MonCreateListGroup(this, NULL, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),_aCaseName, _aListeGroupes) ; aDlg->show(); } @@ -763,8 +791,8 @@ void MonCreateHypothesis::AssocieComposants() _aFieldName=CBFieldName->currentText(); aHypothesis->SetField(CORBA::string_dup(_aFieldName.toStdString().c_str()) ) ; - aHypothesis->SetRefinThr( _TypeThR, _ThreshR ) ; - aHypothesis->SetUnRefThr( _TypeThC, _ThreshC ) ; + if ( _TypeThR > 0 ) { aHypothesis->SetRefinThr( _TypeThR, _ThreshR ) ; } + if ( _TypeThC > 0 ) { aHypothesis->SetUnRefThr( _TypeThC, _ThreshC ) ; } aHypothesis->SetUseField( _UsField ) ; aHypothesis->SetUseComp( _UsCmpI ) ; _aListeComposant = GetListCompChecked() ; @@ -793,8 +821,9 @@ void MonCreateHypothesis::SetFieldNo() else { GBFieldFile->setVisible(0); } TWField->setVisible(0); // - adjustSize(); _TypeFieldInterp = 0 ; +// + adjustSize(); } // ------------------------------------------------------------------------ void MonCreateHypothesis::SetFieldAll() @@ -815,7 +844,8 @@ void MonCreateHypothesis::SetFieldAll() TWField->setVisible(0); // _TypeFieldInterp = 1 ; - adjustSize(); +// + adjustSize(); } // ------------------------------------------------------------------------ void MonCreateHypothesis::SetFieldChosen() @@ -862,7 +892,8 @@ void MonCreateHypothesis::SetFieldChosen() TWField->setVisible(1); _TypeFieldInterp = 2 ; - adjustSize(); +// + adjustSize(); } // ------------------------------------------------------------------------ void MonCreateHypothesis::SetAdvanced() @@ -871,21 +902,21 @@ void MonCreateHypothesis::SetAdvanced() MESSAGE("Debut de SetAdvanced "); if (CBAdvanced->isChecked()) { GBAdvancedOptions->setVisible(1); - if (_aFieldFile != QString("")) - { GBAdapInit->setVisible(1) ; - } - else - { GBAdapInit->setVisible(0) ; - } + if (_aFieldFile != QString("")) { GBAdapInit->setVisible(1) ; } + else { GBAdapInit->setVisible(0) ; } } else { GBAdvancedOptions->setVisible(0); _NivMax = -1 ; _DiamMin = -1. ; _AdapInit = 0 ; - CBLevelOutput->setChecked(false); - _LevelOutput = 0 ; + CBOutputLevel->setChecked(false); + CBOutputQuality->setChecked(false); + CBOutputDiameter->setChecked(false); +// CBOutputParent->setChecked(false); + _ExtraOutput = 1 ; } +// adjustSize(); } // ------------------------------------------------------------------------