Version: 6.3.1
Signals | Public Member Functions | Protected Types | Protected Slots | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

StdMeshersGUI_NbSegmentsCreator Class Reference

#include <StdMeshersGUI_NbSegmentsCreator.h>

Inheritance diagram for StdMeshersGUI_NbSegmentsCreator:
Inheritance graph
[legend]

Signals

void finished (int)

Public Member Functions

 StdMeshersGUI_NbSegmentsCreator ()
virtual ~StdMeshersGUI_NbSegmentsCreator ()
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< StdParamListOfStdParams
typedef QList< QWidget * > ListOfWidgets

Protected Slots

virtual void onValueChanged ()

Protected Member Functions

virtual QFramebuildFrame ()
 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 QWidgetgetCustomWidget (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 QWidgetgetWidgetForParam (int paramIndex) const
 Return widget for i-th hypothesis parameter (got from myParamWidgets)
virtual ListOfWidgetscustomWidgets () 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 ListOfWidgetswidgets () const
ListOfWidgetschangeWidgets ()
QtxDialogdlg () const
QFramebuildStdFrame ()
bool getStdParamFromDlg (ListOfStdParams &) const
virtual QStringList getVariablesFromDlg () const

Static Protected Member Functions

static QString stdParamValues (const ListOfStdParams &)

Protected Attributes

ListOfWidgets myCustomWidgets

Private Member Functions

bool readParamsFromHypo (NbSegmentsHypothesisData &) const
bool readParamsFromWidgets (NbSegmentsHypothesisData &) const
bool storeParamsToHypo (const NbSegmentsHypothesisData &) const

Private Attributes

SalomeApp_IntSpinBox * myNbSeg
QtxComboBox * myDistr
SMESHGUI_SpinBoxmyScale
StdMeshersGUI_DistrTableFramemyTable
StdMeshersGUI_DistrPreviewmyPreview
QLineEdit * myName
QLineEdit * myExpr
QGroupBoxmyConvBox
QButtonGroup * myConv
QLabel * myLScale
QLabel * myLTable
QLabel * myLExpr
QLabel * myInfo
QGridLayout * myGroupLayout
int myTableRow
int myPreviewRow
QGroupBoxmyReversedEdgesBox
StdMeshersGUI_SubShapeSelectorWdgmyDirectionWidget

Detailed Description

Definition at line 60 of file StdMeshersGUI_NbSegmentsCreator.h.


Member Typedef Documentation

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.


Constructor & Destructor Documentation

StdMeshersGUI_NbSegmentsCreator::StdMeshersGUI_NbSegmentsCreator ( )

Definition at line 60 of file StdMeshersGUI_NbSegmentsCreator.cxx.

: StdMeshersGUI_StdHypothesisCreator( "NumberOfSegments" ),
  myNbSeg( 0 ),
  myDistr( 0 ),
  myScale( 0 ),
  myTable( 0 ),
  myPreview( 0 ),
  myExpr( 0 ),
  myConvBox( 0 ),
  myConv( 0 ),
  myLScale( 0 ),
  myLTable( 0 ),
  myLExpr( 0 ),
  myInfo( 0 ),
  myGroupLayout( 0 ),
  myTableRow( 0 ),
  myPreviewRow( 0 )
{
}
StdMeshersGUI_NbSegmentsCreator::~StdMeshersGUI_NbSegmentsCreator ( ) [virtual]

Definition at line 80 of file StdMeshersGUI_NbSegmentsCreator.cxx.

{
}

Member Function Documentation

void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget ( QWidget w,
const int   
) const [protected, virtual, inherited]

tune "standard" control

Parameters:
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_NbSegmentsCreator::buildFrame ( ) [protected, virtual]

Builds dlg layout.

Return values:
QFrame*- the built widget

Reimplemented from StdMeshersGUI_StdHypothesisCreator.

Definition at line 98 of file StdMeshersGUI_NbSegmentsCreator.cxx.

References SMESHGUI_GenericHypothesisCreator.getMainShapeEntry(), SMESHGUI_GenericHypothesisCreator.getShapeEntry(), SMESHGUI_GenericHypothesisCreator.hypothesis(), SMESHGUI_GenericHypothesisCreator.isCreation(), MARGIN, myConv, myConvBox, myDirectionWidget, myDistr, myExpr, myGroupLayout, myInfo, myLExpr, myLScale, myName, myNbSeg, myPreview, myReversedEdgesBox, myScale, myTable, onValueChanged(), SMESHGUI_SpinBox.RangeStepAndValidator(), StdMeshersGUI_SubShapeSelectorWdg.SetGeomShapeEntry(), StdMeshersGUI_SubShapeSelectorWdg.SetListOfIDs(), StdMeshersGUI_SubShapeSelectorWdg.SetMainShapeEntry(), SPACING, and StdMeshersGUI_StdHypothesisCreator.valueChanged().

{
  QFrame* fr = new QFrame();
  fr->setMinimumWidth(460);

  QVBoxLayout* lay = new QVBoxLayout( fr );
  lay->setMargin( 0 );
  lay->setSpacing( SPACING );

  QGroupBox* GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), fr );
  lay->addWidget( GroupC1 );

  StdMeshers::StdMeshers_NumberOfSegments_var h =
    StdMeshers::StdMeshers_NumberOfSegments::_narrow( hypothesis() );

  myGroupLayout = new QGridLayout( GroupC1 );
  myGroupLayout->setSpacing( SPACING );
  myGroupLayout->setMargin( MARGIN );
  myGroupLayout->setColumnStretch( 0, 0 );
  myGroupLayout->setColumnStretch( 1, 1 );

  int row = 0;
  // 0)  name
  myName = 0;
  if( isCreation() )
  {
    myName = new QLineEdit( GroupC1 );
    myGroupLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), GroupC1 ), row, 0 );
    myGroupLayout->addWidget( myName, row, 1 );
    row++;
  }


  // 1)  number of segments
  myGroupLayout->addWidget( new QLabel( tr( "SMESH_NB_SEGMENTS_PARAM" ), GroupC1 ), row, 0 );
  myNbSeg = new SalomeApp_IntSpinBox( GroupC1 );
  myNbSeg->setMinimum( 1 );
  myNbSeg->setMaximum( 9999 );
  myGroupLayout->addWidget( myNbSeg, row, 1 );
  row++;

  
  // 2)  type of distribution
  myGroupLayout->addWidget( new QLabel( tr( "SMESH_DISTR_TYPE" ), GroupC1 ), row, 0 );
  myDistr = new QtxComboBox( GroupC1 );
  QStringList types;
  types.append( tr( "SMESH_DISTR_REGULAR" ) );
  types.append( tr( "SMESH_DISTR_SCALE"   ) );
  types.append( tr( "SMESH_DISTR_TAB"     ) );
  types.append( tr( "SMESH_DISTR_EXPR"    ) );
  myDistr->addItems( types );
  myGroupLayout->addWidget( myDistr, row, 1 );
  row++;

  
  // 3)  scale
  myGroupLayout->addWidget( myLScale = new QLabel( tr( "SMESH_NB_SEGMENTS_SCALE_PARAM" ), GroupC1 ), row, 0 );
  myScale = new SMESHGUI_SpinBox( GroupC1 );
  myScale->RangeStepAndValidator( 1E-5, 1E+5, 0.1, "parametric_precision" );
  myGroupLayout->addWidget( myScale, row, 1 );
  row++;

  
  // 4) Distribution definition
  QGridLayout* myDistLayout = new QGridLayout(GroupC1);
  myGroupLayout->addLayout( myDistLayout, row, 0, 1, 2 );
  myGroupLayout->setRowStretch( row, 1 );
  row ++;

       // a)  expression
  QHBoxLayout* myExprLayout = new QHBoxLayout(GroupC1);
  myExprLayout->addWidget( myLExpr = new QLabel( "f(t)=", GroupC1 ), 0);
  myExpr = new QLineEdit( GroupC1 );
  myExprLayout->addWidget( myExpr,1);
  myDistLayout->addLayout(myExprLayout,1 ,0);
  myDistLayout->setRowStretch(2, 1);

       // b)  warning
  myInfo = new QLabel( tr( "SMESH_FUNC_DOMAIN" ), GroupC1 );
  myDistLayout->addWidget( myInfo, 0, 0, 1, 2);
  
       // c)  table
  myTable = new StdMeshersGUI_DistrTableFrame( GroupC1 );
  myDistLayout->addWidget( myTable, 1, 0, 2, 1 );

       // d) preview
  myPreview = new StdMeshersGUI_DistrPreview( GroupC1, h.in() );  
  myPreview->setMinimumHeight(220);
  myDistLayout->addWidget( myPreview, 1, 1, 2, 1 );
  
  // 5)  conversion (radiogroup)
  myConvBox = new QGroupBox( tr( "SMESH_CONV_MODE" ), GroupC1 );
  myConv = new QButtonGroup( GroupC1 );

  QHBoxLayout* convLay = new QHBoxLayout( myConvBox );
  convLay->setMargin( MARGIN );
  convLay->setSpacing( SPACING );

  QRadioButton* rbExp = new QRadioButton( tr( "SMESH_EXP_MODE" ), myConvBox );
  QRadioButton* myCutNeg = new QRadioButton( tr( "SMESH_CUT_NEG_MODE" ), myConvBox );

  convLay->addWidget( rbExp );
  convLay->addWidget( myCutNeg );
  myConv->addButton( rbExp, 0 );
  myConv->addButton( myCutNeg, 1 );

  myGroupLayout->addWidget( myConvBox, row, 0, 1, 2 );
  row++;


  // 6) reverse edge parameters
  myReversedEdgesBox = new QGroupBox(tr( "SMESH_REVERSED_EDGES" ), fr);
  QHBoxLayout* edgeLay = new QHBoxLayout( myReversedEdgesBox );

  myDirectionWidget = new StdMeshersGUI_SubShapeSelectorWdg( myReversedEdgesBox );
  QString aGeomEntry = getShapeEntry();
  QString aMainEntry = getMainShapeEntry();
  if ( aGeomEntry == "" )
    aGeomEntry = h->GetObjectEntry();
  myDirectionWidget->SetGeomShapeEntry( aGeomEntry );
  myDirectionWidget->SetMainShapeEntry( aMainEntry );
  myDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
  edgeLay->addWidget( myDirectionWidget );

  lay->addWidget( myReversedEdgesBox );
  lay->setStretchFactor( GroupC1, 2);
  lay->setStretchFactor( myReversedEdgesBox, 1);
  
  connect( myNbSeg, SIGNAL( valueChanged( const QString& ) ), this, SLOT( onValueChanged() ) );
  connect( myDistr, SIGNAL( activated( int ) ), this, SLOT( onValueChanged() ) );
  connect( myTable, SIGNAL( valueChanged( int, int ) ), this, SLOT( onValueChanged() ) );
  connect( myExpr,  SIGNAL( textChanged( const QString& ) ), this, SLOT( onValueChanged() ) );
  connect( myConv,  SIGNAL( buttonClicked( int ) ), this, SLOT( onValueChanged() ) );

  return fr;
}
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 StdMeshersGUI_StdHypothesisCreator.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, inherited]

