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 );
157 QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
159 if( CORBA::is_nil( hypothesis() ) )
162 ListOfStdParams params;
163 if( !stdParams( params ) || params.isEmpty() )
166 QFrame* fr = new QFrame( 0 );
167 QVBoxLayout* lay = new QVBoxLayout( fr );
169 lay->setSpacing( 0 );
171 QGroupBox* GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), fr );
172 lay->addWidget( GroupC1 );
174 QGridLayout* GroupC1Layout = new QGridLayout( GroupC1 );
175 GroupC1Layout->setSpacing( SPACING );
176 GroupC1Layout->setMargin( MARGIN );
178 ListOfStdParams::const_iterator anIt = params.begin(), aLast = params.end();
179 for( int i=0; anIt!=aLast; anIt++, i++ )
181 QLabel* lab = new QLabel( (*anIt).myName, GroupC1 );
182 GroupC1Layout->addWidget( lab, i, 0 );
184 QWidget* w = getCustomWidget( *anIt, GroupC1, i );
186 switch( (*anIt).myValue.type() )
190 SalomeApp_IntSpinBox* sb = new SalomeApp_IntSpinBox( GroupC1 );
191 sb->setObjectName( (*anIt).myName );
192 attuneStdWidget( sb, i );
193 sb->setValue( (*anIt).myValue.toInt() );
194 connect( sb, SIGNAL( valueChanged( int ) ), this, SLOT( onValueChanged() ) );
198 case QVariant::Double:
200 SalomeApp_DoubleSpinBox* sb = new SMESHGUI_SpinBox( GroupC1 );
201 sb->setObjectName( (*anIt).myName );
202 attuneStdWidget( sb, i );
203 sb->setValue( (*anIt).myValue.toDouble() );
204 connect( sb, SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged() ) );
208 case QVariant::String:
210 if((*anIt).isVariable) {
211 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
212 QString aVar = (*anIt).myValue.toString();
213 if(aStudy->IsInteger(aVar.toLatin1().constData())){
214 SalomeApp_IntSpinBox* sb = new SalomeApp_IntSpinBox( GroupC1 );
215 sb->setObjectName( (*anIt).myName );
216 attuneStdWidget( sb, i );
218 connect( sb, SIGNAL( valueChanged( int ) ), this, SLOT( onValueChanged() ) );
221 else if(aStudy->IsReal(aVar.toLatin1().constData())){
222 SalomeApp_DoubleSpinBox* sb = new SMESHGUI_SpinBox( GroupC1 );
223 sb->setObjectName( (*anIt).myName );
224 attuneStdWidget( sb, i );
226 connect( sb, SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged() ) );
231 QLineEdit* le = new QLineEdit( GroupC1 );
232 le->setObjectName( (*anIt).myName );
233 attuneStdWidget( le, i );
234 le->setText( (*anIt).myValue.toString() );
235 connect( le, SIGNAL( textChanged( const QString& ) ), this, SLOT( onValueChanged() ) );
244 GroupC1Layout->addWidget( w, i, 1 );
245 changeWidgets().append( w );
252 void SMESHGUI_GenericHypothesisCreator::onValueChanged()
254 valueChanged( (QWidget*) sender() );
257 void SMESHGUI_GenericHypothesisCreator::valueChanged( QWidget* )
261 void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int result )
263 bool res = result==QDialog::Accepted;
266 /*QString paramValues = */storeParams();
267 // No longer needed since NoteBook appears and "Value" OB field shows names of variable
268 // if ( !paramValues.isEmpty() ) {
269 // if ( _PTR(SObject) SHyp = SMESH::FindSObject( myHypo ))
270 // SMESH::SetValue( SHyp, paramValues );
274 changeWidgets().clear();
276 if( myIsCreate && !res )
278 //remove just created hypothesis
279 _PTR(SObject) aHypSObject = SMESH::FindSObject( myHypo );
280 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
281 if( aStudy && !aStudy->GetProperties()->IsLocked() )
283 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
284 aBuilder->RemoveObjectWithChildren( aHypSObject );
287 else if( !myIsCreate && res )
289 SMESH::SObjectList listSOmesh = SMESH::GetMeshesUsingAlgoOrHypothesis( myHypo );
290 if( listSOmesh.size() > 0 )
291 for( int i = 0; i < listSOmesh.size(); i++ )
293 _PTR(SObject) submSO = listSOmesh[i];
294 SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( submSO );
295 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( submSO );
296 if( !aSubMesh->_is_nil() )
297 aMesh = aSubMesh->GetFather();
298 _PTR(SObject) meshSO = SMESH::FindSObject( aMesh );
299 SMESH::ModifiedMesh( meshSO, false, aMesh->NbNodes()==0);
302 SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
303 #ifdef WITHGENERICOBJ
304 myHypo->UnRegister();
306 myHypo = SMESH::SMESH_Hypothesis::_nil();
307 myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
309 disconnect( myDlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
311 //delete myDlg; since WA_DeleteOnClose==true
313 emit finished( result );
316 bool SMESHGUI_GenericHypothesisCreator::stdParams( ListOfStdParams& ) const
321 bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& params ) const
325 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
326 for( ; anIt!=aLast; anIt++ )
328 item.myName = (*anIt)->objectName();
329 if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) )
331 SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
332 item.myValue = sb->value();
333 params.append( item );
335 else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
337 SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
338 item.myValue = sb->value();
339 params.append( item );
341 else if( (*anIt)->inherits( "QLineEdit" ) )
343 QLineEdit* line = ( QLineEdit* )( *anIt );
344 item.myValue = line->text();
345 params.append( item );
347 else if ( getParamFromCustomWidget( item, *anIt ))
349 params.append( item );
358 QStringList SMESHGUI_GenericHypothesisCreator::getVariablesFromDlg() const
361 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
362 for( ; anIt!=aLast; anIt++ ) {
363 if( (*anIt)->inherits( "QAbstractSpinBox" ) ) {
364 QAbstractSpinBox* sb = ( QAbstractSpinBox* )( *anIt );
365 aResult.append(sb->text());
371 QString SMESHGUI_GenericHypothesisCreator::stdParamValues( const ListOfStdParams& params)
373 QString valueStr = "";
374 ListOfStdParams::const_iterator param = params.begin(), aLast = params.end();
376 for( int i=0; param!=aLast; param++, i++ )
378 if ( valueStr.length() > len0 ) {
380 len0 = valueStr.length();
382 switch( (*param).myValue.type() )
385 valueStr += valueStr.number( (*param).myValue.toInt() );
387 case QVariant::Double:
388 valueStr += valueStr.number( (*param).myValue.toDouble() );
390 case QVariant::String:
391 valueStr += (*param).myValue.toString();
394 QVariant valCopy = (*param).myValue;
395 valueStr += valCopy.toString();
401 SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::hypothesis() const
406 void SMESHGUI_GenericHypothesisCreator::setShapeEntry( const QString& theEntry )
408 myShapeEntry = theEntry;
411 //================================================================================
413 * \brief Return hypothesis containing initial parameters
414 * \param strictly - if true, always return myInitParamsHypo,
415 * else, return myInitParamsHypo only in creation mode and if it
418 //================================================================================
420 SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::initParamsHypothesis(const bool strictly) const
423 return myInitParamsHypo;
424 if ( !isCreation() || CORBA::is_nil( myInitParamsHypo ))
426 return myInitParamsHypo;
429 bool SMESHGUI_GenericHypothesisCreator::hasInitParamsHypothesis() const
431 return !CORBA::is_nil( myInitParamsHypo );
434 QString SMESHGUI_GenericHypothesisCreator::hypType() const
439 QString SMESHGUI_GenericHypothesisCreator::hypName() const
444 const SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCreator::widgets() const
446 return myParamWidgets;
449 SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCreator::changeWidgets()
451 return myParamWidgets;
454 QtxDialog* SMESHGUI_GenericHypothesisCreator:: dlg() const
459 bool SMESHGUI_GenericHypothesisCreator::isCreation() const
464 void SMESHGUI_GenericHypothesisCreator::attuneStdWidget( QWidget*, const int ) const
468 QString SMESHGUI_GenericHypothesisCreator::caption() const
473 QPixmap SMESHGUI_GenericHypothesisCreator::icon() const
478 QString SMESHGUI_GenericHypothesisCreator::type() const
482 QWidget* SMESHGUI_GenericHypothesisCreator::getCustomWidget( const StdParam & /*param*/,
484 const int /*index*/) const
488 bool SMESHGUI_GenericHypothesisCreator::getParamFromCustomWidget( StdParam&, QWidget* ) const
493 bool SMESHGUI_GenericHypothesisCreator::checkParams( QString& msg ) const
496 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
497 for( ; anIt!=aLast; anIt++ )
499 if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) )
501 SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
502 ok = sb->isValid( msg, true ) && ok;
504 else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
506 SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
507 ok = sb->isValid( msg, true ) && ok;
513 void SMESHGUI_GenericHypothesisCreator::onReject()
517 QString SMESHGUI_GenericHypothesisCreator::helpPage() const
519 QString aHypType = hypType();
520 QString aHelpFileName = "";
521 if ( aHypType == "LocalLength" )
522 aHelpFileName = "a1d_meshing_hypo_page.html#average_length_anchor";
523 else if ( aHypType == "MaxLength" )
524 aHelpFileName = "a1d_meshing_hypo_page.html#max_length_anchor";
525 else if ( aHypType == "Arithmetic1D")
526 aHelpFileName = "a1d_meshing_hypo_page.html#arithmetic_1d_anchor";
527 else if ( aHypType == "FixedPoints1D")
528 aHelpFileName = "a1d_meshing_hypo_page.html#fixed_points_1d_anchor";
529 else if ( aHypType == "MaxElementArea")
530 aHelpFileName = "a2d_meshing_hypo_page.html#max_element_area_anchor";
531 else if ( aHypType == "MaxElementVolume")
532 aHelpFileName = "max_element_volume_hypo_page.html";
533 else if ( aHypType == "StartEndLength")
534 aHelpFileName = "a1d_meshing_hypo_page.html#start_and_end_length_anchor";
535 else if ( aHypType == "Deflection1D")
536 aHelpFileName = "a1d_meshing_hypo_page.html#deflection_1d_anchor";
537 else if ( aHypType == "AutomaticLength")
538 aHelpFileName = "a1d_meshing_hypo_page.html#automatic_length_anchor";
539 else if ( aHypType == "NumberOfSegments")
540 aHelpFileName = "a1d_meshing_hypo_page.html#number_of_segments_anchor";
541 else if ( aHypType == "ProjectionSource1D")
542 aHelpFileName = "projection_algos_page.html";
543 else if ( aHypType == "ProjectionSource2D")
544 aHelpFileName = "projection_algos_page.html";
545 else if ( aHypType == "ProjectionSource3D")
546 aHelpFileName = "projection_algos_page.html";
547 else if ( aHypType == "NumberOfLayers")
548 aHelpFileName = "radial_prism_algo_page.html";
549 else if ( aHypType == "NumberOfLayers2D")
550 aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
551 else if ( aHypType == "LayerDistribution")
552 aHelpFileName = "radial_prism_algo_page.html";
553 else if ( aHypType == "LayerDistribution2D")
554 aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
555 else if ( aHypType == "SegmentLengthAroundVertex")
556 aHelpFileName = "segments_around_vertex_algo_page.html";
557 else if ( aHypType == "QuadrangleParams")
558 aHelpFileName = "a2d_meshing_hypo_page.html#hypo_quad_params_anchor";
559 else if ( aHypType == "ViscousLayers")
560 aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
561 else if ( aHypType == "ImportSource1D" || aHypType == "ImportSource2D")
562 aHelpFileName = "import_algos_page.html";
563 return aHelpFileName;
566 SMESHGUI_HypothesisDlg::SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator* creator, QWidget* parent )
567 : QtxDialog( parent, false, true ),
570 setAttribute(Qt::WA_DeleteOnClose, true);
571 // setMinimumSize( 300, height() );
572 // setFixedSize( 300, height() );
573 QVBoxLayout* topLayout = new QVBoxLayout( mainFrame() );
574 topLayout->setMargin( 0 );
575 topLayout->setSpacing( 0 );
577 QFrame* titFrame = new QFrame( mainFrame() );
578 QHBoxLayout* titLay = new QHBoxLayout( titFrame );
579 titLay->setMargin( 0 );
580 titLay->setSpacing( SPACING );
582 myIconLabel = new QLabel( titFrame );
583 myIconLabel->setScaledContents( false );
584 myIconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
585 myTypeLabel = new QLabel( titFrame );
587 myTypeLabel->setText( creator->hypType() );
589 titLay->addWidget( myIconLabel, 0 );
590 titLay->addWidget( myTypeLabel, 0 );
591 titLay->addStretch( 1 );
593 topLayout->addWidget( titFrame, 0 );
595 myHelpFileName = creator->helpPage();
597 connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
600 SMESHGUI_HypothesisDlg::~SMESHGUI_HypothesisDlg()
605 void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f )
609 f->setParent( mainFrame() );
610 qobject_cast<QVBoxLayout*>( mainFrame()->layout() )->insertWidget( 1, f, 1 );
614 void SMESHGUI_HypothesisDlg::accept()
617 if ( myCreator && !myCreator->checkParams( msg ) )
619 QString str( tr( "SMESH_INCORRECT_INPUT" ) );
620 if ( !msg.isEmpty() )
622 SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
628 void SMESHGUI_HypothesisDlg::reject()
630 if ( myCreator ) myCreator->onReject();
634 void SMESHGUI_HypothesisDlg::onHelp()
636 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
638 SMESHGUI* aSMESHGUI = dynamic_cast<SMESHGUI*>( app->activeModule() );
639 app->onHelpContextModule(aSMESHGUI ? app->moduleName(aSMESHGUI->moduleName()) : QString(""), myHelpFileName);
644 platform = "winapplication";
646 platform = "application";
648 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
649 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
650 arg(app->resourceMgr()->stringValue("ExternalBrowser",
652 arg(myHelpFileName));
656 void SMESHGUI_HypothesisDlg::setHIcon( const QPixmap& p )
658 myIconLabel->setPixmap( p );
661 void SMESHGUI_HypothesisDlg::setType( const QString& t )
663 myTypeLabel->setText( t );
666 HypothesisData::HypothesisData( const QString& theTypeName,
667 const QString& thePluginName,
668 const QString& theServerLibName,
669 const QString& theClientLibName,
670 const QString& theLabel,
671 const QString& theIconId,
672 const QList<int>& theDim,
674 const QStringList& theNeededHypos,
675 const QStringList& theOptionalHypos,
676 const QStringList& theInputTypes,
677 const QStringList& theOutputTypes,
678 const bool theIsNeedGeometry,
679 const bool supportSub)
680 : TypeName( theTypeName ),
681 PluginName( thePluginName ),
682 ServerLibName( theServerLibName ),
683 ClientLibName( theClientLibName ),
688 NeededHypos( theNeededHypos ),
689 OptionalHypos( theOptionalHypos ),
690 InputTypes( theInputTypes ),
691 OutputTypes( theOutputTypes ),
692 IsNeedGeometry( theIsNeedGeometry ),
693 IsSupportSubmeshes( supportSub )
697 HypothesesSet::HypothesesSet( const QString& theSetName )
698 : myHypoSetName( theSetName ),
704 HypothesesSet::HypothesesSet( const QString& theSetName,
705 const QStringList& theHypoList,
706 const QStringList& theAlgoList )
707 : myHypoSetName( theSetName ),
708 myHypoList( theHypoList ),
709 myAlgoList( theAlgoList ),
715 QStringList* HypothesesSet::list(bool is_algo) const
717 return const_cast<QStringList*>( &( is_algo ? myAlgoList : myHypoList ) );
720 QStringList* HypothesesSet::list() const
722 return list( myIsAlgo );
725 QString HypothesesSet::name() const
727 return myHypoSetName;
730 void HypothesesSet::set( bool isAlgo, const QStringList& lst )
735 int HypothesesSet::count( bool isAlgo ) const
737 return list(isAlgo)->count();
740 bool HypothesesSet::isAlgo() const
745 void HypothesesSet::init( bool isAlgo )
751 bool HypothesesSet::more() const
753 return myIndex < list()->count();
756 void HypothesesSet::next()
761 QString HypothesesSet::current() const
763 return list()->at(myIndex);
766 void HypothesesSet::setIsCustom( bool isCustom )
768 myIsCustom = isCustom;
771 bool HypothesesSet::getIsCustom() const
776 int HypothesesSet::maxDim() const
778 HypothesesSet * thisSet = (HypothesesSet*) this;
780 for ( int isAlgo = 0; isAlgo < 2; ++isAlgo )
782 thisSet->init( isAlgo );
783 while ( thisSet->next(), thisSet->more() )
784 if ( HypothesisData* hypData = SMESH::GetHypothesisData( thisSet->current() ))
785 for ( int i = 0; i < hypData->Dim.count(); ++i )
786 dim = qMax( dim, hypData->Dim[i] );