1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : StdMeshersGUI_StdHypothesisCreator.cxx
24 // Author : Alexander SOLOVYOV, Open CASCADE S.A.S.
27 #include "StdMeshersGUI_StdHypothesisCreator.h"
30 #include <SMESHGUI_SpinBox.h>
31 #include <SMESHGUI_HypothesesUtils.h>
32 #include <SMESHGUI_Utils.h>
33 #include <SMESH_TypeFilter.hxx>
34 #include <SMESH_NumberFilter.hxx>
35 #include "StdMeshersGUI_ObjectReferenceParamWdg.h"
36 #include "StdMeshersGUI_LayerDistributionParamWdg.h"
37 #include "StdMeshersGUI_SubShapeSelectorWdg.h"
38 #include "StdMeshersGUI_FixedPointsParamWdg.h"
39 #include <SALOMEDSClient_Study.hxx>
41 // SALOME GUI includes
42 #include <SUIT_ResourceMgr.h>
45 #include <SALOMEconfig.h>
46 #include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
47 #include CORBA_SERVER_HEADER(SMESH_Mesh)
50 #include <QHBoxLayout>
55 const double VALUE_MAX = 1.0e+15, // COORD_MAX
56 VALUE_MAX_2 = VALUE_MAX * VALUE_MAX,
57 VALUE_MAX_3 = VALUE_MAX_2 * VALUE_MAX,
58 VALUE_SMALL = 1.0e-15,
59 VALUE_SMALL_2 = VALUE_SMALL * VALUE_SMALL,
60 VALUE_SMALL_3 = VALUE_SMALL_2 * VALUE_SMALL;
62 //================================================================================
65 * \param type - hypothesis type
67 //================================================================================
69 StdMeshersGUI_StdHypothesisCreator::StdMeshersGUI_StdHypothesisCreator( const QString& type )
70 : SMESHGUI_GenericHypothesisCreator( type )
74 //================================================================================
78 //================================================================================
80 StdMeshersGUI_StdHypothesisCreator::~StdMeshersGUI_StdHypothesisCreator()
84 //================================================================================
86 * \brief Return widget for i-th hypothesis parameter (got from myParamWidgets)
87 * \param i - index of hypothesis parameter
88 * \retval QWidget* - found widget
90 //================================================================================
92 QWidget* StdMeshersGUI_StdHypothesisCreator::getWidgetForParam( int i ) const
95 if ( isCreation() ) ++i; // skip widget of 'name' parameter
97 if ( i < myCustomWidgets.count() ) {
98 QList<QWidget*>::const_iterator anIt = myCustomWidgets.begin();
99 QList<QWidget*>::const_iterator aLast = myCustomWidgets.end();
100 for ( int j = 0 ; !w && anIt != aLast; ++anIt, ++j )
105 // list has no at() const, so we iterate
106 QList<QWidget*>::const_iterator anIt = widgets().begin();
107 QList<QWidget*>::const_iterator aLast = widgets().end();
108 for( int j = 0; !w && anIt!=aLast; anIt++, ++j ) {
116 //================================================================================
118 * \brief Allow modifing myCustomWidgets in const methods
119 * \retval ListOfWidgets* - non-const pointer to myCustomWidgets
121 //================================================================================
123 StdMeshersGUI_StdHypothesisCreator::ListOfWidgets*
124 StdMeshersGUI_StdHypothesisCreator::customWidgets() const
126 return const_cast< ListOfWidgets* >( & myCustomWidgets );
129 //================================================================================
131 * \brief Builds dlg layout
132 * \retval QFrame* - the built widget
134 //================================================================================
136 QFrame* StdMeshersGUI_StdHypothesisCreator::buildFrame()
138 return buildStdFrame();
141 //================================================================================
143 * \brief Initialise parameter values in controls
145 //================================================================================
147 void StdMeshersGUI_StdHypothesisCreator::retrieveParams() const
149 // buildStdFrame() sets values itself calling stdParams()
151 if ( hypType().startsWith("ProjectionSource" ))
153 // we use this method to connect depending custom widgets
154 StdMeshersGUI_ObjectReferenceParamWdg* widgetToActivate = 0;
155 ListOfWidgets::const_iterator anIt = myCustomWidgets.begin();
156 for ( ; anIt != myCustomWidgets.end(); anIt++)
158 if ( *anIt && (*anIt)->inherits("StdMeshersGUI_ObjectReferenceParamWdg"))
160 StdMeshersGUI_ObjectReferenceParamWdg * w1 =
161 ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
162 ListOfWidgets::const_iterator anIt2 = anIt;
163 for ( ++anIt2; anIt2 != myCustomWidgets.end(); anIt2++)
164 if ( *anIt2 && (*anIt2)->inherits("StdMeshersGUI_ObjectReferenceParamWdg"))
166 StdMeshersGUI_ObjectReferenceParamWdg * w2 =
167 ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt2 );
168 w1->AvoidSimultaneousSelection( w2 );
170 if ( !widgetToActivate )
171 widgetToActivate = w1;
174 if ( widgetToActivate )
175 widgetToActivate->activateSelection();
179 dlg()->setMinimumSize( dlg()->minimumSizeHint().width(), dlg()->minimumSizeHint().height() );
184 //================================================================================
186 * \brief Widget: slider with left and right labels
188 //================================================================================
190 class TDoubleSliderWith2Lables: public QWidget
193 TDoubleSliderWith2Lables( const QString& leftLabel, const QString& rightLabel,
194 const double initValue, const double bottom,
195 const double top , const double precision,
196 QWidget * parent=0 , const char * name=0 )
197 :QWidget(parent), _bottom(bottom), _precision(precision)
201 QHBoxLayout* aHBoxL = new QHBoxLayout(this);
203 if ( !leftLabel.isEmpty() ) {
204 QLabel* aLeftLabel = new QLabel( this );
205 aLeftLabel->setText( leftLabel );
206 aHBoxL->addWidget( aLeftLabel );
209 _slider = new QSlider( Qt::Horizontal, this );
210 _slider->setRange( 0, toInt( top ));
211 _slider->setValue( toInt( initValue ));
212 aHBoxL->addWidget( _slider );
214 if ( !rightLabel.isEmpty() ) {
215 QLabel* aRightLabel = new QLabel( this );
216 aRightLabel->setText( rightLabel );
217 aHBoxL->addWidget( aRightLabel );
222 double value() const { return _bottom + _slider->value() * _precision; }
223 QSlider * getSlider() const { return _slider; }
224 int toInt( double val ) const { return (int) ceil(( val - _bottom ) / _precision ); }
226 double _bottom, _precision;
230 //================================================================================
232 * \brief Retrieve GEOM_Object held by widget
234 //================================================================================
236 inline GEOM::GEOM_Object_var geomFromWdg(const QWidget* wdg)
238 const StdMeshersGUI_ObjectReferenceParamWdg * objRefWdg =
239 dynamic_cast<const StdMeshersGUI_ObjectReferenceParamWdg*>( wdg );
241 return objRefWdg->GetObject< GEOM::GEOM_Object >();
243 return GEOM::GEOM_Object::_nil();
245 //================================================================================
247 * \brief Retrieve SMESH_Mesh held by widget
249 //================================================================================
251 inline SMESH::SMESH_Mesh_var meshFromWdg(const QWidget* wdg)
253 const StdMeshersGUI_ObjectReferenceParamWdg * objRefWdg =
254 dynamic_cast<const StdMeshersGUI_ObjectReferenceParamWdg*>( wdg );
256 return objRefWdg->GetObject< SMESH::SMESH_Mesh >();
258 return SMESH::SMESH_Mesh::_nil();
260 //================================================================================
262 * \brief creates a filter for selection of shapes of given dimension
263 * \param dim - dimension
264 * \param subShapeType - required type of subshapes, number of which must be \a nbSubShapes
265 * \param nbSubShapes - number of subshapes of given type
266 * \param closed - required closeness flag of a shape
267 * \retval SUIT_SelectionFilter* - created filter
269 //================================================================================
271 SUIT_SelectionFilter* filterForShapeOfDim(const int dim,
272 TopAbs_ShapeEnum subShapeType = TopAbs_SHAPE,
273 const int nbSubShapes = 0,
276 TColStd_MapOfInteger shapeTypes;
278 case 0: shapeTypes.Add( TopAbs_VERTEX ); break;
280 if ( subShapeType == TopAbs_SHAPE ) subShapeType = TopAbs_EDGE;
281 shapeTypes.Add( TopAbs_EDGE );
282 shapeTypes.Add( TopAbs_COMPOUND ); // for a group
285 if ( subShapeType == TopAbs_SHAPE ) subShapeType = TopAbs_FACE;
286 shapeTypes.Add( TopAbs_FACE );
287 shapeTypes.Add( TopAbs_COMPOUND ); // for a group
290 shapeTypes.Add( TopAbs_SHELL );
291 shapeTypes.Add( TopAbs_SOLID );
292 shapeTypes.Add( TopAbs_COMPSOLID );
293 shapeTypes.Add( TopAbs_COMPOUND );
296 return new SMESH_NumberFilter("GEOM", subShapeType, nbSubShapes,
297 shapeTypes, GEOM::GEOM_Object::_nil(), closed);
300 //================================================================================
302 * \brief Create a widget for object selection
303 * \param object - initial object
304 * \param filter - selection filter
305 * \retval QWidget* - created widget
307 //================================================================================
309 QWidget* newObjRefParamWdg( SUIT_SelectionFilter* filter,
310 CORBA::Object_var object)
312 StdMeshersGUI_ObjectReferenceParamWdg* w =
313 new StdMeshersGUI_ObjectReferenceParamWdg( filter, 0);
314 w->SetObject( object.in() );
318 //================================================================================
320 * \brief calls deactivateSelection() for StdMeshersGUI_ObjectReferenceParamWdg
321 * \param widgetList - list of widgets
323 //================================================================================
325 void deactivateObjRefParamWdg( QList<QWidget*>* widgetList )
327 StdMeshersGUI_ObjectReferenceParamWdg* w = 0;
328 QList<QWidget*>::iterator anIt = widgetList->begin();
329 QList<QWidget*>::iterator aLast = widgetList->end();
330 for ( ; anIt != aLast; anIt++ ) {
331 if ( (*anIt) && (*anIt)->inherits( "StdMeshersGUI_ObjectReferenceParamWdg" ))
333 w = (StdMeshersGUI_ObjectReferenceParamWdg* )( *anIt );
334 w->deactivateSelection();
340 //================================================================================
342 * \brief Check parameter values before accept()
343 * \retval bool - true if OK
345 //================================================================================
347 bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg ) const
349 if( !SMESHGUI_GenericHypothesisCreator::checkParams( msg ) )
352 // check if object reference parameter is set, as it has no default value
354 if ( hypType().startsWith("ProjectionSource" ))
356 StdMeshersGUI_ObjectReferenceParamWdg* w =
357 widget< StdMeshersGUI_ObjectReferenceParamWdg >( 0 );
358 ok = ( w->IsObjectSelected() );
359 if ( !ok ) w->SetObject( CORBA::Object::_nil() );
360 int nbAssocVert = ( hypType() == "ProjectionSource1D" ? 1 : 2 );
361 for ( int i = 0; ok && i < nbAssocVert; i += 2)
364 StdMeshersGUI_ObjectReferenceParamWdg* w1 =
365 widget< StdMeshersGUI_ObjectReferenceParamWdg >( i+2 );
366 StdMeshersGUI_ObjectReferenceParamWdg* w2 =
367 widget< StdMeshersGUI_ObjectReferenceParamWdg >( i+3 );
368 srcV = w1->GetValue();
369 tgtV = w2->GetValue();
370 ok = (( srcV.isEmpty() && tgtV.isEmpty() ) ||
371 ( !srcV.isEmpty() && !tgtV.isEmpty() && srcV != tgtV ));
373 w1->SetObject( CORBA::Object::_nil() );
374 w2->SetObject( CORBA::Object::_nil() );
378 // Uninstall filters of StdMeshersGUI_ObjectReferenceParamWdg
380 deactivateObjRefParamWdg( customWidgets() );
382 else if ( hypType() == "LayerDistribution" || hypType() == "LayerDistribution2D" )
384 StdMeshersGUI_LayerDistributionParamWdg* w =
385 widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
386 ok = ( w && w->IsOk() );
388 else if ( hypType() == "QuadrangleParams" )
390 StdMeshersGUI_SubShapeSelectorWdg* w =
391 widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 );
392 ok = ( w->GetListSize() > 0 );
397 //================================================================================
399 * \brief Store params from GUI controls to a hypothesis
400 * \retval QString - text representation of parameters
402 //================================================================================
404 QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
406 ListOfStdParams params;
407 bool res = getStdParamFromDlg( params );
410 SMESH::SetName( SMESH::FindSObject( hypothesis() ), params[0].myValue.toString().toLatin1().data() );
411 params.erase( params.begin() );
414 QString valueStr = stdParamValues( params );
415 QStringList aVariablesList = getVariablesFromDlg();
417 if( res && !params.isEmpty() )
419 if( hypType()=="LocalLength" )
421 StdMeshers::StdMeshers_LocalLength_var h =
422 StdMeshers::StdMeshers_LocalLength::_narrow( hypothesis() );
424 h->SetLength( params[0].myValue.toDouble() );
425 h->SetParameters(aVariablesList.join(":").toLatin1().constData());
426 h->SetPrecision( params[1].myValue.toDouble() );
427 h->SetParameters(aVariablesList.join(":").toLatin1().constData());
429 else if( hypType()=="MaxLength" )
431 StdMeshers::StdMeshers_MaxLength_var h =
432 StdMeshers::StdMeshers_MaxLength::_narrow( hypothesis() );
434 h->SetLength( params[0].myValue.toDouble() );
435 h->SetParameters(aVariablesList.join(":").toLatin1().constData());
436 h->SetUsePreestimatedLength( widget< QCheckBox >( 1 )->isChecked() );
437 if ( !h->HavePreestimatedLength() && !h->_is_equivalent( initParamsHypothesis() )) {
438 StdMeshers::StdMeshers_MaxLength_var hInit =
439 StdMeshers::StdMeshers_MaxLength::_narrow( initParamsHypothesis() );
440 h->SetPreestimatedLength( hInit->GetPreestimatedLength() );
443 else if( hypType()=="SegmentLengthAroundVertex" )
445 StdMeshers::StdMeshers_SegmentLengthAroundVertex_var h =
446 StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hypothesis() );
448 h->SetLength( params[0].myValue.toDouble() );
449 h->SetParameters(aVariablesList.join(":").toLatin1().constData());
451 else if( hypType()=="Arithmetic1D" )
453 StdMeshers::StdMeshers_Arithmetic1D_var h =
454 StdMeshers::StdMeshers_Arithmetic1D::_narrow( hypothesis() );
456 StdMeshersGUI_SubShapeSelectorWdg* w =
457 widget< StdMeshersGUI_SubShapeSelectorWdg >( 2 );
459 h->SetStartLength( params[0].myValue.toDouble() );
460 h->SetParameters(aVariablesList.join(":").toLatin1().constData());
461 h->SetEndLength( params[1].myValue.toDouble() );
462 h->SetParameters(aVariablesList.join(":").toLatin1().constData());
464 h->SetReversedEdges( w->GetListOfIDs() );
465 h->SetObjectEntry( w->GetMainShapeEntry() );
468 else if( hypType()=="FixedPoints1D" )
470 StdMeshers::StdMeshers_FixedPoints1D_var h =
471 StdMeshers::StdMeshers_FixedPoints1D::_narrow( hypothesis() );
473 StdMeshersGUI_FixedPointsParamWdg* w1 =
474 widget< StdMeshersGUI_FixedPointsParamWdg >( 0 );
476 StdMeshersGUI_SubShapeSelectorWdg* w2 =
477 widget< StdMeshersGUI_SubShapeSelectorWdg >( 1 );
480 h->SetParameters(aVariablesList.join(":").toLatin1().constData());
481 h->SetPoints( w1->GetListOfPoints() );
482 h->SetNbSegments( w1->GetListOfSegments() );
485 h->SetReversedEdges( w2->GetListOfIDs() );
486 h->SetObjectEntry( w2->GetMainShapeEntry() );
489 else if( hypType()=="MaxElementArea" )
491 StdMeshers::StdMeshers_MaxElementArea_var h =
492 StdMeshers::StdMeshers_MaxElementArea::_narrow( hypothesis() );
493 h->SetParameters(aVariablesList.join(":").toLatin1().constData());
494 h->SetMaxElementArea( params[0].myValue.toDouble() );
496 else if( hypType()=="MaxElementVolume" )
498 StdMeshers::StdMeshers_MaxElementVolume_var h =
499 StdMeshers::StdMeshers_MaxElementVolume::_narrow( hypothesis() );
501 h->SetMaxElementVolume( params[0].myValue.toDouble() );
502 h->SetParameters(aVariablesList.join(":").toLatin1().constData());
504 else if( hypType()=="StartEndLength" )
506 StdMeshers::StdMeshers_StartEndLength_var h =
507 StdMeshers::StdMeshers_StartEndLength::_narrow( hypothesis() );
509 StdMeshersGUI_SubShapeSelectorWdg* w =
510 widget< StdMeshersGUI_SubShapeSelectorWdg >( 2 );
512 h->SetStartLength( params[0].myValue.toDouble() );
513 h->SetParameters(aVariablesList.join(":").toLatin1().constData());
514 h->SetEndLength( params[1].myValue.toDouble() );
515 h->SetParameters(aVariablesList.join(":").toLatin1().constData());
517 h->SetReversedEdges( w->GetListOfIDs() );
518 h->SetObjectEntry( w->GetMainShapeEntry() );
521 else if( hypType()=="Deflection1D" )
523 StdMeshers::StdMeshers_Deflection1D_var h =
524 StdMeshers::StdMeshers_Deflection1D::_narrow( hypothesis() );
525 h->SetParameters(aVariablesList.join(":").toLatin1().constData());
526 h->SetDeflection( params[0].myValue.toDouble() );
528 else if( hypType()=="AutomaticLength" )
530 StdMeshers::StdMeshers_AutomaticLength_var h =
531 StdMeshers::StdMeshers_AutomaticLength::_narrow( hypothesis() );
533 h->SetFineness( params[0].myValue.toDouble() );
535 else if( hypType()=="NumberOfLayers" )
537 StdMeshers::StdMeshers_NumberOfLayers_var h =
538 StdMeshers::StdMeshers_NumberOfLayers::_narrow( hypothesis() );
540 h->SetNumberOfLayers( params[0].myValue.toInt() );
541 h->SetParameters(aVariablesList.join(":").toLatin1().constData());
543 else if( hypType()=="LayerDistribution" )
545 StdMeshers::StdMeshers_LayerDistribution_var h =
546 StdMeshers::StdMeshers_LayerDistribution::_narrow( hypothesis() );
547 StdMeshersGUI_LayerDistributionParamWdg* w =
548 widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
550 h->SetLayerDistribution( w->GetHypothesis() );
551 h->SetParameters(w->GetHypothesis()->GetParameters());
552 w->GetHypothesis()->ClearParameters();
554 else if( hypType()=="NumberOfLayers2D" )
556 StdMeshers::StdMeshers_NumberOfLayers2D_var h =
557 StdMeshers::StdMeshers_NumberOfLayers2D::_narrow( hypothesis() );
559 h->SetNumberOfLayers( params[0].myValue.toInt() );
560 h->SetParameters(aVariablesList.join(":").toLatin1().constData());
562 else if( hypType()=="LayerDistribution2D" )
564 StdMeshers::StdMeshers_LayerDistribution2D_var h =
565 StdMeshers::StdMeshers_LayerDistribution2D::_narrow( hypothesis() );
566 StdMeshersGUI_LayerDistributionParamWdg* w =
567 widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
569 h->SetLayerDistribution( w->GetHypothesis() );
570 h->SetParameters(w->GetHypothesis()->GetParameters());
571 w->GetHypothesis()->ClearParameters();
573 else if( hypType()=="ProjectionSource1D" )
575 StdMeshers::StdMeshers_ProjectionSource1D_var h =
576 StdMeshers::StdMeshers_ProjectionSource1D::_narrow( hypothesis() );
578 h->SetSourceEdge ( geomFromWdg ( getWidgetForParam( 0 )));
579 h->SetSourceMesh ( meshFromWdg ( getWidgetForParam( 1 )));
580 h->SetVertexAssociation( geomFromWdg ( getWidgetForParam( 2 )),
581 geomFromWdg ( getWidgetForParam( 3 )));
583 else if( hypType()=="ProjectionSource2D" )
585 StdMeshers::StdMeshers_ProjectionSource2D_var h =
586 StdMeshers::StdMeshers_ProjectionSource2D::_narrow( hypothesis() );
588 h->SetSourceFace ( geomFromWdg ( getWidgetForParam( 0 )));
589 h->SetSourceMesh ( meshFromWdg ( getWidgetForParam( 1 )));
590 h->SetVertexAssociation( geomFromWdg ( getWidgetForParam( 2 )), // src1
591 geomFromWdg ( getWidgetForParam( 4 )), // src2
592 geomFromWdg ( getWidgetForParam( 3 )), // tgt1
593 geomFromWdg ( getWidgetForParam( 5 ))); // tgt2
595 else if( hypType()=="ProjectionSource3D" )
597 StdMeshers::StdMeshers_ProjectionSource3D_var h =
598 StdMeshers::StdMeshers_ProjectionSource3D::_narrow( hypothesis() );
600 h->SetSource3DShape ( geomFromWdg ( getWidgetForParam( 0 )));
601 h->SetSourceMesh ( meshFromWdg ( getWidgetForParam( 1 )));
602 h->SetVertexAssociation( geomFromWdg ( getWidgetForParam( 2 )), // src1
603 geomFromWdg ( getWidgetForParam( 4 )), // src2
604 geomFromWdg ( getWidgetForParam( 3 )), // tgt1
605 geomFromWdg ( getWidgetForParam( 5 ))); // tgt2
607 else if( hypType()=="QuadrangleParams" )
609 StdMeshers::StdMeshers_QuadrangleParams_var h =
610 StdMeshers::StdMeshers_QuadrangleParams::_narrow( hypothesis() );
611 StdMeshersGUI_SubShapeSelectorWdg* w =
612 widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 );
614 if( w->GetListSize() > 0 ) {
615 h->SetTriaVertex( w->GetListOfIDs()[0] ); // getlist must be called once
616 const char * entry = w->GetMainShapeEntry();
617 h->SetObjectEntry( entry );
625 //================================================================================
627 * \brief Return parameter values as SMESHGUI_GenericHypothesisCreator::StdParam
628 * \param p - list of parameters
629 * \retval bool - success flag
631 * Is called from SMESHGUI_GenericHypothesisCreator::buildStdFrame().
632 * Parameters will be shown using "standard" controls:
633 * Int by QtxIntSpinBox
634 * Double by SMESHGUI_SpinBox
635 * String by QLineEdit
636 * getCustomWidget() allows to redefine control for a parameter
638 //================================================================================
640 bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
643 SMESHGUI_GenericHypothesisCreator::StdParam item;
646 customWidgets()->clear();
649 HypothesisData* data = SMESH::GetHypothesisData( hypType() );
650 item.myName = tr( "SMESH_NAME" );
651 item.myValue = data ? hypName() : QString();
653 customWidgets()->append(0);
656 SMESH::SMESH_Hypothesis_var hyp = initParamsHypothesis();
657 SMESH::ListOfParameters_var aParameters = hyp->GetLastParameters();
659 if( hypType()=="LocalLength" )
661 StdMeshers::StdMeshers_LocalLength_var h =
662 StdMeshers::StdMeshers_LocalLength::_narrow( hyp );
664 item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
665 if(!initVariableName(aParameters,item,0))
666 item.myValue = h->GetLength();
669 item.myName = tr("SMESH_LOCAL_LENGTH_PRECISION");
670 if(!initVariableName(aParameters,item,1))
671 item.myValue = h->GetPrecision();
675 else if( hypType()=="MaxLength" )
677 StdMeshers::StdMeshers_MaxLength_var h =
678 StdMeshers::StdMeshers_MaxLength::_narrow( hyp );
679 // try to set a right preestimated length to edited hypothesis
680 bool noPreestimatedAtEdition = false;
681 if ( !isCreation() ) {
682 StdMeshers::StdMeshers_MaxLength_var initHyp =
683 StdMeshers::StdMeshers_MaxLength::_narrow( initParamsHypothesis(true) );
684 noPreestimatedAtEdition =
685 ( initHyp->_is_nil() || !initHyp->HavePreestimatedLength() );
686 if ( !noPreestimatedAtEdition )
687 h->SetPreestimatedLength( initHyp->GetPreestimatedLength() );
690 item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
691 if(!initVariableName(aParameters,item,0))
692 item.myValue = h->GetLength();
694 customWidgets()->append(0);
696 item.myName = tr("SMESH_USE_PREESTIMATED_LENGTH");
698 QCheckBox* aQCheckBox = new QCheckBox(dlg());
699 if ( !noPreestimatedAtEdition && h->HavePreestimatedLength() ) {
700 aQCheckBox->setChecked( h->GetUsePreestimatedLength() );
701 connect( aQCheckBox, SIGNAL( stateChanged(int) ), this, SLOT( onValueChanged() ) );
704 aQCheckBox->setChecked( false );
705 aQCheckBox->setEnabled( false );
707 customWidgets()->append( aQCheckBox );
709 else if( hypType()=="SegmentLengthAroundVertex" )
711 StdMeshers::StdMeshers_SegmentLengthAroundVertex_var h =
712 StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hyp );
714 item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
715 if(!initVariableName(aParameters,item,0))
716 item.myValue = h->GetLength();
720 else if( hypType()=="Arithmetic1D" )
722 StdMeshers::StdMeshers_Arithmetic1D_var h =
723 StdMeshers::StdMeshers_Arithmetic1D::_narrow( hyp );
725 item.myName = tr( "SMESH_START_LENGTH_PARAM" );
726 if(!initVariableName(aParameters,item,0))
727 item.myValue = h->GetLength( true );
730 customWidgets()->append (0);
732 item.myName = tr( "SMESH_END_LENGTH_PARAM" );
733 if(!initVariableName(aParameters,item,1))
734 item.myValue = h->GetLength( false );
737 customWidgets()->append (0);
739 item.myName = tr( "SMESH_REVERSED_EDGES" );
742 StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
743 new StdMeshersGUI_SubShapeSelectorWdg();
744 QString aGeomEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
745 QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
746 if ( aGeomEntry == "" )
747 aGeomEntry = h->GetObjectEntry();
749 aDirectionWidget->SetGeomShapeEntry( aGeomEntry );
750 aDirectionWidget->SetMainShapeEntry( aMainEntry );
751 aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
752 aDirectionWidget->showPreview( true );
753 customWidgets()->append ( aDirectionWidget );
757 else if( hypType()=="FixedPoints1D" )
759 StdMeshers::StdMeshers_FixedPoints1D_var h =
760 StdMeshers::StdMeshers_FixedPoints1D::_narrow( hyp );
762 item.myName = tr( "SMESH_FIXED_POINTS" );
765 StdMeshersGUI_FixedPointsParamWdg* aFixedPointsWidget =
766 new StdMeshersGUI_FixedPointsParamWdg();
768 if ( !isCreation() ) {
769 aFixedPointsWidget->SetListOfPoints( h->GetPoints() );
770 aFixedPointsWidget->SetListOfSegments( h->GetNbSegments() );
772 customWidgets()->append( aFixedPointsWidget );
774 item.myName = tr( "SMESH_REVERSED_EDGES" );
777 StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
778 new StdMeshersGUI_SubShapeSelectorWdg();
779 QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
780 QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
782 anEntry = h->GetObjectEntry();
783 aDirectionWidget->SetGeomShapeEntry( anEntry );
784 aDirectionWidget->SetMainShapeEntry( aMainEntry );
785 aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
786 aDirectionWidget->showPreview( true );
787 customWidgets()->append ( aDirectionWidget );
791 else if( hypType()=="MaxElementArea" )
793 StdMeshers::StdMeshers_MaxElementArea_var h =
794 StdMeshers::StdMeshers_MaxElementArea::_narrow( hyp );
796 item.myName = tr( "SMESH_MAX_ELEMENT_AREA_PARAM" );
797 if(!initVariableName(aParameters,item,0))
798 item.myValue = h->GetMaxElementArea();
802 else if( hypType()=="MaxElementVolume" )
804 StdMeshers::StdMeshers_MaxElementVolume_var h =
805 StdMeshers::StdMeshers_MaxElementVolume::_narrow( hyp );
807 item.myName = tr( "SMESH_MAX_ELEMENT_VOLUME_PARAM" );
808 if(!initVariableName(aParameters,item,0))
809 item.myValue = h->GetMaxElementVolume();
812 else if( hypType()=="StartEndLength" )
814 StdMeshers::StdMeshers_StartEndLength_var h =
815 StdMeshers::StdMeshers_StartEndLength::_narrow( hyp );
817 item.myName = tr( "SMESH_START_LENGTH_PARAM" );
819 if(!initVariableName(aParameters,item,0))
820 item.myValue = h->GetLength( true );
822 customWidgets()->append(0);
824 item.myName = tr( "SMESH_END_LENGTH_PARAM" );
825 if(!initVariableName(aParameters,item,1))
826 item.myValue = h->GetLength( false );
828 customWidgets()->append(0);
830 item.myName = tr( "SMESH_REVERSED_EDGES" );
833 StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
834 new StdMeshersGUI_SubShapeSelectorWdg();
835 QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
836 QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
838 anEntry = h->GetObjectEntry();
839 aDirectionWidget->SetGeomShapeEntry( anEntry );
840 aDirectionWidget->SetMainShapeEntry( aMainEntry );
841 aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
842 aDirectionWidget->showPreview( true );
843 customWidgets()->append ( aDirectionWidget );
845 else if( hypType()=="Deflection1D" )
847 StdMeshers::StdMeshers_Deflection1D_var h =
848 StdMeshers::StdMeshers_Deflection1D::_narrow( hyp );
850 item.myName = tr( "SMESH_DEFLECTION1D_PARAM" );
851 if(!initVariableName(aParameters,item,0))
852 item.myValue = h->GetDeflection();
855 else if( hypType()=="AutomaticLength" )
857 StdMeshers::StdMeshers_AutomaticLength_var h =
858 StdMeshers::StdMeshers_AutomaticLength::_narrow( hyp );
860 item.myName = tr( "SMESH_FINENESS_PARAM" );
861 //item.myValue = h->GetFineness();
863 customWidgets()->append
864 ( new TDoubleSliderWith2Lables( "0 ", " 1", h->GetFineness(), 0, 1, 0.01, 0 ));
866 else if( hypType()=="NumberOfLayers" )
868 StdMeshers::StdMeshers_NumberOfLayers_var h =
869 StdMeshers::StdMeshers_NumberOfLayers::_narrow( hyp );
871 item.myName = tr( "SMESH_NUMBER_OF_LAYERS" );
872 if(!initVariableName(aParameters,item,0))
873 item.myValue = (int) h->GetNumberOfLayers();
876 else if( hypType()=="LayerDistribution" ) {
877 StdMeshers::StdMeshers_LayerDistribution_var h =
878 StdMeshers::StdMeshers_LayerDistribution::_narrow( hyp );
880 item.myName = tr( "SMESH_LAYERS_DISTRIBUTION" ); p.append( item );
882 //Set into not published hypo last variables
883 QStringList aLastVarsList;
884 for(int i = 0;i<aParameters->length();i++)
885 aLastVarsList.append(QString(aParameters[i].in()));
887 if(!aLastVarsList.isEmpty())
888 h->GetLayerDistribution()->SetLastParameters(aLastVarsList.join(":").toLatin1().constData());
890 customWidgets()->append
891 ( new StdMeshersGUI_LayerDistributionParamWdg( h->GetLayerDistribution(), hypName(), dlg()));
893 else if( hypType()=="NumberOfLayers2D" ) {
894 StdMeshers::StdMeshers_NumberOfLayers2D_var h =
895 StdMeshers::StdMeshers_NumberOfLayers2D::_narrow( hyp );
897 item.myName = tr( "SMESH_NUMBER_OF_LAYERS" );
898 if(!initVariableName(aParameters,item,0))
899 item.myValue = (int) h->GetNumberOfLayers();
902 else if( hypType()=="LayerDistribution2D" ) {
903 StdMeshers::StdMeshers_LayerDistribution2D_var h =
904 StdMeshers::StdMeshers_LayerDistribution2D::_narrow( hyp );
906 item.myName = tr( "SMESH_LAYERS_DISTRIBUTION" ); p.append( item );
908 //Set into not published hypo last variables
909 QStringList aLastVarsList;
910 for(int i = 0;i<aParameters->length();i++)
911 aLastVarsList.append(QString(aParameters[i].in()));
913 if(!aLastVarsList.isEmpty())
914 h->GetLayerDistribution()->SetLastParameters(aLastVarsList.join(":").toLatin1().constData());
916 customWidgets()->append
917 ( new StdMeshersGUI_LayerDistributionParamWdg( h->GetLayerDistribution(), hypName(), dlg()));
919 else if( hypType()=="ProjectionSource1D" )
921 StdMeshers::StdMeshers_ProjectionSource1D_var h =
922 StdMeshers::StdMeshers_ProjectionSource1D::_narrow( hyp );
924 item.myName = tr( "SMESH_SOURCE_EDGE" ); p.append( item );
925 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 1 ),
926 h->GetSourceEdge()));
927 item.myName = tr( "SMESH_SOURCE_MESH" ); p.append( item );
928 customWidgets()->append( newObjRefParamWdg( new SMESH_TypeFilter( MESH ),
929 h->GetSourceMesh()));
930 item.myName = tr( "SMESH_SOURCE_VERTEX" ); p.append( item );
931 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
932 h->GetSourceVertex()));
933 item.myName = tr( "SMESH_TARGET_VERTEX" ); p.append( item );
934 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
935 h->GetTargetVertex()));
937 else if( hypType()=="ProjectionSource2D" )
939 StdMeshers::StdMeshers_ProjectionSource2D_var h =
940 StdMeshers::StdMeshers_ProjectionSource2D::_narrow( hyp );
942 item.myName = tr( "SMESH_SOURCE_FACE" ); p.append( item );
943 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 2 ),
944 h->GetSourceFace()));
945 item.myName = tr( "SMESH_SOURCE_MESH" ); p.append( item );
946 customWidgets()->append( newObjRefParamWdg( new SMESH_TypeFilter( MESH ),
947 h->GetSourceMesh()));
948 item.myName = tr( "SMESH_SOURCE_VERTEX1" ); p.append( item );
949 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
950 h->GetSourceVertex( 1 )));
951 item.myName = tr( "SMESH_TARGET_VERTEX1" ); p.append( item );
952 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
953 h->GetTargetVertex( 1 )));
954 item.myName = tr( "SMESH_SOURCE_VERTEX2" ); p.append( item );
955 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
956 h->GetSourceVertex( 2 )));
957 item.myName = tr( "SMESH_TARGET_VERTEX2" ); p.append( item );
958 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
959 h->GetTargetVertex( 2 )));
961 else if( hypType()=="ProjectionSource3D" )
963 StdMeshers::StdMeshers_ProjectionSource3D_var h =
964 StdMeshers::StdMeshers_ProjectionSource3D::_narrow( hyp );
966 item.myName = tr( "SMESH_SOURCE_3DSHAPE" ); p.append( item );
967 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 3, TopAbs_FACE, 6, true ),
968 h->GetSource3DShape()));
969 item.myName = tr( "SMESH_SOURCE_MESH" ); p.append( item );
970 customWidgets()->append( newObjRefParamWdg( new SMESH_TypeFilter( MESH ),
971 h->GetSourceMesh()));
972 item.myName = tr( "SMESH_SOURCE_VERTEX1" ); p.append( item );
973 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
974 h->GetSourceVertex( 1 )));
975 item.myName = tr( "SMESH_TARGET_VERTEX1" ); p.append( item );
976 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
977 h->GetTargetVertex( 1 )));
978 item.myName = tr( "SMESH_SOURCE_VERTEX2" ); p.append( item );
979 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
980 h->GetSourceVertex( 2 )));
981 item.myName = tr( "SMESH_TARGET_VERTEX2" ); p.append( item );
982 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
983 h->GetTargetVertex( 2 )));
985 else if( hypType()=="QuadrangleParams" )
987 StdMeshers::StdMeshers_QuadrangleParams_var h =
988 StdMeshers::StdMeshers_QuadrangleParams::_narrow( hyp );
990 item.myName = tr( "SMESH_BASE_VERTEX" );
993 StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
994 new StdMeshersGUI_SubShapeSelectorWdg();
995 aDirectionWidget->SetMaxSize(1);
996 aDirectionWidget->SetSubShType(TopAbs_VERTEX);
997 QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
998 QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
1000 anEntry = h->GetObjectEntry();
1001 aDirectionWidget->SetGeomShapeEntry( anEntry );
1002 aDirectionWidget->SetMainShapeEntry( aMainEntry );
1003 if ( !isCreation() ) {
1004 SMESH::long_array_var aVec = new SMESH::long_array;
1005 int vertID = h->GetTriaVertex();
1009 aDirectionWidget->SetListOfIDs( aVec );
1012 aDirectionWidget->showPreview( true );
1013 customWidgets()->append ( aDirectionWidget );
1020 //================================================================================
1022 * \brief tune "standard" control
1023 * \param w - control widget
1024 * \param int - parameter index
1026 //================================================================================
1028 void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int) const
1030 SMESHGUI_SpinBox* sb = w->inherits( "SMESHGUI_SpinBox" ) ? ( SMESHGUI_SpinBox* )w : 0;
1031 if( hypType()=="LocalLength" && sb )
1033 if (sb->objectName() == tr("SMESH_LOCAL_LENGTH_PARAM"))
1034 sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
1035 else if (sb->objectName() == tr("SMESH_LOCAL_LENGTH_PRECISION"))
1036 sb->RangeStepAndValidator( 0.0, 1.0, 0.05, "len_tol_precision" );
1038 else if( hypType()=="Arithmetic1D" && sb )
1040 sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "parametric_precision" );
1042 else if( hypType()=="MaxLength" && sb )
1044 sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
1045 sb->setEnabled( !widget< QCheckBox >( 1 )->isChecked() );
1047 else if( hypType()=="MaxElementArea" && sb )
1049 sb->RangeStepAndValidator( VALUE_SMALL_2, VALUE_MAX_2, 1.0, "area_precision" );
1051 else if( hypType()=="MaxElementVolume" && sb )
1053 sb->RangeStepAndValidator( VALUE_SMALL_3, VALUE_MAX_3, 1.0, "vol_precision" );
1055 else if( hypType()=="StartEndLength" && sb )
1057 sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
1059 else if( hypType()=="Deflection1D" && sb )
1061 sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "parametric_precision" );
1063 else if ( sb ) // default validator for possible ancestors
1065 sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
1069 //================================================================================
1071 * \brief Return dlg title
1072 * \retval QString - title string
1074 //================================================================================
1076 QString StdMeshersGUI_StdHypothesisCreator::caption() const
1078 return tr( QString( "SMESH_%1_TITLE" ).arg( hypTypeName( hypType() ) ).toLatin1().data() );
1081 //================================================================================
1083 * \brief return pixmap for dlg icon
1086 //================================================================================
1088 QPixmap StdMeshersGUI_StdHypothesisCreator::icon() const
1090 QString hypIconName = tr( QString( "ICON_DLG_%1" ).arg( hypTypeName( hypType() ) ).toLatin1().data() );
1091 return SMESHGUI::resourceMgr()->loadPixmap( "SMESH", hypIconName );
1094 //================================================================================
1096 * \brief Return hypothesis type name to show in dlg
1099 //================================================================================
1101 QString StdMeshersGUI_StdHypothesisCreator::type() const
1103 return tr( QString( "SMESH_%1_HYPOTHESIS" ).arg( hypTypeName( hypType() ) ).toLatin1().data() );
1106 //================================================================================
1108 * \brief String to insert in "SMESH_%1_HYPOTHESIS" to get hypothesis type name
1109 * from message resouce file
1110 * \param t - hypothesis type
1111 * \retval QString - result string
1113 //================================================================================
1115 QString StdMeshersGUI_StdHypothesisCreator::hypTypeName( const QString& t ) const
1117 static QMap<QString,QString> types;
1118 if( types.isEmpty() )
1120 types.insert( "LocalLength", "LOCAL_LENGTH" );
1121 types.insert( "NumberOfSegments", "NB_SEGMENTS" );
1122 types.insert( "MaxElementArea", "MAX_ELEMENT_AREA" );
1123 types.insert( "MaxElementVolume", "MAX_ELEMENT_VOLUME" );
1124 types.insert( "StartEndLength", "START_END_LENGTH" );
1125 types.insert( "Deflection1D", "DEFLECTION1D" );
1126 types.insert( "Arithmetic1D", "ARITHMETIC_1D" );
1127 types.insert( "FixedPoints1D", "FIXED_POINTS_1D" );
1128 types.insert( "AutomaticLength", "AUTOMATIC_LENGTH" );
1129 types.insert( "ProjectionSource1D", "PROJECTION_SOURCE_1D" );
1130 types.insert( "ProjectionSource2D", "PROJECTION_SOURCE_2D" );
1131 types.insert( "ProjectionSource3D", "PROJECTION_SOURCE_3D" );
1132 types.insert( "NumberOfLayers", "NUMBER_OF_LAYERS" );
1133 types.insert( "LayerDistribution", "LAYER_DISTRIBUTION" );
1134 types.insert( "NumberOfLayers2D", "NUMBER_OF_LAYERS_2D" );
1135 types.insert( "LayerDistribution2D", "LAYER_DISTRIBUTION" );
1136 types.insert( "SegmentLengthAroundVertex", "SEGMENT_LENGTH_AROUND_VERTEX" );
1137 types.insert( "MaxLength", "MAX_LENGTH" );
1138 types.insert( "QuadrangleParams", "QUADRANGLE_PARAMS" );
1142 if( types.contains( t ) )
1149 //=======================================================================
1150 //function : getCustomWidget
1151 //purpose : is called from buildStdFrame()
1152 //=======================================================================
1154 QWidget* StdMeshersGUI_StdHypothesisCreator::getCustomWidget( const StdParam & param,
1156 const int index) const
1159 if ( index < customWidgets()->count() ) {
1160 w = customWidgets()->at( index );
1162 w->setParent( parent );
1163 w->move( QPoint( 0, 0 ) );
1169 //================================================================================
1171 * \brief Set param value taken from a custom widget
1172 * \param param - SMESHGUI_GenericHypothesisCreator::StdParam structure
1173 * \param widget - widget presenting param
1174 * \retval bool - success flag
1176 * this method is called from getStdParamFromDlg()
1178 //================================================================================
1180 bool StdMeshersGUI_StdHypothesisCreator::getParamFromCustomWidget( StdParam & param,
1181 QWidget* widget) const
1183 if ( hypType()=="AutomaticLength" ) {
1184 TDoubleSliderWith2Lables* w = dynamic_cast<TDoubleSliderWith2Lables*>( widget );
1186 param.myValue = w->value();
1190 if ( hypType() == "MaxLength" ) {
1194 if ( widget->inherits( "StdMeshersGUI_ObjectReferenceParamWdg" ))
1196 // show only 1st reference value
1197 if ( true /*widget == getWidgetForParam( 0 )*/) {
1198 const StdMeshersGUI_ObjectReferenceParamWdg * w =
1199 static_cast<const StdMeshersGUI_ObjectReferenceParamWdg*>( widget );
1200 param.myValue = w->GetValue();
1204 if ( widget->inherits( "StdMeshersGUI_LayerDistributionParamWdg" ))
1206 const StdMeshersGUI_LayerDistributionParamWdg * w =
1207 static_cast<const StdMeshersGUI_LayerDistributionParamWdg*>( widget );
1208 param.myValue = w->GetValue();
1211 if ( widget->inherits( "StdMeshersGUI_SubShapeSelectorWdg" ))
1213 const StdMeshersGUI_SubShapeSelectorWdg * w =
1214 static_cast<const StdMeshersGUI_SubShapeSelectorWdg*>( widget );
1215 param.myValue = w->GetValue();
1218 if ( widget->inherits( "StdMeshersGUI_FixedPointsParamWdg" ))
1220 const StdMeshersGUI_FixedPointsParamWdg * w =
1221 static_cast<const StdMeshersGUI_FixedPointsParamWdg*>( widget );
1222 param.myValue = w->GetValue();
1228 //================================================================================
1230 * \brief called when operation cancelled
1232 //================================================================================
1234 void StdMeshersGUI_StdHypothesisCreator::onReject()
1236 if ( hypType().startsWith("ProjectionSource" ))
1238 // Uninstall filters of StdMeshersGUI_ObjectReferenceParamWdg
1239 deactivateObjRefParamWdg( customWidgets() );
1243 //================================================================================
1247 //================================================================================
1249 void StdMeshersGUI_StdHypothesisCreator::valueChanged( QWidget* paramWidget)
1251 if ( hypType() == "MaxLength" && paramWidget == getWidgetForParam(1) ) {
1252 getWidgetForParam(0)->setEnabled( !widget< QCheckBox >( 1 )->isChecked() );
1253 if ( !getWidgetForParam(0)->isEnabled() ) {
1254 StdMeshers::StdMeshers_MaxLength_var h =
1255 StdMeshers::StdMeshers_MaxLength::_narrow( initParamsHypothesis() );
1256 widget< QtxDoubleSpinBox >( 0 )->setValue( h->GetPreestimatedLength() );
1261 //================================================================================
1265 //================================================================================
1267 bool StdMeshersGUI_StdHypothesisCreator::initVariableName(SMESH::ListOfParameters_var theParameters,
1268 StdParam &theParams,
1271 QString aVaribaleName = (theParameters->length() > order) ? QString(theParameters[order].in()) : QString("");
1272 theParams.isVariable = !aVaribaleName.isEmpty();
1273 if(theParams.isVariable)
1274 theParams.myValue = aVaribaleName;
1276 return theParams.isVariable;