Class for creation of standard hypotheses. More...
#include <StdMeshersGUI_StdHypothesisCreator.h>

Signals | |
| void | finished (int) |
Public Member Functions | |
| StdMeshersGUI_StdHypothesisCreator (const QString &) | |
| Constructor. | |
| virtual | ~StdMeshersGUI_StdHypothesisCreator () |
| Destructor. | |
| virtual bool | checkParams (QString &) const |
| Check parameter values before accept() | |
| void | create (SMESH::SMESH_Hypothesis_ptr, const QString &, QWidget *, QObject *, const QString &) |
| void | create (bool, const QString &, QWidget *, QObject *, const QString &) |
| void | edit (SMESH::SMESH_Hypothesis_ptr, const QString &, QWidget *, QObject *, const QString &) |
| void | setInitParamsHypothesis (SMESH::SMESH_Hypothesis_ptr) |
| virtual QString | helpPage () const |
| QString | hypType () const |
| QString | hypName () const |
| bool | isCreation () const |
| QString | getShapeEntry () const |
| void | setShapeEntry (const QString &theEntry) |
| QString | getMainShapeEntry () const |
| void | setMainShapeEntry (const QString &theEntry) |
Protected Types | |
| typedef QList< StdParam > | ListOfStdParams |
| typedef QList< QWidget * > | ListOfWidgets |
Protected Slots | |
| virtual void | onValueChanged () |
Protected Member Functions | |
| virtual QFrame * | buildFrame () |
| Builds dlg layout. | |
| virtual void | retrieveParams () const |
| Initialise parameter values in controls. | |
| virtual QString | storeParams () const |
| Store params from GUI controls to a hypothesis. | |
| virtual bool | stdParams (ListOfStdParams &) const |
| Return parameter values as SMESHGUI_GenericHypothesisCreator.StdParam. | |
| virtual void | attuneStdWidget (QWidget *, const int) const |
| tune "standard" control | |
| virtual QString | caption () const |
| Return dlg title. | |
| virtual QPixmap | icon () const |
| return pixmap for dlg icon | |
| virtual QString | type () const |
| Return hypothesis type name to show in dlg. | |
| virtual QWidget * | getCustomWidget (const StdParam &, QWidget *, const int) const |
| virtual bool | getParamFromCustomWidget (StdParam &, QWidget *) const |
| Set param value taken from a custom widget. | |
| virtual QString | hypTypeName (const QString &) const |
| String to insert in "SMESH_%1_HYPOTHESIS" to get hypothesis type name from message resouce file. | |
| virtual QWidget * | getWidgetForParam (int paramIndex) const |
| Return widget for i-th hypothesis parameter (got from myParamWidgets) | |
| virtual ListOfWidgets * | customWidgets () const |
| Allow modifing myCustomWidgets in const methods. | |
| virtual void | onReject () |
| called when operation cancelled | |
| virtual bool | initVariableName (SMESH::ListOfParameters_var theParameters, StdParam &theParams, int order) const |
| virtual void | valueChanged (QWidget *) |
| Update widgets dependent on paramWidget. | |
| template<class T > | |
| T * | widget (int i) const |
| SMESH::SMESH_Hypothesis_var | hypothesis () const |
| SMESH::SMESH_Hypothesis_var | initParamsHypothesis (const bool strict=false) const |
| Return hypothesis containing initial parameters. | |
| bool | hasInitParamsHypothesis () const |
| const ListOfWidgets & | widgets () const |
| ListOfWidgets & | changeWidgets () |
| QtxDialog * | dlg () const |
| QFrame * | buildStdFrame () |
| bool | getStdParamFromDlg (ListOfStdParams &) const |
| virtual QStringList | getVariablesFromDlg () const |
Static Protected Member Functions | |
| static QString | stdParamValues (const ListOfStdParams &) |
Protected Attributes | |
| ListOfWidgets | myCustomWidgets |
Class for creation of standard hypotheses.
Definition at line 37 of file StdMeshersGUI_StdHypothesisCreator.h.
typedef QList<StdParam> SMESHGUI_GenericHypothesisCreator.ListOfStdParams [protected, inherited] |
Definition at line 89 of file SMESHGUI_Hypotheses.h.
typedef QList<QWidget*> SMESHGUI_GenericHypothesisCreator.ListOfWidgets [protected, inherited] |
Definition at line 90 of file SMESHGUI_Hypotheses.h.
| StdMeshersGUI_StdHypothesisCreator::StdMeshersGUI_StdHypothesisCreator | ( | const QString & | type | ) |
Constructor.
| type | - hypothesis type |
Definition at line 73 of file StdMeshersGUI_StdHypothesisCreator.cxx.
: SMESHGUI_GenericHypothesisCreator( type ) { }
| StdMeshersGUI_StdHypothesisCreator::~StdMeshersGUI_StdHypothesisCreator | ( | ) | [virtual] |
| void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget | ( | QWidget * | w, |
| const int | |||
| ) | const [protected, virtual] |
tune "standard" control
| w | - control widget |
| int | - parameter index |
Reimplemented from SMESHGUI_GenericHypothesisCreator.
Definition at line 1214 of file StdMeshersGUI_StdHypothesisCreator.cxx.
References SMESHGUI_GenericHypothesisCreator.hypType(), SMESHGUI_SpinBox.RangeStepAndValidator(), VALUE_MAX, VALUE_MAX_2, VALUE_MAX_3, VALUE_SMALL, VALUE_SMALL_2, and VALUE_SMALL_3.
{
SMESHGUI_SpinBox* sb = w->inherits( "SMESHGUI_SpinBox" ) ? ( SMESHGUI_SpinBox* )w : 0;
if ( sb )
{
if( hypType()=="LocalLength" )
{
if (sb->objectName() == tr("SMESH_LOCAL_LENGTH_PARAM"))
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
else if (sb->objectName() == tr("SMESH_LOCAL_LENGTH_PRECISION"))
sb->RangeStepAndValidator( 0.0, 1.0, 0.05, "len_tol_precision" );
}
else if( hypType()=="Arithmetic1D" )
{
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "parametric_precision" );
}
else if( hypType()=="MaxLength" )
{
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
sb->setEnabled( !widget< QCheckBox >( 1 )->isChecked() );
}
else if( hypType()=="MaxElementArea" )
{
sb->RangeStepAndValidator( VALUE_SMALL_2, VALUE_MAX_2, 1.0, "area_precision" );
}
else if( hypType()=="MaxElementVolume" )
{
sb->RangeStepAndValidator( VALUE_SMALL_3, VALUE_MAX_3, 1.0, "vol_precision" );
}
else if( hypType()=="StartEndLength" )
{
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
}
else if( hypType()=="Deflection1D" )
{
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "parametric_precision" );
}
else if( hypType()=="ViscousLayers" )
{
if (sb->objectName() == tr("SMESH_STRETCH_FACTOR"))
sb->RangeStepAndValidator( 1.0, VALUE_MAX, 0.1, "parametric_precision" );
else
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
}
else // default validator for possible ancestors
{
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
}
}
// else if ( QtxIntSpinBox* ib = w->inherits( "QtxIntSpinBox" ) ? ( QtxIntSpinBox* )w : 0)
// {
// if( hypType()=="ViscousLayers" )
// {
// }
// }
}
| QFrame * StdMeshersGUI_StdHypothesisCreator::buildFrame | ( | ) | [protected, virtual] |
Builds dlg layout.
| QFrame* | - the built widget |
Implements SMESHGUI_GenericHypothesisCreator.
Reimplemented in StdMeshersGUI_NbSegmentsCreator.
Definition at line 140 of file StdMeshersGUI_StdHypothesisCreator.cxx.
References SMESHGUI_GenericHypothesisCreator.buildStdFrame().
{
return buildStdFrame();
}
| QFrame * SMESHGUI_GenericHypothesisCreator::buildStdFrame | ( | ) | [protected, inherited] |
Definition at line 157 of file SMESHGUI_Hypotheses.cxx.
References _PTR(), SMESHGUI_GenericHypothesisCreator.attuneStdWidget(), SMESHGUI_GenericHypothesisCreator.changeWidgets(), SMESHGUI_GenericHypothesisCreator.getCustomWidget(), SMESHGUI_GenericHypothesisCreator.hypothesis(), MARGIN, SMESHGUI_GenericHypothesisCreator.onValueChanged(), SPACING, SMESHGUI_GenericHypothesisCreator.stdParams(), and SMESHGUI_GenericHypothesisCreator.valueChanged().
Referenced by buildFrame().
{
if( CORBA::is_nil( hypothesis() ) )
return 0;
ListOfStdParams params;
if( !stdParams( params ) || params.isEmpty() )
return 0;
QFrame* fr = new QFrame( 0 );
QVBoxLayout* lay = new QVBoxLayout( fr );
lay->setMargin( 5 );
lay->setSpacing( 0 );
QGroupBox* GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), fr );
lay->addWidget( GroupC1 );
QGridLayout* GroupC1Layout = new QGridLayout( GroupC1 );
GroupC1Layout->setSpacing( SPACING );
GroupC1Layout->setMargin( MARGIN );
ListOfStdParams::const_iterator anIt = params.begin(), aLast = params.end();
for( int i=0; anIt!=aLast; anIt++, i++ )
{
QLabel* lab = new QLabel( (*anIt).myName, GroupC1 );
GroupC1Layout->addWidget( lab, i, 0 );
QWidget* w = getCustomWidget( *anIt, GroupC1, i );
if ( !w )
switch( (*anIt).myValue.type() )
{
case QVariant::Int:
{
SalomeApp_IntSpinBox* sb = new SalomeApp_IntSpinBox( GroupC1 );
sb->setObjectName( (*anIt).myName );
attuneStdWidget( sb, i );
sb->setValue( (*anIt).myValue.toInt() );
connect( sb, SIGNAL( valueChanged( int ) ), this, SLOT( onValueChanged() ) );
w = sb;
}
break;
case QVariant::Double:
{
SalomeApp_DoubleSpinBox* sb = new SMESHGUI_SpinBox( GroupC1 );
sb->setObjectName( (*anIt).myName );
attuneStdWidget( sb, i );
sb->setValue( (*anIt).myValue.toDouble() );
connect( sb, SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged() ) );
w = sb;
}
break;
case QVariant::String:
{
if((*anIt).isVariable) {
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
QString aVar = (*anIt).myValue.toString();
if(aStudy->IsInteger(aVar.toLatin1().constData())){
SalomeApp_IntSpinBox* sb = new SalomeApp_IntSpinBox( GroupC1 );
sb->setObjectName( (*anIt).myName );
attuneStdWidget( sb, i );
sb->setText( aVar );
connect( sb, SIGNAL( valueChanged( int ) ), this, SLOT( onValueChanged() ) );
w = sb;
}
else if(aStudy->IsReal(aVar.toLatin1().constData())){
SalomeApp_DoubleSpinBox* sb = new SMESHGUI_SpinBox( GroupC1 );
sb->setObjectName( (*anIt).myName );
attuneStdWidget( sb, i );
sb->setText( aVar );
connect( sb, SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged() ) );
w = sb;
}
}
else {
QLineEdit* le = new QLineEdit( GroupC1 );
le->setObjectName( (*anIt).myName );
attuneStdWidget( le, i );
le->setText( (*anIt).myValue.toString() );
connect( le, SIGNAL( textChanged( const QString& ) ), this, SLOT( onValueChanged() ) );
w = le;
}
}
break;
}
if( w )
{
GroupC1Layout->addWidget( w, i, 1 );
changeWidgets().append( w );
}
}
return fr;
}
| QString StdMeshersGUI_StdHypothesisCreator::caption | ( | ) | const [protected, virtual] |
Return dlg title.
| QString | - title string |
Reimplemented from SMESHGUI_GenericHypothesisCreator.
Definition at line 1278 of file StdMeshersGUI_StdHypothesisCreator.cxx.
References SMESHGUI_GenericHypothesisCreator.hypType(), and hypTypeName().
{
return tr( QString( "SMESH_%1_TITLE" ).arg( hypTypeName( hypType() ) ).toLatin1().data() );
}
| SMESHGUI_GenericHypothesisCreator::ListOfWidgets & SMESHGUI_GenericHypothesisCreator::changeWidgets | ( | ) | [protected, inherited] |
Definition at line 449 of file SMESHGUI_Hypotheses.cxx.
References SMESHGUI_GenericHypothesisCreator.myParamWidgets.
Referenced by SMESHGUI_GenericHypothesisCreator.buildStdFrame(), and SMESHGUI_GenericHypothesisCreator.onDialogFinished().
{
return myParamWidgets;
}
| bool StdMeshersGUI_StdHypothesisCreator::checkParams | ( | QString & | msg | ) | const [virtual] |
Check parameter values before accept()
| bool | - true if OK |
Reimplemented from SMESHGUI_GenericHypothesisCreator.
Reimplemented in StdMeshersGUI_NbSegmentsCreator.
Definition at line 380 of file StdMeshersGUI_StdHypothesisCreator.cxx.
References SMESHGUI_GenericHypothesisCreator.checkParams(), customWidgets(), StdMeshersGUI_ObjectReferenceParamWdg.GetValue(), SMESHGUI_GenericHypothesisCreator.hypType(), StdMeshersGUI_ObjectReferenceParamWdg.IsObjectSelected(), StdMeshersGUI_LayerDistributionParamWdg.IsOk(), and StdMeshersGUI_ObjectReferenceParamWdg.SetObject().
{
if( !SMESHGUI_GenericHypothesisCreator::checkParams( msg ) )
return false;
// check if object reference parameter is set, as it has no default value
bool ok = true;
if ( hypType().startsWith("ProjectionSource" ))
{
StdMeshersGUI_ObjectReferenceParamWdg* w =
widget< StdMeshersGUI_ObjectReferenceParamWdg >( 0 );
ok = ( w->IsObjectSelected() );
if ( !ok ) w->SetObject( CORBA::Object::_nil() );
int nbAssocVert = ( hypType() == "ProjectionSource1D" ? 1 : 2 );
for ( int i = 0; ok && i < nbAssocVert; i += 2)
{
QString srcV, tgtV;
StdMeshersGUI_ObjectReferenceParamWdg* w1 =
widget< StdMeshersGUI_ObjectReferenceParamWdg >( i+2 );
StdMeshersGUI_ObjectReferenceParamWdg* w2 =
widget< StdMeshersGUI_ObjectReferenceParamWdg >( i+3 );
srcV = w1->GetValue();
tgtV = w2->GetValue();
ok = (( srcV.isEmpty() && tgtV.isEmpty() ) ||
( !srcV.isEmpty() && !tgtV.isEmpty() && srcV != tgtV ));
if ( !ok ) {
w1->SetObject( CORBA::Object::_nil() );
w2->SetObject( CORBA::Object::_nil() );
}
}
// Uninstall filters of StdMeshersGUI_ObjectReferenceParamWdg
if ( ok )
deactivateObjRefParamWdg( customWidgets() );
}
else if ( hypType().startsWith("ImportSource" ))
{
StdMeshersGUI_ObjectReferenceParamWdg* w =
widget< StdMeshersGUI_ObjectReferenceParamWdg >( 0 );
ok = ( w->IsObjectSelected() );
}
else if ( hypType() == "LayerDistribution" || hypType() == "LayerDistribution2D" )
{
StdMeshersGUI_LayerDistributionParamWdg* w =
widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
ok = ( w && w->IsOk() );
}
else if ( hypType() == "QuadrangleParams" )
{
//StdMeshersGUI_SubShapeSelectorWdg* w =
// widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 );
//ok = ( w->GetListSize() > 0 );
//StdMeshersGUI_QuadrangleParamWdg* w =
// widget< StdMeshersGUI_QuadrangleParamWdg >( 1 );
}
return ok;
}
| void SMESHGUI_GenericHypothesisCreator::create | ( | SMESH::SMESH_Hypothesis_ptr | initParamsHyp, |
| const QString & | theHypName, | ||
| QWidget * | parent, | ||
| QObject * | obj, | ||
| const QString & | slot | ||
| ) | [inherited] |
Definition at line 73 of file SMESHGUI_Hypotheses.cxx.
References MESSAGE, and SMESHGUI_GenericHypothesisCreator.setInitParamsHypothesis().
Referenced by SMESHGUI_MeshOp.createHypothesis(), and SMESHGUI_MeshOp.getAlgo().
{
MESSAGE( "Creation of hypothesis with initial params" );
setInitParamsHypothesis( initParamsHyp );
create( false, theHypName, parent, obj, slot );
}
| void SMESHGUI_GenericHypothesisCreator::create | ( | bool | isAlgo, |
| const QString & | theHypName, | ||
| QWidget * | theParent, | ||
| QObject * | obj, | ||
| const QString & | slot | ||
| ) | [inherited] |
Definition at line 82 of file SMESHGUI_Hypotheses.cxx.
References SMESH.CreateHypothesis(), SMESHGUI_GenericHypothesisCreator.editHypothesis(), SMESHGUI_GenericHypothesisCreator.hypType(), MESSAGE, and SMESHGUI_GenericHypothesisCreator.myIsCreate.
{
MESSAGE( "Creation of hypothesis" );
myIsCreate = true;
// Create hypothesis/algorithm
if (isAlgo) {
SMESH::SMESH_Hypothesis_var anAlgo =
SMESH::CreateHypothesis( hypType(), theHypName, isAlgo );
#ifdef WITHGENERICOBJ
if (!CORBA::is_nil(anAlgo))
anAlgo->UnRegister();
#endif
}
else {
SMESH::SMESH_Hypothesis_var aHypothesis =
SMESH::CreateHypothesis( hypType(), theHypName, false );
editHypothesis( aHypothesis.in(), theHypName, theParent, obj, slot );
#ifdef WITHGENERICOBJ
if (!CORBA::is_nil(aHypothesis))
aHypothesis->UnRegister();
#endif
}
}
| StdMeshersGUI_StdHypothesisCreator::ListOfWidgets * StdMeshersGUI_StdHypothesisCreator::customWidgets | ( | ) | const [protected, virtual] |
Allow modifing myCustomWidgets in const methods.
| ListOfWidgets* | - non-const pointer to myCustomWidgets |
Definition at line 128 of file StdMeshersGUI_StdHypothesisCreator.cxx.
References myCustomWidgets.
Referenced by checkParams(), getCustomWidget(), onReject(), and stdParams().
{
return const_cast< ListOfWidgets* >( & myCustomWidgets );
}
| QtxDialog * SMESHGUI_GenericHypothesisCreator::dlg | ( | ) | const [protected, inherited] |
Definition at line 454 of file SMESHGUI_Hypotheses.cxx.
References SMESHGUI_GenericHypothesisCreator.myDlg.
Referenced by StdMeshersGUI_NbSegmentsCreator.onValueChanged(), retrieveParams(), StdMeshersGUI_NbSegmentsCreator.retrieveParams(), and stdParams().
{
return myDlg;
}
| void SMESHGUI_GenericHypothesisCreator::edit | ( | SMESH::SMESH_Hypothesis_ptr | theHypothesis, |
| const QString & | theHypName, | ||
| QWidget * | theParent, | ||
| QObject * | obj, | ||
| const QString & | slot | ||
| ) | [inherited] |
Definition at line 110 of file SMESHGUI_Hypotheses.cxx.
References SMESHGUI_GenericHypothesisCreator.editHypothesis(), MESSAGE, and SMESHGUI_GenericHypothesisCreator.myIsCreate.
Referenced by StdMeshersGUI_LayerDistributionParamWdg.onEdit(), SMESHGUI_MeshOp.onEditHyp(), and SMESHGUI.OnGUIEvent().
{
if( CORBA::is_nil( theHypothesis ) )
return;
MESSAGE("Edition of hypothesis");
myIsCreate = false;
editHypothesis( theHypothesis, theHypName, theParent, obj, slot );
}
| void SMESHGUI_GenericHypothesisCreator.finished | ( | int | ) | [signal, inherited] |
| QWidget * StdMeshersGUI_StdHypothesisCreator::getCustomWidget | ( | const StdParam & | param, |
| QWidget * | parent, | ||
| const int | index | ||
| ) | const [protected, virtual] |
Reimplemented from SMESHGUI_GenericHypothesisCreator.
Definition at line 1359 of file StdMeshersGUI_StdHypothesisCreator.cxx.
References customWidgets().
{
QWidget* w = 0;
if ( index < customWidgets()->count() ) {
w = customWidgets()->at( index );
if ( w ) {
w->setParent( parent );
w->move( QPoint( 0, 0 ) );
}
}
return w;
}
| QString SMESHGUI_GenericHypothesisCreator.getMainShapeEntry | ( | ) | const [inherited] |
Definition at line 72 of file SMESHGUI_Hypotheses.h.
Referenced by StdMeshersGUI_NbSegmentsCreator.buildFrame(), and stdParams().
{ return myMainShapeEntry; }
| bool StdMeshersGUI_StdHypothesisCreator::getParamFromCustomWidget | ( | StdParam & | param, |
| QWidget * | widget | ||
| ) | const [protected, virtual] |
Set param value taken from a custom widget.
| param | - SMESHGUI_GenericHypothesisCreator.StdParam structure |
| widget | - widget presenting param |
| bool | - success flag |
this method is called from getStdParamFromDlg()
Reimplemented from SMESHGUI_GenericHypothesisCreator.
Definition at line 1385 of file StdMeshersGUI_StdHypothesisCreator.cxx.
References StdMeshersGUI_FixedPointsParamWdg.GetValue(), StdMeshersGUI_SubShapeSelectorWdg.GetValue(), StdMeshersGUI_LayerDistributionParamWdg.GetValue(), StdMeshersGUI_ObjectReferenceParamWdg.GetValue(), SMESHGUI_SpinBox.GetValue(), SMESHGUI_GenericHypothesisCreator.hypType(), SMESHGUI_GenericHypothesisCreator.StdParam.myValue, and widget().
{
if ( hypType()=="AutomaticLength" ) {
SMESHGUI_SpinBox* w = dynamic_cast<SMESHGUI_SpinBox*>( widget );
if ( w ) {
param.myValue = w->GetValue();
return true;
}
}
if ( hypType() == "MaxLength" ) {
param.myValue = "";
return true;
}
if ( widget->inherits( "StdMeshersGUI_ObjectReferenceParamWdg" ))
{
// show only 1st reference value
if ( true /*widget == getWidgetForParam( 0 )*/) {
const StdMeshersGUI_ObjectReferenceParamWdg * w =
static_cast<const StdMeshersGUI_ObjectReferenceParamWdg*>( widget );
param.myValue = w->GetValue();
}
return true;
}
if ( widget->inherits( "StdMeshersGUI_LayerDistributionParamWdg" ))
{
const StdMeshersGUI_LayerDistributionParamWdg * w =
static_cast<const StdMeshersGUI_LayerDistributionParamWdg*>( widget );
param.myValue = w->GetValue();
return true;
}
if ( widget->inherits( "StdMeshersGUI_SubShapeSelectorWdg" ))
{
const StdMeshersGUI_SubShapeSelectorWdg * w =
static_cast<const StdMeshersGUI_SubShapeSelectorWdg*>( widget );
param.myValue = w->GetValue();
return true;
}
if ( widget->inherits( "StdMeshersGUI_QuadrangleParamWdg" ))
{
//const StdMeshersGUI_QuadrangleParamWdg * w =
// static_cast<const StdMeshersGUI_QuadrangleParamWdg*>( widget );
param.myValue = "QuadType";
return true;
}
if ( widget->inherits( "StdMeshersGUI_FixedPointsParamWdg" ))
{
const StdMeshersGUI_FixedPointsParamWdg * w =
static_cast<const StdMeshersGUI_FixedPointsParamWdg*>( widget );
param.myValue = w->GetValue();
return true;
}
if ( widget->inherits( "QCheckBox" ))
{
//const QCheckBox * w = static_cast<const QCheckBox*>( widget );
//param.myValue = w->isChecked();
return true;
}
return false;
}
| QString SMESHGUI_GenericHypothesisCreator.getShapeEntry | ( | ) | const [inherited] |
Definition at line 69 of file SMESHGUI_Hypotheses.h.
Referenced by StdMeshersGUI_NbSegmentsCreator.buildFrame(), and stdParams().
{ return myShapeEntry; }
| bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg | ( | ListOfStdParams & | params | ) | const [protected, inherited] |
Definition at line 321 of file SMESHGUI_Hypotheses.cxx.
References SMESHGUI_GenericHypothesisCreator.getParamFromCustomWidget(), SMESHGUI_GenericHypothesisCreator.StdParam.myName, SMESHGUI_GenericHypothesisCreator.StdParam.myValue, SMESH_AdvancedEditor.res, and SMESHGUI_GenericHypothesisCreator.widgets().
Referenced by storeParams().
{
bool res = true;
StdParam item;
ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
for( ; anIt!=aLast; anIt++ )
{
item.myName = (*anIt)->objectName();
if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) )
{
SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
item.myValue = sb->value();
params.append( item );
}
else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
{
SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
item.myValue = sb->value();
params.append( item );
}
else if( (*anIt)->inherits( "QLineEdit" ) )
{
QLineEdit* line = ( QLineEdit* )( *anIt );
item.myValue = line->text();
params.append( item );
}
else if ( getParamFromCustomWidget( item, *anIt ))
{
params.append( item );
}
else
res = false;
}
return res;
}
| QStringList SMESHGUI_GenericHypothesisCreator::getVariablesFromDlg | ( | ) | const [protected, virtual, inherited] |
Definition at line 358 of file SMESHGUI_Hypotheses.cxx.
References SMESHGUI_GenericHypothesisCreator.widgets().
Referenced by storeParams().
Return widget for i-th hypothesis parameter (got from myParamWidgets)
| i | - index of hypothesis parameter |
| QWidget* | - found widget |
Definition at line 96 of file StdMeshersGUI_StdHypothesisCreator.cxx.
References SMESHGUI_GenericHypothesisCreator.isCreation(), myCustomWidgets, and SMESHGUI_GenericHypothesisCreator.widgets().
Referenced by storeParams(), and valueChanged().
{
QWidget* w = 0;
if ( isCreation() ) ++i; // skip widget of 'name' parameter
if ( i < myCustomWidgets.count() ) {
QList<QWidget*>::const_iterator anIt = myCustomWidgets.begin();
QList<QWidget*>::const_iterator aLast = myCustomWidgets.end();
for ( int j = 0 ; !w && anIt != aLast; ++anIt, ++j )
if ( i == j )
w = *anIt;
}
if ( !w ) {
// list has no at() const, so we iterate
QList<QWidget*>::const_iterator anIt = widgets().begin();
QList<QWidget*>::const_iterator aLast = widgets().end();
for( int j = 0; !w && anIt!=aLast; anIt++, ++j ) {
if ( i == j )
w = *anIt;
}
}
return w;
}
| bool SMESHGUI_GenericHypothesisCreator::hasInitParamsHypothesis | ( | ) | const [protected, inherited] |
Definition at line 429 of file SMESHGUI_Hypotheses.cxx.
References SMESHGUI_GenericHypothesisCreator.myInitParamsHypo.
{
return !CORBA::is_nil( myInitParamsHypo );
}
| QString SMESHGUI_GenericHypothesisCreator::helpPage | ( | ) | const [virtual, inherited] |
Definition at line 517 of file SMESHGUI_Hypotheses.cxx.
References SMESHGUI_GenericHypothesisCreator.hypType().
Referenced by SMESHGUI_HypothesisDlg.SMESHGUI_HypothesisDlg().
{
QString aHypType = hypType();
QString aHelpFileName = "";
if ( aHypType == "LocalLength" )
aHelpFileName = "a1d_meshing_hypo_page.html#average_length_anchor";
else if ( aHypType == "MaxLength" )
aHelpFileName = "a1d_meshing_hypo_page.html#max_length_anchor";
else if ( aHypType == "Arithmetic1D")
aHelpFileName = "a1d_meshing_hypo_page.html#arithmetic_1d_anchor";
else if ( aHypType == "FixedPoints1D")
aHelpFileName = "a1d_meshing_hypo_page.html#fixed_points_1d_anchor";
else if ( aHypType == "MaxElementArea")
aHelpFileName = "a2d_meshing_hypo_page.html#max_element_area_anchor";
else if ( aHypType == "MaxElementVolume")
aHelpFileName = "max_element_volume_hypo_page.html";
else if ( aHypType == "StartEndLength")
aHelpFileName = "a1d_meshing_hypo_page.html#start_and_end_length_anchor";
else if ( aHypType == "Deflection1D")
aHelpFileName = "a1d_meshing_hypo_page.html#deflection_1d_anchor";
else if ( aHypType == "AutomaticLength")
aHelpFileName = "a1d_meshing_hypo_page.html#automatic_length_anchor";
else if ( aHypType == "NumberOfSegments")
aHelpFileName = "a1d_meshing_hypo_page.html#number_of_segments_anchor";
else if ( aHypType == "ProjectionSource1D")
aHelpFileName = "projection_algos_page.html";
else if ( aHypType == "ProjectionSource2D")
aHelpFileName = "projection_algos_page.html";
else if ( aHypType == "ProjectionSource3D")
aHelpFileName = "projection_algos_page.html";
else if ( aHypType == "NumberOfLayers")
aHelpFileName = "radial_prism_algo_page.html";
else if ( aHypType == "NumberOfLayers2D")
aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
else if ( aHypType == "LayerDistribution")
aHelpFileName = "radial_prism_algo_page.html";
else if ( aHypType == "LayerDistribution2D")
aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
else if ( aHypType == "SegmentLengthAroundVertex")
aHelpFileName = "segments_around_vertex_algo_page.html";
else if ( aHypType == "QuadrangleParams")
aHelpFileName = "a2d_meshing_hypo_page.html#hypo_quad_params_anchor";
else if ( aHypType == "ViscousLayers")
aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
else if ( aHypType == "ImportSource1D" || aHypType == "ImportSource2D")
aHelpFileName = "import_algos_page.html";
return aHelpFileName;
}
| QString SMESHGUI_GenericHypothesisCreator::hypName | ( | ) | const [inherited] |
Definition at line 439 of file SMESHGUI_Hypotheses.cxx.
References SMESHGUI_GenericHypothesisCreator.myHypName.
Referenced by StdMeshersGUI_NbSegmentsCreator.readParamsFromHypo(), and stdParams().
{
return myHypName;
}
| SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::hypothesis | ( | ) | const [protected, inherited] |
Definition at line 401 of file SMESHGUI_Hypotheses.cxx.
References SMESHGUI_GenericHypothesisCreator.myHypo.
Referenced by StdMeshersGUI_NbSegmentsCreator.buildFrame(), SMESHGUI_GenericHypothesisCreator.buildStdFrame(), storeParams(), and StdMeshersGUI_NbSegmentsCreator.storeParamsToHypo().
{
return myHypo;
}
| QString SMESHGUI_GenericHypothesisCreator::hypType | ( | ) | const [inherited] |
Definition at line 434 of file SMESHGUI_Hypotheses.cxx.
References SMESHGUI_GenericHypothesisCreator.myHypType.
Referenced by attuneStdWidget(), caption(), checkParams(), SMESHGUI_GenericHypothesisCreator.create(), getParamFromCustomWidget(), SMESHGUI_GenericHypothesisCreator.helpPage(), icon(), onReject(), retrieveParams(), SMESHGUI_GenericHypothesisCreator.setInitParamsHypothesis(), SMESHGUI_HypothesisDlg.SMESHGUI_HypothesisDlg(), stdParams(), storeParams(), type(), and valueChanged().
{
return myHypType;
}
| QString StdMeshersGUI_StdHypothesisCreator::hypTypeName | ( | const QString & | t | ) | const [protected, virtual] |
String to insert in "SMESH_%1_HYPOTHESIS" to get hypothesis type name from message resouce file.
| t | - hypothesis type |
| QString | - result string |
Definition at line 1317 of file StdMeshersGUI_StdHypothesisCreator.cxx.
References SMESH_AdvancedEditor.res.
Referenced by caption(), icon(), and type().
{
static QMap<QString,QString> types;
if( types.isEmpty() )
{
types.insert( "LocalLength", "LOCAL_LENGTH" );
types.insert( "NumberOfSegments", "NB_SEGMENTS" );
types.insert( "MaxElementArea", "MAX_ELEMENT_AREA" );
types.insert( "MaxElementVolume", "MAX_ELEMENT_VOLUME" );
types.insert( "StartEndLength", "START_END_LENGTH" );
types.insert( "Deflection1D", "DEFLECTION1D" );
types.insert( "Arithmetic1D", "ARITHMETIC_1D" );
types.insert( "FixedPoints1D", "FIXED_POINTS_1D" );
types.insert( "AutomaticLength", "AUTOMATIC_LENGTH" );
types.insert( "ProjectionSource1D", "PROJECTION_SOURCE_1D" );
types.insert( "ProjectionSource2D", "PROJECTION_SOURCE_2D" );
types.insert( "ProjectionSource3D", "PROJECTION_SOURCE_3D" );
types.insert( "ImportSource1D", "IMPORT_SOURCE_1D" );
types.insert( "ImportSource2D", "IMPORT_SOURCE_2D" );
types.insert( "NumberOfLayers", "NUMBER_OF_LAYERS" );
types.insert( "LayerDistribution", "LAYER_DISTRIBUTION" );
types.insert( "NumberOfLayers2D", "NUMBER_OF_LAYERS_2D" );
types.insert( "LayerDistribution2D", "LAYER_DISTRIBUTION" );
types.insert( "SegmentLengthAroundVertex", "SEGMENT_LENGTH_AROUND_VERTEX" );
types.insert( "MaxLength", "MAX_LENGTH" );
types.insert( "ViscousLayers", "VISCOUS_LAYERS" );
types.insert( "QuadrangleParams", "QUADRANGLE_PARAMS" );
}
QString res;
if( types.contains( t ) )
res = types[ t ];
return res;
}
| QPixmap StdMeshersGUI_StdHypothesisCreator::icon | ( | ) | const [protected, virtual] |
return pixmap for dlg icon
| QPixmap | - |
Reimplemented from SMESHGUI_GenericHypothesisCreator.
Definition at line 1290 of file StdMeshersGUI_StdHypothesisCreator.cxx.
References SMESHGUI_GenericHypothesisCreator.hypType(), hypTypeName(), and SMESHGUI.resourceMgr().
{
QString hypIconName = tr( QString( "ICON_DLG_%1" ).arg( hypTypeName( hypType() ) ).toLatin1().data() );
return SMESHGUI::resourceMgr()->loadPixmap( "SMESH", hypIconName );
}
| SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::initParamsHypothesis | ( | const bool | strictly = false | ) | const [protected, inherited] |
Return hypothesis containing initial parameters.
| strictly | - if true, always return myInitParamsHypo, else, return myInitParamsHypo only in creation mode and if it is non-nil |
Definition at line 420 of file SMESHGUI_Hypotheses.cxx.
References SMESHGUI_GenericHypothesisCreator.isCreation(), SMESHGUI_GenericHypothesisCreator.myHypo, and SMESHGUI_GenericHypothesisCreator.myInitParamsHypo.
Referenced by StdMeshersGUI_NbSegmentsCreator.readParamsFromHypo(), stdParams(), storeParams(), and valueChanged().
{
if ( strictly )
return myInitParamsHypo;
if ( !isCreation() || CORBA::is_nil( myInitParamsHypo ))
return myHypo;
return myInitParamsHypo;
}
| bool StdMeshersGUI_StdHypothesisCreator::initVariableName | ( | SMESH::ListOfParameters_var | theParameters, |
| StdParam & | theParams, | ||
| int | order | ||
| ) | const [protected, virtual] |
Definition at line 1501 of file StdMeshersGUI_StdHypothesisCreator.cxx.
References SMESHGUI_GenericHypothesisCreator.StdParam.isVariable, and SMESHGUI_GenericHypothesisCreator.StdParam.myValue.
Referenced by stdParams().
{
QString aVaribaleName = (theParameters->length() > order) ? QString(theParameters[order].in()) : QString("");
theParams.isVariable = !aVaribaleName.isEmpty();
if(theParams.isVariable)
theParams.myValue = aVaribaleName;
return theParams.isVariable;
}
| bool SMESHGUI_GenericHypothesisCreator::isCreation | ( | ) | const [inherited] |
Definition at line 459 of file SMESHGUI_Hypotheses.cxx.
References SMESHGUI_GenericHypothesisCreator.myIsCreate.
Referenced by StdMeshersGUI_NbSegmentsCreator.buildFrame(), getWidgetForParam(), SMESHGUI_GenericHypothesisCreator.initParamsHypothesis(), stdParams(), storeParams(), and StdMeshersGUI_NbSegmentsCreator.storeParamsToHypo().
{
return myIsCreate;
}
| void StdMeshersGUI_StdHypothesisCreator::onReject | ( | ) | [protected, virtual] |
called when operation cancelled
Reimplemented from SMESHGUI_GenericHypothesisCreator.
Definition at line 1452 of file StdMeshersGUI_StdHypothesisCreator.cxx.
References customWidgets(), and SMESHGUI_GenericHypothesisCreator.hypType().
{
if ( hypType().startsWith("ProjectionSource" ) ||
hypType().startsWith("ImportSource" ))
{
// Uninstall filters of StdMeshersGUI_ObjectReferenceParamWdg
deactivateObjRefParamWdg( customWidgets() );
}
}
| void SMESHGUI_GenericHypothesisCreator::onValueChanged | ( | ) | [protected, virtual, slot, inherited] |
Reimplemented in StdMeshersGUI_NbSegmentsCreator.
Definition at line 252 of file SMESHGUI_Hypotheses.cxx.
References SMESHGUI_GenericHypothesisCreator.valueChanged().
Referenced by SMESHGUI_GenericHypothesisCreator.buildStdFrame(), and stdParams().
{
valueChanged( (QWidget*) sender() );
}
| void StdMeshersGUI_StdHypothesisCreator::retrieveParams | ( | ) | const [protected, virtual] |
Initialise parameter values in controls.
Implements SMESHGUI_GenericHypothesisCreator.
Reimplemented in StdMeshersGUI_NbSegmentsCreator.
Definition at line 151 of file StdMeshersGUI_StdHypothesisCreator.cxx.
References StdMeshersGUI_ObjectReferenceParamWdg.activateSelection(), StdMeshersGUI_ObjectReferenceParamWdg.AvoidSimultaneousSelection(), SMESHGUI_GenericHypothesisCreator.dlg(), ex21_lamp.height, SMESHGUI_GenericHypothesisCreator.hypType(), and myCustomWidgets.
{
// buildStdFrame() sets values itself calling stdParams()
if ( hypType().startsWith("ProjectionSource" ))
{
// we use this method to connect depending custom widgets
StdMeshersGUI_ObjectReferenceParamWdg* widgetToActivate = 0;
ListOfWidgets::const_iterator anIt = myCustomWidgets.begin();
for ( ; anIt != myCustomWidgets.end(); anIt++)
{
if ( *anIt && (*anIt)->inherits("StdMeshersGUI_ObjectReferenceParamWdg"))
{
StdMeshersGUI_ObjectReferenceParamWdg * w1 =
( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
ListOfWidgets::const_iterator anIt2 = anIt;
for ( ++anIt2; anIt2 != myCustomWidgets.end(); anIt2++)
if ( *anIt2 && (*anIt2)->inherits("StdMeshersGUI_ObjectReferenceParamWdg"))
{
StdMeshersGUI_ObjectReferenceParamWdg * w2 =
( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt2 );
w1->AvoidSimultaneousSelection( w2 );
}
if ( !widgetToActivate )
widgetToActivate = w1;
}
}
if ( widgetToActivate )
widgetToActivate->activateSelection();
}
if ( dlg() )
dlg()->setMinimumSize( dlg()->minimumSizeHint().width(), dlg()->minimumSizeHint().height() );
}
| void SMESHGUI_GenericHypothesisCreator::setInitParamsHypothesis | ( | SMESH::SMESH_Hypothesis_ptr | hyp | ) | [inherited] |
Definition at line 67 of file SMESHGUI_Hypotheses.cxx.
References SMESHGUI_GenericHypothesisCreator.hypType(), and SMESHGUI_GenericHypothesisCreator.myInitParamsHypo.
Referenced by SMESHGUI_GenericHypothesisCreator.create(), and SMESHGUI_MeshOp.onEditHyp().
{
if ( !CORBA::is_nil( hyp ) && hypType() == hyp->GetName() )
myInitParamsHypo = SMESH::SMESH_Hypothesis::_duplicate( hyp );
}
| void SMESHGUI_GenericHypothesisCreator.setMainShapeEntry | ( | const QString & | theEntry | ) | [inherited] |
Definition at line 73 of file SMESHGUI_Hypotheses.h.
Referenced by SMESHGUI_MeshOp.createHypothesis(), and SMESHGUI_MeshOp.onEditHyp().
{ myMainShapeEntry = theEntry; }
| void SMESHGUI_GenericHypothesisCreator::setShapeEntry | ( | const QString & | theEntry | ) | [inherited] |
Definition at line 406 of file SMESHGUI_Hypotheses.cxx.
References SMESHGUI_GenericHypothesisCreator.myShapeEntry.
Referenced by SMESHGUI_MeshOp.createHypothesis(), and SMESHGUI_MeshOp.onEditHyp().
{
myShapeEntry = theEntry;
}
| bool StdMeshersGUI_StdHypothesisCreator::stdParams | ( | ListOfStdParams & | p | ) | const [protected, virtual] |
Return parameter values as SMESHGUI_GenericHypothesisCreator.StdParam.
| p | - list of parameters |
| bool | - success flag |
Is called from SMESHGUI_GenericHypothesisCreator.buildStdFrame(). Parameters will be shown using "standard" controls: Int by QtxIntSpinBox Double by SMESHGUI_SpinBox String by QLineEdit getCustomWidget() allows to redefine control for a parameter
Reimplemented from SMESHGUI_GenericHypothesisCreator.
Definition at line 725 of file StdMeshersGUI_StdHypothesisCreator.cxx.
References customWidgets(), SMESHGUI_GenericHypothesisCreator.dlg(), SMESH.GetHypothesisData(), SMESHGUI_GenericHypothesisCreator.getMainShapeEntry(), SMESHGUI_GenericHypothesisCreator.getShapeEntry(), GROUP_EDGE, GROUP_FACE, SMESH_demo_hexa2_upd.hyp, SMESHGUI_GenericHypothesisCreator.hypName(), SMESHGUI_GenericHypothesisCreator.hypType(), SMESHGUI_GenericHypothesisCreator.initParamsHypothesis(), initVariableName(), SMESHGUI_GenericHypothesisCreator.isCreation(), SMESHGUI_GenericHypothesisCreator.StdParam.myName, SMESHGUI_GenericHypothesisCreator.StdParam.myValue, SMESHGUI_GenericHypothesisCreator.onValueChanged(), SMESHGUI_SpinBox.RangeStepAndValidator(), SMESH_AdvancedEditor.res, StdMeshersGUI_SubShapeSelectorWdg.SetGeomShapeEntry(), StdMeshersGUI_SubShapeSelectorWdg.SetListOfIDs(), StdMeshersGUI_FixedPointsParamWdg.SetListOfPoints(), StdMeshersGUI_FixedPointsParamWdg.SetListOfSegments(), StdMeshersGUI_SubShapeSelectorWdg.SetMainShapeEntry(), StdMeshersGUI_SubShapeSelectorWdg.SetMaxSize(), StdMeshersGUI_QuadrangleParamWdg.SetType(), SMESHGUI_SpinBox.SetValue(), and StdMeshersGUI_SubShapeSelectorWdg.showPreview().
{
bool res = true;
SMESHGUI_GenericHypothesisCreator::StdParam item;
p.clear();
customWidgets()->clear();
if( isCreation() )
{
HypothesisData* data = SMESH::GetHypothesisData( hypType() );
item.myName = tr( "SMESH_NAME" );
item.myValue = data ? hypName() : QString();
p.append( item );
customWidgets()->append(0);
}
SMESH::SMESH_Hypothesis_var hyp = initParamsHypothesis();
SMESH::ListOfParameters_var aParameters = hyp->GetLastParameters();
if( hypType()=="LocalLength" )
{
StdMeshers::StdMeshers_LocalLength_var h =
StdMeshers::StdMeshers_LocalLength::_narrow( hyp );
item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
if(!initVariableName(aParameters,item,0))
item.myValue = h->GetLength();
p.append( item );
item.myName = tr("SMESH_LOCAL_LENGTH_PRECISION");
if(!initVariableName(aParameters,item,1))
item.myValue = h->GetPrecision();
p.append( item );
}
else if( hypType()=="MaxLength" )
{
StdMeshers::StdMeshers_MaxLength_var h =
StdMeshers::StdMeshers_MaxLength::_narrow( hyp );
// try to set a right preestimated length to edited hypothesis
bool noPreestimatedAtEdition = false;
if ( !isCreation() ) {
StdMeshers::StdMeshers_MaxLength_var initHyp =
StdMeshers::StdMeshers_MaxLength::_narrow( initParamsHypothesis(true) );
noPreestimatedAtEdition =
( initHyp->_is_nil() || !initHyp->HavePreestimatedLength() );
if ( !noPreestimatedAtEdition )
h->SetPreestimatedLength( initHyp->GetPreestimatedLength() );
}
item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
if(!initVariableName(aParameters,item,0))
item.myValue = h->GetLength();
p.append( item );
customWidgets()->append(0);
item.myName = tr("SMESH_USE_PREESTIMATED_LENGTH");
p.append( item );
QCheckBox* aQCheckBox = new QCheckBox(dlg());
if ( !noPreestimatedAtEdition && h->HavePreestimatedLength() ) {
aQCheckBox->setChecked( h->GetUsePreestimatedLength() );
connect( aQCheckBox, SIGNAL( stateChanged(int) ), this, SLOT( onValueChanged() ) );
}
else {
aQCheckBox->setChecked( false );
aQCheckBox->setEnabled( false );
}
customWidgets()->append( aQCheckBox );
}
else if( hypType()=="SegmentLengthAroundVertex" )
{
StdMeshers::StdMeshers_SegmentLengthAroundVertex_var h =
StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hyp );
item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
if(!initVariableName(aParameters,item,0))
item.myValue = h->GetLength();
p.append( item );
}
else if( hypType()=="Arithmetic1D" )
{
StdMeshers::StdMeshers_Arithmetic1D_var h =
StdMeshers::StdMeshers_Arithmetic1D::_narrow( hyp );
item.myName = tr( "SMESH_START_LENGTH_PARAM" );
if(!initVariableName(aParameters,item,0))
item.myValue = h->GetLength( true );
p.append( item );
customWidgets()->append (0);
item.myName = tr( "SMESH_END_LENGTH_PARAM" );
if(!initVariableName(aParameters,item,1))
item.myValue = h->GetLength( false );
p.append( item );
customWidgets()->append (0);
item.myName = tr( "SMESH_REVERSED_EDGES" );
p.append( item );
StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
new StdMeshersGUI_SubShapeSelectorWdg();
QString aGeomEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
if ( aGeomEntry == "" )
aGeomEntry = h->GetObjectEntry();
aDirectionWidget->SetGeomShapeEntry( aGeomEntry );
aDirectionWidget->SetMainShapeEntry( aMainEntry );
aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
aDirectionWidget->showPreview( true );
customWidgets()->append ( aDirectionWidget );
}
else if( hypType()=="FixedPoints1D" )
{
StdMeshers::StdMeshers_FixedPoints1D_var h =
StdMeshers::StdMeshers_FixedPoints1D::_narrow( hyp );
item.myName = tr( "SMESH_FIXED_POINTS" );
p.append( item );
StdMeshersGUI_FixedPointsParamWdg* aFixedPointsWidget =
new StdMeshersGUI_FixedPointsParamWdg();
if ( !isCreation() ) {
aFixedPointsWidget->SetListOfPoints( h->GetPoints() );
aFixedPointsWidget->SetListOfSegments( h->GetNbSegments() );
}
customWidgets()->append( aFixedPointsWidget );
item.myName = tr( "SMESH_REVERSED_EDGES" );
p.append( item );
StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
new StdMeshersGUI_SubShapeSelectorWdg();
QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
if ( anEntry == "" )
anEntry = h->GetObjectEntry();
aDirectionWidget->SetGeomShapeEntry( anEntry );
aDirectionWidget->SetMainShapeEntry( aMainEntry );
aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
aDirectionWidget->showPreview( true );
customWidgets()->append ( aDirectionWidget );
}
else if( hypType()=="MaxElementArea" )
{
StdMeshers::StdMeshers_MaxElementArea_var h =
StdMeshers::StdMeshers_MaxElementArea::_narrow( hyp );
item.myName = tr( "SMESH_MAX_ELEMENT_AREA_PARAM" );
if(!initVariableName(aParameters,item,0))
item.myValue = h->GetMaxElementArea();
p.append( item );
}
else if( hypType()=="MaxElementVolume" )
{
StdMeshers::StdMeshers_MaxElementVolume_var h =
StdMeshers::StdMeshers_MaxElementVolume::_narrow( hyp );
item.myName = tr( "SMESH_MAX_ELEMENT_VOLUME_PARAM" );
if(!initVariableName(aParameters,item,0))
item.myValue = h->GetMaxElementVolume();
p.append( item );
}
else if( hypType()=="StartEndLength" )
{
StdMeshers::StdMeshers_StartEndLength_var h =
StdMeshers::StdMeshers_StartEndLength::_narrow( hyp );
item.myName = tr( "SMESH_START_LENGTH_PARAM" );
if(!initVariableName(aParameters,item,0))
item.myValue = h->GetLength( true );
p.append( item );
customWidgets()->append(0);
item.myName = tr( "SMESH_END_LENGTH_PARAM" );
if(!initVariableName(aParameters,item,1))
item.myValue = h->GetLength( false );
p.append( item );
customWidgets()->append(0);
item.myName = tr( "SMESH_REVERSED_EDGES" );
p.append( item );
StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
new StdMeshersGUI_SubShapeSelectorWdg();
QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
if ( anEntry == "" )
anEntry = h->GetObjectEntry();
aDirectionWidget->SetGeomShapeEntry( anEntry );
aDirectionWidget->SetMainShapeEntry( aMainEntry );
aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
aDirectionWidget->showPreview( true );
customWidgets()->append ( aDirectionWidget );
}
else if( hypType()=="Deflection1D" )
{
StdMeshers::StdMeshers_Deflection1D_var h =
StdMeshers::StdMeshers_Deflection1D::_narrow( hyp );
item.myName = tr( "SMESH_DEFLECTION1D_PARAM" );
if(!initVariableName(aParameters,item,0))
item.myValue = h->GetDeflection();
p.append( item );
}
else if( hypType()=="AutomaticLength" )
{
StdMeshers::StdMeshers_AutomaticLength_var h =
StdMeshers::StdMeshers_AutomaticLength::_narrow( hyp );
item.myName = tr( "SMESH_FINENESS_PARAM" );
//item.myValue = h->GetFineness();
p.append( item );
SMESHGUI_SpinBox* _autoLengthSpinBox = new SMESHGUI_SpinBox(dlg());
_autoLengthSpinBox->RangeStepAndValidator(0, 1, 0.01, "length_precision");
_autoLengthSpinBox->SetValue(h->GetFineness());
customWidgets()->append( _autoLengthSpinBox);
}
else if( hypType()=="NumberOfLayers" )
{
StdMeshers::StdMeshers_NumberOfLayers_var h =
StdMeshers::StdMeshers_NumberOfLayers::_narrow( hyp );
item.myName = tr( "SMESH_NUMBER_OF_LAYERS" );
if(!initVariableName(aParameters,item,0))
item.myValue = (int) h->GetNumberOfLayers();
p.append( item );
}
else if( hypType()=="LayerDistribution" ) {
StdMeshers::StdMeshers_LayerDistribution_var h =
StdMeshers::StdMeshers_LayerDistribution::_narrow( hyp );
item.myName = tr( "SMESH_LAYERS_DISTRIBUTION" ); p.append( item );
//Set into not published hypo last variables
QStringList aLastVarsList;
for(int i = 0;i<aParameters->length();i++)
aLastVarsList.append(QString(aParameters[i].in()));
if(!aLastVarsList.isEmpty())
h->GetLayerDistribution()->SetLastParameters(aLastVarsList.join(":").toLatin1().constData());
customWidgets()->append
( new StdMeshersGUI_LayerDistributionParamWdg( h->GetLayerDistribution(), hypName(), dlg()));
}
else if( hypType()=="NumberOfLayers2D" ) {
StdMeshers::StdMeshers_NumberOfLayers2D_var h =
StdMeshers::StdMeshers_NumberOfLayers2D::_narrow( hyp );
item.myName = tr( "SMESH_NUMBER_OF_LAYERS" );
if(!initVariableName(aParameters,item,0))
item.myValue = (int) h->GetNumberOfLayers();
p.append( item );
}
else if( hypType()=="LayerDistribution2D" ) {
StdMeshers::StdMeshers_LayerDistribution2D_var h =
StdMeshers::StdMeshers_LayerDistribution2D::_narrow( hyp );
item.myName = tr( "SMESH_LAYERS_DISTRIBUTION" ); p.append( item );
//Set into not published hypo last variables
QStringList aLastVarsList;
for(int i = 0;i<aParameters->length();i++)
aLastVarsList.append(QString(aParameters[i].in()));
if(!aLastVarsList.isEmpty())
h->GetLayerDistribution()->SetLastParameters(aLastVarsList.join(":").toLatin1().constData());
customWidgets()->append
( new StdMeshersGUI_LayerDistributionParamWdg( h->GetLayerDistribution(), hypName(), dlg()));
}
else if( hypType()=="ProjectionSource1D" )
{
StdMeshers::StdMeshers_ProjectionSource1D_var h =
StdMeshers::StdMeshers_ProjectionSource1D::_narrow( hyp );
item.myName = tr( "SMESH_SOURCE_EDGE" ); p.append( item );
customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 1 ),
h->GetSourceEdge()));
item.myName = tr( "SMESH_SOURCE_MESH" ); p.append( item );
customWidgets()->append( newObjRefParamWdg( new SMESH_TypeFilter( MESH ),
h->GetSourceMesh()));
item.myName = tr( "SMESH_SOURCE_VERTEX" ); p.append( item );
customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
h->GetSourceVertex()));
item.myName = tr( "SMESH_TARGET_VERTEX" ); p.append( item );
customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
h->GetTargetVertex()));
}
else if( hypType()=="ProjectionSource2D" )
{
StdMeshers::StdMeshers_ProjectionSource2D_var h =
StdMeshers::StdMeshers_ProjectionSource2D::_narrow( hyp );
item.myName = tr( "SMESH_SOURCE_FACE" ); p.append( item );
customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 2 ),
h->GetSourceFace()));
item.myName = tr( "SMESH_SOURCE_MESH" ); p.append( item );
customWidgets()->append( newObjRefParamWdg( new SMESH_TypeFilter( MESH ),
h->GetSourceMesh()));
item.myName = tr( "SMESH_SOURCE_VERTEX1" ); p.append( item );
customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
h->GetSourceVertex( 1 )));
item.myName = tr( "SMESH_TARGET_VERTEX1" ); p.append( item );
customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
h->GetTargetVertex( 1 )));
item.myName = tr( "SMESH_SOURCE_VERTEX2" ); p.append( item );
customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
h->GetSourceVertex( 2 )));
item.myName = tr( "SMESH_TARGET_VERTEX2" ); p.append( item );
customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
h->GetTargetVertex( 2 )));
}
else if( hypType()=="ProjectionSource3D" )
{
StdMeshers::StdMeshers_ProjectionSource3D_var h =
StdMeshers::StdMeshers_ProjectionSource3D::_narrow( hyp );
item.myName = tr( "SMESH_SOURCE_3DSHAPE" ); p.append( item );
customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 3, TopAbs_FACE, 6, true ),
h->GetSource3DShape()));
item.myName = tr( "SMESH_SOURCE_MESH" ); p.append( item );
customWidgets()->append( newObjRefParamWdg( new SMESH_TypeFilter( MESH ),
h->GetSourceMesh()));
item.myName = tr( "SMESH_SOURCE_VERTEX1" ); p.append( item );
customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
h->GetSourceVertex( 1 )));
item.myName = tr( "SMESH_TARGET_VERTEX1" ); p.append( item );
customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
h->GetTargetVertex( 1 )));
item.myName = tr( "SMESH_SOURCE_VERTEX2" ); p.append( item );
customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
h->GetSourceVertex( 2 )));
item.myName = tr( "SMESH_TARGET_VERTEX2" ); p.append( item );
customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
h->GetTargetVertex( 2 )));
}
else if( hypType()=="ImportSource1D" )
{
StdMeshers::StdMeshers_ImportSource1D_var h =
StdMeshers::StdMeshers_ImportSource1D::_narrow( hyp );
SMESH::string_array_var groupEntries = h->GetSourceEdges();
CORBA::Boolean toCopyMesh, toCopyGroups;
h->GetCopySourceMesh(toCopyMesh, toCopyGroups);
item.myName = tr( "SMESH_SOURCE_EDGES" ); p.append( item );
customWidgets()->append( newObjRefParamWdg( new SMESH_TypeFilter( GROUP_EDGE ),
groupEntries));
item.myName = tr( "SMESH_COPY_MESH" ); p.append( item );
QCheckBox* aQCheckBox = new QCheckBox(dlg());
aQCheckBox->setChecked( toCopyMesh );
connect( aQCheckBox, SIGNAL( stateChanged(int) ), this, SLOT( onValueChanged() ));
customWidgets()->append( aQCheckBox );
item.myName = tr( "SMESH_TO_COPY_GROUPS" ); p.append( item );
aQCheckBox = new QCheckBox(dlg());
aQCheckBox->setChecked( toCopyGroups );
aQCheckBox->setEnabled( toCopyMesh );
customWidgets()->append( aQCheckBox );
}
else if( hypType()=="ImportSource2D" )
{
StdMeshers::StdMeshers_ImportSource2D_var h =
StdMeshers::StdMeshers_ImportSource2D::_narrow( hyp );
SMESH::string_array_var groupEntries = h->GetSourceFaces();
CORBA::Boolean toCopyMesh, toCopyGroups;
h->GetCopySourceMesh(toCopyMesh, toCopyGroups);
item.myName = tr( "SMESH_SOURCE_FACES" ); p.append( item );
customWidgets()->append( newObjRefParamWdg( new SMESH_TypeFilter( GROUP_FACE ),
groupEntries));
item.myName = tr( "SMESH_COPY_MESH" ); p.append( item );
QCheckBox* aQCheckBox = new QCheckBox(dlg());
aQCheckBox->setChecked( toCopyMesh );
connect( aQCheckBox, SIGNAL( stateChanged(int) ), this, SLOT( onValueChanged() ));
customWidgets()->append( aQCheckBox );
item.myName = tr( "SMESH_COPY_GROUPS" ); p.append( item );
aQCheckBox = new QCheckBox(dlg());
aQCheckBox->setChecked( toCopyGroups );
aQCheckBox->setEnabled( toCopyMesh );
customWidgets()->append( aQCheckBox );
}
else if( hypType()=="ViscousLayers" )
{
StdMeshers::StdMeshers_ViscousLayers_var h =
StdMeshers::StdMeshers_ViscousLayers::_narrow( hyp );
item.myName = tr( "SMESH_TOTAL_THICKNESS" );
if(!initVariableName(aParameters,item,0))
item.myValue = h->GetTotalThickness();
p.append( item );
customWidgets()->append (0);
item.myName = tr( "SMESH_NUMBER_OF_LAYERS" );
if(!initVariableName(aParameters,item,1))
item.myValue = h->GetNumberLayers();
p.append( item );
customWidgets()->append (0);
item.myName = tr( "SMESH_STRETCH_FACTOR" );
if(!initVariableName(aParameters,item,2))
item.myValue = h->GetStretchFactor();
p.append( item );
customWidgets()->append (0);
QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
if ( !aMainEntry.isEmpty() )
{
item.myName = tr( "SMESH_FACES_WO_LAYERS" );
p.append( item );
StdMeshersGUI_SubShapeSelectorWdg* idsWg =
new StdMeshersGUI_SubShapeSelectorWdg(0,TopAbs_FACE);
idsWg->SetGeomShapeEntry( aMainEntry );
idsWg->SetMainShapeEntry( aMainEntry );
idsWg->SetListOfIDs( h->GetIgnoreFaces() );
idsWg->showPreview( true );
customWidgets()->append ( idsWg );
}
}
else if (hypType() == "QuadrangleParams")
{
StdMeshers::StdMeshers_QuadrangleParams_var h =
StdMeshers::StdMeshers_QuadrangleParams::_narrow(hyp);
item.myName = tr("SMESH_BASE_VERTEX");
p.append(item);
StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
new StdMeshersGUI_SubShapeSelectorWdg(0, TopAbs_VERTEX);
aDirectionWidget->SetMaxSize(1);
QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
if (anEntry == "")
anEntry = h->GetObjectEntry();
aDirectionWidget->SetGeomShapeEntry(anEntry);
aDirectionWidget->SetMainShapeEntry(aMainEntry);
if (!isCreation()) {
SMESH::long_array_var aVec = new SMESH::long_array;
int vertID = h->GetTriaVertex();
if (vertID > 0) {
aVec->length(1);
aVec[0] = vertID;
aDirectionWidget->SetListOfIDs(aVec);
}
}
aDirectionWidget->showPreview(true);
item.myName = tr("SMESH_QUAD_TYPE");
p.append(item);
StdMeshersGUI_QuadrangleParamWdg* aTypeWidget =
new StdMeshersGUI_QuadrangleParamWdg();
if (!isCreation()) {
aTypeWidget->SetType(int(h->GetQuadType()));
}
customWidgets()->append(aDirectionWidget);
customWidgets()->append(aTypeWidget);
}
else
res = false;
return res;
}
| QString SMESHGUI_GenericHypothesisCreator::stdParamValues | ( | const ListOfStdParams & | params | ) | [static, protected, inherited] |
Definition at line 371 of file SMESHGUI_Hypotheses.cxx.
Referenced by storeParams().
{
QString valueStr = "";
ListOfStdParams::const_iterator param = params.begin(), aLast = params.end();
uint len0 = 0;
for( int i=0; param!=aLast; param++, i++ )
{
if ( valueStr.length() > len0 ) {
valueStr += "; ";
len0 = valueStr.length();
}
switch( (*param).myValue.type() )
{
case QVariant::Int:
valueStr += valueStr.number( (*param).myValue.toInt() );
break;
case QVariant::Double:
valueStr += valueStr.number( (*param).myValue.toDouble() );
break;
case QVariant::String:
valueStr += (*param).myValue.toString();
break;
default:
QVariant valCopy = (*param).myValue;
valueStr += valCopy.toString();
}
}
return valueStr;
}
| QString StdMeshersGUI_StdHypothesisCreator::storeParams | ( | ) | const [protected, virtual] |
Store params from GUI controls to a hypothesis.
| QString | - text representation of parameters |
Implements SMESHGUI_GenericHypothesisCreator.
Reimplemented in StdMeshersGUI_NbSegmentsCreator.
Definition at line 445 of file StdMeshersGUI_StdHypothesisCreator.cxx.
References StdMeshersGUI_LayerDistributionParamWdg.GetHypothesis(), StdMeshersGUI_SubShapeSelectorWdg.GetListOfIDs(), StdMeshersGUI_FixedPointsParamWdg.GetListOfPoints(), StdMeshersGUI_FixedPointsParamWdg.GetListOfSegments(), StdMeshersGUI_SubShapeSelectorWdg.GetListSize(), StdMeshersGUI_SubShapeSelectorWdg.GetMainShapeEntry(), SMESHGUI_GenericHypothesisCreator.getStdParamFromDlg(), SMESHGUI_GenericHypothesisCreator.getVariablesFromDlg(), getWidgetForParam(), SMESHGUI_GenericHypothesisCreator.hypothesis(), SMESHGUI_GenericHypothesisCreator.hypType(), SMESHGUI_GenericHypothesisCreator.initParamsHypothesis(), SMESHGUI_GenericHypothesisCreator.isCreation(), SMESH_AdvancedEditor.res, batchmode_smesh.SetName(), and SMESHGUI_GenericHypothesisCreator.stdParamValues().
{
ListOfStdParams params;
bool res = getStdParamFromDlg( params );
if( isCreation() )
{
SMESH::SetName( SMESH::FindSObject( hypothesis() ), params[0].myValue.toString().toLatin1().data() );
params.erase( params.begin() );
}
QString valueStr = stdParamValues( params );
QStringList aVariablesList = getVariablesFromDlg();
if( res && !params.isEmpty() )
{
if( hypType()=="LocalLength" )
{
StdMeshers::StdMeshers_LocalLength_var h =
StdMeshers::StdMeshers_LocalLength::_narrow( hypothesis() );
h->SetLength( params[0].myValue.toDouble() );
h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetPrecision( params[1].myValue.toDouble() );
h->SetParameters(aVariablesList.join(":").toLatin1().constData());
}
else if( hypType()=="MaxLength" )
{
StdMeshers::StdMeshers_MaxLength_var h =
StdMeshers::StdMeshers_MaxLength::_narrow( hypothesis() );
h->SetLength( params[0].myValue.toDouble() );
h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetUsePreestimatedLength( widget< QCheckBox >( 1 )->isChecked() );
if ( !h->HavePreestimatedLength() && !h->_is_equivalent( initParamsHypothesis() )) {
StdMeshers::StdMeshers_MaxLength_var hInit =
StdMeshers::StdMeshers_MaxLength::_narrow( initParamsHypothesis() );
h->SetPreestimatedLength( hInit->GetPreestimatedLength() );
}
}
else if( hypType()=="SegmentLengthAroundVertex" )
{
StdMeshers::StdMeshers_SegmentLengthAroundVertex_var h =
StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hypothesis() );
h->SetLength( params[0].myValue.toDouble() );
h->SetParameters(aVariablesList.join(":").toLatin1().constData());
}
else if( hypType()=="Arithmetic1D" )
{
StdMeshers::StdMeshers_Arithmetic1D_var h =
StdMeshers::StdMeshers_Arithmetic1D::_narrow( hypothesis() );
StdMeshersGUI_SubShapeSelectorWdg* w =
widget< StdMeshersGUI_SubShapeSelectorWdg >( 2 );
h->SetStartLength( params[0].myValue.toDouble() );
h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetEndLength( params[1].myValue.toDouble() );
h->SetParameters(aVariablesList.join(":").toLatin1().constData());
if (w) {
h->SetReversedEdges( w->GetListOfIDs() );
h->SetObjectEntry( w->GetMainShapeEntry() );
}
}
else if( hypType()=="FixedPoints1D" )
{
StdMeshers::StdMeshers_FixedPoints1D_var h =
StdMeshers::StdMeshers_FixedPoints1D::_narrow( hypothesis() );
StdMeshersGUI_FixedPointsParamWdg* w1 =
widget< StdMeshersGUI_FixedPointsParamWdg >( 0 );
StdMeshersGUI_SubShapeSelectorWdg* w2 =
widget< StdMeshersGUI_SubShapeSelectorWdg >( 1 );
if (w1) {
h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetPoints( w1->GetListOfPoints() );
h->SetNbSegments( w1->GetListOfSegments() );
}
if (w2) {
h->SetReversedEdges( w2->GetListOfIDs() );
h->SetObjectEntry( w2->GetMainShapeEntry() );
}
}
else if( hypType()=="MaxElementArea" )
{
StdMeshers::StdMeshers_MaxElementArea_var h =
StdMeshers::StdMeshers_MaxElementArea::_narrow( hypothesis() );
h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetMaxElementArea( params[0].myValue.toDouble() );
}
else if( hypType()=="MaxElementVolume" )
{
StdMeshers::StdMeshers_MaxElementVolume_var h =
StdMeshers::StdMeshers_MaxElementVolume::_narrow( hypothesis() );
h->SetMaxElementVolume( params[0].myValue.toDouble() );
h->SetParameters(aVariablesList.join(":").toLatin1().constData());
}
else if( hypType()=="StartEndLength" )
{
StdMeshers::StdMeshers_StartEndLength_var h =
StdMeshers::StdMeshers_StartEndLength::_narrow( hypothesis() );
StdMeshersGUI_SubShapeSelectorWdg* w =
widget< StdMeshersGUI_SubShapeSelectorWdg >( 2 );
h->SetStartLength( params[0].myValue.toDouble() );
h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetEndLength( params[1].myValue.toDouble() );
h->SetParameters(aVariablesList.join(":").toLatin1().constData());
if (w) {
h->SetReversedEdges( w->GetListOfIDs() );
h->SetObjectEntry( w->GetMainShapeEntry() );
}
}
else if( hypType()=="Deflection1D" )
{
StdMeshers::StdMeshers_Deflection1D_var h =
StdMeshers::StdMeshers_Deflection1D::_narrow( hypothesis() );
h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetDeflection( params[0].myValue.toDouble() );
}
else if( hypType()=="AutomaticLength" )
{
StdMeshers::StdMeshers_AutomaticLength_var h =
StdMeshers::StdMeshers_AutomaticLength::_narrow( hypothesis() );
h->SetFineness( params[0].myValue.toDouble() );
}
else if( hypType()=="NumberOfLayers" )
{
StdMeshers::StdMeshers_NumberOfLayers_var h =
StdMeshers::StdMeshers_NumberOfLayers::_narrow( hypothesis() );
h->SetNumberOfLayers( params[0].myValue.toInt() );
h->SetParameters(aVariablesList.join(":").toLatin1().constData());
}
else if( hypType()=="LayerDistribution" )
{
StdMeshers::StdMeshers_LayerDistribution_var h =
StdMeshers::StdMeshers_LayerDistribution::_narrow( hypothesis() );
StdMeshersGUI_LayerDistributionParamWdg* w =
widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
h->SetLayerDistribution( w->GetHypothesis() );
h->SetParameters(w->GetHypothesis()->GetParameters());
w->GetHypothesis()->ClearParameters();
}
else if( hypType()=="NumberOfLayers2D" )
{
StdMeshers::StdMeshers_NumberOfLayers2D_var h =
StdMeshers::StdMeshers_NumberOfLayers2D::_narrow( hypothesis() );
h->SetNumberOfLayers( params[0].myValue.toInt() );
h->SetParameters(aVariablesList.join(":").toLatin1().constData());
}
else if( hypType()=="LayerDistribution2D" )
{
StdMeshers::StdMeshers_LayerDistribution2D_var h =
StdMeshers::StdMeshers_LayerDistribution2D::_narrow( hypothesis() );
StdMeshersGUI_LayerDistributionParamWdg* w =
widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
h->SetLayerDistribution( w->GetHypothesis() );
h->SetParameters(w->GetHypothesis()->GetParameters());
w->GetHypothesis()->ClearParameters();
}
else if( hypType()=="ProjectionSource1D" )
{
StdMeshers::StdMeshers_ProjectionSource1D_var h =
StdMeshers::StdMeshers_ProjectionSource1D::_narrow( hypothesis() );
h->SetSourceEdge ( geomFromWdg ( getWidgetForParam( 0 )));
h->SetSourceMesh ( meshFromWdg ( getWidgetForParam( 1 )));
h->SetVertexAssociation( geomFromWdg ( getWidgetForParam( 2 )),
geomFromWdg ( getWidgetForParam( 3 )));
}
else if( hypType()=="ProjectionSource2D" )
{
StdMeshers::StdMeshers_ProjectionSource2D_var h =
StdMeshers::StdMeshers_ProjectionSource2D::_narrow( hypothesis() );
h->SetSourceFace ( geomFromWdg ( getWidgetForParam( 0 )));
h->SetSourceMesh ( meshFromWdg ( getWidgetForParam( 1 )));
h->SetVertexAssociation( geomFromWdg ( getWidgetForParam( 2 )), // src1
geomFromWdg ( getWidgetForParam( 4 )), // src2
geomFromWdg ( getWidgetForParam( 3 )), // tgt1
geomFromWdg ( getWidgetForParam( 5 ))); // tgt2
}
else if( hypType()=="ProjectionSource3D" )
{
StdMeshers::StdMeshers_ProjectionSource3D_var h =
StdMeshers::StdMeshers_ProjectionSource3D::_narrow( hypothesis() );
h->SetSource3DShape ( geomFromWdg ( getWidgetForParam( 0 )));
h->SetSourceMesh ( meshFromWdg ( getWidgetForParam( 1 )));
h->SetVertexAssociation( geomFromWdg ( getWidgetForParam( 2 )), // src1
geomFromWdg ( getWidgetForParam( 4 )), // src2
geomFromWdg ( getWidgetForParam( 3 )), // tgt1
geomFromWdg ( getWidgetForParam( 5 ))); // tgt2
}
else if( hypType()=="ImportSource1D" )
{
StdMeshers::StdMeshers_ImportSource1D_var h =
StdMeshers::StdMeshers_ImportSource1D::_narrow( hypothesis() );
SMESH::ListOfGroups_var groups = groupsFromWdg( getWidgetForParam( 0 ));
h->SetSourceEdges( groups.in() );
QCheckBox* toCopyMesh = widget< QCheckBox >( 1 );
QCheckBox* toCopyGroups = widget< QCheckBox >( 2 );
h->SetCopySourceMesh( toCopyMesh->isChecked(), toCopyGroups->isChecked());
}
else if( hypType()=="ImportSource2D" )
{
StdMeshers::StdMeshers_ImportSource2D_var h =
StdMeshers::StdMeshers_ImportSource2D::_narrow( hypothesis() );
SMESH::ListOfGroups_var groups = groupsFromWdg( getWidgetForParam( 0 ));
h->SetSourceFaces( groups.in() );
QCheckBox* toCopyMesh = widget< QCheckBox >( 1 );
QCheckBox* toCopyGroups = widget< QCheckBox >( 2 );
h->SetCopySourceMesh( toCopyMesh->isChecked(), toCopyGroups->isChecked());
}
else if( hypType()=="ViscousLayers" )
{
StdMeshers::StdMeshers_ViscousLayers_var h =
StdMeshers::StdMeshers_ViscousLayers::_narrow( hypothesis() );
h->SetTotalThickness( params[0].myValue.toDouble() );
/* */ h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetNumberLayers ( params[1].myValue.toInt() );
/* */ h->SetParameters(aVariablesList.join(":").toLatin1().constData());
h->SetStretchFactor ( params[2].myValue.toDouble() );
/* */ h->SetParameters(aVariablesList.join(":").toLatin1().constData());
if ( StdMeshersGUI_SubShapeSelectorWdg* idsWg =
widget< StdMeshersGUI_SubShapeSelectorWdg >( 3 ))
{
h->SetIgnoreFaces( idsWg->GetListOfIDs() );
//h->SetObjectEntry( idsWg->GetMainShapeEntry() );
}
}
else if( hypType()=="QuadrangleParams" )
{
StdMeshers::StdMeshers_QuadrangleParams_var h =
StdMeshers::StdMeshers_QuadrangleParams::_narrow( hypothesis() );
StdMeshersGUI_SubShapeSelectorWdg* w1 =
widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 );
StdMeshersGUI_QuadrangleParamWdg* w2 =
widget< StdMeshersGUI_QuadrangleParamWdg >( 1 );
if (w1 && w2) {
if (w1->GetListSize() > 0) {
h->SetTriaVertex(w1->GetListOfIDs()[0]); // getlist must be called once
const char * entry = w1->GetMainShapeEntry();
h->SetObjectEntry(entry);
}
h->SetQuadType(StdMeshers::QuadType(w2->GetType()));
}
}
}
return valueStr;
}
| QString StdMeshersGUI_StdHypothesisCreator::type | ( | ) | const [protected, virtual] |
Return hypothesis type name to show in dlg.
| QString | - |
Reimplemented from SMESHGUI_GenericHypothesisCreator.
Definition at line 1303 of file StdMeshersGUI_StdHypothesisCreator.cxx.
References SMESHGUI_GenericHypothesisCreator.hypType(), and hypTypeName().
{
return tr( QString( "SMESH_%1_HYPOTHESIS" ).arg( hypTypeName( hypType() ) ).toLatin1().data() );
}
| void StdMeshersGUI_StdHypothesisCreator::valueChanged | ( | QWidget * | paramWidget | ) | [protected, virtual] |
Update widgets dependent on paramWidget.
Reimplemented from SMESHGUI_GenericHypothesisCreator.
Definition at line 1468 of file StdMeshersGUI_StdHypothesisCreator.cxx.
References getWidgetForParam(), SMESHGUI_GenericHypothesisCreator.hypType(), and SMESHGUI_GenericHypothesisCreator.initParamsHypothesis().
Referenced by StdMeshersGUI_NbSegmentsCreator.buildFrame().
{
if ( hypType() == "MaxLength" && paramWidget == getWidgetForParam(1) )
{
getWidgetForParam(0)->setEnabled( !widget< QCheckBox >( 1 )->isChecked() );
if ( !getWidgetForParam(0)->isEnabled() ) {
StdMeshers::StdMeshers_MaxLength_var h =
StdMeshers::StdMeshers_MaxLength::_narrow( initParamsHypothesis() );
widget< QtxDoubleSpinBox >( 0 )->setValue( h->GetPreestimatedLength() );
}
}
else if ( hypType().startsWith("ImportSource") && paramWidget == getWidgetForParam(1) )
{
QCheckBox* toCopyMesh = (QCheckBox*) paramWidget;
QCheckBox* toCopyGroups = widget< QCheckBox >( 2 );
if ( !toCopyMesh->isChecked() )
{
toCopyGroups->setChecked( false );
toCopyGroups->setEnabled( false );
}
else
{
toCopyGroups->setEnabled( true );
}
}
}
| T* StdMeshersGUI_StdHypothesisCreator.widget | ( | int | i | ) | const [protected] |
Definition at line 68 of file StdMeshersGUI_StdHypothesisCreator.h.
Referenced by getParamFromCustomWidget().
{
return dynamic_cast< T* >( getWidgetForParam( i ));
}
| const SMESHGUI_GenericHypothesisCreator::ListOfWidgets & SMESHGUI_GenericHypothesisCreator::widgets | ( | ) | const [protected, inherited] |
Definition at line 444 of file SMESHGUI_Hypotheses.cxx.
References SMESHGUI_GenericHypothesisCreator.myParamWidgets.
Referenced by SMESHGUI_GenericHypothesisCreator.checkParams(), SMESHGUI_GenericHypothesisCreator.getStdParamFromDlg(), SMESHGUI_GenericHypothesisCreator.getVariablesFromDlg(), and getWidgetForParam().
{
return myParamWidgets;
}
Definition at line 72 of file StdMeshersGUI_StdHypothesisCreator.h.
Referenced by customWidgets(), getWidgetForParam(), and retrieveParams().