1 // Copyright (C) 2007-2011 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 : SMESHGUI_Hypotheses.cxx
23 // Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
26 #include "SMESHGUI_Hypotheses.h"
29 #include "SMESHGUI_HypothesesUtils.h"
30 #include "SMESHGUI_Utils.h"
31 #include "SMESHGUI_SpinBox.h"
33 // SALOME KERNEL includes
34 #include <SALOMEDSClient_Study.hxx>
35 #include <utilities.h>
37 // SALOME GUI includes
38 #include <SUIT_Session.h>
39 #include <SUIT_MessageBox.h>
40 #include <SUIT_ResourceMgr.h>
41 #include <LightApp_Application.h>
42 #include <SalomeApp_IntSpinBox.h>
49 #include <QVBoxLayout>
54 //To disable automatic genericobj management, the following line should be commented.
55 //Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
56 #define WITHGENERICOBJ
58 SMESHGUI_GenericHypothesisCreator::SMESHGUI_GenericHypothesisCreator( const QString& theHypType )
59 : myHypType( theHypType ), myIsCreate( false ), myDlg( 0 )
63 SMESHGUI_GenericHypothesisCreator::~SMESHGUI_GenericHypothesisCreator()
67 void SMESHGUI_GenericHypothesisCreator::setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr hyp)
69 if ( !CORBA::is_nil( hyp ) && hypType() == hyp->GetName() )
70 myInitParamsHypo = SMESH::SMESH_Hypothesis::_duplicate( hyp );
73 void SMESHGUI_GenericHypothesisCreator::create( SMESH::SMESH_Hypothesis_ptr initParamsHyp,
74 const QString& theHypName,
75 QWidget* parent, QObject* obj, const QString& slot )
77 MESSAGE( "Creation of hypothesis with initial params" );
78 setInitParamsHypothesis( initParamsHyp );
79 create( false, theHypName, parent, obj, slot );
82 void SMESHGUI_GenericHypothesisCreator::create( bool isAlgo,
83 const QString& theHypName,
84 QWidget* theParent, QObject* obj, const QString& slot )
86 MESSAGE( "Creation of hypothesis" );
90 // Create hypothesis/algorithm
92 SMESH::SMESH_Hypothesis_var anAlgo =
93 SMESH::CreateHypothesis( hypType(), theHypName, isAlgo );
95 if (!CORBA::is_nil(anAlgo))
100 SMESH::SMESH_Hypothesis_var aHypothesis =
101 SMESH::CreateHypothesis( hypType(), theHypName, false );
102 editHypothesis( aHypothesis.in(), theHypName, theParent, obj, slot );
103 #ifdef WITHGENERICOBJ
104 if (!CORBA::is_nil(aHypothesis))
105 aHypothesis->UnRegister();
110 void SMESHGUI_GenericHypothesisCreator::edit( SMESH::SMESH_Hypothesis_ptr theHypothesis,
111 const QString& theHypName,
112 QWidget* theParent, QObject* obj, const QString& slot )
114 if( CORBA::is_nil( theHypothesis ) )
117 MESSAGE("Edition of hypothesis");
121 editHypothesis( theHypothesis, theHypName, theParent, obj, slot );
124 void SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_ptr h,
125 const QString& theHypName,
127 QObject* obj, const QString& slot )
129 myHypName = theHypName;
130 myHypo = SMESH::SMESH_Hypothesis::_duplicate( h );
131 #ifdef WITHGENERICOBJ
135 SMESHGUI_HypothesisDlg* Dlg = new SMESHGUI_HypothesisDlg( this, theParent );
136 connect( Dlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
137 connect( this, SIGNAL( finished( int ) ), obj, slot.toLatin1().constData() );
138 connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalCloseAllDialogs() ), Dlg, SLOT( reject() ));
141 QFrame* fr = buildFrame();
144 Dlg->setCustomFrame( fr );
145 Dlg->setWindowTitle( caption() );
146 Dlg->setObjectName( theHypName );
147 Dlg->setHIcon( icon() );
148 Dlg->setType( type() );
151 Dlg->resize( Dlg->minimumSizeHint() );
154 emit finished( QDialog::Accepted );
159 QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
161 if( CORBA::is_nil( hypothesis() ) )
164 ListOfStdParams params;
165 if( !stdParams( params ) || params.isEmpty() )
168 QFrame* fr = new QFrame( 0 );
169 QVBoxLayout* lay = new QVBoxLayout( fr );
171 lay->setSpacing( 0 );
173 QGroupBox* GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), fr );
174 lay->addWidget( GroupC1 );
176 QGridLayout* GroupC1Layout = new QGridLayout( GroupC1 );
177 GroupC1Layout->setSpacing( SPACING );
178 GroupC1Layout->setMargin( MARGIN );
180 ListOfStdParams::const_iterator anIt = params.begin(), aLast = params.end();
181 for( int i=0; anIt!=aLast; anIt++, i++ )
183 QLabel* lab = new QLabel( (*anIt).myName, GroupC1 );
184 GroupC1Layout->addWidget( lab, i, 0 );
186 QWidget* w = getCustomWidget( *anIt, GroupC1, i );
188 switch( (*anIt).myValue.type() )
192 SalomeApp_IntSpinBox* sb = new SalomeApp_IntSpinBox( GroupC1 );
193 sb->setObjectName( (*anIt).myName );
194 attuneStdWidget( sb, i );
195 sb->setValue( (*anIt).myValue.toInt() );
196 connect( sb, SIGNAL( valueChanged( int ) ), this, SLOT( onValueChanged() ) );
200 case QVariant::Double:
202 SalomeApp_DoubleSpinBox* sb = new SMESHGUI_SpinBox( GroupC1 );
203 sb->setObjectName( (*anIt).myName );
204 attuneStdWidget( sb, i );
205 sb->setValue( (*anIt).myValue.toDouble() );
206 connect( sb, SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged() ) );
210 case QVariant::String:
212 if((*anIt).isVariable) {
213 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
214 QString aVar = (*anIt).myValue.toString();
215 if(aStudy->IsInteger(aVar.toLatin1().constData())){
216 SalomeApp_IntSpinBox* sb = new SalomeApp_IntSpinBox( GroupC1 );
217 sb->setObjectName( (*anIt).myName );
218 attuneStdWidget( sb, i );
220 connect( sb, SIGNAL( valueChanged( int ) ), this, SLOT( onValueChanged() ) );
223 else if(aStudy->IsReal(aVar.toLatin1().constData())){
224 SalomeApp_DoubleSpinBox* sb = new SMESHGUI_SpinBox( GroupC1 );
225 sb->setObjectName( (*anIt).myName );
226 attuneStdWidget( sb, i );
228 connect( sb, SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged() ) );
233 QLineEdit* le = new QLineEdit( GroupC1 );
234 le->setObjectName( (*anIt).myName );
235 attuneStdWidget( le, i );
236 le->setText( (*anIt).myValue.toString() );
237 connect( le, SIGNAL( textChanged( const QString& ) ), this, SLOT( onValueChanged() ) );
246 GroupC1Layout->addWidget( w, i, 1 );
247 changeWidgets().append( w );
254 void SMESHGUI_GenericHypothesisCreator::onValueChanged()
256 valueChanged( (QWidget*) sender() );
259 void SMESHGUI_GenericHypothesisCreator::valueChanged( QWidget* )
263 void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int result )
265 bool res = result==QDialog::Accepted;
268 /*QString paramValues = */storeParams();
269 // No longer needed since NoteBook appears and "Value" OB field shows names of variable
270 // if ( !paramValues.isEmpty() ) {
271 // if ( _PTR(SObject) SHyp = SMESH::FindSObject( myHypo ))
272 // SMESH::SetValue( SHyp, paramValues );
276 changeWidgets().clear();
278 if( myIsCreate && !res )
280 //remove just created hypothesis
281 _PTR(SObject) aHypSObject = SMESH::FindSObject( myHypo );
282 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
283 if( aStudy && !aStudy->GetProperties()->IsLocked() )
285 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
286 aBuilder->RemoveObjectWithChildren( aHypSObject );
289 else if( !myIsCreate && res )
291 SMESH::SObjectList listSOmesh = SMESH::GetMeshesUsingAlgoOrHypothesis( myHypo );
292 if( listSOmesh.size() > 0 )
293 for( int i = 0; i < listSOmesh.size(); i++ )
295 _PTR(SObject) submSO = listSOmesh[i];
296 SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( submSO );
297 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( submSO );
298 if( !aSubMesh->_is_nil() )
299 aMesh = aSubMesh->GetFather();
300 _PTR(SObject) meshSO = SMESH::FindSObject( aMesh );
301 SMESH::ModifiedMesh( meshSO, false, aMesh->NbNodes()==0);
304 SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
305 #ifdef WITHGENERICOBJ
306 myHypo->UnRegister();
308 myHypo = SMESH::SMESH_Hypothesis::_nil();
309 myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
311 disconnect( myDlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
313 //delete myDlg; since WA_DeleteOnClose==true
315 emit finished( result );
318 bool SMESHGUI_GenericHypothesisCreator::stdParams( ListOfStdParams& ) const
323 bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& params ) const
327 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
328 for( ; anIt!=aLast; anIt++ )
330 item.myName = (*anIt)->objectName();
331 if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) )
333 SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
334 item.myValue = sb->value();
335 params.append( item );
337 else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
339 SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
340 item.myValue = sb->value();
341 params.append( item );
343 else if( (*anIt)->inherits( "QLineEdit" ) )
345 QLineEdit* line = ( QLineEdit* )( *anIt );
346 item.myValue = line->text();
347 params.append( item );
349 else if ( getParamFromCustomWidget( item, *anIt ))
351 params.append( item );
360 QStringList SMESHGUI_GenericHypothesisCreator::getVariablesFromDlg() const
363 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
364 for( ; anIt!=aLast; anIt++ ) {
365 if( (*anIt)->inherits( "QAbstractSpinBox" ) ) {
366 QAbstractSpinBox* sb = ( QAbstractSpinBox* )( *anIt );
367 aResult.append(sb->text());
373 QString SMESHGUI_GenericHypothesisCreator::stdParamValues( const ListOfStdParams& params)
375 QString valueStr = "";
376 ListOfStdParams::const_iterator param = params.begin(), aLast = params.end();
378 for( int i=0; param!=aLast; param++, i++ )
380 if ( valueStr.length() > len0 ) {
382 len0 = valueStr.length();
384 switch( (*param).myValue.type() )
387 valueStr += valueStr.number( (*param).myValue.toInt() );
389 case QVariant::Double:
390 valueStr += valueStr.number( (*param).myValue.toDouble() );
392 case QVariant::String:
393 valueStr += (*param).myValue.toString();
396 QVariant valCopy = (*param).myValue;
397 valueStr += valCopy.toString();
403 SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::hypothesis() const
408 void SMESHGUI_GenericHypothesisCreator::setShapeEntry( const QString& theEntry )
410 myShapeEntry = theEntry;
413 //================================================================================
415 * \brief Return hypothesis containing initial parameters
416 * \param strictly - if true, always return myInitParamsHypo,
417 * else, return myInitParamsHypo only in creation mode and if it
420 //================================================================================
422 SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::initParamsHypothesis(const bool strictly) const
425 return myInitParamsHypo;
426 if ( !isCreation() || CORBA::is_nil( myInitParamsHypo ))
428 return myInitParamsHypo;
431 bool SMESHGUI_GenericHypothesisCreator::hasInitParamsHypothesis() const
433 return !CORBA::is_nil( myInitParamsHypo );
436 QString SMESHGUI_GenericHypothesisCreator::hypType() const
441 QString SMESHGUI_GenericHypothesisCreator::hypName() const
446 const SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCreator::widgets() const
448 return myParamWidgets;
451 SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCreator::changeWidgets()
453 return myParamWidgets;
456 QtxDialog* SMESHGUI_GenericHypothesisCreator:: dlg() const
461 bool SMESHGUI_GenericHypothesisCreator::isCreation() const
466 void SMESHGUI_GenericHypothesisCreator::attuneStdWidget( QWidget*, const int ) const
470 QString SMESHGUI_GenericHypothesisCreator::caption() const
475 QPixmap SMESHGUI_GenericHypothesisCreator::icon() const
480 QString SMESHGUI_GenericHypothesisCreator::type() const
484 QWidget* SMESHGUI_GenericHypothesisCreator::getCustomWidget( const StdParam & /*param*/,
486 const int /*index*/) const
490 bool SMESHGUI_GenericHypothesisCreator::getParamFromCustomWidget( StdParam&, QWidget* ) const
495 bool SMESHGUI_GenericHypothesisCreator::checkParams( QString& msg ) const
498 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
499 for( ; anIt!=aLast; anIt++ )
501 if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) )
503 SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
504 ok = sb->isValid( msg, true ) && ok;
506 else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
508 SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
509 ok = sb->isValid( msg, true ) && ok;
515 void SMESHGUI_GenericHypothesisCreator::onReject()
519 QString SMESHGUI_GenericHypothesisCreator::helpPage() const
521 QString aHypType = hypType();
522 QString aHelpFileName = "";
523 if ( aHypType == "LocalLength" )
524 aHelpFileName = "a1d_meshing_hypo_page.html#average_length_anchor";
525 else if ( aHypType == "MaxLength" )
526 aHelpFileName = "a1d_meshing_hypo_page.html#max_length_anchor";
527 else if ( aHypType == "Arithmetic1D")
528 aHelpFileName = "a1d_meshing_hypo_page.html#arithmetic_1d_anchor";
529 else if ( aHypType == "FixedPoints1D")
530 aHelpFileName = "a1d_meshing_hypo_page.html#fixed_points_1d_anchor";
531 else if ( aHypType == "MaxElementArea")
532 aHelpFileName = "a2d_meshing_hypo_page.html#max_element_area_anchor";
533 else if ( aHypType == "MaxElementVolume")
534 aHelpFileName = "max_element_volume_hypo_page.html";
535 else if ( aHypType == "StartEndLength")
536 aHelpFileName = "a1d_meshing_hypo_page.html#start_and_end_length_anchor";
537 else if ( aHypType == "Deflection1D")
538 aHelpFileName = "a1d_meshing_hypo_page.html#deflection_1d_anchor";
539 else if ( aHypType == "AutomaticLength")
540 aHelpFileName = "a1d_meshing_hypo_page.html#automatic_length_anchor";
541 else if ( aHypType == "NumberOfSegments")
542 aHelpFileName = "a1d_meshing_hypo_page.html#number_of_segments_anchor";
543 else if ( aHypType == "ProjectionSource1D")
544 aHelpFileName = "projection_algos_page.html";
545 else if ( aHypType == "ProjectionSource2D")
546 aHelpFileName = "projection_algos_page.html";
547 else if ( aHypType == "ProjectionSource3D")
548 aHelpFileName = "projection_algos_page.html";
549 else if ( aHypType == "NumberOfLayers")
550 aHelpFileName = "radial_prism_algo_page.html";
551 else if ( aHypType == "NumberOfLayers2D")
552 aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
553 else if ( aHypType == "LayerDistribution")
554 aHelpFileName = "radial_prism_algo_page.html";
555 else if ( aHypType == "LayerDistribution2D")
556 aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
557 else if ( aHypType == "SegmentLengthAroundVertex")
558 aHelpFileName = "segments_around_vertex_algo_page.html";
559 else if ( aHypType == "QuadrangleParams")
560 aHelpFileName = "a2d_meshing_hypo_page.html#hypo_quad_params_anchor";
561 else if ( aHypType == "ViscousLayers")
562 aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
563 else if ( aHypType == "ImportSource1D" || aHypType == "ImportSource2D")
564 aHelpFileName = "import_algos_page.html";
565 return aHelpFileName;
568 SMESHGUI_HypothesisDlg::SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator* creator, QWidget* parent )
569 : QtxDialog( parent, false, true ),
572 setAttribute(Qt::WA_DeleteOnClose, true);
573 // setMinimumSize( 300, height() );
574 // setFixedSize( 300, height() );
575 QVBoxLayout* topLayout = new QVBoxLayout( mainFrame() );
576 topLayout->setMargin( 0 );
577 topLayout->setSpacing( 0 );
579 QFrame* titFrame = new QFrame( mainFrame() );
580 QHBoxLayout* titLay = new QHBoxLayout( titFrame );
581 titLay->setMargin( 0 );
582 titLay->setSpacing( SPACING );
584 myIconLabel = new QLabel( titFrame );
585 myIconLabel->setScaledContents( false );
586 myIconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
587 myTypeLabel = new QLabel( titFrame );
589 myTypeLabel->setText( creator->hypType() );
591 titLay->addWidget( myIconLabel, 0 );
592 titLay->addWidget( myTypeLabel, 0 );
593 titLay->addStretch( 1 );
595 topLayout->addWidget( titFrame, 0 );
597 myHelpFileName = creator->helpPage();
599 connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
602 SMESHGUI_HypothesisDlg::~SMESHGUI_HypothesisDlg()
607 void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f )
611 f->setParent( mainFrame() );
612 qobject_cast<QVBoxLayout*>( mainFrame()->layout() )->insertWidget( 1, f, 1 );
616 void SMESHGUI_HypothesisDlg::accept()
619 if ( myCreator && !myCreator->checkParams( msg ) )
621 QString str( tr( "SMESH_INCORRECT_INPUT" ) );
622 if ( !msg.isEmpty() )
624 SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
630 void SMESHGUI_HypothesisDlg::reject()
632 if ( myCreator ) myCreator->onReject();
636 void SMESHGUI_HypothesisDlg::onHelp()
638 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
640 SMESHGUI* aSMESHGUI = dynamic_cast<SMESHGUI*>( app->activeModule() );
641 app->onHelpContextModule(aSMESHGUI ? app->moduleName(aSMESHGUI->moduleName()) : QString(""), myHelpFileName);
646 platform = "winapplication";
648 platform = "application";
650 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
651 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
652 arg(app->resourceMgr()->stringValue("ExternalBrowser",
654 arg(myHelpFileName));
658 void SMESHGUI_HypothesisDlg::setHIcon( const QPixmap& p )
660 myIconLabel->setPixmap( p );
663 void SMESHGUI_HypothesisDlg::setType( const QString& t )
665 myTypeLabel->setText( t );
668 HypothesisData::HypothesisData( const QString& theTypeName,
669 const QString& thePluginName,
670 const QString& theServerLibName,
671 const QString& theClientLibName,
672 const QString& theLabel,
673 const QString& theIconId,
674 const QList<int>& theDim,
676 const QStringList& theNeededHypos,
677 const QStringList& theOptionalHypos,
678 const QStringList& theInputTypes,
679 const QStringList& theOutputTypes,
680 const bool theIsNeedGeometry,
681 const bool supportSub)
682 : TypeName( theTypeName ),
683 PluginName( thePluginName ),
684 ServerLibName( theServerLibName ),
685 ClientLibName( theClientLibName ),
690 NeededHypos( theNeededHypos ),
691 OptionalHypos( theOptionalHypos ),
692 InputTypes( theInputTypes ),
693 OutputTypes( theOutputTypes ),
694 IsNeedGeometry( theIsNeedGeometry ),
695 IsSupportSubmeshes( supportSub )
699 HypothesesSet::HypothesesSet( const QString& theSetName )
700 : myHypoSetName( theSetName ),
706 HypothesesSet::HypothesesSet( const QString& theSetName,
707 const QStringList& theHypoList,
708 const QStringList& theAlgoList )
709 : myHypoSetName( theSetName ),
710 myHypoList( theHypoList ),
711 myAlgoList( theAlgoList ),
717 QStringList* HypothesesSet::list(bool is_algo) const
719 return const_cast<QStringList*>( &( is_algo ? myAlgoList : myHypoList ) );
722 QStringList* HypothesesSet::list() const
724 return list( myIsAlgo );
727 QString HypothesesSet::name() const
729 return myHypoSetName;
732 void HypothesesSet::set( bool isAlgo, const QStringList& lst )
737 int HypothesesSet::count( bool isAlgo ) const
739 return list(isAlgo)->count();
742 bool HypothesesSet::isAlgo() const
747 void HypothesesSet::init( bool isAlgo )
753 bool HypothesesSet::more() const
755 return myIndex < list()->count();
758 void HypothesesSet::next()
763 QString HypothesesSet::current() const
765 return list()->at(myIndex);
768 void HypothesesSet::setIsCustom( bool isCustom )
770 myIsCustom = isCustom;
773 bool HypothesesSet::getIsCustom() const
778 int HypothesesSet::maxDim() const
780 HypothesesSet * thisSet = (HypothesesSet*) this;
782 for ( int isAlgo = 0; isAlgo < 2; ++isAlgo )
784 thisSet->init( isAlgo );
785 while ( thisSet->next(), thisSet->more() )
786 if ( HypothesisData* hypData = SMESH::GetHypothesisData( thisSet->current() ))
787 for ( int i = 0; i < hypData->Dim.count(); ++i )
788 dim = qMax( dim, hypData->Dim[i] );