-// Copyright (C) 2011-2012 CEA/DEN, EDF R&D
+// Copyright (C) 2011-2020 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
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-using namespace std;
-
#include "MonEditHypothesis.h"
#include "MonEditListGroup.h"
#include "SalomeApp_Tools.h"
#include "HOMARDGUI_Utils.h"
#include "HomardQtCommun.h"
+#include "HOMARD.hxx"
#include <utilities.h>
+
+using namespace std;
+
// ----------------------------------------------------------------------------
MonEditHypothesis::MonEditHypothesis( MonCreateIteration* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen,
- QString aHypothesisName,
+ QString Name,
QString caseName, QString aFieldFile ):
// ----------------------------------------------------------------------------
/* Constructs a MonEditHypothesis
herite de MonCreateHypothesis
*/
- MonCreateHypothesis(parent, modal,myHomardGen, aHypothesisName, caseName, aFieldFile)
+ MonCreateHypothesis(parent, modal,myHomardGen, Name, caseName, aFieldFile)
{
- MESSAGE("Hypothese " << aHypothesisName.toStdString().c_str());
+ MESSAGE("Hypothese " << Name.toStdString().c_str());
setWindowTitle(QObject::tr("HOM_HYPO_EDIT_WINDOW_TITLE"));
- _aHypothesis = _myHomardGen->GetHypothesis(_aHypothesisName.toStdString().c_str());
- if (caseName == QString("") ){ _aCaseName = _aHypothesis->GetCaseCreation();}
+ aHypothesis = myHomardGen->GetHypothesis(_Name.toStdString().c_str());
+ if (caseName == QString("") ){ _aCaseName = aHypothesis->GetCaseCreation();}
InitValEdit();
InitGroupes();
}
void MonEditHypothesis::InitGroupes()
// ------------------------------
{
- HOMARD::ListGroupType_var maListe = _aHypothesis->GetGroups();
+ HOMARD::ListGroupType_var maListe = aHypothesis->GetGroups();
for ( int i = 0; i < maListe->length(); i++ )
_aListeGroupes << QString(maListe[i]);
// ------------------------------
{
MESSAGE("Debut de InitValEdit");
- LEHypothesisName->setText(_aHypothesisName);
- LEHypothesisName->setReadOnly(true);
- HOMARD::listeTypes_var ListTypes (_aHypothesis->GetAdapRefinUnRef());
+ LEName->setText(_Name);
+ LEName->setReadOnly(true);
+ HOMARD::listeTypes_var ListTypes (aHypothesis->GetAdapRefinUnRef());
ASSERT( ListTypes->length()==3) ;
_aTypeAdap = ListTypes[0];
_aTypeRaff = ListTypes[1];
InitFieldInterp();
- if (_aTypeAdap == 1 or _TypeFieldInterp >= 1 )
+ if (_aTypeAdap == 1 || _TypeFieldInterp >= 1 )
{
if (_aFieldFile == QString("")) { GBFieldFile->setVisible(0); }
else
}
// Les options avancees (non modifiables)
CBAdvanced->setVisible(0) ;
- int NivMax = _aHypothesis->GetNivMax();
- double DiamMin = _aHypothesis->GetDiamMin();
- int AdapInit = _aHypothesis->GetAdapInit();
- int LevelOutput = _aHypothesis->GetLevelOutput();
- if ( NivMax > 0 or DiamMin > 0 or AdapInit != 0 or LevelOutput != 0 )
+ int NivMax = aHypothesis->GetNivMax();
+ double DiamMin = aHypothesis->GetDiamMin();
+ int AdapInit = aHypothesis->GetAdapInit();
+ int ExtraOutput = aHypothesis->GetExtraOutput();
+ if ( NivMax > 0 || DiamMin > 0 || AdapInit != 0 || ExtraOutput != 1 )
{ GBAdvancedOptions->setVisible(1);
if ( NivMax > 0 )
- { spinBoxNivMax->setValue(NivMax);
- spinBoxNivMax->setDisabled(true); }
+ { SpinBoxNivMax->setValue(NivMax);
+ SpinBoxNivMax->setDisabled(true); }
else
{ TLMaximalLevel->setVisible(0);
- spinBoxNivMax->setVisible(0); }
+ SpinBoxNivMax->setVisible(0); }
if ( DiamMin > 0 )
{ doubleSpinBoxDiamMin->setValue(DiamMin);
doubleSpinBoxDiamMin->setDisabled(true); }
else
{ GBAdapInit->setVisible(0) ;
}
- if ( LevelOutput != 0 )
+ if ( ExtraOutput % 2 == 0 )
{
- CBLevelOutput->setChecked(true);
- CBLevelOutput->setEnabled(false);
+ CBOutputLevel->setChecked(true);
+ CBOutputLevel->setEnabled(false);
}
- else
- { CBLevelOutput->setVisible(0) ;
+ else { CBOutputLevel->setVisible(0) ; }
+ if ( ExtraOutput % 3 == 0 )
+ {
+ CBOutputQuality->setChecked(true);
+ CBOutputQuality->setEnabled(false);
+ }
+ else { CBOutputQuality->setVisible(0) ; }
+ if ( ExtraOutput % 5 == 0 )
+ {
+ CBOutputDiameter->setChecked(true);
+ CBOutputDiameter->setEnabled(false);
+ }
+ else { CBOutputDiameter->setVisible(0) ; }
+ if ( ExtraOutput % 7 == 0 )
+ {
+ CBOutputParent->setChecked(true);
+ CBOutputParent->setEnabled(false);
+ }
+ else { CBOutputParent->setVisible(0) ; }
+ if ( ExtraOutput % 11 == 0 )
+ {
+ CBOutputVoisins->setChecked(true);
+ CBOutputVoisins->setEnabled(false);
}
+ else { CBOutputVoisins->setVisible(0) ; }
}
else
{ GBAdvancedOptions->setVisible(0); }
//
- adjustSize();
}
// ----------------------------------------
void MonEditHypothesis::InitAdaptUniforme()
// Affichage des informations pour une adaptation uniforme
{
// Choix des options generales
- GBFieldManagement->setVisible(0);
- GBAreaManagement->setVisible(0);
- GBUniform->setVisible(1);
- adjustSize();
- RBUniforme->setChecked(true);
- RBUniforme->setEnabled(false);
- RBChamp->setEnabled(false);
- RBZone->setEnabled(false);
+ GBFieldManagement->setVisible(0);
+ GBAreaManagement->setVisible(0);
+ GBUniform->setVisible(1);
+ RBUniforme->setChecked(true);
+ RBUniforme->setEnabled(false);
+ RBChamp->setEnabled(false);
+ RBZone->setEnabled(false);
//
// Raffinement ou deraffinement ?
- if (_aTypeDera == 0)
- {
- ASSERT(_aTypeRaff==1);
- RBUniDera->setChecked(false);
- RBUniRaff->setChecked(true);
- }
- if (_aTypeDera == 1)
- {
- ASSERT(_aTypeRaff==0);
- RBUniDera->setChecked(true);
- RBUniRaff->setChecked(false);
- }
+ if (_aTypeDera == 0)
+ {
+ VERIFICATION(_aTypeRaff==1);
+ RBUniDera->setChecked(false);
+ RBUniRaff->setChecked(true);
+ }
+ if (_aTypeDera == 1)
+ {
+ VERIFICATION(_aTypeRaff==0);
+ RBUniDera->setChecked(true);
+ RBUniRaff->setChecked(false);
+ }
+//
+ adjustSize();
//
}
// -------------------------------------
// -------------------------------------
// Affichage des informations pour une adaptation selon des zones :
{
- MESSAGE ("Debut de InitAdaptZone");
+ MESSAGE ("Debut de InitAdaptZone");
// Choix des options generales
- GBUniform->setVisible(0);
- GBFieldManagement->setVisible(0);
- GBAreaManagement->setVisible(1);
- adjustSize();
- RBZone->setChecked(true);
- RBChamp->setEnabled(false);
- RBUniforme->setEnabled(false);
- RBZone->setEnabled(false);
+ GBUniform->setVisible(0);
+ GBFieldManagement->setVisible(0);
+ GBAreaManagement->setVisible(1);
+ RBZone->setChecked(true);
+ RBChamp->setEnabled(false);
+ RBUniforme->setEnabled(false);
+ RBZone->setEnabled(false);
// Recuperation de toutes les zones decrites et notation de celles retenues
- GetAllZones();
- HOMARD::listeZonesHypo_var mesZonesAvant = _aHypothesis->GetZones();
- for (int i=0; i<mesZonesAvant->length(); i++)
- {
+ GetAllZones();
+ HOMARD::listeZonesHypo_var mesZonesAvant = aHypothesis->GetZones();
+ for (int i=0; i<mesZonesAvant->length(); i++)
+ {
MESSAGE ("i"<<i<<", zone :"<<string(mesZonesAvant[i])<<", type :"<<string(mesZonesAvant[i+1]));
- for ( int j =0 ; j < TWZone->rowCount(); j++)
+ for ( int j =0 ; j < TWZone->rowCount(); j++)
+ {
+ MESSAGE (". j"<<j<<", zone :"<<TWZone->item(j,2)->text().toStdString());
+ if ( TWZone->item(j,2)->text().toStdString() == string(mesZonesAvant[i]) )
{
- MESSAGE (". j"<<j<<", zone :"<<TWZone->item(j,2)->text().toStdString());
- if ( TWZone->item(j,2)->text().toStdString() == string(mesZonesAvant[i]) )
+ MESSAGE ("OK avec "<<string(mesZonesAvant[i]));
+ if ( string(mesZonesAvant[i+1]) == "1" )
+ {
+ MESSAGE ("... RAFF");
+ TWZone->item( j,0 )->setCheckState( Qt::Checked );
+ TWZone->item( j,1 )->setCheckState( Qt::Unchecked ); }
+ else
{
- MESSAGE ("OK avec "<<string(mesZonesAvant[i]));
- if ( string(mesZonesAvant[i+1]) == "1" )
- {
- MESSAGE ("... RAFF");
- TWZone->item( j,0 )->setCheckState( Qt::Checked );
- TWZone->item( j,1 )->setCheckState( Qt::Unchecked ); }
- else
- {
- MESSAGE ("... DERA");
- TWZone->item( j,0 )->setCheckState( Qt::Unchecked );
- TWZone->item( j,1 )->setCheckState( Qt::Checked ); }
- break;
- }
+ MESSAGE ("... DERA");
+ TWZone->item( j,0 )->setCheckState( Qt::Unchecked );
+ TWZone->item( j,1 )->setCheckState( Qt::Checked ); }
+ break;
}
- i += 1 ;
}
+ i += 1 ;
+ }
//
// Inactivation des choix
- for ( int j =0 ; j < TWZone->rowCount(); j++)
- {
- TWZone->item( j, 0 )->setFlags(0);
- TWZone->item( j, 1 )->setFlags(0);
- }
- PBZoneNew->setVisible(0);
+ for ( int j =0 ; j < TWZone->rowCount(); j++)
+ {
+ TWZone->item( j, 0 )->setFlags(0);
+ TWZone->item( j, 1 )->setFlags(0);
+ }
+ PBZoneNew->setVisible(0);
+//
+ adjustSize();
//
}
// -------------------------------------
GBUniform->setVisible(0);
GBAreaManagement->setVisible(0);
GBFieldManagement->setVisible(1);
- adjustSize();
RBChamp->setChecked(true);
RBUniforme->setEnabled(false);
RBChamp->setEnabled(false);
RBZone->setEnabled(false);
-
-
- HOMARD::InfosHypo_var aInfosHypo = _aHypothesis->GetField();
+ HOMARD::InfosHypo_var aInfosHypo = aHypothesis->GetField();
_aFieldName = aInfosHypo->FieldName;
_TypeThR = aInfosHypo->TypeThR;
_ThreshR = aInfosHypo->ThreshR;
_UsField = aInfosHypo->UsField;
_UsCmpI = aInfosHypo->UsCmpI;
-
CBFieldName->insertItem(0,_aFieldName);
CBFieldName->setCurrentIndex(0);
CBFieldName->setEnabled(false);
//SetFieldName(Qt::Unchecked);
- HOMARD::listeComposantsHypo_var mesComposantsAvant = _aHypothesis->GetListComp();
+ HOMARD::listeComposantsHypo_var mesComposantsAvant = aHypothesis->GetComps();
TWCMP->clear();
TWCMP->setRowCount(0);
TWCMP->resizeRowsToContents();
RBInf->setChecked(true);
RBInf->setEnabled(true);
}
+//
+ adjustSize();
}
// -------------------------------------
void MonEditHypothesis::InitFieldInterp()
{
MESSAGE ("Debut de InitFieldInterp");
// Choix des options generales
- _TypeFieldInterp = _aHypothesis->GetTypeFieldInterp();
+ _TypeFieldInterp = aHypothesis->GetTypeFieldInterp();
MESSAGE ("_TypeFieldInterp = " << _TypeFieldInterp);
//
// Aucune interpolation
RBFieldChosen->setChecked(true);
//
TWField->setVisible(1);
- HOMARD::listFieldInterpHypo_var mesChampsAvant = _aHypothesis->GetListFieldInterp();
+ HOMARD::listeFieldInterpsHypo_var mesChampsAvant = aHypothesis->GetFieldInterps();
TWField->clear();
TWField->setRowCount(0);
TWField->resizeRowsToContents();
- for (int i=0; i<mesChampsAvant->length(); i++)
+ for (int iaux=0; iaux<mesChampsAvant->length(); iaux++)
{
TWField->insertRow(0);
TWField->setItem( 0, 0, new QTableWidgetItem( QString ("") ) );
TWField->item( 0, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled);
TWField->item( 0, 0 )->setCheckState(Qt::Checked );
TWField->item( 0, 0 )->setFlags( 0 );
- TWField->setItem( 0, 1, new QTableWidgetItem(QString(mesChampsAvant[i]).trimmed()));
+ TWField->setItem( 0, 1, new QTableWidgetItem(QString(mesChampsAvant[iaux]).trimmed()));
TWField->item( 0, 1 )->setFlags( Qt::ItemIsEnabled |Qt::ItemIsSelectable );
+ iaux++;
}
TWField->resizeColumnsToContents();
TWField->resizeRowsToContents();
if (_TypeThR == 2) { _ThreshR = SpinBox_RRel->value(); }
if (_TypeThR == 3) { _ThreshR = SpinBox_RPE->value(); }
if (_TypeThR == 4) { _ThreshR = SpinBox_RMuSigma->value(); }
- _aHypothesis->SetRefinThr(_TypeThR, _ThreshR) ;
+ aHypothesis->SetRefinThr(_TypeThR, _ThreshR) ;
}
if (_aTypeDera!= 0 )
{
if (_TypeThC == 2) { _ThreshC = SpinBox_CRel->value() ; }
if (_TypeThC == 3) { _ThreshC = SpinBox_CPE->value() ; }
if (_TypeThC == 4) { _ThreshC = SpinBox_CMuSigma->value() ; }
- _aHypothesis->SetUnRefThr(_TypeThC, _ThreshC) ;
+ aHypothesis->SetUnRefThr(_TypeThC, _ThreshC) ;
}
- _myHomardGen->InvalideHypo(_aHypothesisName.toStdString().c_str());
+ myHomardGen->InvalideHypo(_Name.toStdString().c_str());
HOMARD_UTILS::updateObjBrowser();
}
return true;
{
if (CBGroupe->isChecked())
{
- MonEditListGroup *aDlg = new MonEditListGroup(this, NULL, TRUE, HOMARD::HOMARD_Gen::_duplicate(_myHomardGen),_aCaseName, _aListeGroupes) ;
+ MonEditListGroup *aDlg = new MonEditListGroup(this, NULL, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),_aCaseName, _aListeGroupes) ;
aDlg->show();
}
}