Return dlg title.

Return values:
QString- title string

Reimplemented from SMESHGUI_GenericHypothesisCreator.

Definition at line 1278 of file StdMeshersGUI_StdHypothesisCreator.cxx.

References SMESHGUI_GenericHypothesisCreator.hypType(), and StdMeshersGUI_StdHypothesisCreator.hypTypeName().

{
  return tr( QString( "SMESH_%1_TITLE" ).arg( hypTypeName( hypType() ) ).toLatin1().data() );
}
SMESHGUI_GenericHypothesisCreator::ListOfWidgets & SMESHGUI_GenericHypothesisCreator::changeWidgets ( ) [protected, inherited]
bool StdMeshersGUI_NbSegmentsCreator::checkParams ( QString &  msg) const [virtual]

Check parameter values before accept()

Return values:
bool- true if OK

Reimplemented from StdMeshersGUI_StdHypothesisCreator.

Definition at line 84 of file StdMeshersGUI_NbSegmentsCreator.cxx.

References SMESHGUI_GenericHypothesisCreator.checkParams(), myNbSeg, myScale, readParamsFromHypo(), readParamsFromWidgets(), SMESH_AdvancedEditor.res, and storeParamsToHypo().

{
  if( !SMESHGUI_GenericHypothesisCreator::checkParams( msg ) )
    return false;
  NbSegmentsHypothesisData data_old, data_new;
  readParamsFromHypo( data_old );
  readParamsFromWidgets( data_new );
  bool res = storeParamsToHypo( data_new );
  storeParamsToHypo( data_old );
  res = myNbSeg->isValid( msg, true ) && res;
  res = myScale->isValid( msg, true ) && res;
  return res;
}
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, inherited]

