1 // Copyright (C) 2007-2008 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
22 // File : StdMeshersGUI_StdHypothesisCreator.cxx
23 // Author : Alexander SOLOVYOV, Open CASCADE S.A.S.
26 #include "StdMeshersGUI_StdHypothesisCreator.h"
29 #include <SMESHGUI_SpinBox.h>
30 #include <SMESHGUI_HypothesesUtils.h>
31 #include <SMESHGUI_Utils.h>
32 #include <SMESH_TypeFilter.hxx>
33 #include <SMESH_NumberFilter.hxx>
34 #include "StdMeshersGUI_ObjectReferenceParamWdg.h"
35 #include "StdMeshersGUI_LayerDistributionParamWdg.h"
36 #include "StdMeshersGUI_SubShapeSelectorWdg.h"
37 #include "StdMeshersGUI_FixedPointsParamWdg.h"
38 #include <SALOMEDSClient_Study.hxx>
40 // SALOME GUI includes
41 #include <SUIT_ResourceMgr.h>
44 #include <SALOMEconfig.h>
45 #include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
46 #include CORBA_SERVER_HEADER(SMESH_Mesh)
49 #include <QHBoxLayout>
54 const double VALUE_MAX = 1.0e+15, // COORD_MAX
55 VALUE_MAX_2 = VALUE_MAX * VALUE_MAX,
56 VALUE_MAX_3 = VALUE_MAX_2 * VALUE_MAX,
57 VALUE_SMALL = 1.0e-15,
58 VALUE_SMALL_2 = VALUE_SMALL * VALUE_SMALL,
59 VALUE_SMALL_3 = VALUE_SMALL_2 * VALUE_SMALL;
61 //================================================================================
64 * \param type - hypothesis type
66 //================================================================================
68 StdMeshersGUI_StdHypothesisCreator::StdMeshersGUI_StdHypothesisCreator( const QString& type )
69 : SMESHGUI_GenericHypothesisCreator( type )
73 //================================================================================
77 //================================================================================
79 StdMeshersGUI_StdHypothesisCreator::~StdMeshersGUI_StdHypothesisCreator()
83 //================================================================================
85 * \brief Return widget for i-th hypothesis parameter (got from myParamWidgets)
86 * \param i - index of hypothesis parameter
87 * \retval QWidget* - found widget
89 //================================================================================
91 QWidget* StdMeshersGUI_StdHypothesisCreator::getWidgetForParam( int i ) const
94 if ( isCreation() ) ++i; // skip widget of 'name' parameter
96 if ( i < myCustomWidgets.count() ) {
97 QList<QWidget*>::const_iterator anIt = myCustomWidgets.begin();
98 QList<QWidget*>::const_iterator aLast = myCustomWidgets.end();
99 for ( int j = 0 ; !w && anIt != aLast; ++anIt, ++j )
104 // list has no at() const, so we iterate
105 QList<QWidget*>::const_iterator anIt = widgets().begin();
106 QList<QWidget*>::const_iterator aLast = widgets().end();
107 for( int j = 0; !w && anIt!=aLast; anIt++, ++j ) {
115 //================================================================================
117 * \brief Allow modifing myCustomWidgets in const methods
118 * \retval ListOfWidgets* - non-const pointer to myCustomWidgets
120 //================================================================================
122 StdMeshersGUI_StdHypothesisCreator::ListOfWidgets*
123 StdMeshersGUI_StdHypothesisCreator::customWidgets() const
125 return const_cast< ListOfWidgets* >( & myCustomWidgets );
128 //================================================================================
130 * \brief Builds dlg layout
131 * \retval QFrame* - the built widget
133 //================================================================================
135 QFrame* StdMeshersGUI_StdHypothesisCreator::buildFrame()
137 return buildStdFrame();
140 //================================================================================
142 * \brief Initialise parameter values in controls
144 //================================================================================
146 void StdMeshersGUI_StdHypothesisCreator::retrieveParams() const
148 // buildStdFrame() sets values itself calling stdParams()
150 if ( hypType().startsWith("ProjectionSource" ))
152 // we use this method to connect depending custom widgets
153 StdMeshersGUI_ObjectReferenceParamWdg* widgetToActivate = 0;
154 ListOfWidgets::const_iterator anIt = myCustomWidgets.begin();
155 for ( ; anIt != myCustomWidgets.end(); anIt++)
157 if ( *anIt && (*anIt)->inherits("StdMeshersGUI_ObjectReferenceParamWdg"))
159 StdMeshersGUI_ObjectReferenceParamWdg * w1 =
160 ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
161 ListOfWidgets::const_iterator anIt2 = anIt;
162 for ( ++anIt2; anIt2 != myCustomWidgets.end(); anIt2++)
163 if ( *anIt2 && (*anIt2)->inherits("StdMeshersGUI_ObjectReferenceParamWdg"))
165 StdMeshersGUI_ObjectReferenceParamWdg * w2 =
166 ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt2 );
167 w1->AvoidSimultaneousSelection( w2 );
169 if ( !widgetToActivate )
170 widgetToActivate = w1;
173 if ( widgetToActivate )
174 widgetToActivate->activateSelection();
178 dlg()->setMinimumSize( dlg()->minimumSizeHint().width(), dlg()->minimumSizeHint().height() );
183 //================================================================================
185 * \brief Widget: slider with left and right labels
187 //================================================================================
189 class TDoubleSliderWith2Lables: public QWidget
192 TDoubleSliderWith2Lables( const QString& leftLabel, const QString& rightLabel,
193 const double initValue, const double bottom,
194 const double top , const double precision,
195 QWidget * parent=0 , const char * name=0 )
196 :QWidget(parent), _bottom(bottom), _precision(precision)
200 QHBoxLayout* aHBoxL = new QHBoxLayout(this);
202 if ( !leftLabel.isEmpty() ) {
203 QLabel* aLeftLabel = new QLabel( this );
204 aLeftLabel->setText( leftLabel );
205 aHBoxL->addWidget( aLeftLabel );
208 _slider = new QSlider( Qt::Horizontal, this );
209 _slider->setRange( 0, toInt( top ));
210 _slider->setValue( toInt( initValue ));
211 aHBoxL->addWidget( _slider );
213 if ( !rightLabel.isEmpty() ) {
214 QLabel* aRightLabel = new QLabel( this );
215 aRightLabel->setText( rightLabel );
216 aHBoxL->addWidget( aRightLabel );
221 double value() const { return _bottom + _slider->value() * _precision; }
222 QSlider * getSlider() const { return _slider; }
223 int toInt( double val ) const { return (int) ceil(( val - _bottom ) / _precision ); }
225 double _bottom, _precision;
229 //================================================================================
231 * \brief Retrieve GEOM_Object held by widget
233 //================================================================================
235 inline GEOM::GEOM_Object_var geomFromWdg(const QWidget* wdg)
237 const StdMeshersGUI_ObjectReferenceParamWdg * objRefWdg =
238 dynamic_cast<const StdMeshersGUI_ObjectReferenceParamWdg*>( wdg );
240 return objRefWdg->GetObject< GEOM::GEOM_Object >();
242 return GEOM::GEOM_Object::_nil();
244 //================================================================================
246 * \brief Retrieve SMESH_Mesh held by widget
248 //================================================================================
250 inline SMESH::SMESH_Mesh_var meshFromWdg(const QWidget* wdg)
252 const StdMeshersGUI_ObjectReferenceParamWdg * objRefWdg =
253 dynamic_cast<const StdMeshersGUI_ObjectReferenceParamWdg*>( wdg );
255 return objRefWdg->GetObject< SMESH::SMESH_Mesh >();
257 return SMESH::SMESH_Mesh::_nil();
259 //================================================================================
261 * \brief creates a filter for selection of shapes of given dimension
262 * \param dim - dimension
263 * \param subShapeType - required type of subshapes, number of which must be \a nbSubShapes
264 * \param nbSubShapes - number of subshapes of given type
265 * \param closed - required closeness flag of a shape
266 * \retval SUIT_SelectionFilter* - created filter
268 //================================================================================
270 SUIT_SelectionFilter* filterForShapeOfDim(const int dim,
271 TopAbs_ShapeEnum subShapeType = TopAbs_SHAPE,
272 const int nbSubShapes = 0,
275 TColStd_MapOfInteger shapeTypes;
277 case 0: shapeTypes.Add( TopAbs_VERTEX ); break;
279 if ( subShapeType == TopAbs_SHAPE ) subShapeType = TopAbs_EDGE;
280 shapeTypes.Add( TopAbs_EDGE );
281 shapeTypes.Add( TopAbs_COMPOUND ); // for a group
284 if ( subShapeType == TopAbs_SHAPE ) subShapeType = TopAbs_FACE;
285 shapeTypes.Add( TopAbs_FACE );
286 shapeTypes.Add( TopAbs_COMPOUND ); // for a group
289 shapeTypes.Add( TopAbs_SHELL );
290 shapeTypes.Add( TopAbs_SOLID );
291 shapeTypes.Add( TopAbs_COMPSOLID );
292 shapeTypes.Add( TopAbs_COMPOUND );
295 return new SMESH_NumberFilter("GEOM", subShapeType, nbSubShapes,
296 shapeTypes, GEOM::GEOM_Object::_nil(), closed);
299 //================================================================================
301 * \brief Create a widget for object selection
302 * \param object - initial object
303 * \param filter - selection filter
304 * \retval QWidget* - created widget
306 //================================================================================
308 QWidget* newObjRefParamWdg( SUIT_SelectionFilter* filter,
309 CORBA::Object_var object)
311 StdMeshersGUI_ObjectReferenceParamWdg* w =
312 new StdMeshersGUI_ObjectReferenceParamWdg( filter, 0);
313 w->SetObject( object.in() );
317 //================================================================================
319 * \brief calls deactivateSelection() for StdMeshersGUI_ObjectReferenceParamWdg
320 * \param widgetList - list of widgets
322 //================================================================================
324 void deactivateObjRefParamWdg( QList<QWidget*>* widgetList )
326 StdMeshersGUI_ObjectReferenceParamWdg* w = 0;
327 QList<QWidget*>::iterator anIt = widgetList->begin();
328 QList<QWidget*>::iterator aLast = widgetList->end();
329 for ( ; anIt != aLast; anIt++ ) {
330 if ( (*anIt) && (*anIt)->inherits( "StdMeshersGUI_ObjectReferenceParamWdg" ))
332 w = (StdMeshersGUI_ObjectReferenceParamWdg* )( *anIt );
333 w->deactivateSelection();
339 //================================================================================
341 * \brief Check parameter values before accept()
342 * \retval bool - true if OK
344 //================================================================================
346 bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg, QStringList& absentParams ) const
348 if( !SMESHGUI_GenericHypothesisCreator::checkParams( msg, absentParams ) )
351 // check if object reference parameter is set, as it has no default value
353 if ( hypType().startsWith("ProjectionSource" ))
355 StdMeshersGUI_ObjectReferenceParamWdg* w =
356 widget< StdMeshersGUI_ObjectReferenceParamWdg >( 0 );
357 ok = ( w->IsObjectSelected() );
358 if ( !ok ) w->SetObject( CORBA::Object::_nil() );
359 int nbAssocVert = ( hypType() == "ProjectionSource1D" ? 1 : 2 );
360 for ( int i = 0; ok && i < nbAssocVert; i += 2)
363 StdMeshersGUI_ObjectReferenceParamWdg* w1 =
364 widget< StdMeshersGUI_ObjectReferenceParamWdg >( i+2 );
365 StdMeshersGUI_ObjectReferenceParamWdg* w2 =
366 widget< StdMeshersGUI_ObjectReferenceParamWdg >( i+3 );
367 srcV = w1->GetValue();
368 tgtV = w2->GetValue();
369 ok = (( srcV.isEmpty() && tgtV.isEmpty() ) ||
370 ( !srcV.isEmpty() && !tgtV.isEmpty() && srcV != tgtV ));
372 w1->SetObject( CORBA::Object::_nil() );
373 w2->SetObject( CORBA::Object::_nil() );
377 // Uninstall filters of StdMeshersGUI_ObjectReferenceParamWdg
379 deactivateObjRefParamWdg( customWidgets() );
381 else if ( hypType() == "LayerDistribution" || hypType() == "LayerDistribution2D" )
383 StdMeshersGUI_LayerDistributionParamWdg* w =
384 widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
385 ok = ( w && w->IsOk() );
387 else if ( hypType() == "QuadrangleParams" )
389 StdMeshersGUI_SubShapeSelectorWdg* w =
390 widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 );
391 ok = ( w->GetListSize() > 0 );
396 //================================================================================
398 * \brief Store params from GUI controls to a hypothesis
399 * \retval QString - text representation of parameters
401 //================================================================================
403 QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
405 ListOfStdParams params;
406 bool res = getStdParamFromDlg( params );
409 SMESH::SetName( SMESH::FindSObject( hypothesis() ), params[0].myValue.toString().toLatin1().data() );
410 params.erase( params.begin() );
413 QString valueStr = stdParamValues( params );
414 QStringList aVariablesList = getVariablesFromDlg();
416 if( res && !params.isEmpty() )
418 if( hypType()=="LocalLength" )
420 StdMeshers::StdMeshers_LocalLength_var h =
421 StdMeshers::StdMeshers_LocalLength::_narrow( hypothesis() );
423 h->SetLength( params[0].myValue.toDouble() );
424 //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
425 h->SetPrecision( params[1].myValue.toDouble() );
426 //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
428 else if( hypType()=="MaxLength" )
430 StdMeshers::StdMeshers_MaxLength_var h =
431 StdMeshers::StdMeshers_MaxLength::_narrow( hypothesis() );
433 h->SetLength( params[0].myValue.toDouble() );
434 //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
435 h->SetUsePreestimatedLength( widget< QCheckBox >( 1 )->isChecked() );
436 if ( !h->HavePreestimatedLength() && !h->_is_equivalent( initParamsHypothesis() )) {
437 StdMeshers::StdMeshers_MaxLength_var hInit =
438 StdMeshers::StdMeshers_MaxLength::_narrow( initParamsHypothesis() );
439 h->SetPreestimatedLength( hInit->GetPreestimatedLength() );
442 else if( hypType()=="SegmentLengthAroundVertex" )
444 StdMeshers::StdMeshers_SegmentLengthAroundVertex_var h =
445 StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hypothesis() );
447 h->SetLength( params[0].myValue.toDouble() );
448 //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
450 else if( hypType()=="Arithmetic1D" )
452 StdMeshers::StdMeshers_Arithmetic1D_var h =
453 StdMeshers::StdMeshers_Arithmetic1D::_narrow( hypothesis() );
455 StdMeshersGUI_SubShapeSelectorWdg* w =
456 widget< StdMeshersGUI_SubShapeSelectorWdg >( 2 );
458 h->SetStartLength( params[0].myValue.toDouble() );
459 //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
460 h->SetEndLength( params[1].myValue.toDouble() );
461 //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
463 h->SetReversedEdges( w->GetListOfIDs() );
464 h->SetObjectEntry( w->GetMainShapeEntry() );
467 else if( hypType()=="FixedPoints1D" )
469 StdMeshers::StdMeshers_FixedPoints1D_var h =
470 StdMeshers::StdMeshers_FixedPoints1D::_narrow( hypothesis() );
472 StdMeshersGUI_FixedPointsParamWdg* w1 =
473 widget< StdMeshersGUI_FixedPointsParamWdg >( 0 );
475 StdMeshersGUI_SubShapeSelectorWdg* w2 =
476 widget< StdMeshersGUI_SubShapeSelectorWdg >( 1 );
479 //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
480 h->SetPoints( w1->GetListOfPoints() );
481 h->SetNbSegments( w1->GetListOfSegments() );
484 h->SetReversedEdges( w2->GetListOfIDs() );
485 h->SetObjectEntry( w2->GetMainShapeEntry() );
488 else if( hypType()=="MaxElementArea" )
490 StdMeshers::StdMeshers_MaxElementArea_var h =
491 StdMeshers::StdMeshers_MaxElementArea::_narrow( hypothesis() );
492 //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
493 h->SetMaxElementArea( params[0].myValue.toDouble() );
495 else if( hypType()=="MaxElementVolume" )
497 StdMeshers::StdMeshers_MaxElementVolume_var h =
498 StdMeshers::StdMeshers_MaxElementVolume::_narrow( hypothesis() );
500 h->SetMaxElementVolume( params[0].myValue.toDouble() );
501 //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
503 else if( hypType()=="StartEndLength" )
505 StdMeshers::StdMeshers_StartEndLength_var h =
506 StdMeshers::StdMeshers_StartEndLength::_narrow( hypothesis() );
508 StdMeshersGUI_SubShapeSelectorWdg* w =
509 widget< StdMeshersGUI_SubShapeSelectorWdg >( 2 );
511 h->SetStartLength( params[0].myValue.toDouble() );
512 //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
513 h->SetEndLength( params[1].myValue.toDouble() );
514 //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
516 h->SetReversedEdges( w->GetListOfIDs() );
517 h->SetObjectEntry( w->GetMainShapeEntry() );
520 else if( hypType()=="Deflection1D" )
522 StdMeshers::StdMeshers_Deflection1D_var h =
523 StdMeshers::StdMeshers_Deflection1D::_narrow( hypothesis() );
524 //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
525 h->SetDeflection( params[0].myValue.toDouble() );
527 else if( hypType()=="AutomaticLength" )
529 StdMeshers::StdMeshers_AutomaticLength_var h =
530 StdMeshers::StdMeshers_AutomaticLength::_narrow( hypothesis() );
532 h->SetFineness( params[0].myValue.toDouble() );
534 else if( hypType()=="NumberOfLayers" )
536 StdMeshers::StdMeshers_NumberOfLayers_var h =
537 StdMeshers::StdMeshers_NumberOfLayers::_narrow( hypothesis() );
539 h->SetNumberOfLayers( params[0].myValue.toInt() );
540 //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
542 else if( hypType()=="LayerDistribution" )
544 StdMeshers::StdMeshers_LayerDistribution_var h =
545 StdMeshers::StdMeshers_LayerDistribution::_narrow( hypothesis() );
546 StdMeshersGUI_LayerDistributionParamWdg* w =
547 widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
549 h->SetLayerDistribution( w->GetHypothesis() );
550 //h->SetParameters(w->GetHypothesis()->GetParameters());
551 //w->GetHypothesis()->ClearParameters();
553 else if( hypType()=="NumberOfLayers2D" )
555 StdMeshers::StdMeshers_NumberOfLayers2D_var h =
556 StdMeshers::StdMeshers_NumberOfLayers2D::_narrow( hypothesis() );
558 h->SetNumberOfLayers( params[0].myValue.toInt() );
559 //h->SetParameters(aVariablesList.join(":").toLatin1().constData());
561 else if( hypType()=="LayerDistribution2D" )
563 StdMeshers::StdMeshers_LayerDistribution2D_var h =
564 StdMeshers::StdMeshers_LayerDistribution2D::_narrow( hypothesis() );
565 StdMeshersGUI_LayerDistributionParamWdg* w =
566 widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
568 h->SetLayerDistribution( w->GetHypothesis() );
569 //h->SetParameters(w->GetHypothesis()->GetParameters());
570 //w->GetHypothesis()->ClearParameters();
572 else if( hypType()=="ProjectionSource1D" )
574 StdMeshers::StdMeshers_ProjectionSource1D_var h =
575 StdMeshers::StdMeshers_ProjectionSource1D::_narrow( hypothesis() );
577 h->SetSourceEdge ( geomFromWdg ( getWidgetForParam( 0 )));
578 h->SetSourceMesh ( meshFromWdg ( getWidgetForParam( 1 )));
579 h->SetVertexAssociation( geomFromWdg ( getWidgetForParam( 2 )),
580 geomFromWdg ( getWidgetForParam( 3 )));
582 else if( hypType()=="ProjectionSource2D" )
584 StdMeshers::StdMeshers_ProjectionSource2D_var h =
585 StdMeshers::StdMeshers_ProjectionSource2D::_narrow( hypothesis() );
587 h->SetSourceFace ( geomFromWdg ( getWidgetForParam( 0 )));
588 h->SetSourceMesh ( meshFromWdg ( getWidgetForParam( 1 )));
589 h->SetVertexAssociation( geomFromWdg ( getWidgetForParam( 2 )), // src1
590 geomFromWdg ( getWidgetForParam( 4 )), // src2
591 geomFromWdg ( getWidgetForParam( 3 )), // tgt1
592 geomFromWdg ( getWidgetForParam( 5 ))); // tgt2
594 else if( hypType()=="ProjectionSource3D" )
596 StdMeshers::StdMeshers_ProjectionSource3D_var h =
597 StdMeshers::StdMeshers_ProjectionSource3D::_narrow( hypothesis() );
599 h->SetSource3DShape ( geomFromWdg ( getWidgetForParam( 0 )));
600 h->SetSourceMesh ( meshFromWdg ( getWidgetForParam( 1 )));
601 h->SetVertexAssociation( geomFromWdg ( getWidgetForParam( 2 )), // src1
602 geomFromWdg ( getWidgetForParam( 4 )), // src2
603 geomFromWdg ( getWidgetForParam( 3 )), // tgt1
604 geomFromWdg ( getWidgetForParam( 5 ))); // tgt2
606 else if( hypType()=="QuadrangleParams" )
608 StdMeshers::StdMeshers_QuadrangleParams_var h =
609 StdMeshers::StdMeshers_QuadrangleParams::_narrow( hypothesis() );
610 StdMeshersGUI_SubShapeSelectorWdg* w =
611 widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 );
613 if( w->GetListSize() > 0 ) {
614 h->SetTriaVertex( w->GetListOfIDs()[0] ); // getlist must be called once
615 const char * entry = w->GetMainShapeEntry();
616 h->SetObjectEntry( entry );
624 //================================================================================
626 * \brief Return parameter values as SMESHGUI_GenericHypothesisCreator::StdParam
627 * \param p - list of parameters
628 * \retval bool - success flag
630 * Is called from SMESHGUI_GenericHypothesisCreator::buildStdFrame().
631 * Parameters will be shown using "standard" controls:
632 * Int by QtxIntSpinBox
633 * Double by SMESHGUI_SpinBox
634 * String by QLineEdit
635 * getCustomWidget() allows to redefine control for a parameter
637 //================================================================================
639 bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
642 SMESHGUI_GenericHypothesisCreator::StdParam item;
645 customWidgets()->clear();
648 HypothesisData* data = SMESH::GetHypothesisData( hypType() );
649 item.myName = tr( "SMESH_NAME" );
650 item.myValue = data ? hypName() : QString();
652 customWidgets()->append(0);
655 SMESH::SMESH_Hypothesis_var hyp = initParamsHypothesis();
656 //SMESH::ListOfParameters_var aParameters = hyp->GetLastParameters();
657 SALOME::StringArray* aParameters = hyp->GetParameters();
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->operator[](i)));
887 /* ouv: temporarily disabled
888 if(!aLastVarsList.isEmpty())
889 h->GetLayerDistribution()->SetLastParameters(aLastVarsList.join(":").toLatin1().constData());
892 customWidgets()->append
893 ( new StdMeshersGUI_LayerDistributionParamWdg( h->GetLayerDistribution(), hypName(), dlg()));
895 else if( hypType()=="NumberOfLayers2D" ) {
896 StdMeshers::StdMeshers_NumberOfLayers2D_var h =
897 StdMeshers::StdMeshers_NumberOfLayers2D::_narrow( hyp );
899 item.myName = tr( "SMESH_NUMBER_OF_LAYERS" );
900 if(!initVariableName(aParameters,item,0))
901 item.myValue = (int) h->GetNumberOfLayers();
904 else if( hypType()=="LayerDistribution2D" ) {
905 StdMeshers::StdMeshers_LayerDistribution2D_var h =
906 StdMeshers::StdMeshers_LayerDistribution2D::_narrow( hyp );
908 item.myName = tr( "SMESH_LAYERS_DISTRIBUTION" ); p.append( item );
910 //Set into not published hypo last variables
911 QStringList aLastVarsList;
912 for(int i = 0;i<aParameters->length();i++)
913 aLastVarsList.append(QString(aParameters->operator[](i)));
915 /* ouv: temporarily disabled
916 if(!aLastVarsList.isEmpty())
917 h->GetLayerDistribution()->SetLastParameters(aLastVarsList.join(":").toLatin1().constData());
920 customWidgets()->append
921 ( new StdMeshersGUI_LayerDistributionParamWdg( h->GetLayerDistribution(), hypName(), dlg()));
923 else if( hypType()=="ProjectionSource1D" )
925 StdMeshers::StdMeshers_ProjectionSource1D_var h =
926 StdMeshers::StdMeshers_ProjectionSource1D::_narrow( hyp );
928 item.myName = tr( "SMESH_SOURCE_EDGE" ); p.append( item );
929 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 1 ),
930 h->GetSourceEdge()));
931 item.myName = tr( "SMESH_SOURCE_MESH" ); p.append( item );
932 customWidgets()->append( newObjRefParamWdg( new SMESH_TypeFilter( MESH ),
933 h->GetSourceMesh()));
934 item.myName = tr( "SMESH_SOURCE_VERTEX" ); p.append( item );
935 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
936 h->GetSourceVertex()));
937 item.myName = tr( "SMESH_TARGET_VERTEX" ); p.append( item );
938 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
939 h->GetTargetVertex()));
941 else if( hypType()=="ProjectionSource2D" )
943 StdMeshers::StdMeshers_ProjectionSource2D_var h =
944 StdMeshers::StdMeshers_ProjectionSource2D::_narrow( hyp );
946 item.myName = tr( "SMESH_SOURCE_FACE" ); p.append( item );
947 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 2 ),
948 h->GetSourceFace()));
949 item.myName = tr( "SMESH_SOURCE_MESH" ); p.append( item );
950 customWidgets()->append( newObjRefParamWdg( new SMESH_TypeFilter( MESH ),
951 h->GetSourceMesh()));
952 item.myName = tr( "SMESH_SOURCE_VERTEX1" ); p.append( item );
953 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
954 h->GetSourceVertex( 1 )));
955 item.myName = tr( "SMESH_TARGET_VERTEX1" ); p.append( item );
956 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
957 h->GetTargetVertex( 1 )));
958 item.myName = tr( "SMESH_SOURCE_VERTEX2" ); p.append( item );
959 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
960 h->GetSourceVertex( 2 )));
961 item.myName = tr( "SMESH_TARGET_VERTEX2" ); p.append( item );
962 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
963 h->GetTargetVertex( 2 )));
965 else if( hypType()=="ProjectionSource3D" )
967 StdMeshers::StdMeshers_ProjectionSource3D_var h =
968 StdMeshers::StdMeshers_ProjectionSource3D::_narrow( hyp );
970 item.myName = tr( "SMESH_SOURCE_3DSHAPE" ); p.append( item );
971 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 3, TopAbs_FACE, 6, true ),
972 h->GetSource3DShape()));
973 item.myName = tr( "SMESH_SOURCE_MESH" ); p.append( item );
974 customWidgets()->append( newObjRefParamWdg( new SMESH_TypeFilter( MESH ),
975 h->GetSourceMesh()));
976 item.myName = tr( "SMESH_SOURCE_VERTEX1" ); p.append( item );
977 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
978 h->GetSourceVertex( 1 )));
979 item.myName = tr( "SMESH_TARGET_VERTEX1" ); p.append( item );
980 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
981 h->GetTargetVertex( 1 )));
982 item.myName = tr( "SMESH_SOURCE_VERTEX2" ); p.append( item );
983 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
984 h->GetSourceVertex( 2 )));
985 item.myName = tr( "SMESH_TARGET_VERTEX2" ); p.append( item );
986 customWidgets()->append( newObjRefParamWdg( filterForShapeOfDim( 0 ),
987 h->GetTargetVertex( 2 )));
989 else if( hypType()=="QuadrangleParams" )
991 StdMeshers::StdMeshers_QuadrangleParams_var h =
992 StdMeshers::StdMeshers_QuadrangleParams::_narrow( hyp );
994 item.myName = tr( "SMESH_BASE_VERTEX" );
997 StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
998 new StdMeshersGUI_SubShapeSelectorWdg();
999 aDirectionWidget->SetMaxSize(1);
1000 aDirectionWidget->SetSubShType(TopAbs_VERTEX);
1001 QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
1002 QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
1003 if ( anEntry == "" )
1004 anEntry = h->GetObjectEntry();
1005 aDirectionWidget->SetGeomShapeEntry( anEntry );
1006 aDirectionWidget->SetMainShapeEntry( aMainEntry );
1007 SMESH::long_array_var aVec = new SMESH::long_array;
1008 int vertID = h->GetTriaVertex();
1013 aDirectionWidget->SetListOfIDs( aVec );
1014 aDirectionWidget->showPreview( true );
1015 customWidgets()->append ( aDirectionWidget );
1022 //================================================================================
1024 * \brief tune "standard" control
1025 * \param w - control widget
1026 * \param int - parameter index
1028 //================================================================================
1030 void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int) const
1032 SMESHGUI_SpinBox* sb = w->inherits( "SMESHGUI_SpinBox" ) ? ( SMESHGUI_SpinBox* )w : 0;
1033 if( hypType()=="LocalLength" && sb )
1035 if (sb->objectName() == tr("SMESH_LOCAL_LENGTH_PARAM"))
1036 sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 );
1037 else if (sb->objectName() == tr("SMESH_LOCAL_LENGTH_PRECISION"))
1038 sb->RangeStepAndValidator( 0.0, 1.0, 0.05, 7 );
1040 else if( hypType()=="Arithmetic1D" && sb )
1042 sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 );
1044 else if( hypType()=="MaxLength" && sb )
1046 sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 );
1047 sb->setEnabled( !widget< QCheckBox >( 1 )->isChecked() );
1049 else if( hypType()=="MaxElementArea" && sb )
1051 sb->RangeStepAndValidator( VALUE_SMALL_2, VALUE_MAX_2, 1.0, 6 );
1053 else if( hypType()=="MaxElementVolume" && sb )
1055 sb->RangeStepAndValidator( VALUE_SMALL_3, VALUE_MAX_3, 1.0, 6 );
1057 else if( hypType()=="StartEndLength" && sb )
1059 sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 );
1061 else if( hypType()=="Deflection1D" && sb )
1063 sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 );
1065 else if ( sb ) // default validator for possible ancestors
1067 sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 );
1071 //================================================================================
1073 * \brief Return dlg title
1074 * \retval QString - title string
1076 //================================================================================
1078 QString StdMeshersGUI_StdHypothesisCreator::caption() const
1080 return tr( QString( "SMESH_%1_TITLE" ).arg( hypTypeName( hypType() ) ).toLatin1().data() );
1083 //================================================================================
1085 * \brief return pixmap for dlg icon
1088 //================================================================================
1090 QPixmap StdMeshersGUI_StdHypothesisCreator::icon() const
1092 QString hypIconName = tr( QString( "ICON_DLG_%1" ).arg( hypTypeName( hypType() ) ).toLatin1().data() );
1093 return SMESHGUI::resourceMgr()->loadPixmap( "SMESH", hypIconName );
1096 //================================================================================
1098 * \brief Return hypothesis type name to show in dlg
1101 //================================================================================
1103 QString StdMeshersGUI_StdHypothesisCreator::type() const
1105 return tr( QString( "SMESH_%1_HYPOTHESIS" ).arg( hypTypeName( hypType() ) ).toLatin1().data() );
1108 //================================================================================
1110 * \brief String to insert in "SMESH_%1_HYPOTHESIS" to get hypothesis type name
1111 * from message resouce file
1112 * \param t - hypothesis type
1113 * \retval QString - result string
1115 //================================================================================
1117 QString StdMeshersGUI_StdHypothesisCreator::hypTypeName( const QString& t ) const
1119 static QMap<QString,QString> types;
1120 if( types.isEmpty() )
1122 types.insert( "LocalLength", "LOCAL_LENGTH" );
1123 types.insert( "NumberOfSegments", "NB_SEGMENTS" );
1124 types.insert( "MaxElementArea", "MAX_ELEMENT_AREA" );
1125 types.insert( "MaxElementVolume", "MAX_ELEMENT_VOLUME" );
1126 types.insert( "StartEndLength", "START_END_LENGTH" );
1127 types.insert( "Deflection1D", "DEFLECTION1D" );
1128 types.insert( "Arithmetic1D", "ARITHMETIC_1D" );
1129 types.insert( "FixedPoints1D", "FIXED_POINTS_1D" );
1130 types.insert( "AutomaticLength", "AUTOMATIC_LENGTH" );
1131 types.insert( "ProjectionSource1D", "PROJECTION_SOURCE_1D" );
1132 types.insert( "ProjectionSource2D", "PROJECTION_SOURCE_2D" );
1133 types.insert( "ProjectionSource3D", "PROJECTION_SOURCE_3D" );
1134 types.insert( "NumberOfLayers", "NUMBER_OF_LAYERS" );
1135 types.insert( "LayerDistribution", "LAYER_DISTRIBUTION" );
1136 types.insert( "NumberOfLayers2D", "NUMBER_OF_LAYERS_2D" );
1137 types.insert( "LayerDistribution2D", "LAYER_DISTRIBUTION" );
1138 types.insert( "SegmentLengthAroundVertex", "SEGMENT_LENGTH_AROUND_VERTEX" );
1139 types.insert( "MaxLength", "MAX_LENGTH" );
1140 types.insert( "QuadrangleParams", "QUADRANGLE_PARAMS" );
1144 if( types.contains( t ) )
1151 //=======================================================================
1152 //function : getCustomWidget
1153 //purpose : is called from buildStdFrame()
1154 //=======================================================================
1156 QWidget* StdMeshersGUI_StdHypothesisCreator::getCustomWidget( const StdParam & param,
1158 const int index) const
1161 if ( index < customWidgets()->count() ) {
1162 w = customWidgets()->at( index );
1164 w->setParent( parent );
1165 w->move( QPoint( 0, 0 ) );
1171 //================================================================================
1173 * \brief Set param value taken from a custom widget
1174 * \param param - SMESHGUI_GenericHypothesisCreator::StdParam structure
1175 * \param widget - widget presenting param
1176 * \retval bool - success flag
1178 * this method is called from getStdParamFromDlg()
1180 //================================================================================
1182 bool StdMeshersGUI_StdHypothesisCreator::getParamFromCustomWidget( StdParam & param,
1183 QWidget* widget) const
1185 if ( hypType()=="AutomaticLength" ) {
1186 TDoubleSliderWith2Lables* w = dynamic_cast<TDoubleSliderWith2Lables*>( widget );
1188 param.myValue = w->value();
1192 if ( hypType() == "MaxLength" ) {
1196 if ( widget->inherits( "StdMeshersGUI_ObjectReferenceParamWdg" ))
1198 // show only 1st reference value
1199 if ( true /*widget == getWidgetForParam( 0 )*/) {
1200 const StdMeshersGUI_ObjectReferenceParamWdg * w =
1201 static_cast<const StdMeshersGUI_ObjectReferenceParamWdg*>( widget );
1202 param.myValue = w->GetValue();
1206 if ( widget->inherits( "StdMeshersGUI_LayerDistributionParamWdg" ))
1208 const StdMeshersGUI_LayerDistributionParamWdg * w =
1209 static_cast<const StdMeshersGUI_LayerDistributionParamWdg*>( widget );
1210 param.myValue = w->GetValue();
1213 if ( widget->inherits( "StdMeshersGUI_SubShapeSelectorWdg" ))
1215 const StdMeshersGUI_SubShapeSelectorWdg * w =
1216 static_cast<const StdMeshersGUI_SubShapeSelectorWdg*>( widget );
1217 param.myValue = w->GetValue();
1220 if ( widget->inherits( "StdMeshersGUI_FixedPointsParamWdg" ))
1222 const StdMeshersGUI_FixedPointsParamWdg * w =
1223 static_cast<const StdMeshersGUI_FixedPointsParamWdg*>( widget );
1224 param.myValue = w->GetValue();
1230 //================================================================================
1232 * \brief called when operation cancelled
1234 //================================================================================
1236 void StdMeshersGUI_StdHypothesisCreator::onReject()
1238 if ( hypType().startsWith("ProjectionSource" ))
1240 // Uninstall filters of StdMeshersGUI_ObjectReferenceParamWdg
1241 deactivateObjRefParamWdg( customWidgets() );
1245 //================================================================================
1249 //================================================================================
1251 void StdMeshersGUI_StdHypothesisCreator::valueChanged( QWidget* paramWidget)
1253 if ( hypType() == "MaxLength" && paramWidget == getWidgetForParam(1) ) {
1254 getWidgetForParam(0)->setEnabled( !widget< QCheckBox >( 1 )->isChecked() );
1255 if ( !getWidgetForParam(0)->isEnabled() ) {
1256 StdMeshers::StdMeshers_MaxLength_var h =
1257 StdMeshers::StdMeshers_MaxLength::_narrow( initParamsHypothesis() );
1258 widget< QtxDoubleSpinBox >( 0 )->setValue( h->GetPreestimatedLength() );
1263 //================================================================================
1267 //================================================================================
1269 bool StdMeshersGUI_StdHypothesisCreator::initVariableName(SALOME::StringArray* theParameters,
1270 StdParam &theParams,
1273 QString aVaribaleName = (theParameters->length() > order) ?
1274 QString( CORBA::string_dup( theParameters->operator[]( order ) ) ) : QString("");
1275 theParams.isVariable = !aVaribaleName.isEmpty();
1276 if(theParams.isVariable)
1277 theParams.myValue = aVaribaleName;
1279 return theParams.isVariable;