Salome HOME
22355: EDF SMESH: New 1D hypothesis "Adaptive"
[modules/smesh.git] / src / StdMeshersGUI / StdMeshersGUI_StdHypothesisCreator.cxx
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  File   : StdMeshersGUI_StdHypothesisCreator.cxx
23 //  Author : Alexander SOLOVYOV, Open CASCADE S.A.S.
24 //  SMESH includes
25
26 #include "StdMeshersGUI_StdHypothesisCreator.h"
27
28 #include <SMESHGUI.h>
29 #include <SMESHGUI_SpinBox.h>
30 #include <SMESHGUI_HypothesesUtils.h>
31 #include <SMESHGUI_Utils.h>
32 #include <SMESHGUI_GEOMGenUtils.h>
33
34 #include <SMESH_TypeFilter.hxx>
35 #include <SMESH_NumberFilter.hxx>
36
37 #include "StdMeshersGUI_FixedPointsParamWdg.h"
38 #include "StdMeshersGUI_LayerDistributionParamWdg.h"
39 #include "StdMeshersGUI_ObjectReferenceParamWdg.h"
40 #include "StdMeshersGUI_QuadrangleParamWdg.h"
41 #include "StdMeshersGUI_SubShapeSelectorWdg.h"
42 #include "StdMeshersGUI_RadioButtonsGrpWdg.h"
43
44 #include <SALOMEDSClient_Study.hxx>
45
46 #include <GEOM_wrap.hxx>
47
48 // SALOME GUI includes
49 #include <SUIT_ResourceMgr.h>
50
51 // IDL includes
52 #include <SALOMEconfig.h>
53 #include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
54 #include CORBA_SERVER_HEADER(SMESH_Mesh)
55 #include CORBA_SERVER_HEADER(SMESH_Group)
56
57 // Qt includes
58 #include <QHBoxLayout>
59 #include <QSlider>
60 #include <QLabel>
61 #include <QCheckBox>
62 #include <QButtonGroup>
63
64 const double VALUE_MAX = 1.0e+15, // COORD_MAX
65              VALUE_MAX_2  = VALUE_MAX * VALUE_MAX,
66              VALUE_MAX_3  = VALUE_MAX_2 * VALUE_MAX,
67              VALUE_SMALL = 1.0e-15,
68              VALUE_SMALL_2 = VALUE_SMALL * VALUE_SMALL,
69              VALUE_SMALL_3 = VALUE_SMALL_2 * VALUE_SMALL;
70
71 //================================================================================
72 /*!
73  * \brief Constructor
74   * \param type - hypothesis type
75  */
76 //================================================================================
77
78 StdMeshersGUI_StdHypothesisCreator::StdMeshersGUI_StdHypothesisCreator( const QString& type )
79 : SMESHGUI_GenericHypothesisCreator( type )
80 {
81 }
82
83 //================================================================================
84 /*!
85  * \brief Destructor
86  */
87 //================================================================================
88
89 StdMeshersGUI_StdHypothesisCreator::~StdMeshersGUI_StdHypothesisCreator()
90 {
91 }
92
93 //================================================================================
94 /*!
95  * \brief Return widget for i-th hypothesis parameter (got from myParamWidgets)
96   * \param i - index of hypothesis parameter
97   * \retval QWidget* - found widget
98  */
99 //================================================================================
100
101 QWidget* StdMeshersGUI_StdHypothesisCreator::getWidgetForParam( int i ) const
102 {
103   QWidget* w = 0;
104   if ( isCreation() ) ++i; // skip widget of 'name' parameter
105
106   if ( i < myCustomWidgets.count() ) {
107     QList<QWidget*>::const_iterator anIt  = myCustomWidgets.begin();
108     QList<QWidget*>::const_iterator aLast = myCustomWidgets.end();
109     for ( int j = 0 ; !w && anIt != aLast; ++anIt, ++j )
110       if ( i == j )
111         w = *anIt;
112   }
113   if ( !w ) {
114     // list has no at() const, so we iterate
115     QList<QWidget*>::const_iterator anIt  = widgets().begin();
116     QList<QWidget*>::const_iterator aLast = widgets().end();
117     for( int j = 0; !w && anIt!=aLast; anIt++, ++j ) {
118       if ( i == j )
119         w = *anIt;
120     }
121   }
122   return w;
123 }
124
125 //================================================================================
126 /*!
127  * \brief Allow modifing myCustomWidgets in const methods
128   * \retval ListOfWidgets* - non-const pointer to myCustomWidgets
129  */
130 //================================================================================
131
132 StdMeshersGUI_StdHypothesisCreator::ListOfWidgets*
133 StdMeshersGUI_StdHypothesisCreator::customWidgets() const
134 {
135   return const_cast< ListOfWidgets* >( & myCustomWidgets );
136 }
137
138 //================================================================================
139 /*!
140  * \brief Builds dlg layout
141   * \retval QFrame* - the built widget
142  */
143 //================================================================================
144
145 QFrame* StdMeshersGUI_StdHypothesisCreator::buildFrame()
146 {
147   return buildStdFrame();
148 }
149
150 //================================================================================
151 /*!
152  * \brief Initialise parameter values in controls
153  */
154 //================================================================================
155
156 void StdMeshersGUI_StdHypothesisCreator::retrieveParams() const
157 {
158   // buildStdFrame() sets values itself calling stdParams()
159
160   if ( hypType().startsWith("ProjectionSource" ))
161   {
162     // we use this method to connect depending custom widgets
163     StdMeshersGUI_ObjectReferenceParamWdg* widgetToActivate = 0;
164     ListOfWidgets::const_iterator anIt = myCustomWidgets.begin();
165     for ( ; anIt != myCustomWidgets.end(); anIt++)
166     {
167       if ( *anIt && (*anIt)->inherits("StdMeshersGUI_ObjectReferenceParamWdg"))
168       {
169         StdMeshersGUI_ObjectReferenceParamWdg * w1 =
170           ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
171         ListOfWidgets::const_iterator anIt2 = anIt;
172         for ( ++anIt2; anIt2 != myCustomWidgets.end(); anIt2++)
173           if ( *anIt2 && (*anIt2)->inherits("StdMeshersGUI_ObjectReferenceParamWdg"))
174           {
175             StdMeshersGUI_ObjectReferenceParamWdg * w2 =
176               ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt2 );
177             w1->AvoidSimultaneousSelection( w2 );
178           }
179         if ( !widgetToActivate )
180           widgetToActivate = w1;
181       }
182     }
183     if ( widgetToActivate )
184       widgetToActivate->activateSelection();
185   }
186
187   if ( dlg() )
188     dlg()->setMinimumSize( dlg()->minimumSizeHint().width(), dlg()->minimumSizeHint().height() );
189 }
190
191 namespace {
192
193   //================================================================================
194   /*!
195    * \brief Widget: slider with left and right labels
196    */
197   //================================================================================
198
199   class TDoubleSliderWith2Labels: public QWidget
200   {
201   public:
202     TDoubleSliderWith2Labels( const QString& leftLabel, const QString& rightLabel,
203                               const double   initValue, const double   bottom,
204                               const double   top      , const double   precision,
205                               QWidget *      parent=0 , const char *   name=0 )
206       :QWidget(parent), _bottom(bottom), _precision(precision)
207     {
208       setObjectName(name);
209
210       QHBoxLayout* aHBoxL = new QHBoxLayout(this);
211
212       if ( !leftLabel.isEmpty() ) {
213         QLabel* aLeftLabel = new QLabel( this );
214         aLeftLabel->setText( leftLabel );
215         aHBoxL->addWidget( aLeftLabel );
216       }
217
218       _slider = new QSlider( Qt::Horizontal, this );
219       _slider->setRange( 0, toInt( top ));
220       _slider->setValue( toInt( initValue ));
221       aHBoxL->addWidget( _slider );
222
223       if ( !rightLabel.isEmpty() ) {
224         QLabel* aRightLabel = new QLabel( this );
225         aRightLabel->setText( rightLabel );
226         aHBoxL->addWidget( aRightLabel );
227       }
228
229       setLayout( aHBoxL );
230     }
231     double value() const { return _bottom + _slider->value() * _precision; }
232     QSlider * getSlider() const { return _slider; }
233     int toInt( double val ) const { return (int) ceil(( val - _bottom ) / _precision ); }
234   private:
235     double _bottom, _precision;
236     QSlider * _slider;
237   };
238
239   //================================================================================
240   /*!
241    * \brief Retrieve GEOM_Object held by widget
242    */
243   //================================================================================
244
245   inline GEOM::GEOM_Object_var geomFromWdg(const QWidget* wdg)
246   {
247     const StdMeshersGUI_ObjectReferenceParamWdg * objRefWdg =
248       dynamic_cast<const StdMeshersGUI_ObjectReferenceParamWdg*>( wdg );
249     if ( objRefWdg )
250       return objRefWdg->GetObject< GEOM::GEOM_Object >();
251
252     return GEOM::GEOM_Object::_nil();
253   }
254   //================================================================================
255   /*!
256    * \brief Retrieve SMESH_Mesh held by widget
257    */
258   //================================================================================
259
260   inline SMESH::SMESH_Mesh_var meshFromWdg(const QWidget* wdg)
261   {
262     const StdMeshersGUI_ObjectReferenceParamWdg * objRefWdg =
263       dynamic_cast<const StdMeshersGUI_ObjectReferenceParamWdg*>( wdg );
264     if ( objRefWdg )
265       return objRefWdg->GetObject< SMESH::SMESH_Mesh >();
266
267     return SMESH::SMESH_Mesh::_nil();
268   }
269   //================================================================================
270   /*!
271    * \brief Retrieve SMESH_Mesh held by widget
272    */
273   //================================================================================
274
275   inline SMESH::ListOfGroups_var groupsFromWdg(const QWidget* wdg)
276   {
277     SMESH::ListOfGroups_var groups = new SMESH::ListOfGroups;
278     const StdMeshersGUI_ObjectReferenceParamWdg * objRefWdg =
279       dynamic_cast<const StdMeshersGUI_ObjectReferenceParamWdg*>( wdg );
280     if ( objRefWdg )
281     {
282       groups->length( objRefWdg->NbObjects() );
283       for ( unsigned i = 0; i < groups->length(); ++i )
284         groups[i] = objRefWdg->GetObject< SMESH::SMESH_GroupBase >(i);
285     }
286     return groups;
287   }
288   //================================================================================
289   /*!
290    * \brief creates a filter for selection of shapes of given dimension
291     * \param dim - dimension
292     * \param subShapeType - required type of sub-shapes, number of which must be \a nbSubShapes
293     * \param nbSubShapes - number of sub-shapes of given type
294     * \param closed - required closeness flag of a shape
295     * \retval SUIT_SelectionFilter* - created filter
296    */
297   //================================================================================
298
299   SUIT_SelectionFilter* filterForShapeOfDim(const int        dim,
300                                             TopAbs_ShapeEnum subShapeType = TopAbs_SHAPE,
301                                             const int        nbSubShapes = 0,
302                                             bool             closed = false)
303   {
304     TColStd_MapOfInteger shapeTypes;
305     switch ( dim ) {
306     case 0: shapeTypes.Add( TopAbs_VERTEX ); break;
307     case 1:
308       if ( subShapeType == TopAbs_SHAPE ) subShapeType = TopAbs_EDGE;
309       shapeTypes.Add( TopAbs_EDGE );
310       shapeTypes.Add( TopAbs_COMPOUND ); // for a group
311       break;
312     case 2:
313       if ( subShapeType == TopAbs_SHAPE ) subShapeType = TopAbs_FACE;
314       shapeTypes.Add( TopAbs_FACE );
315       shapeTypes.Add( TopAbs_COMPOUND ); // for a group
316       break;
317     case 3:
318       shapeTypes.Add( TopAbs_SHELL );
319       shapeTypes.Add( TopAbs_SOLID );
320       shapeTypes.Add( TopAbs_COMPSOLID );
321       shapeTypes.Add( TopAbs_COMPOUND );
322       break;
323     }
324     return new SMESH_NumberFilter("GEOM", subShapeType, nbSubShapes,
325                                   shapeTypes, GEOM::GEOM_Object::_nil(), closed);
326   }
327
328   //================================================================================
329   /*!
330    * \brief Create a widget for object selection
331     * \param object - initial object
332     * \param filter - selection filter
333     * \retval QWidget* - created widget
334    */
335   //================================================================================
336
337   QWidget* newObjRefParamWdg( SUIT_SelectionFilter* filter,
338                               CORBA::Object_var     object)
339   {
340     StdMeshersGUI_ObjectReferenceParamWdg* w =
341       new StdMeshersGUI_ObjectReferenceParamWdg( filter, 0);
342     w->SetObject( object.in() );
343     return w;
344   }
345   QWidget* newObjRefParamWdg( SUIT_SelectionFilter*    filter,
346                               SMESH::string_array_var& objEntries)
347   {
348     StdMeshersGUI_ObjectReferenceParamWdg* w =
349       new StdMeshersGUI_ObjectReferenceParamWdg( filter, 0, /*multiSel=*/true);
350     //RNV: Firstly, activate selection, then set objects
351     w->activateSelection();
352     w->SetObjects( objEntries );
353     return w;
354   }
355
356   //================================================================================
357   /*!
358    * \brief calls deactivateSelection() for StdMeshersGUI_ObjectReferenceParamWdg
359     * \param widgetList - list of widgets
360    */
361   //================================================================================
362
363   void deactivateObjRefParamWdg( QList<QWidget*>* widgetList )
364   {
365     StdMeshersGUI_ObjectReferenceParamWdg* w = 0;
366     QList<QWidget*>::iterator anIt  = widgetList->begin();
367     QList<QWidget*>::iterator aLast = widgetList->end();
368     for ( ; anIt != aLast; anIt++ ) {
369       if ( (*anIt) && (*anIt)->inherits( "StdMeshersGUI_ObjectReferenceParamWdg" ))
370       {
371         w = (StdMeshersGUI_ObjectReferenceParamWdg* )( *anIt );
372         w->deactivateSelection();
373       }
374     }
375   }
376 }
377
378 //================================================================================
379 /*!
380  * \brief Check parameter values before accept()
381   * \retval bool - true if OK
382  */
383 //================================================================================
384
385 bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg ) const
386 {
387   if( !SMESHGUI_GenericHypothesisCreator::checkParams( msg ) )
388     return false;
389
390   // check if object reference parameter is set, as it has no default value
391   bool ok = true;
392   if ( hypType().startsWith("ProjectionSource" ))
393   {
394     StdMeshersGUI_ObjectReferenceParamWdg* w =
395       widget< StdMeshersGUI_ObjectReferenceParamWdg >( 0 );
396     ok = ( w->IsObjectSelected() );
397     if ( !ok ) w->SetObject( CORBA::Object::_nil() );
398     int nbAssocVert = ( hypType() == "ProjectionSource1D" ? 1 : 2 );
399     int nbNonEmptyAssoc = 0;
400     for ( int i = 0; ok && i < nbAssocVert*2; i += 2)
401     {
402       QString srcV, tgtV;
403       StdMeshersGUI_ObjectReferenceParamWdg* w1 =
404         widget< StdMeshersGUI_ObjectReferenceParamWdg >( i+2 );
405       StdMeshersGUI_ObjectReferenceParamWdg* w2 =
406         widget< StdMeshersGUI_ObjectReferenceParamWdg >( i+3 );
407       srcV = w1->GetValue();
408       tgtV = w2->GetValue();
409       ok = (( srcV.isEmpty()  && tgtV.isEmpty() ) ||
410             ( !srcV.isEmpty() && !tgtV.isEmpty() && srcV != tgtV ));
411       if ( !ok ) {
412         w1->SetObject( CORBA::Object::_nil() );
413         w2->SetObject( CORBA::Object::_nil() );
414       }
415       nbNonEmptyAssoc += !srcV.isEmpty();
416     }
417     if ( ok && nbNonEmptyAssoc == 1 && nbAssocVert == 2 )
418     {
419       // only one pair of VERTEXes is given for a FACE,
420       // then the FACE must have only one VERTEX
421       GEOM::GEOM_Object_var face = w->GetObject< GEOM::GEOM_Object >();
422
423       GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
424       _PTR(Study)         aStudy = SMESH::GetActiveStudyDocument();
425       GEOM::GEOM_IShapesOperations_wrap shapeOp;
426       if ( !geomGen->_is_nil() && aStudy )
427         shapeOp = geomGen->GetIShapesOperations( aStudy->StudyId() );
428       if ( !shapeOp->_is_nil() )
429       {
430         GEOM::ListOfLong_var vertices =
431           shapeOp->GetAllSubShapesIDs (face, GEOM::VERTEX, /*isSorted=*/false);
432         ok = ( vertices->length() == 1 );
433       }
434     }
435     // Uninstall filters of StdMeshersGUI_ObjectReferenceParamWdg
436     if ( ok )
437       deactivateObjRefParamWdg( customWidgets() );
438   }
439   else if ( hypType().startsWith("ImportSource" ))
440   {
441     StdMeshersGUI_ObjectReferenceParamWdg* w =
442       widget< StdMeshersGUI_ObjectReferenceParamWdg >( 0 );
443     ok = ( w->IsObjectSelected() );
444   }
445   else if ( hypType() == "LayerDistribution" || hypType() == "LayerDistribution2D" )
446   {
447     StdMeshersGUI_LayerDistributionParamWdg* w = 
448       widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
449     ok = ( w && w->IsOk() );
450   }
451
452   return ok;
453 }
454
455 //================================================================================
456 /*!
457  * \brief Store params from GUI controls to a hypothesis
458   * \retval QString - text representation of parameters
459  */
460 //================================================================================
461
462 QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
463 {
464   ListOfStdParams params;
465   bool res = getStdParamFromDlg( params );
466   if( isCreation() )
467   {
468     SMESH::SetName( SMESH::FindSObject( hypothesis() ), params[0].myValue.toString().toLatin1().data() );
469     params.erase( params.begin() );
470   }
471
472   QString valueStr = stdParamValues( params );
473   //QStringList aVariablesList = getVariablesFromDlg();
474
475   if( res && !params.isEmpty() )
476   {
477     if( hypType()=="LocalLength" )
478     {
479       StdMeshers::StdMeshers_LocalLength_var h =
480         StdMeshers::StdMeshers_LocalLength::_narrow( hypothesis() );
481
482       h->SetVarParameter( params[0].text(), "SetLength" );
483       h->SetLength( params[0].myValue.toDouble() );
484       h->SetVarParameter( params[1].text(), "SetPrecision" );
485       h->SetPrecision( params[1].myValue.toDouble() );
486     }
487     else if( hypType()=="MaxLength" )
488     {
489       StdMeshers::StdMeshers_MaxLength_var h =
490         StdMeshers::StdMeshers_MaxLength::_narrow( hypothesis() );
491
492       h->SetVarParameter( params[0].text(), "SetLength" );
493       h->SetLength( params[0].myValue.toDouble() );
494       h->SetUsePreestimatedLength( widget< QCheckBox >( 1 )->isChecked() );
495       if ( !h->HavePreestimatedLength() && !h->_is_equivalent( initParamsHypothesis() )) {
496         StdMeshers::StdMeshers_MaxLength_var hInit =
497           StdMeshers::StdMeshers_MaxLength::_narrow( initParamsHypothesis() );
498         h->SetPreestimatedLength( hInit->GetPreestimatedLength() );
499       }
500     }
501     else if( hypType()=="SegmentLengthAroundVertex" )
502     {
503       StdMeshers::StdMeshers_SegmentLengthAroundVertex_var h =
504         StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hypothesis() );
505
506       h->SetVarParameter( params[0].text(), "SetLength" );
507       h->SetLength( params[0].myValue.toDouble() );
508     }
509     else if( hypType()=="Arithmetic1D" )
510     {
511       StdMeshers::StdMeshers_Arithmetic1D_var h =
512         StdMeshers::StdMeshers_Arithmetic1D::_narrow( hypothesis() );
513
514       StdMeshersGUI_SubShapeSelectorWdg* w = 
515         widget< StdMeshersGUI_SubShapeSelectorWdg >( 2 );
516
517       h->SetVarParameter( params[0].text(), "SetStartLength" );
518       h->SetStartLength( params[0].myValue.toDouble() );
519       h->SetVarParameter( params[1].text(), "SetEndLength" );
520       h->SetEndLength( params[1].myValue.toDouble() );
521       if (w) {
522         h->SetReversedEdges( w->GetListOfIDs() );
523         h->SetObjectEntry( w->GetMainShapeEntry() );
524       }
525     }
526     else if( hypType()=="FixedPoints1D" )
527     {
528       StdMeshers::StdMeshers_FixedPoints1D_var h =
529         StdMeshers::StdMeshers_FixedPoints1D::_narrow( hypothesis() );
530
531       StdMeshersGUI_FixedPointsParamWdg* w1 = 
532         widget< StdMeshersGUI_FixedPointsParamWdg >( 0 );
533
534       StdMeshersGUI_SubShapeSelectorWdg* w2 = 
535         widget< StdMeshersGUI_SubShapeSelectorWdg >( 1 );
536
537       if (w1) {
538         h->SetPoints( w1->GetListOfPoints() );
539         h->SetNbSegments( w1->GetListOfSegments() );
540       }
541       if (w2) {
542         h->SetReversedEdges( w2->GetListOfIDs() );
543         h->SetObjectEntry( w2->GetMainShapeEntry() );
544       }
545     }
546     else if( hypType()=="MaxElementArea" )
547     {
548       StdMeshers::StdMeshers_MaxElementArea_var h =
549         StdMeshers::StdMeshers_MaxElementArea::_narrow( hypothesis() );
550       h->SetVarParameter( params[0].text(), "SetMaxElementArea" );
551       h->SetMaxElementArea( params[0].myValue.toDouble() );
552     }
553     else if( hypType()=="MaxElementVolume" )
554     {
555       StdMeshers::StdMeshers_MaxElementVolume_var h =
556         StdMeshers::StdMeshers_MaxElementVolume::_narrow( hypothesis() );
557
558       h->SetVarParameter( params[0].text(), "SetMaxElementVolume" );
559       h->SetMaxElementVolume( params[0].myValue.toDouble() );
560     }
561     else if( hypType()=="StartEndLength" )
562     {
563       StdMeshers::StdMeshers_StartEndLength_var h =
564         StdMeshers::StdMeshers_StartEndLength::_narrow( hypothesis() );
565
566       StdMeshersGUI_SubShapeSelectorWdg* w = 
567         widget< StdMeshersGUI_SubShapeSelectorWdg >( 2 );
568
569       h->SetVarParameter( params[0].text(), "SetStartLength" );
570       h->SetStartLength( params[0].myValue.toDouble() );
571       h->SetVarParameter( params[1].text(), "SetEndLength" );
572       h->SetEndLength( params[1].myValue.toDouble() );
573       if (w) {
574         h->SetReversedEdges( w->GetListOfIDs() );
575         h->SetObjectEntry( w->GetMainShapeEntry() );
576       }
577     }
578     else if( hypType()=="Deflection1D" )
579     {
580       StdMeshers::StdMeshers_Deflection1D_var h =
581         StdMeshers::StdMeshers_Deflection1D::_narrow( hypothesis() );
582       h->SetVarParameter( params[0].text(), "SetDeflection" );
583       h->SetDeflection( params[0].myValue.toDouble() );
584     }
585     else if( hypType()=="Adaptive1D" )
586     {
587       StdMeshers::StdMeshers_Adaptive1D_var h =
588         StdMeshers::StdMeshers_Adaptive1D::_narrow( hypothesis() );
589       h->SetVarParameter( params[0].text(), "SetMinSize" );
590       h->SetMinSize( params[0].myValue.toDouble() );
591       h->SetVarParameter( params[0].text(), "SetMaxSize" );
592       h->SetMaxSize( params[1].myValue.toDouble() );
593       h->SetVarParameter( params[0].text(), "SetDeflection" );
594       h->SetDeflection( params[2].myValue.toDouble() );
595     }
596     else if( hypType()=="AutomaticLength" )
597     {
598       StdMeshers::StdMeshers_AutomaticLength_var h =
599         StdMeshers::StdMeshers_AutomaticLength::_narrow( hypothesis() );
600
601       h->SetVarParameter( params[0].text(), "SetFineness" );
602       h->SetFineness( params[0].myValue.toDouble() );
603     }
604     else if( hypType()=="NumberOfLayers" )
605     {
606       StdMeshers::StdMeshers_NumberOfLayers_var h =
607         StdMeshers::StdMeshers_NumberOfLayers::_narrow( hypothesis() );
608
609       h->SetVarParameter( params[0].text(), "SetNumberOfLayers" );
610       h->SetNumberOfLayers( params[0].myValue.toInt() );
611     }
612     else if( hypType()=="LayerDistribution" )
613     {
614       StdMeshers::StdMeshers_LayerDistribution_var h =
615         StdMeshers::StdMeshers_LayerDistribution::_narrow( hypothesis() );
616       StdMeshersGUI_LayerDistributionParamWdg* w = 
617         widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
618       
619       h->SetLayerDistribution( w->GetHypothesis() );
620     }
621     else if( hypType()=="NumberOfLayers2D" )
622     {
623       StdMeshers::StdMeshers_NumberOfLayers2D_var h =
624         StdMeshers::StdMeshers_NumberOfLayers2D::_narrow( hypothesis() );
625
626       h->SetVarParameter( params[0].text(), "SetNumberOfLayers" );
627       h->SetNumberOfLayers( params[0].myValue.toInt() );
628     }
629     else if( hypType()=="LayerDistribution2D" )
630     {
631       StdMeshers::StdMeshers_LayerDistribution2D_var h =
632         StdMeshers::StdMeshers_LayerDistribution2D::_narrow( hypothesis() );
633       StdMeshersGUI_LayerDistributionParamWdg* w = 
634         widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
635       
636       h->SetLayerDistribution( w->GetHypothesis() );
637     }
638     else if( hypType()=="ProjectionSource1D" )
639     {
640       StdMeshers::StdMeshers_ProjectionSource1D_var h =
641         StdMeshers::StdMeshers_ProjectionSource1D::_narrow( hypothesis() );
642
643       h->SetSourceEdge       ( geomFromWdg ( getWidgetForParam( 0 )));
644       h->SetSourceMesh       ( meshFromWdg ( getWidgetForParam( 1 )));
645       h->SetVertexAssociation( geomFromWdg ( getWidgetForParam( 2 )),
646                                geomFromWdg ( getWidgetForParam( 3 )));
647     }
648     else if( hypType()=="ProjectionSource2D" )
649     {
650       StdMeshers::StdMeshers_ProjectionSource2D_var h =
651         StdMeshers::StdMeshers_ProjectionSource2D::_narrow( hypothesis() );
652
653       h->SetSourceFace       ( geomFromWdg ( getWidgetForParam( 0 )));
654       h->SetSourceMesh       ( meshFromWdg ( getWidgetForParam( 1 )));
655       h->SetVertexAssociation( geomFromWdg ( getWidgetForParam( 2 )), // src1
656                                geomFromWdg ( getWidgetForParam( 4 )), // src2
657                                geomFromWdg ( getWidgetForParam( 3 )), // tgt1
658                                geomFromWdg ( getWidgetForParam( 5 ))); // tgt2
659     }
660     else if( hypType()=="ProjectionSource3D" )
661     {
662       StdMeshers::StdMeshers_ProjectionSource3D_var h =
663         StdMeshers::StdMeshers_ProjectionSource3D::_narrow( hypothesis() );
664
665       h->SetSource3DShape    ( geomFromWdg ( getWidgetForParam( 0 )));
666       h->SetSourceMesh       ( meshFromWdg ( getWidgetForParam( 1 )));
667       h->SetVertexAssociation( geomFromWdg ( getWidgetForParam( 2 )), // src1
668                                geomFromWdg ( getWidgetForParam( 4 )), // src2
669                                geomFromWdg ( getWidgetForParam( 3 )), // tgt1
670                                geomFromWdg ( getWidgetForParam( 5 ))); // tgt2
671     }
672     else if( hypType()=="ImportSource1D" )
673     {
674       StdMeshers::StdMeshers_ImportSource1D_var h =
675         StdMeshers::StdMeshers_ImportSource1D::_narrow( hypothesis() );
676
677       SMESH::ListOfGroups_var groups = groupsFromWdg( getWidgetForParam( 0 ));
678       h->SetSourceEdges( groups.in() );
679       QCheckBox* toCopyMesh   = widget< QCheckBox >( 1 );
680       QCheckBox* toCopyGroups = widget< QCheckBox >( 2 );
681       h->SetCopySourceMesh( toCopyMesh->isChecked(), toCopyGroups->isChecked());
682     }
683     else if( hypType()=="ImportSource2D" )
684     {
685       StdMeshers::StdMeshers_ImportSource2D_var h =
686         StdMeshers::StdMeshers_ImportSource2D::_narrow( hypothesis() );
687
688       SMESH::ListOfGroups_var groups = groupsFromWdg( getWidgetForParam( 0 ));
689       h->SetSourceFaces( groups.in() );
690       QCheckBox* toCopyMesh   = widget< QCheckBox >( 1 );
691       QCheckBox* toCopyGroups = widget< QCheckBox >( 2 );
692       h->SetCopySourceMesh( toCopyMesh->isChecked(), toCopyGroups->isChecked());
693     }
694     else if( hypType()=="ViscousLayers" )
695     {
696       StdMeshers::StdMeshers_ViscousLayers_var h =
697         StdMeshers::StdMeshers_ViscousLayers::_narrow( hypothesis() );
698
699       h->SetVarParameter( params[0].text(), "SetTotalThickness" );
700       h->SetTotalThickness( params[0].myValue.toDouble() );
701       h->SetVarParameter( params[1].text(), "SetNumberLayers" );
702       h->SetNumberLayers  ( params[1].myValue.toInt() );
703       h->SetVarParameter( params[2].text(), "SetStretchFactor" );
704       h->SetStretchFactor ( params[2].myValue.toDouble() );
705
706       if ( StdMeshersGUI_SubShapeSelectorWdg* idsWg = 
707            widget< StdMeshersGUI_SubShapeSelectorWdg >( 3 ))
708       {
709         h->SetIgnoreFaces( idsWg->GetListOfIDs() );
710       }
711     }
712     else if( hypType()=="ViscousLayers2D" )
713     {
714       StdMeshers::StdMeshers_ViscousLayers2D_var h =
715         StdMeshers::StdMeshers_ViscousLayers2D::_narrow( hypothesis() );
716
717       h->SetVarParameter( params[0].text(), "SetTotalThickness" );
718       h->SetTotalThickness( params[0].myValue.toDouble() );
719       h->SetVarParameter( params[1].text(), "SetNumberLayers" );
720       h->SetNumberLayers  ( params[1].myValue.toInt() );
721       h->SetVarParameter( params[2].text(), "SetStretchFactor" );
722       h->SetStretchFactor ( params[2].myValue.toDouble() );
723
724       if ( StdMeshersGUI_SubShapeSelectorWdg* idsWg =
725            widget< StdMeshersGUI_SubShapeSelectorWdg >( 4 ))
726       {
727         h->SetEdges( idsWg->GetListOfIDs(), params[3].myValue.toInt() );
728       }
729     }
730     else if( hypType()=="QuadrangleParams" )
731     {
732       StdMeshers::StdMeshers_QuadrangleParams_var h =
733         StdMeshers::StdMeshers_QuadrangleParams::_narrow( hypothesis() );
734       StdMeshersGUI_SubShapeSelectorWdg* w1 =
735         widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 );
736       StdMeshersGUI_QuadrangleParamWdg* w2 =
737         widget< StdMeshersGUI_QuadrangleParamWdg >( 1 );
738       if (w1 && w2) {
739         if (w1->GetListSize() > 0) {
740           h->SetTriaVertex(w1->GetListOfIDs()[0]); // getlist must be called once
741           const char * entry = w1->GetMainShapeEntry();
742           h->SetObjectEntry(entry);
743         }
744         h->SetQuadType(StdMeshers::QuadType(w2->GetType()));
745       }
746     }
747   }
748   return valueStr;
749 }
750
751 //================================================================================
752 /*!
753  * \brief Return parameter values as SMESHGUI_GenericHypothesisCreator::StdParam
754  * \param p - list of parameters
755  * \retval bool - success flag
756  *
757  * Is called from SMESHGUI_GenericHypothesisCreator::buildStdFrame().
758  * Parameters will be shown using "standard" controls:
759  *   Int by QtxIntSpinBox
760  *   Double by SMESHGUI_SpinBox
761  *   String by QLineEdit
762  * getCustomWidget() allows to redefine control for a parameter
763  */
764 //================================================================================
765
766 bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
767 {
768   bool res = true;
769   SMESHGUI_GenericHypothesisCreator::StdParam item;
770
771   p.clear();
772   customWidgets()->clear();
773   if( isCreation() )
774   {
775     HypothesisData* data = SMESH::GetHypothesisData( hypType() );
776     item.myName = tr( "SMESH_NAME" );
777     item.myValue = data ? hypName() : QString();
778     p.append( item );
779     customWidgets()->append(0);
780   }
781
782   SMESH::SMESH_Hypothesis_var hyp = initParamsHypothesis();
783   //SMESH::ListOfParameters_var aParameters = hyp->GetLastParameters();
784
785   if( hypType()=="LocalLength" )
786   {
787     StdMeshers::StdMeshers_LocalLength_var h =
788       StdMeshers::StdMeshers_LocalLength::_narrow( hyp );
789
790     item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
791     if(!initVariableName( hyp, item, "SetLength"))
792       item.myValue = h->GetLength();
793     p.append( item );     
794
795     item.myName = tr("SMESH_LOCAL_LENGTH_PRECISION");
796     if(!initVariableName( hyp, item, "SetPrecision"))
797       item.myValue = h->GetPrecision(); 
798     p.append( item );
799   }
800   else if( hypType()=="MaxLength" )
801   {
802     StdMeshers::StdMeshers_MaxLength_var h =
803       StdMeshers::StdMeshers_MaxLength::_narrow( hyp );
804     // try to set a right preestimated length to edited hypothesis
805     bool noPreestimatedAtEdition = false;
806     if ( !isCreation() ) {
807       StdMeshers::StdMeshers_MaxLength_var initHyp =
808         StdMeshers::StdMeshers_MaxLength::_narrow( initParamsHypothesis(true) );
809       noPreestimatedAtEdition =
810         ( initHyp->_is_nil() || !initHyp->HavePreestimatedLength() );
811       if ( !noPreestimatedAtEdition )
812         h->SetPreestimatedLength( initHyp->GetPreestimatedLength() );
813     }
814
815     item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
816     if(!initVariableName( hyp, item, "SetLength"))
817       item.myValue = h->GetLength();
818     p.append( item );
819     customWidgets()->append(0);
820
821     item.myName = tr("SMESH_USE_PREESTIMATED_LENGTH");
822     p.append( item );
823     QCheckBox* aQCheckBox = new QCheckBox(dlg());
824     if ( !noPreestimatedAtEdition && h->HavePreestimatedLength() ) {
825       aQCheckBox->setChecked( h->GetUsePreestimatedLength() );
826       connect( aQCheckBox, SIGNAL(  stateChanged(int) ), this, SLOT( onValueChanged() ) );
827     }
828     else {
829       aQCheckBox->setChecked( false );
830       aQCheckBox->setEnabled( false );
831     }
832     customWidgets()->append( aQCheckBox );
833   }
834   else if( hypType()=="SegmentLengthAroundVertex" )
835   {
836     StdMeshers::StdMeshers_SegmentLengthAroundVertex_var h =
837       StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hyp );
838
839     item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
840     if(!initVariableName( hyp, item, "SetLength"))
841       item.myValue = h->GetLength();
842     
843     p.append( item );
844   }
845   else if( hypType()=="Arithmetic1D" )
846   {
847     StdMeshers::StdMeshers_Arithmetic1D_var h =
848       StdMeshers::StdMeshers_Arithmetic1D::_narrow( hyp );
849
850     item.myName = tr( "SMESH_START_LENGTH_PARAM" );
851     if(!initVariableName( hyp, item, "SetStartLength" ))
852       item.myValue = h->GetLength( true );
853     p.append( item );
854
855     customWidgets()->append (0);
856
857     item.myName = tr( "SMESH_END_LENGTH_PARAM" );
858     if(!initVariableName( hyp, item, "SetEndLength" ))
859       item.myValue = h->GetLength( false );
860     p.append( item );
861
862     customWidgets()->append (0);
863
864     item.myName = tr( "SMESH_REVERSED_EDGES" );
865     p.append( item );
866
867     StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
868       new StdMeshersGUI_SubShapeSelectorWdg();
869     QString aGeomEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
870     QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
871     if ( aGeomEntry == "" )
872       aGeomEntry = h->GetObjectEntry();
873
874     aDirectionWidget->SetGeomShapeEntry( aGeomEntry );
875     aDirectionWidget->SetMainShapeEntry( aMainEntry );
876     aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
877     aDirectionWidget->showPreview( true );
878     customWidgets()->append ( aDirectionWidget );
879   }
880
881
882   else if( hypType()=="FixedPoints1D" )
883   {
884     StdMeshers::StdMeshers_FixedPoints1D_var h =
885       StdMeshers::StdMeshers_FixedPoints1D::_narrow( hyp );
886
887     item.myName = tr( "SMESH_FIXED_POINTS" );
888     p.append( item );
889
890     StdMeshersGUI_FixedPointsParamWdg* aFixedPointsWidget =
891       new StdMeshersGUI_FixedPointsParamWdg();
892
893     if ( !isCreation() ) {
894       aFixedPointsWidget->SetListOfPoints( h->GetPoints() );
895       aFixedPointsWidget->SetListOfSegments( h->GetNbSegments() );
896     }
897     customWidgets()->append( aFixedPointsWidget );
898
899     item.myName = tr( "SMESH_REVERSED_EDGES" );
900     p.append( item );
901
902     StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
903       new StdMeshersGUI_SubShapeSelectorWdg();
904     QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
905     QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
906     if ( anEntry == "" )
907       anEntry = h->GetObjectEntry();
908     aDirectionWidget->SetGeomShapeEntry( anEntry );
909     aDirectionWidget->SetMainShapeEntry( aMainEntry );
910     aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
911     aDirectionWidget->showPreview( true );
912     customWidgets()->append ( aDirectionWidget );
913   }
914
915
916   else if( hypType()=="MaxElementArea" )
917   {
918     StdMeshers::StdMeshers_MaxElementArea_var h =
919       StdMeshers::StdMeshers_MaxElementArea::_narrow( hyp );
920
921     item.myName = tr( "SMESH_MAX_ELEMENT_AREA_PARAM" );
922     if(!initVariableName( hyp, item, "SetMaxElementArea" ))
923       item.myValue = h->GetMaxElementArea();
924     p.append( item );
925     
926   }
927   else if( hypType()=="MaxElementVolume" )
928   {
929     StdMeshers::StdMeshers_MaxElementVolume_var h =
930       StdMeshers::StdMeshers_MaxElementVolume::_narrow( hyp );
931
932     item.myName = tr( "SMESH_MAX_ELEMENT_VOLUME_PARAM" );
933     if(!initVariableName( hyp, item, "SetMaxElementVolume" ))
934       item.myValue = h->GetMaxElementVolume();
935     p.append( item );
936   }
937   else if( hypType()=="StartEndLength" )
938   {
939     StdMeshers::StdMeshers_StartEndLength_var h =
940       StdMeshers::StdMeshers_StartEndLength::_narrow( hyp );
941
942     item.myName = tr( "SMESH_START_LENGTH_PARAM" );
943
944     if(!initVariableName( hyp, item, "SetStartLength" )) 
945       item.myValue = h->GetLength( true );
946     p.append( item );
947     customWidgets()->append(0);
948
949     item.myName = tr( "SMESH_END_LENGTH_PARAM" );
950     if(!initVariableName( hyp, item, "SetEndLength" )) 
951       item.myValue = h->GetLength( false );
952     p.append( item );
953     customWidgets()->append(0);
954
955     item.myName = tr( "SMESH_REVERSED_EDGES" );
956     p.append( item );
957
958     StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
959       new StdMeshersGUI_SubShapeSelectorWdg();
960     QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
961     QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
962     if ( anEntry == "" )
963       anEntry = h->GetObjectEntry();
964     aDirectionWidget->SetGeomShapeEntry( anEntry );
965     aDirectionWidget->SetMainShapeEntry( aMainEntry );
966     aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
967     aDirectionWidget->showPreview( true );
968     customWidgets()->append ( aDirectionWidget );
969   }
970   else if( hypType()=="Deflection1D" )
971   {
972     StdMeshers::StdMeshers_Deflection1D_var h =
973       StdMeshers::StdMeshers_Deflection1D::_narrow( hyp );
974
975     item.myName = tr( "SMESH_DEFLECTION1D_PARAM" );
976     if(!initVariableName( hyp, item, "SetDeflection" )) 
977       item.myValue = h->GetDeflection();
978     p.append( item );
979   }
980   else if( hypType()=="Adaptive1D" )
981   {
982     StdMeshers::StdMeshers_Adaptive1D_var h =
983       StdMeshers::StdMeshers_Adaptive1D::_narrow( hyp );
984
985     item.myName = tr( "SMESH_MIN_SIZE" );
986     if(!initVariableName( hyp, item, "SetMinSize" )) 
987       item.myValue = h->GetMinSize();
988     p.append( item );
989
990     item.myName = tr( "SMESH_MAX_SIZE" );
991     if(!initVariableName( hyp, item, "SetMaxSize" )) 
992       item.myValue = h->GetMaxSize();
993     p.append( item );
994
995     item.myName = tr( "SMESH_DEFLECTION1D_PARAM" );
996     if(!initVariableName( hyp, item, "SetDeflection" )) 
997       item.myValue = h->GetDeflection();
998     p.append( item );
999   }
1000   else if( hypType()=="AutomaticLength" )
1001   {
1002     StdMeshers::StdMeshers_AutomaticLength_var h =
1003       StdMeshers::StdMeshers_AutomaticLength::_narrow( hyp );
1004
1005     item.myName = tr( "SMESH_FINENESS_PARAM" );
1006     //item.myValue = h->GetFineness();
1007     p.append( item );
1008     SMESHGUI_SpinBox* _autoLengthSpinBox = new SMESHGUI_SpinBox(dlg());
1009     _autoLengthSpinBox->RangeStepAndValidator(0, 1, 0.01, "length_precision");
1010     _autoLengthSpinBox->SetValue(h->GetFineness());
1011     customWidgets()->append( _autoLengthSpinBox);
1012   }
1013   else if( hypType()=="NumberOfLayers" )
1014   {
1015     StdMeshers::StdMeshers_NumberOfLayers_var h =
1016       StdMeshers::StdMeshers_NumberOfLayers::_narrow( hyp );
1017
1018     item.myName = tr( "SMESH_NUMBER_OF_LAYERS" );
1019     if(!initVariableName( hyp, item, "SetNumberOfLayers" ))     
1020       item.myValue = (int) h->GetNumberOfLayers();
1021     p.append( item );
1022   }
1023   else if( hypType()=="LayerDistribution" )
1024   {
1025     StdMeshers::StdMeshers_LayerDistribution_var h =
1026       StdMeshers::StdMeshers_LayerDistribution::_narrow( hyp );
1027     
1028     item.myName = tr( "SMESH_LAYERS_DISTRIBUTION" ); p.append( item );
1029     initVariableName( hyp, item, "SetLayerDistribution" );
1030     customWidgets()->append ( new StdMeshersGUI_LayerDistributionParamWdg
1031                               ( h, h->GetLayerDistribution(), hypName(), dlg() ));
1032   }
1033   else if( hypType()=="NumberOfLayers2D" )
1034   {
1035     StdMeshers::StdMeshers_NumberOfLayers2D_var h =
1036       StdMeshers::StdMeshers_NumberOfLayers2D::_narrow( hyp );
1037     
1038     item.myName = tr( "SMESH_NUMBER_OF_LAYERS" );
1039     if(!initVariableName( hyp, item, "SetNumberOfLayers" ))     
1040       item.myValue = (int) h->GetNumberOfLayers();
1041     p.append( item );
1042   }
1043   else if( hypType()=="LayerDistribution2D" )
1044   {
1045     StdMeshers::StdMeshers_LayerDistribution2D_var h =
1046       StdMeshers::StdMeshers_LayerDistribution2D::_narrow( hyp );
1047
1048     item.myName = tr( "SMESH_LAYERS_DISTRIBUTION" ); p.append( item );
1049     initVariableName( hyp, item, "SetLayerDistribution" );
1050     customWidgets()->append ( new StdMeshersGUI_LayerDistributionParamWdg
1051                               ( h, h->GetLayerDistribution(), hypName(), dlg() ));
1052   }
1053   else if( hypType()=="ProjectionSource1D" )
1054   {
1055     StdMeshers::StdMeshers_ProjectionSource1D_var h =
1056       StdMeshers::StdMeshers_ProjectionSource1D::_narrow( hyp );
1057
1058     item.myName = tr( "SMESH_SOURCE_EDGE" ); p.append( item );
1059     customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 1 ),
1060                                                h->GetSourceEdge()));
1061     item.myName = tr( "SMESH_SOURCE_MESH" ); p.append( item );
1062     customWidgets()->append( newObjRefParamWdg( new SMESH_TypeFilter( SMESH::MESH ),
1063                                                h->GetSourceMesh()));
1064     item.myName = tr( "SMESH_SOURCE_VERTEX" ); p.append( item );
1065     customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
1066                                                h->GetSourceVertex()));
1067     item.myName = tr( "SMESH_TARGET_VERTEX" ); p.append( item );
1068     customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
1069                                                h->GetTargetVertex()));
1070   }
1071   else if( hypType()=="ProjectionSource2D" )
1072   {
1073     StdMeshers::StdMeshers_ProjectionSource2D_var h =
1074       StdMeshers::StdMeshers_ProjectionSource2D::_narrow( hyp );
1075
1076     item.myName = tr( "SMESH_SOURCE_FACE" ); p.append( item );
1077     customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 2 ),
1078                                                h->GetSourceFace()));
1079     item.myName = tr( "SMESH_SOURCE_MESH" ); p.append( item );
1080     customWidgets()->append( newObjRefParamWdg( new SMESH_TypeFilter( SMESH::MESH ),
1081                                                h->GetSourceMesh()));
1082     item.myName = tr( "SMESH_SOURCE_VERTEX1" ); p.append( item );
1083     customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
1084                                                h->GetSourceVertex( 1 )));
1085     item.myName = tr( "SMESH_TARGET_VERTEX1" ); p.append( item );
1086     customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
1087                                                h->GetTargetVertex( 1 )));
1088     item.myName = tr( "SMESH_SOURCE_VERTEX2" ); p.append( item );
1089     customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
1090                                                h->GetSourceVertex( 2 )));
1091     item.myName = tr( "SMESH_TARGET_VERTEX2" ); p.append( item );
1092     customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
1093                                                h->GetTargetVertex( 2 )));
1094   }
1095   else if( hypType()=="ProjectionSource3D" )
1096   {
1097     StdMeshers::StdMeshers_ProjectionSource3D_var h =
1098       StdMeshers::StdMeshers_ProjectionSource3D::_narrow( hyp );
1099
1100     item.myName = tr( "SMESH_SOURCE_3DSHAPE" ); p.append( item );
1101     customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 3, TopAbs_FACE, 6, true ),
1102                                                h->GetSource3DShape()));
1103     item.myName = tr( "SMESH_SOURCE_MESH" ); p.append( item );
1104     customWidgets()->append( newObjRefParamWdg( new SMESH_TypeFilter( SMESH::MESH ),
1105                                                h->GetSourceMesh()));
1106     item.myName = tr( "SMESH_SOURCE_VERTEX1" ); p.append( item );
1107     customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
1108                                                h->GetSourceVertex( 1 )));
1109     item.myName = tr( "SMESH_TARGET_VERTEX1" ); p.append( item );
1110     customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
1111                                                h->GetTargetVertex( 1 )));
1112     item.myName = tr( "SMESH_SOURCE_VERTEX2" ); p.append( item );
1113     customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
1114                                                h->GetSourceVertex( 2 )));
1115     item.myName = tr( "SMESH_TARGET_VERTEX2" ); p.append( item );
1116     customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
1117                                                h->GetTargetVertex( 2 )));
1118   }
1119   else if( hypType()=="ImportSource1D" )
1120   {
1121     StdMeshers::StdMeshers_ImportSource1D_var h =
1122       StdMeshers::StdMeshers_ImportSource1D::_narrow( hyp );
1123
1124     SMESH::string_array_var groupEntries = h->GetSourceEdges();
1125     CORBA::Boolean toCopyMesh, toCopyGroups;
1126     h->GetCopySourceMesh(toCopyMesh, toCopyGroups);
1127
1128     item.myName = tr( "SMESH_SOURCE_EDGES" ); p.append( item );
1129     customWidgets()->append( newObjRefParamWdg( new SMESH_TypeFilter( SMESH::GROUP_EDGE ), 
1130                                                 groupEntries));
1131
1132     item.myName = tr( "SMESH_COPY_MESH" ); p.append( item );
1133     QCheckBox* aQCheckBox = new QCheckBox(dlg());
1134     aQCheckBox->setChecked( toCopyMesh );
1135     connect( aQCheckBox, SIGNAL(  stateChanged(int) ), this, SLOT( onValueChanged() ));
1136     customWidgets()->append( aQCheckBox );
1137
1138     item.myName = tr( "SMESH_TO_COPY_GROUPS" ); p.append( item );
1139     aQCheckBox = new QCheckBox(dlg());
1140     aQCheckBox->setChecked( toCopyGroups );
1141     aQCheckBox->setEnabled( toCopyMesh );
1142     customWidgets()->append( aQCheckBox );
1143   }
1144   else if( hypType()=="ImportSource2D" )
1145   {
1146     StdMeshers::StdMeshers_ImportSource2D_var h =
1147       StdMeshers::StdMeshers_ImportSource2D::_narrow( hyp );
1148
1149     SMESH::string_array_var groupEntries = h->GetSourceFaces();
1150     CORBA::Boolean toCopyMesh, toCopyGroups;
1151     h->GetCopySourceMesh(toCopyMesh, toCopyGroups);
1152
1153     item.myName = tr( "SMESH_SOURCE_FACES" ); p.append( item );
1154     customWidgets()->append( newObjRefParamWdg( new SMESH_TypeFilter( SMESH::GROUP_FACE ), 
1155                                                 groupEntries));
1156
1157     item.myName = tr( "SMESH_COPY_MESH" ); p.append( item );
1158     QCheckBox* aQCheckBox = new QCheckBox(dlg());
1159     aQCheckBox->setChecked( toCopyMesh );
1160     connect( aQCheckBox, SIGNAL(  stateChanged(int) ), this, SLOT( onValueChanged() ));
1161     customWidgets()->append( aQCheckBox );
1162
1163     item.myName = tr( "SMESH_COPY_GROUPS" ); p.append( item );
1164     aQCheckBox = new QCheckBox(dlg());
1165     aQCheckBox->setChecked( toCopyGroups );
1166     aQCheckBox->setEnabled( toCopyMesh );
1167     customWidgets()->append( aQCheckBox );
1168   }
1169   else if( hypType()=="ViscousLayers" )
1170   {
1171     StdMeshers::StdMeshers_ViscousLayers_var h =
1172       StdMeshers::StdMeshers_ViscousLayers::_narrow( hyp );
1173
1174     item.myName = tr( "SMESH_TOTAL_THICKNESS" );
1175     if(!initVariableName( hyp, item, "SetTotalThickness" ))
1176       item.myValue = h->GetTotalThickness();
1177     p.append( item );
1178     customWidgets()->append (0);
1179
1180     item.myName = tr( "SMESH_NUMBER_OF_LAYERS" );
1181     if(!initVariableName( hyp, item, "SetNumberLayers" ))
1182       item.myValue = h->GetNumberLayers();
1183     p.append( item );
1184     customWidgets()->append (0);
1185
1186     item.myName = tr( "SMESH_STRETCH_FACTOR" );
1187     if(!initVariableName( hyp, item, "SetStretchFactor" ))
1188       item.myValue = h->GetStretchFactor();
1189     p.append( item );
1190     customWidgets()->append (0);
1191
1192     QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
1193     if ( !aMainEntry.isEmpty() )
1194     {
1195       item.myName = tr( "SMESH_FACES_WO_LAYERS" );
1196       p.append( item );
1197
1198       StdMeshersGUI_SubShapeSelectorWdg* idsWg =
1199         new StdMeshersGUI_SubShapeSelectorWdg(0,TopAbs_FACE);
1200
1201       idsWg->SetGeomShapeEntry( aMainEntry );
1202       idsWg->SetMainShapeEntry( aMainEntry );
1203       idsWg->SetListOfIDs( h->GetIgnoreFaces() );
1204       idsWg->showPreview( true );
1205       customWidgets()->append ( idsWg );
1206     }
1207   }
1208   else if( hypType()=="ViscousLayers2D" )
1209   {
1210     StdMeshers::StdMeshers_ViscousLayers2D_var h =
1211       StdMeshers::StdMeshers_ViscousLayers2D::_narrow( hyp );
1212
1213     item.myName = tr( "SMESH_TOTAL_THICKNESS" );
1214     if(!initVariableName( hyp, item, "SetTotalThickness" ))
1215       item.myValue = h->GetTotalThickness();
1216     p.append( item );
1217     customWidgets()->append (0);
1218
1219     item.myName = tr( "SMESH_NUMBER_OF_LAYERS" );
1220     if(!initVariableName( hyp, item, "SetNumberLayers" ))
1221       item.myValue = h->GetNumberLayers();
1222     p.append( item );
1223     customWidgets()->append (0);
1224
1225     item.myName = tr( "SMESH_STRETCH_FACTOR" );
1226     if(!initVariableName( hyp, item, "SetStretchFactor" ))
1227       item.myValue = h->GetStretchFactor();
1228     p.append( item );
1229     customWidgets()->append (0);
1230
1231     QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
1232     if ( !aMainEntry.isEmpty() )
1233     {
1234       item.myName = tr("TO_IGNORE_EDGES_OR_NOT");
1235       p.append( item );
1236
1237       StdMeshersGUI_RadioButtonsGrpWdg* ignoreWdg = new StdMeshersGUI_RadioButtonsGrpWdg("");
1238       ignoreWdg->setButtonLabels ( QStringList()
1239                                    << tr("NOT_TO_IGNORE_EDGES")
1240                                    << tr("TO_IGNORE_EDGES") );
1241       ignoreWdg->setChecked( h->GetIsToIgnoreEdges() );
1242       connect(ignoreWdg->getButtonGroup(),SIGNAL(buttonClicked(int)),this,SLOT(onValueChanged()));
1243       customWidgets()->append( ignoreWdg );
1244
1245       item.myName =
1246         tr( h->GetIsToIgnoreEdges() ? "SMESH_EDGES_WO_LAYERS" : "SMESH_EDGES_WITH_LAYERS" );
1247       p.append( item );
1248
1249       StdMeshersGUI_SubShapeSelectorWdg* idsWg =
1250         new StdMeshersGUI_SubShapeSelectorWdg(0,TopAbs_EDGE);
1251
1252       idsWg->SetGeomShapeEntry( aMainEntry );
1253       idsWg->SetMainShapeEntry( aMainEntry );
1254       idsWg->SetListOfIDs( h->GetEdges() );
1255       idsWg->showPreview( true );
1256       customWidgets()->append ( idsWg );
1257     }
1258   }
1259   else if (hypType() == "QuadrangleParams")
1260   {
1261     StdMeshers::StdMeshers_QuadrangleParams_var h =
1262       StdMeshers::StdMeshers_QuadrangleParams::_narrow(hyp);
1263
1264     item.myName = tr("SMESH_BASE_VERTEX");
1265     p.append(item);
1266
1267     StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
1268       new StdMeshersGUI_SubShapeSelectorWdg(0, TopAbs_VERTEX);
1269     aDirectionWidget->SetMaxSize(1);
1270     QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
1271     QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
1272     if (anEntry == "")
1273       anEntry = h->GetObjectEntry();
1274     aDirectionWidget->SetGeomShapeEntry(anEntry);
1275     aDirectionWidget->SetMainShapeEntry(aMainEntry);
1276     if (!isCreation()) {
1277       SMESH::long_array_var aVec = new SMESH::long_array;
1278       int vertID = h->GetTriaVertex();
1279       if (vertID > 0) {
1280         aVec->length(1);
1281         aVec[0] = vertID;
1282         aDirectionWidget->SetListOfIDs(aVec);
1283       }
1284     }
1285     aDirectionWidget->showPreview(true);
1286
1287     item.myName = tr("SMESH_QUAD_TYPE");
1288     p.append(item);
1289
1290     StdMeshersGUI_QuadrangleParamWdg* aTypeWidget =
1291       new StdMeshersGUI_QuadrangleParamWdg();
1292     if (!isCreation()) {
1293       aTypeWidget->SetType(int(h->GetQuadType()));
1294     }
1295
1296     customWidgets()->append(aDirectionWidget);
1297     customWidgets()->append(aTypeWidget);
1298   }
1299   else
1300     res = false;
1301   return res;
1302 }
1303
1304 //================================================================================
1305 /*!
1306  * \brief tune "standard" control
1307  *  \param w - control widget
1308  *  \param int - parameter index
1309  */
1310 //================================================================================
1311
1312 void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int) const
1313 {
1314   SMESHGUI_SpinBox* sb = w->inherits( "SMESHGUI_SpinBox" ) ? ( SMESHGUI_SpinBox* )w : 0;
1315   if ( sb )
1316   {
1317     if( hypType()=="LocalLength" )
1318     {
1319       if (sb->objectName() == tr("SMESH_LOCAL_LENGTH_PARAM"))
1320         sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
1321       else if (sb->objectName() == tr("SMESH_LOCAL_LENGTH_PRECISION"))
1322         sb->RangeStepAndValidator( 0.0, 1.0, 0.05, "len_tol_precision" );
1323     }
1324     else if( hypType()=="Arithmetic1D" )
1325     {
1326       sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "parametric_precision" );
1327     }
1328     else if( hypType()=="MaxLength" )
1329     {
1330       sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
1331       sb->setEnabled( !widget< QCheckBox >( 1 )->isChecked() );
1332     }
1333     else if( hypType()=="MaxElementArea" )
1334     {
1335       sb->RangeStepAndValidator( VALUE_SMALL_2, VALUE_MAX_2, 1.0, "area_precision" );
1336     }
1337     else if( hypType()=="MaxElementVolume" )
1338     {
1339       sb->RangeStepAndValidator( VALUE_SMALL_3, VALUE_MAX_3, 1.0, "vol_precision" );
1340     }
1341     else if( hypType()=="StartEndLength" )
1342     {
1343       sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
1344     }
1345     else if( hypType()=="Deflection1D" )
1346     {
1347       sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "parametric_precision" );
1348     }
1349     else if( hypType()=="Adaptive1D" )
1350     {
1351       sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
1352     }
1353     else if( hypType().startsWith( "ViscousLayers" ))
1354     {
1355       if (sb->objectName() == tr("SMESH_STRETCH_FACTOR"))
1356         sb->RangeStepAndValidator( 1.0, VALUE_MAX, 0.1, "parametric_precision" );
1357       else
1358         sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
1359     }
1360     else // default validator for possible ancestors
1361     {
1362       sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
1363     }
1364   }
1365 }
1366
1367 //================================================================================
1368 /*!
1369  * \brief Return dlg title
1370   * \retval QString - title string
1371  */
1372 //================================================================================
1373
1374 QString StdMeshersGUI_StdHypothesisCreator::caption() const
1375 {
1376   return tr( QString( "SMESH_%1_TITLE" ).arg( hypTypeName( hypType() ) ).toLatin1().data() );
1377 }
1378
1379 //================================================================================
1380 /*!
1381  * \brief return pixmap for dlg icon
1382   * \retval QPixmap - 
1383  */
1384 //================================================================================
1385
1386 QPixmap StdMeshersGUI_StdHypothesisCreator::icon() const
1387 {
1388   QString hypIconName = tr( QString( "ICON_DLG_%1" ).arg( hypTypeName( hypType() ) ).toLatin1().data() );
1389   return SMESHGUI::resourceMgr()->loadPixmap( "SMESH", hypIconName );
1390 }
1391
1392 //================================================================================
1393 /*!
1394  * \brief Return hypothesis type name to show in dlg
1395   * \retval QString - 
1396  */
1397 //================================================================================
1398
1399 QString StdMeshersGUI_StdHypothesisCreator::type() const
1400 {
1401   return tr( QString( "SMESH_%1_HYPOTHESIS" ).arg( hypTypeName( hypType() ) ).toLatin1().data() );
1402 }
1403
1404 //================================================================================
1405 /*!
1406  * \brief String to insert in "SMESH_%1_HYPOTHESIS" to get hypothesis type name
1407  * from message resouce file
1408   * \param t - hypothesis type
1409   * \retval QString - result string
1410  */
1411 //================================================================================
1412
1413 QString StdMeshersGUI_StdHypothesisCreator::hypTypeName( const QString& t ) const
1414 {
1415   static QMap<QString,QString>  types;
1416   if( types.isEmpty() )
1417   {
1418     types.insert( "LocalLength", "LOCAL_LENGTH" );
1419     types.insert( "NumberOfSegments", "NB_SEGMENTS" );
1420     types.insert( "MaxElementArea", "MAX_ELEMENT_AREA" );
1421     types.insert( "MaxElementVolume", "MAX_ELEMENT_VOLUME" );
1422     types.insert( "StartEndLength", "START_END_LENGTH" );
1423     types.insert( "Deflection1D", "DEFLECTION1D" );
1424     types.insert( "Adaptive1D", "ADAPTIVE1D" );
1425     types.insert( "Arithmetic1D", "ARITHMETIC_1D" );
1426     types.insert( "FixedPoints1D", "FIXED_POINTS_1D" );
1427     types.insert( "AutomaticLength", "AUTOMATIC_LENGTH" );
1428     types.insert( "ProjectionSource1D", "PROJECTION_SOURCE_1D" );
1429     types.insert( "ProjectionSource2D", "PROJECTION_SOURCE_2D" );
1430     types.insert( "ProjectionSource3D", "PROJECTION_SOURCE_3D" );
1431     types.insert( "ImportSource1D", "IMPORT_SOURCE_1D" );
1432     types.insert( "ImportSource2D", "IMPORT_SOURCE_2D" );
1433     types.insert( "NumberOfLayers", "NUMBER_OF_LAYERS" );
1434     types.insert( "LayerDistribution", "LAYER_DISTRIBUTION" );
1435     types.insert( "NumberOfLayers2D", "NUMBER_OF_LAYERS_2D" );
1436     types.insert( "LayerDistribution2D", "LAYER_DISTRIBUTION" );
1437     types.insert( "SegmentLengthAroundVertex", "SEGMENT_LENGTH_AROUND_VERTEX" );
1438     types.insert( "MaxLength", "MAX_LENGTH" );
1439     types.insert( "ViscousLayers", "VISCOUS_LAYERS" );
1440     types.insert( "ViscousLayers2D", "VISCOUS_LAYERS" );
1441     types.insert( "QuadrangleParams", "QUADRANGLE_PARAMS" );
1442     types.insert( "CartesianParameters3D", "CARTESIAN_PARAMS" );
1443   }
1444
1445   QString res;
1446   if( types.contains( t ) )
1447     res = types[ t ];
1448
1449   return res;
1450 }
1451
1452
1453 //=======================================================================
1454 //function : getCustomWidget
1455 //purpose  : is called from buildStdFrame()
1456 //=======================================================================
1457
1458 QWidget* StdMeshersGUI_StdHypothesisCreator::getCustomWidget( const StdParam & param,
1459                                                               QWidget*         parent,
1460                                                               const int        index) const
1461 {
1462   QWidget* w = 0;
1463   if ( index < customWidgets()->count() ) {
1464     w = customWidgets()->at( index );
1465     if ( w ) {
1466       w->setParent( parent );
1467       w->move( QPoint( 0, 0 ) );
1468     }
1469   }
1470   return w;
1471 }
1472
1473 //================================================================================
1474 /*!
1475  * \brief Set param value taken from a custom widget
1476   * \param param - SMESHGUI_GenericHypothesisCreator::StdParam structure
1477   * \param widget - widget presenting param
1478   * \retval bool - success flag
1479  * 
1480  * this method is called from getStdParamFromDlg()
1481  */
1482 //================================================================================
1483
1484 bool StdMeshersGUI_StdHypothesisCreator::getParamFromCustomWidget( StdParam & param,
1485                                                                    QWidget*   widget) const
1486 {
1487   if ( hypType()=="AutomaticLength" ) {
1488     SMESHGUI_SpinBox* w = dynamic_cast<SMESHGUI_SpinBox*>( widget );
1489     if ( w ) {
1490       param.myValue = w->GetValue();
1491       return true;
1492     }
1493   }
1494   if ( hypType() == "MaxLength" ) {
1495     param.myValue = "";
1496     return true;
1497   }
1498   if ( widget->inherits( "StdMeshersGUI_ObjectReferenceParamWdg" ))
1499   {
1500     // show only 1st reference value
1501     if ( true /*widget == getWidgetForParam( 0 )*/) {
1502       const StdMeshersGUI_ObjectReferenceParamWdg * w =
1503         static_cast<const StdMeshersGUI_ObjectReferenceParamWdg*>( widget );
1504       param.myValue = w->GetValue();
1505     }
1506     return true;
1507   }
1508   if ( widget->inherits( "StdMeshersGUI_LayerDistributionParamWdg" ))
1509   {
1510     const StdMeshersGUI_LayerDistributionParamWdg * w =
1511       static_cast<const StdMeshersGUI_LayerDistributionParamWdg*>( widget );
1512     param.myValue = w->GetValue();
1513     return true;
1514   }
1515   if ( widget->inherits( "StdMeshersGUI_SubShapeSelectorWdg" ))
1516   {
1517     const StdMeshersGUI_SubShapeSelectorWdg * w =
1518       static_cast<const StdMeshersGUI_SubShapeSelectorWdg*>( widget );
1519     param.myValue = w->GetValue();
1520     return true;
1521   }
1522   if ( widget->inherits( "StdMeshersGUI_QuadrangleParamWdg" ))
1523   {
1524     //const StdMeshersGUI_QuadrangleParamWdg * w =
1525     //  static_cast<const StdMeshersGUI_QuadrangleParamWdg*>( widget );
1526     param.myValue = "QuadType";
1527     return true;
1528   }
1529   if ( widget->inherits( "StdMeshersGUI_FixedPointsParamWdg" ))
1530   {
1531     const StdMeshersGUI_FixedPointsParamWdg * w =
1532       static_cast<const StdMeshersGUI_FixedPointsParamWdg*>( widget );
1533     param.myValue = w->GetValue();
1534     return true;
1535   }
1536   if ( widget->inherits( "QCheckBox" ))
1537   {
1538     //const QCheckBox * w = static_cast<const QCheckBox*>( widget );
1539     //param.myValue = w->isChecked();
1540     return true;
1541   }
1542   if ( widget->inherits( "StdMeshersGUI_RadioButtonsGrpWdg" ))
1543   {
1544     const StdMeshersGUI_RadioButtonsGrpWdg * w =
1545       static_cast<const StdMeshersGUI_RadioButtonsGrpWdg*>( widget );
1546     param.myValue = w->checkedId();
1547     return true;
1548   }
1549   return false;
1550 }
1551
1552 //================================================================================
1553 /*!
1554  * \brief called when operation cancelled
1555  */
1556 //================================================================================
1557
1558 void StdMeshersGUI_StdHypothesisCreator::onReject()
1559 {
1560   if ( hypType().startsWith("ProjectionSource" ) ||
1561        hypType().startsWith("ImportSource" ))
1562   {
1563     // Uninstall filters of StdMeshersGUI_ObjectReferenceParamWdg
1564     deactivateObjRefParamWdg( customWidgets() );
1565   }
1566 }
1567
1568 //================================================================================
1569 /*!
1570  * \brief Update widgets dependent on paramWidget
1571  */
1572 //================================================================================
1573
1574 void StdMeshersGUI_StdHypothesisCreator::valueChanged( QWidget* paramWidget)
1575 {
1576   if ( hypType() == "MaxLength" && paramWidget == getWidgetForParam(1) )
1577   {
1578     getWidgetForParam(0)->setEnabled( !widget< QCheckBox >( 1 )->isChecked() );
1579     if ( !getWidgetForParam(0)->isEnabled() ) {
1580       StdMeshers::StdMeshers_MaxLength_var h =
1581         StdMeshers::StdMeshers_MaxLength::_narrow( initParamsHypothesis() );
1582       widget< QtxDoubleSpinBox >( 0 )->setValue( h->GetPreestimatedLength() );
1583     }
1584   }
1585   else if ( hypType().startsWith("ImportSource") && paramWidget == getWidgetForParam(1) )
1586   {
1587     QCheckBox* toCopyMesh   = (QCheckBox*) paramWidget;
1588     QCheckBox* toCopyGroups = widget< QCheckBox >( 2 );
1589     if ( !toCopyMesh->isChecked() )
1590     {
1591       toCopyGroups->setChecked( false );
1592       toCopyGroups->setEnabled( false );
1593     }
1594     else
1595     {
1596       toCopyGroups->setEnabled( true );
1597     }
1598   }
1599   else if ( hypType() == "ViscousLayers2D" && paramWidget->inherits("QButtonGroup"))
1600   {
1601     if ( QLabel* label = getLabel(4) )
1602     {
1603       bool toIgnore = widget< StdMeshersGUI_RadioButtonsGrpWdg >( 3 )->checkedId();
1604       label->setText( tr( toIgnore ? "SMESH_EDGES_WO_LAYERS" : "SMESH_EDGES_WITH_LAYERS" ));
1605     }
1606   }
1607 }
1608
1609 //================================================================================
1610 /*!
1611  *
1612  */
1613 //================================================================================
1614
1615 bool StdMeshersGUI_StdHypothesisCreator::initVariableName(SMESH::SMESH_Hypothesis_var theHyp, 
1616                                                           StdParam &                  theParams, 
1617                                                           const char*                 theMethod) const
1618 {
1619   QString aVaribaleName = getVariableName( theMethod );
1620   theParams.isVariable = !aVaribaleName.isEmpty();
1621   if (theParams.isVariable)
1622     theParams.myValue = aVaribaleName;
1623
1624   return theParams.isVariable;
1625 }