Allow modifing myCustomWidgets in const methods.

Return values:
ListOfWidgets*- non-const pointer to myCustomWidgets

Definition at line 128 of file StdMeshersGUI_StdHypothesisCreator.cxx.

References StdMeshersGUI_StdHypothesisCreator.myCustomWidgets.

Referenced by StdMeshersGUI_StdHypothesisCreator.checkParams(), StdMeshersGUI_StdHypothesisCreator.getCustomWidget(), StdMeshersGUI_StdHypothesisCreator.onReject(), and StdMeshersGUI_StdHypothesisCreator.stdParams().

{
  return const_cast< ListOfWidgets* >( & myCustomWidgets );
}
QtxDialog * SMESHGUI_GenericHypothesisCreator::dlg ( ) const [protected, inherited]
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, inherited]

Reimplemented from SMESHGUI_GenericHypothesisCreator.

Definition at line 1359 of file StdMeshersGUI_StdHypothesisCreator.cxx.

References StdMeshersGUI_StdHypothesisCreator.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 buildFrame(), and StdMeshersGUI_StdHypothesisCreator.stdParams().

{ return myMainShapeEntry; }
bool StdMeshersGUI_StdHypothesisCreator::getParamFromCustomWidget ( StdParam param,
QWidget widget 
) const [protected, virtual, inherited]

