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 == "ViscousLayers2D")
576 aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
577 else if ( aHypType == "ImportSource1D" || aHypType == "ImportSource2D")
578 aHelpFileName = "import_algos_page.html";
579 return aHelpFileName;
582 SMESHGUI_HypothesisDlg::SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator* creator, QWidget* parent )
583 : QtxDialog( parent, false, true ),
586 setAttribute(Qt::WA_DeleteOnClose, true);
587 // setMinimumSize( 300, height() );
588 // setFixedSize( 300, height() );
589 QVBoxLayout* topLayout = new QVBoxLayout( mainFrame() );
590 topLayout->setMargin( 0 );
591 topLayout->setSpacing( 0 );
593 QFrame* titFrame = new QFrame( mainFrame() );
594 QHBoxLayout* titLay = new QHBoxLayout( titFrame );
595 titLay->setMargin( 0 );
596 titLay->setSpacing( SPACING );
598 myIconLabel = new QLabel( titFrame );
599 myIconLabel->setScaledContents( false );
600 myIconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
601 myTypeLabel = new QLabel( titFrame );
603 myTypeLabel->setText( creator->hypType() );
605 titLay->addWidget( myIconLabel, 0 );
606 titLay->addWidget( myTypeLabel, 0 );
607 titLay->addStretch( 1 );
609 topLayout->addWidget( titFrame, 0 );
611 myHelpFileName = creator->helpPage();
613 connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
616 SMESHGUI_HypothesisDlg::~SMESHGUI_HypothesisDlg()
621 void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f )
625 f->setParent( mainFrame() );
626 qobject_cast<QVBoxLayout*>( mainFrame()->layout() )->insertWidget( 1, f, 1 );
630 void SMESHGUI_HypothesisDlg::accept()
633 if ( myCreator && !myCreator->checkParams( msg ) )
635 QString str( tr( "SMESH_INCORRECT_INPUT" ) );
636 if ( !msg.isEmpty() )
638 SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
644 void SMESHGUI_HypothesisDlg::reject()
646 if ( myCreator ) myCreator->onReject();
650 void SMESHGUI_HypothesisDlg::onHelp()
652 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
654 QString name = "SMESH";
656 QVariant pluginName = myCreator->property( PLUGIN_NAME );
657 if( pluginName.isValid() ) {
658 QString rootDir = pluginName.toString() + "PLUGIN_ROOT_DIR";
659 QString varValue = QString( getenv(rootDir.toLatin1().constData()));
660 if(!varValue.isEmpty())
661 name = pluginName.toString() + "PLUGIN";
664 app->onHelpContextModule(name, myHelpFileName);
669 platform = "winapplication";
671 platform = "application";
673 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
674 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
675 arg(app->resourceMgr()->stringValue("ExternalBrowser",
677 arg(myHelpFileName));
681 void SMESHGUI_HypothesisDlg::setHIcon( const QPixmap& p )
683 myIconLabel->setPixmap( p );
686 void SMESHGUI_HypothesisDlg::setType( const QString& t )
688 myTypeLabel->setText( t );
691 HypothesisData::HypothesisData( const QString& theTypeName,
692 const QString& thePluginName,
693 const QString& theServerLibName,
694 const QString& theClientLibName,
695 const QString& theLabel,
696 const QString& theIconId,
697 const QList<int>& theDim,
699 const QStringList& theNeededHypos,
700 const QStringList& theOptionalHypos,
701 const QStringList& theInputTypes,
702 const QStringList& theOutputTypes,
703 const bool theIsNeedGeometry,
704 const bool supportSub)
705 : TypeName( theTypeName ),
706 PluginName( thePluginName ),
707 ServerLibName( theServerLibName ),
708 ClientLibName( theClientLibName ),
713 NeededHypos( theNeededHypos ),
714 OptionalHypos( theOptionalHypos ),
715 InputTypes( theInputTypes ),
716 OutputTypes( theOutputTypes ),
717 IsNeedGeometry( theIsNeedGeometry ),
718 IsSupportSubmeshes( supportSub )
722 HypothesesSet::HypothesesSet( const QString& theSetName )
723 : myHypoSetName( theSetName ),
729 HypothesesSet::HypothesesSet( const QString& theSetName,
730 const QStringList& theHypoList,
731 const QStringList& theAlgoList )
732 : myHypoSetName( theSetName ),
733 myHypoList( theHypoList ),
734 myAlgoList( theAlgoList ),
740 QStringList* HypothesesSet::list(bool is_algo) const
742 return const_cast<QStringList*>( &( is_algo ? myAlgoList : myHypoList ) );
745 QStringList* HypothesesSet::list() const
747 return list( myIsAlgo );
750 QString HypothesesSet::name() const
752 return myHypoSetName;
755 void HypothesesSet::set( bool isAlgo, const QStringList& lst )
760 int HypothesesSet::count( bool isAlgo ) const
762 return list(isAlgo)->count();
765 bool HypothesesSet::isAlgo() const
770 void HypothesesSet::init( bool isAlgo )
776 bool HypothesesSet::more() const
778 return myIndex < list()->count();
781 void HypothesesSet::next()
786 QString HypothesesSet::current() const
788 return list()->at(myIndex);
791 void HypothesesSet::setIsCustom( bool isCustom )
793 myIsCustom = isCustom;
796 bool HypothesesSet::getIsCustom() const
801 int HypothesesSet::maxDim() const
803 HypothesesSet * thisSet = (HypothesesSet*) this;
805 for ( int isAlgo = 0; isAlgo < 2; ++isAlgo )
807 thisSet->init( isAlgo );
808 while ( thisSet->next(), thisSet->more() )
809 if ( HypothesisData* hypData = SMESH::GetHypothesisData( thisSet->current() ))
810 for ( int i = 0; i < hypData->Dim.count(); ++i )
811 dim = qMax( dim, hypData->Dim[i] );