1 // Copyright (C) 2007-2012 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 item.myText = sb->text();
336 params.append( item );
338 else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
340 SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
341 item.myValue = sb->value();
342 item.myText = sb->text();
343 params.append( item );
345 else if( (*anIt)->inherits( "QLineEdit" ) )
347 QLineEdit* line = ( QLineEdit* )( *anIt );
348 item.myValue = item.myText = line->text();
349 params.append( item );
351 else if ( getParamFromCustomWidget( item, *anIt ))
353 params.append( item );
361 QString SMESHGUI_GenericHypothesisCreator::getVariableName(const char* methodName) const
363 SMESH::SMESH_Hypothesis_var h = hypothesis();
366 CORBA::String_var aVaribaleName = h->GetVarParameter( methodName );
367 return QString( aVaribaleName.in() );
372 QStringList SMESHGUI_GenericHypothesisCreator::getVariablesFromDlg() const
375 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
376 for( ; anIt!=aLast; anIt++ ) {
377 if( (*anIt)->inherits( "QAbstractSpinBox" ) ) {
378 QAbstractSpinBox* sb = ( QAbstractSpinBox* )( *anIt );
379 aResult.append(sb->text());
385 QString SMESHGUI_GenericHypothesisCreator::stdParamValues( const ListOfStdParams& params)
387 QString valueStr = "";
388 ListOfStdParams::const_iterator param = params.begin(), aLast = params.end();
390 for( int i=0; param!=aLast; param++, i++ )
392 if ( valueStr.length() > len0 ) {
394 len0 = valueStr.length();
396 switch( (*param).myValue.type() )
399 valueStr += valueStr.number( (*param).myValue.toInt() );
401 case QVariant::Double:
402 valueStr += valueStr.number( (*param).myValue.toDouble() );
404 case QVariant::String:
405 valueStr += (*param).myValue.toString();
408 QVariant valCopy = (*param).myValue;
409 valueStr += valCopy.toString();
415 SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::hypothesis() const
420 void SMESHGUI_GenericHypothesisCreator::setShapeEntry( const QString& theEntry )
422 myShapeEntry = theEntry;
425 //================================================================================
427 * \brief Return hypothesis containing initial parameters
428 * \param strictly - if true, always return myInitParamsHypo,
429 * else, return myInitParamsHypo only in creation mode and if it
432 //================================================================================
434 SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::initParamsHypothesis(const bool strictly) const
437 return myInitParamsHypo;
438 if ( !isCreation() || CORBA::is_nil( myInitParamsHypo ))
440 return myInitParamsHypo;
443 bool SMESHGUI_GenericHypothesisCreator::hasInitParamsHypothesis() const
445 return !CORBA::is_nil( myInitParamsHypo );
448 QString SMESHGUI_GenericHypothesisCreator::hypType() const
453 QString SMESHGUI_GenericHypothesisCreator::hypName() const
458 const SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCreator::widgets() const
460 return myParamWidgets;
463 SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCreator::changeWidgets()
465 return myParamWidgets;
468 QtxDialog* SMESHGUI_GenericHypothesisCreator:: dlg() const
473 bool SMESHGUI_GenericHypothesisCreator::isCreation() const
478 void SMESHGUI_GenericHypothesisCreator::attuneStdWidget( QWidget*, const int ) const
482 QString SMESHGUI_GenericHypothesisCreator::caption() const
487 QPixmap SMESHGUI_GenericHypothesisCreator::icon() const
492 QString SMESHGUI_GenericHypothesisCreator::type() const
496 QWidget* SMESHGUI_GenericHypothesisCreator::getCustomWidget( const StdParam & /*param*/,
498 const int /*index*/) const
502 bool SMESHGUI_GenericHypothesisCreator::getParamFromCustomWidget( StdParam&, QWidget* ) const
507 bool SMESHGUI_GenericHypothesisCreator::checkParams( QString& msg ) const
510 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
511 for( ; anIt!=aLast; anIt++ )
513 if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) )
515 SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
516 ok = sb->isValid( msg, true ) && ok;
518 else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
520 SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
521 ok = sb->isValid( msg, true ) && ok;
527 void SMESHGUI_GenericHypothesisCreator::onReject()
531 QString SMESHGUI_GenericHypothesisCreator::helpPage() const
533 QString aHypType = hypType();
534 QString aHelpFileName = "";
535 if ( aHypType == "LocalLength" )
536 aHelpFileName = "a1d_meshing_hypo_page.html#average_length_anchor";
537 else if ( aHypType == "MaxLength" )
538 aHelpFileName = "a1d_meshing_hypo_page.html#max_length_anchor";
539 else if ( aHypType == "Arithmetic1D")
540 aHelpFileName = "a1d_meshing_hypo_page.html#arithmetic_1d_anchor";
541 else if ( aHypType == "FixedPoints1D")
542 aHelpFileName = "a1d_meshing_hypo_page.html#fixed_points_1d_anchor";
543 else if ( aHypType == "MaxElementArea")
544 aHelpFileName = "a2d_meshing_hypo_page.html#max_element_area_anchor";
545 else if ( aHypType == "MaxElementVolume")
546 aHelpFileName = "max_element_volume_hypo_page.html";
547 else if ( aHypType == "StartEndLength")
548 aHelpFileName = "a1d_meshing_hypo_page.html#start_and_end_length_anchor";
549 else if ( aHypType == "Deflection1D")
550 aHelpFileName = "a1d_meshing_hypo_page.html#deflection_1d_anchor";
551 else if ( aHypType == "AutomaticLength")
552 aHelpFileName = "a1d_meshing_hypo_page.html#automatic_length_anchor";
553 else if ( aHypType == "NumberOfSegments")
554 aHelpFileName = "a1d_meshing_hypo_page.html#number_of_segments_anchor";
555 else if ( aHypType == "ProjectionSource1D")
556 aHelpFileName = "projection_algos_page.html";
557 else if ( aHypType == "ProjectionSource2D")
558 aHelpFileName = "projection_algos_page.html";
559 else if ( aHypType == "ProjectionSource3D")
560 aHelpFileName = "projection_algos_page.html";
561 else if ( aHypType == "NumberOfLayers")
562 aHelpFileName = "radial_prism_algo_page.html";
563 else if ( aHypType == "NumberOfLayers2D")
564 aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
565 else if ( aHypType == "LayerDistribution")
566 aHelpFileName = "radial_prism_algo_page.html";
567 else if ( aHypType == "LayerDistribution2D")
568 aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
569 else if ( aHypType == "SegmentLengthAroundVertex")
570 aHelpFileName = "segments_around_vertex_algo_page.html";
571 else if ( aHypType == "QuadrangleParams")
572 aHelpFileName = "a2d_meshing_hypo_page.html#hypo_quad_params_anchor";
573 else if ( aHypType == "ViscousLayers")
574 aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
575 else if ( aHypType == "ImportSource1D" || aHypType == "ImportSource2D")
576 aHelpFileName = "import_algos_page.html";
577 return aHelpFileName;
580 SMESHGUI_HypothesisDlg::SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator* creator, QWidget* parent )
581 : QtxDialog( parent, false, true ),
584 setAttribute(Qt::WA_DeleteOnClose, true);
585 // setMinimumSize( 300, height() );
586 // setFixedSize( 300, height() );
587 QVBoxLayout* topLayout = new QVBoxLayout( mainFrame() );
588 topLayout->setMargin( 0 );
589 topLayout->setSpacing( 0 );
591 QFrame* titFrame = new QFrame( mainFrame() );
592 QHBoxLayout* titLay = new QHBoxLayout( titFrame );
593 titLay->setMargin( 0 );
594 titLay->setSpacing( SPACING );
596 myIconLabel = new QLabel( titFrame );
597 myIconLabel->setScaledContents( false );
598 myIconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
599 myTypeLabel = new QLabel( titFrame );
601 myTypeLabel->setText( creator->hypType() );
603 titLay->addWidget( myIconLabel, 0 );
604 titLay->addWidget( myTypeLabel, 0 );
605 titLay->addStretch( 1 );
607 topLayout->addWidget( titFrame, 0 );
609 myHelpFileName = creator->helpPage();
611 connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
614 SMESHGUI_HypothesisDlg::~SMESHGUI_HypothesisDlg()
619 void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f )
623 f->setParent( mainFrame() );
624 qobject_cast<QVBoxLayout*>( mainFrame()->layout() )->insertWidget( 1, f, 1 );
628 void SMESHGUI_HypothesisDlg::accept()
631 if ( myCreator && !myCreator->checkParams( msg ) )
633 QString str( tr( "SMESH_INCORRECT_INPUT" ) );
634 if ( !msg.isEmpty() )
636 SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
642 void SMESHGUI_HypothesisDlg::reject()
644 if ( myCreator ) myCreator->onReject();
648 void SMESHGUI_HypothesisDlg::onHelp()
650 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
652 QString name = "SMESH";
654 QVariant pluginName = myCreator->property( PLUGIN_NAME );
655 if( pluginName.isValid() ) {
656 QString rootDir = pluginName.toString() + "PLUGIN_ROOT_DIR";
657 QString varValue = QString( getenv(rootDir.toLatin1().constData()));
658 if(!varValue.isEmpty())
659 name = pluginName.toString() + "PLUGIN";
662 app->onHelpContextModule(name, myHelpFileName);
667 platform = "winapplication";
669 platform = "application";
671 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
672 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
673 arg(app->resourceMgr()->stringValue("ExternalBrowser",
675 arg(myHelpFileName));
679 void SMESHGUI_HypothesisDlg::setHIcon( const QPixmap& p )
681 myIconLabel->setPixmap( p );
684 void SMESHGUI_HypothesisDlg::setType( const QString& t )
686 myTypeLabel->setText( t );
689 HypothesisData::HypothesisData( const QString& theTypeName,
690 const QString& thePluginName,
691 const QString& theServerLibName,
692 const QString& theClientLibName,
693 const QString& theLabel,
694 const QString& theIconId,
695 const QList<int>& theDim,
697 const QStringList& theNeededHypos,
698 const QStringList& theOptionalHypos,
699 const QStringList& theInputTypes,
700 const QStringList& theOutputTypes,
701 const bool theIsNeedGeometry,
702 const bool supportSub)
703 : TypeName( theTypeName ),
704 PluginName( thePluginName ),
705 ServerLibName( theServerLibName ),
706 ClientLibName( theClientLibName ),
711 NeededHypos( theNeededHypos ),
712 OptionalHypos( theOptionalHypos ),
713 InputTypes( theInputTypes ),
714 OutputTypes( theOutputTypes ),
715 IsNeedGeometry( theIsNeedGeometry ),
716 IsSupportSubmeshes( supportSub )
720 HypothesesSet::HypothesesSet( const QString& theSetName )
721 : myHypoSetName( theSetName ),
727 HypothesesSet::HypothesesSet( const QString& theSetName,
728 const QStringList& theHypoList,
729 const QStringList& theAlgoList )
730 : myHypoSetName( theSetName ),
731 myHypoList( theHypoList ),
732 myAlgoList( theAlgoList ),
738 QStringList* HypothesesSet::list(bool is_algo) const
740 return const_cast<QStringList*>( &( is_algo ? myAlgoList : myHypoList ) );
743 QStringList* HypothesesSet::list() const
745 return list( myIsAlgo );
748 QString HypothesesSet::name() const
750 return myHypoSetName;
753 void HypothesesSet::set( bool isAlgo, const QStringList& lst )
758 int HypothesesSet::count( bool isAlgo ) const
760 return list(isAlgo)->count();
763 bool HypothesesSet::isAlgo() const
768 void HypothesesSet::init( bool isAlgo )
774 bool HypothesesSet::more() const
776 return myIndex < list()->count();
779 void HypothesesSet::next()
784 QString HypothesesSet::current() const
786 return list()->at(myIndex);
789 void HypothesesSet::setIsCustom( bool isCustom )
791 myIsCustom = isCustom;
794 bool HypothesesSet::getIsCustom() const
799 int HypothesesSet::maxDim() const
801 HypothesesSet * thisSet = (HypothesesSet*) this;
803 for ( int isAlgo = 0; isAlgo < 2; ++isAlgo )
805 thisSet->init( isAlgo );
806 while ( thisSet->next(), thisSet->more() )
807 if ( HypothesisData* hypData = SMESH::GetHypothesisData( thisSet->current() ))
808 for ( int i = 0; i < hypData->Dim.count(); ++i )
809 dim = qMax( dim, hypData->Dim[i] );