Set param value taken from a custom widget.

Parameters:
param- SMESHGUI_GenericHypothesisCreator.StdParam structure
widget- widget presenting param
Return values:
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 StdMeshersGUI_StdHypothesisCreator.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 buildFrame(), and StdMeshersGUI_StdHypothesisCreator.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 StdMeshersGUI_StdHypothesisCreator.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 StdMeshersGUI_StdHypothesisCreator.storeParams().

{
  QStringList aResult;
  ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
  for( ; anIt!=aLast; anIt++ ) {
    if( (*anIt)->inherits( "QAbstractSpinBox" ) ) {
      QAbstractSpinBox* sb = ( QAbstractSpinBox* )( *anIt );
      aResult.append(sb->text());
    }
  }
  return aResult;
}
QWidget * StdMeshersGUI_StdHypothesisCreator::getWidgetForParam ( int  i) const [protected, virtual, inherited]

Return widget for i-th hypothesis parameter (got from myParamWidgets)

Parameters:
i- index of hypothesis parameter
Return values:
QWidget*- found widget

Definition at line 96 of file StdMeshersGUI_StdHypothesisCreator.cxx.

References SMESHGUI_GenericHypothesisCreator.isCreation(), StdMeshersGUI_StdHypothesisCreator.myCustomWidgets, and SMESHGUI_GenericHypothesisCreator.widgets().

Referenced by StdMeshersGUI_StdHypothesisCreator.storeParams(), and StdMeshersGUI_StdHypothesisCreator.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]
SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::hypothesis ( ) const [protected, inherited]
QString SMESHGUI_GenericHypothesisCreator::hypType ( ) const [inherited]
QString StdMeshersGUI_StdHypothesisCreator::hypTypeName ( const QString &  t) const [protected, virtual, inherited]

String to insert in "SMESH_%1_HYPOTHESIS" to get hypothesis type name from message resouce file.

Parameters:
t- hypothesis type
Return values:
QString- result string

Definition at line 1317 of file StdMeshersGUI_StdHypothesisCreator.cxx.

References SMESH_AdvancedEditor.res.

Referenced by StdMeshersGUI_StdHypothesisCreator.caption(), StdMeshersGUI_StdHypothesisCreator.icon(), and StdMeshersGUI_StdHypothesisCreator.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, inherited]

return pixmap for dlg icon

Return values:
QPixmap-

Reimplemented from SMESHGUI_GenericHypothesisCreator.

Definition at line 1290 of file StdMeshersGUI_StdHypothesisCreator.cxx.

References SMESHGUI_GenericHypothesisCreator.hypType(), StdMeshersGUI_StdHypothesisCreator.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.

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 readParamsFromHypo(), StdMeshersGUI_StdHypothesisCreator.stdParams(), StdMeshersGUI_StdHypothesisCreator.storeParams(), and StdMeshersGUI_StdHypothesisCreator.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, inherited]

Definition at line 1501 of file StdMeshersGUI_StdHypothesisCreator.cxx.

References SMESHGUI_GenericHypothesisCreator.StdParam.isVariable, and SMESHGUI_GenericHypothesisCreator.StdParam.myValue.

Referenced by StdMeshersGUI_StdHypothesisCreator.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]
void StdMeshersGUI_StdHypothesisCreator::onReject ( ) [protected, virtual, inherited]

called when operation cancelled

Reimplemented from SMESHGUI_GenericHypothesisCreator.

Definition at line 1452 of file StdMeshersGUI_StdHypothesisCreator.cxx.

References StdMeshersGUI_StdHypothesisCreator.customWidgets(), and SMESHGUI_GenericHypothesisCreator.hypType().

{
  if ( hypType().startsWith("ProjectionSource" ) ||
       hypType().startsWith("ImportSource" ))
  {
    // Uninstall filters of StdMeshersGUI_ObjectReferenceParamWdg
    deactivateObjRefParamWdg( customWidgets() );
  }
}
void StdMeshersGUI_NbSegmentsCreator::onValueChanged ( ) [protected, virtual, slot]

Reimplemented from SMESHGUI_GenericHypothesisCreator.

Definition at line 419 of file StdMeshersGUI_NbSegmentsCreator.cxx.

References SMESH_demo_hexa2_upd.a, StdMeshersGUI_DistrTableFrame.data(), SMESHGUI_GenericHypothesisCreator.dlg(), myConv, myConvBox, myDirectionWidget, myDistr, myExpr, myGroupLayout, myInfo, myLExpr, myLScale, myNbSeg, myPreview, myReversedEdgesBox, myScale, myTable, StdMeshersGUI_DistrPreview.setConversion(), StdMeshersGUI_DistrTableFrame.setData(), StdMeshersGUI_DistrTableFrame.setFuncMinValue(), StdMeshersGUI_DistrPreview.setParams(), and StdMeshersGUI_SubShapeSelectorWdg.showPreview().

Referenced by buildFrame().

{
  int distr = myDistr->currentIndex();

/*  if( distr==2 ) //table func
    myCutNeg->setText( tr( "SMESH_NO_CONV" ) );
  else if( distr==3 )
    myCutNeg->setText( tr( "SMESH_CUT_NEG_MODE" ) );*/

  if( distr==2 && sender()==myConv ) //table func
  {
    myTable->setFuncMinValue( myConv->checkedId()==0 ? -1E20 : 0 );
    SMESH::double_array arr;
    myTable->data( arr );
    myTable->setData( arr ); //update data in table
  }

  myScale->setShown( distr==1 );
  myLScale->setShown( distr==1 );
  myReversedEdgesBox->setShown( !distr==0 );
  myDirectionWidget->showPreview( !distr==0 );

  bool isFunc = distr==2 || distr==3;
  myPreview->setShown( isFunc );
  myConvBox->setShown( isFunc );
  
  myTable->setShown( distr==2 );
  myExpr->setShown( distr==3 );
  myLExpr->setShown( distr==3 );
  myInfo->setShown( distr==3);

  //change of preview
  int nbSeg = myNbSeg->value();
  if( distr==2 ) //preview for table-described function
  {
    SMESH::double_array a;
    myTable->data( a );
    myPreview->setParams( a, nbSeg, false );
  }
  else if( distr==3 ) //preview for analytic-described function
    myPreview->setParams( myExpr->text(), nbSeg, 100, false );

  if( isFunc )
    myPreview->setConversion( StdMeshersGUI_DistrPreview::Conversion( myConv->checkedId() ) );

  if ( (QtxComboBox*)sender() == myDistr && dlg() ) {
    QApplication::instance()->processEvents();
    myGroupLayout->invalidate();
    dlg()->layout()->invalidate();
    dlg()->updateGeometry();
    dlg()->setMinimumSize( dlg()->minimumSizeHint() );
    dlg()->resize( dlg()->minimumSize() );
    QApplication::instance()->processEvents();
  }
}
bool StdMeshersGUI_NbSegmentsCreator::readParamsFromHypo ( NbSegmentsHypothesisData h_data) const [private]

Definition at line 312 of file StdMeshersGUI_NbSegmentsCreator.cxx.

References SMESH_demo_hexa2_upd.a, SMESHGUI_GenericHypothesisCreator.hypName(), SMESHGUI_GenericHypothesisCreator.initParamsHypothesis(), NbSegmentsHypothesisData.myConv, NbSegmentsHypothesisData.myDistrType, NbSegmentsHypothesisData.myExpr, NbSegmentsHypothesisData.myName, NbSegmentsHypothesisData.myNbSeg, NbSegmentsHypothesisData.myNbSegVarName, NbSegmentsHypothesisData.myScale, NbSegmentsHypothesisData.myScaleVarName, and NbSegmentsHypothesisData.myTable.

Referenced by checkParams(), and retrieveParams().

{
  StdMeshers::StdMeshers_NumberOfSegments_var h =
    StdMeshers::StdMeshers_NumberOfSegments::_narrow( initParamsHypothesis() );

  h_data.myName = hypName();

  h_data.myNbSeg = (int) h->GetNumberOfSegments();
  
  SMESH::ListOfParameters_var aParameters = h->GetLastParameters();

  h_data.myNbSegVarName  = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");

  int distr = (int) h->GetDistrType();
  h_data.myDistrType = distr;
  h_data.myScale = distr==1 ? h->GetScaleFactor() : 1.0;
  
  if(distr==1){
    h_data.myScaleVarName  = (aParameters->length() > 1) ? QString(aParameters[1].in()) : QString("");
  }
  else 
    h_data.myScaleVarName = QString("");

  if( distr==2 )
  {
    SMESH::double_array* a = h->GetTableFunction();
    h_data.myTable = *a;
    delete a;
  }
  else
  {
    SMESH::double_array& a = h_data.myTable;
    // by default, constant table function f(t)=1
    a.length( 4 );
    a[0] = 0.0; a[1] = 1.0;
    a[2] = 1.0; a[3] = 1.0; 
  }

  h_data.myExpr = distr==3 ? h->GetExpressionFunction() : "1";
  h_data.myConv = distr==2 || distr==3 ? h->ConversionMode() : 1; /*cut negative by default*/

  return true;
}
bool StdMeshersGUI_NbSegmentsCreator::readParamsFromWidgets ( NbSegmentsHypothesisData h_data) const [private]
void StdMeshersGUI_NbSegmentsCreator::retrieveParams ( ) const [protected, virtual]
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]
bool StdMeshersGUI_StdHypothesisCreator::stdParams ( ListOfStdParams p) const [protected, virtual, inherited]

Return parameter values as SMESHGUI_GenericHypothesisCreator.StdParam.

Parameters:
p- list of parameters
Return values:
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 StdMeshersGUI_StdHypothesisCreator.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(), StdMeshersGUI_StdHypothesisCreator.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 StdMeshersGUI_StdHypothesisCreator.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_NbSegmentsCreator::storeParams ( ) const [protected, virtual]

Store params from GUI controls to a hypothesis.

Return values:
QString- text representation of parameters

< equidistant distribution

< scale distribution

< distribution with density function presented by table

< distribution with density function presented by expression

Reimplemented from StdMeshersGUI_StdHypothesisCreator.

Definition at line 261 of file StdMeshersGUI_NbSegmentsCreator.cxx.

References NbSegmentsHypothesisData.myConv, NbSegmentsHypothesisData.myDistrType, NbSegmentsHypothesisData.myExpr, NbSegmentsHypothesisData.myNbSeg, NbSegmentsHypothesisData.myScale, NbSegmentsHypothesisData.myTable, readParamsFromWidgets(), and storeParamsToHypo().

{
  NbSegmentsHypothesisData data;
  readParamsFromWidgets( data );
  storeParamsToHypo( data );
    
  QString valStr = QString::number( data.myNbSeg ) += "; ";

  enum DistrType
  {
    Regular, 
    Scale,   
    TabFunc, 
    ExprFunc 
  };
  bool hasConv = false;
  switch ( data.myDistrType ) {
  case Regular :
    valStr += tr("SMESH_DISTR_REGULAR");
    break;
  case Scale   : 
    valStr += tr("SMESH_NB_SEGMENTS_SCALE_PARAM") + " = " + QString::number( data.myScale );\
    break;
  case TabFunc : {
    //valStr += tr("SMESH_TAB_FUNC");
    bool param = true;
    for( int i=0; i < data.myTable.length(); i++, param = !param ) {
      if ( param )
        valStr += "[";
      valStr += QString::number( data.myTable[ i ]);
      valStr += ( param ? "," : "]" );
    }
    hasConv = true;
    break;
  }
  case ExprFunc:
    valStr += data.myExpr;
    hasConv = true;
    break;
  }
  if ( hasConv )
  {
    if ( data.myConv )
      valStr += "; " + tr("SMESH_CUT_NEG_MODE");
    else
      valStr += "; " + tr("SMESH_EXP_MODE");
  }

  return valStr;
}
bool StdMeshersGUI_NbSegmentsCreator::storeParamsToHypo ( const NbSegmentsHypothesisData h_data) const [private]

Definition at line 356 of file StdMeshersGUI_NbSegmentsCreator.cxx.

References StdMeshersGUI_SubShapeSelectorWdg.GetListOfIDs(), StdMeshersGUI_SubShapeSelectorWdg.GetMainShapeEntry(), SMESHGUI_GenericHypothesisCreator.hypothesis(), SMESHGUI_GenericHypothesisCreator.isCreation(), NbSegmentsHypothesisData.myConv, myDirectionWidget, NbSegmentsHypothesisData.myDistrType, NbSegmentsHypothesisData.myExpr, NbSegmentsHypothesisData.myName, NbSegmentsHypothesisData.myNbSeg, NbSegmentsHypothesisData.myNbSegVarName, NbSegmentsHypothesisData.myScale, NbSegmentsHypothesisData.myScaleVarName, NbSegmentsHypothesisData.myTable, and batchmode_smesh.SetName().

Referenced by checkParams(), and storeParams().

{
  StdMeshers::StdMeshers_NumberOfSegments_var h =
    StdMeshers::StdMeshers_NumberOfSegments::_narrow( hypothesis() );

  bool ok = true;
  try
  {
    if( isCreation() )
      SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().data() );

    QStringList aVariablesList;
    aVariablesList.append(h_data.myNbSegVarName);

    h->SetNumberOfSegments( h_data.myNbSeg );
    int distr = h_data.myDistrType;
    h->SetDistrType( distr );
    
    if( distr==1 ) {
      h->SetScaleFactor( h_data.myScale );
      aVariablesList.append(h_data.myScaleVarName);
    }
    if( distr==2 || distr==3 )
      h->SetConversionMode( h_data.myConv );

    if( distr==1 || distr==2 || distr==3 ) {
      h->SetReversedEdges( myDirectionWidget->GetListOfIDs() );
      h->SetObjectEntry( myDirectionWidget->GetMainShapeEntry() );
    }

    if( distr==2 )
      h->SetTableFunction( h_data.myTable );

    if( distr==3 )
      h->SetExpressionFunction( h_data.myExpr.toLatin1().data() );
    //setting of function must follow after setConversionMode, because otherwise
    //the function will be checked with old conversion mode, so that it may occurs
    //unexpected errors for user

    h->SetParameters(aVariablesList.join(":").toLatin1().constData());
  }
  catch(const SALOME::SALOME_Exception& ex)
  {
    SalomeApp_Tools::QtCatchCorbaException(ex);
    ok = false;
  }
  return ok;
}
QString StdMeshersGUI_StdHypothesisCreator::type ( ) const [protected, virtual, inherited]

Return hypothesis type name to show in dlg.

Return values:
QString-

Reimplemented from SMESHGUI_GenericHypothesisCreator.

Definition at line 1303 of file StdMeshersGUI_StdHypothesisCreator.cxx.

References SMESHGUI_GenericHypothesisCreator.hypType(), and StdMeshersGUI_StdHypothesisCreator.hypTypeName().

{
  return tr( QString( "SMESH_%1_HYPOTHESIS" ).arg( hypTypeName( hypType() ) ).toLatin1().data() );
}
void StdMeshersGUI_StdHypothesisCreator::valueChanged ( QWidget paramWidget) [protected, virtual, inherited]

Update widgets dependent on paramWidget.

Reimplemented from SMESHGUI_GenericHypothesisCreator.

Definition at line 1468 of file StdMeshersGUI_StdHypothesisCreator.cxx.

References StdMeshersGUI_StdHypothesisCreator.getWidgetForParam(), SMESHGUI_GenericHypothesisCreator.hypType(), and SMESHGUI_GenericHypothesisCreator.initParamsHypothesis().

Referenced by 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 );
    }
  }
}
template<class T >
T* StdMeshersGUI_StdHypothesisCreator.widget ( int  i) const [protected, inherited]

Definition at line 68 of file StdMeshersGUI_StdHypothesisCreator.h.

Referenced by StdMeshersGUI_StdHypothesisCreator.getParamFromCustomWidget().

                           {
    return dynamic_cast< T* >( getWidgetForParam( i ));
  }
const SMESHGUI_GenericHypothesisCreator::ListOfWidgets & SMESHGUI_GenericHypothesisCreator::widgets ( ) const [protected, inherited]

Field Documentation

QButtonGroup* StdMeshersGUI_NbSegmentsCreator.myConv [private]

Definition at line 90 of file StdMeshersGUI_NbSegmentsCreator.h.

Referenced by buildFrame(), and onValueChanged().

Definition at line 98 of file StdMeshersGUI_NbSegmentsCreator.h.

Referenced by buildFrame(), onValueChanged(), and storeParamsToHypo().

Definition at line 93 of file StdMeshersGUI_NbSegmentsCreator.h.

Referenced by buildFrame(), and onValueChanged().

Definition at line 92 of file StdMeshersGUI_NbSegmentsCreator.h.

Referenced by buildFrame(), and onValueChanged().

Definition at line 92 of file StdMeshersGUI_NbSegmentsCreator.h.

Referenced by buildFrame(), and onValueChanged().

Definition at line 92 of file StdMeshersGUI_NbSegmentsCreator.h.

Referenced by buildFrame(), and onValueChanged().

Definition at line 92 of file StdMeshersGUI_NbSegmentsCreator.h.

SalomeApp_IntSpinBox* StdMeshersGUI_NbSegmentsCreator.myNbSeg [private]

Definition at line 88 of file StdMeshersGUI_NbSegmentsCreator.h.

Referenced by buildFrame(), and onValueChanged().

Definition at line 94 of file StdMeshersGUI_NbSegmentsCreator.h.

Definition at line 96 of file StdMeshersGUI_NbSegmentsCreator.h.

Referenced by buildFrame(), and onValueChanged().

Definition at line 94 of file StdMeshersGUI_NbSegmentsCreator.h.

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS