1 // Copyright (C) 2007-2013 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 SMESHGUI_GenericHypothesisCreator::SMESHGUI_GenericHypothesisCreator( const QString& theHypType )
55 : myToDeleteInitParamsHypo( false ),
56 myHypType( theHypType ),
62 SMESHGUI_GenericHypothesisCreator::~SMESHGUI_GenericHypothesisCreator()
64 if ( myToDeleteInitParamsHypo && !myInitParamsHypo->_is_nil() )
65 myInitParamsHypo->UnRegister();
68 void SMESHGUI_GenericHypothesisCreator::setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr hyp)
70 if ( !CORBA::is_nil( hyp ) ) {
71 if ( myToDeleteInitParamsHypo && !myInitParamsHypo->_is_nil() )
72 myInitParamsHypo->UnRegister();
73 CORBA::String_var hypName = hyp->GetName();
74 if ( hypType() == hypName.in() )
76 myInitParamsHypo = SMESH::SMESH_Hypothesis::_duplicate( hyp );
77 myToDeleteInitParamsHypo = !SMESH::FindSObject( myInitParamsHypo );
82 void SMESHGUI_GenericHypothesisCreator::create( SMESH::SMESH_Hypothesis_ptr initParamsHyp,
83 const QString& theHypName,
84 QWidget* parent, QObject* obj, const QString& slot )
86 MESSAGE( "Creation of hypothesis with initial params" );
87 setInitParamsHypothesis( initParamsHyp );
88 create( false, theHypName, parent, obj, slot );
91 void SMESHGUI_GenericHypothesisCreator::create( bool isAlgo,
92 const QString& theHypName,
93 QWidget* theParent, QObject* obj, const QString& slot )
95 MESSAGE( "Creation of hypothesis" );
99 // Create hypothesis/algorithm
101 SMESH::SMESH_Hypothesis_var anAlgo =
102 SMESH::CreateHypothesis( hypType(), theHypName, isAlgo );
103 if (!CORBA::is_nil(anAlgo))
104 anAlgo->UnRegister();
107 SMESH::SMESH_Hypothesis_var aHypothesis =
108 SMESH::CreateHypothesis( hypType(), theHypName, false );
109 editHypothesis( aHypothesis.in(), theHypName, theParent, obj, slot );
110 if (!CORBA::is_nil(aHypothesis))
111 aHypothesis->UnRegister();
115 void SMESHGUI_GenericHypothesisCreator::edit( SMESH::SMESH_Hypothesis_ptr theHypothesis,
116 const QString& theHypName,
117 QWidget* theParent, QObject* obj, const QString& slot )
119 if( CORBA::is_nil( theHypothesis ) )
122 MESSAGE("Edition of hypothesis");
126 editHypothesis( theHypothesis, theHypName, theParent, obj, slot );
129 void SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_ptr h,
130 const QString& theHypName,
132 QObject* obj, const QString& slot )
134 myHypName = theHypName;
135 myHypo = SMESH::SMESH_Hypothesis::_duplicate( h );
138 SMESHGUI_HypothesisDlg* Dlg = new SMESHGUI_HypothesisDlg( this, theParent );
139 connect( Dlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
140 connect( this, SIGNAL( finished( int ) ), obj, slot.toLatin1().constData() );
141 connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalCloseAllDialogs() ), Dlg, SLOT( reject() ));
144 QFrame* fr = buildFrame();
147 Dlg->setCustomFrame( fr );
148 Dlg->setWindowTitle( caption() );
149 Dlg->setObjectName( theHypName );
150 Dlg->setHIcon( icon() );
151 Dlg->setType( type() );
154 Dlg->resize( Dlg->minimumSizeHint() );
157 emit finished( QDialog::Accepted );
162 QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
164 if( CORBA::is_nil( hypothesis() ) )
167 ListOfStdParams params;
168 if( !stdParams( params ) || params.isEmpty() )
171 QFrame* fr = new QFrame( 0 );
172 QVBoxLayout* lay = new QVBoxLayout( fr );
174 lay->setSpacing( 0 );
176 QGroupBox* GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), fr );
177 lay->addWidget( GroupC1 );
179 QGridLayout* GroupC1Layout = new QGridLayout( GroupC1 );
180 GroupC1Layout->setSpacing( SPACING );
181 GroupC1Layout->setMargin( MARGIN );
183 ListOfStdParams::const_iterator anIt = params.begin(), aLast = params.end();
184 for( int i=0; anIt!=aLast; anIt++, i++ )
186 QLabel* lab = new QLabel( (*anIt).myName, GroupC1 );
187 GroupC1Layout->addWidget( lab, i, 0 );
189 QWidget* w = getCustomWidget( *anIt, GroupC1, i );
191 switch( (*anIt).myValue.type() )
195 SalomeApp_IntSpinBox* sb = new SalomeApp_IntSpinBox( GroupC1 );
196 sb->setObjectName( (*anIt).myName );
197 attuneStdWidget( sb, i );
198 sb->setValue( (*anIt).myValue.toInt() );
199 connect( sb, SIGNAL( valueChanged( int ) ), this, SLOT( onValueChanged() ) );
203 case QVariant::Double:
205 SalomeApp_DoubleSpinBox* sb = new SMESHGUI_SpinBox( GroupC1 );
206 sb->setObjectName( (*anIt).myName );
207 attuneStdWidget( sb, i );
208 sb->setValue( (*anIt).myValue.toDouble() );
209 connect( sb, SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged() ) );
213 case QVariant::String:
215 if((*anIt).isVariable) {
216 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
217 QString aVar = (*anIt).myValue.toString();
218 if(aStudy->IsInteger(aVar.toLatin1().constData())){
219 SalomeApp_IntSpinBox* sb = new SalomeApp_IntSpinBox( GroupC1 );
220 sb->setObjectName( (*anIt).myName );
221 attuneStdWidget( sb, i );
223 connect( sb, SIGNAL( valueChanged( int ) ), this, SLOT( onValueChanged() ) );
226 else if(aStudy->IsReal(aVar.toLatin1().constData())){
227 SalomeApp_DoubleSpinBox* sb = new SMESHGUI_SpinBox( GroupC1 );
228 sb->setObjectName( (*anIt).myName );
229 attuneStdWidget( sb, i );
231 connect( sb, SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged() ) );
236 QLineEdit* le = new QLineEdit( GroupC1 );
237 le->setObjectName( (*anIt).myName );
238 attuneStdWidget( le, i );
239 le->setText( (*anIt).myValue.toString() );
240 connect( le, SIGNAL( textChanged( const QString& ) ), this, SLOT( onValueChanged() ) );
249 GroupC1Layout->addWidget( w, i, 1 );
250 changeWidgets().append( w );
257 void SMESHGUI_GenericHypothesisCreator::onValueChanged()
259 valueChanged( (QWidget*) sender() );
262 void SMESHGUI_GenericHypothesisCreator::valueChanged( QWidget* )
266 void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int result )
268 bool res = result==QDialog::Accepted;
271 /*QString paramValues = */storeParams();
272 // No longer needed since NoteBook appears and "Value" OB field shows names of variable
273 // if ( !paramValues.isEmpty() ) {
274 // if ( _PTR(SObject) SHyp = SMESH::FindSObject( myHypo ))
275 // SMESH::SetValue( SHyp, paramValues );
279 changeWidgets().clear();
281 if( myIsCreate && !res )
283 //remove just created hypothesis
284 _PTR(SObject) aHypSObject = SMESH::FindSObject( myHypo );
285 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
286 if( aStudy && !aStudy->GetProperties()->IsLocked() )
288 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
289 aBuilder->RemoveObjectWithChildren( aHypSObject );
292 else if( !myIsCreate && res )
294 SMESH::SObjectList listSOmesh = SMESH::GetMeshesUsingAlgoOrHypothesis( myHypo );
295 if( listSOmesh.size() > 0 )
296 for( int i = 0; i < listSOmesh.size(); i++ )
298 _PTR(SObject) submSO = listSOmesh[i];
299 SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( submSO );
300 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( submSO );
301 if( !aSubMesh->_is_nil() )
302 aMesh = aSubMesh->GetFather();
303 _PTR(SObject) meshSO = SMESH::FindSObject( aMesh );
304 SMESH::ModifiedMesh( meshSO, false, aMesh->NbNodes()==0);
307 SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
308 myHypo->UnRegister();
309 myHypo = SMESH::SMESH_Hypothesis::_nil();
310 myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
312 disconnect( myDlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
314 //delete myDlg; since WA_DeleteOnClose==true
316 emit finished( result );
319 bool SMESHGUI_GenericHypothesisCreator::stdParams( ListOfStdParams& ) const
324 bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& params ) const
328 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
329 for( ; anIt!=aLast; anIt++ )
331 item.myName = (*anIt)->objectName();
332 if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) )
334 SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
335 item.myValue = sb->value();
336 item.myText = sb->text();
337 params.append( item );
339 else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
341 SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
342 item.myValue = sb->value();
343 item.myText = sb->text();
344 params.append( item );
346 else if( (*anIt)->inherits( "QLineEdit" ) )
348 QLineEdit* line = ( QLineEdit* )( *anIt );
349 item.myValue = item.myText = line->text();
350 params.append( item );
352 else if ( getParamFromCustomWidget( item, *anIt ))
354 params.append( item );
362 QString SMESHGUI_GenericHypothesisCreator::getVariableName(const char* methodName) const
364 SMESH::SMESH_Hypothesis_var h = hypothesis();
367 CORBA::String_var aVaribaleName = h->GetVarParameter( methodName );
368 return QString( aVaribaleName.in() );
373 QStringList SMESHGUI_GenericHypothesisCreator::getVariablesFromDlg() const
376 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
377 for( ; anIt!=aLast; anIt++ ) {
378 if( (*anIt)->inherits( "QAbstractSpinBox" ) ) {
379 QAbstractSpinBox* sb = ( QAbstractSpinBox* )( *anIt );
380 aResult.append(sb->text());
386 QString SMESHGUI_GenericHypothesisCreator::stdParamValues( const ListOfStdParams& params)
388 QString valueStr = "";
389 ListOfStdParams::const_iterator param = params.begin(), aLast = params.end();
391 for( int i=0; param!=aLast; param++, i++ )
393 if ( valueStr.length() > len0 ) {
395 len0 = valueStr.length();
397 switch( (*param).myValue.type() )
400 valueStr += valueStr.number( (*param).myValue.toInt() );
402 case QVariant::Double:
403 valueStr += valueStr.number( (*param).myValue.toDouble() );
405 case QVariant::String:
406 valueStr += (*param).myValue.toString();
409 QVariant valCopy = (*param).myValue;
410 valueStr += valCopy.toString();
416 SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::hypothesis() const
421 void SMESHGUI_GenericHypothesisCreator::setShapeEntry( const QString& theEntry )
423 myShapeEntry = theEntry;
426 //================================================================================
428 * \brief Return hypothesis containing initial parameters
429 * \param strictly - if true, always return myInitParamsHypo,
430 * else, return myInitParamsHypo only in creation mode and if it
433 //================================================================================
435 SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::initParamsHypothesis(const bool strictly) const
438 return myInitParamsHypo;
439 if ( !isCreation() || CORBA::is_nil( myInitParamsHypo ))
441 return myInitParamsHypo;
444 bool SMESHGUI_GenericHypothesisCreator::hasInitParamsHypothesis() const
446 return !CORBA::is_nil( myInitParamsHypo );
449 QString SMESHGUI_GenericHypothesisCreator::hypType() const
454 QString SMESHGUI_GenericHypothesisCreator::hypName() const
459 const SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCreator::widgets() const
461 return myParamWidgets;
464 SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCreator::changeWidgets()
466 return myParamWidgets;
469 QtxDialog* SMESHGUI_GenericHypothesisCreator:: dlg() const
474 bool SMESHGUI_GenericHypothesisCreator::isCreation() const
479 void SMESHGUI_GenericHypothesisCreator::attuneStdWidget( QWidget*, const int ) const
483 QString SMESHGUI_GenericHypothesisCreator::caption() const
488 QPixmap SMESHGUI_GenericHypothesisCreator::icon() const
493 QString SMESHGUI_GenericHypothesisCreator::type() const
497 QWidget* SMESHGUI_GenericHypothesisCreator::getCustomWidget( const StdParam & /*param*/,
499 const int /*index*/) const
503 bool SMESHGUI_GenericHypothesisCreator::getParamFromCustomWidget( StdParam&, QWidget* ) const
508 bool SMESHGUI_GenericHypothesisCreator::checkParams( QString& msg ) const
511 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
512 for( ; anIt!=aLast; anIt++ )
514 if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) )
516 SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
517 ok = sb->isValid( msg, true ) && ok;
519 else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
521 SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
522 ok = sb->isValid( msg, true ) && ok;
528 void SMESHGUI_GenericHypothesisCreator::onReject()
532 QString SMESHGUI_GenericHypothesisCreator::helpPage() const
534 QString aHypType = hypType();
535 QString aHelpFileName = "";
536 if ( aHypType == "LocalLength" )
537 aHelpFileName = "a1d_meshing_hypo_page.html#average_length_anchor";
538 else if ( aHypType == "MaxLength" )
539 aHelpFileName = "a1d_meshing_hypo_page.html#max_length_anchor";
540 else if ( aHypType == "Arithmetic1D")
541 aHelpFileName = "a1d_meshing_hypo_page.html#arithmetic_1d_anchor";
542 else if ( aHypType == "FixedPoints1D")
543 aHelpFileName = "a1d_meshing_hypo_page.html#fixed_points_1d_anchor";
544 else if ( aHypType == "MaxElementArea")
545 aHelpFileName = "a2d_meshing_hypo_page.html#max_element_area_anchor";
546 else if ( aHypType == "MaxElementVolume")
547 aHelpFileName = "max_element_volume_hypo_page.html";
548 else if ( aHypType == "StartEndLength")
549 aHelpFileName = "a1d_meshing_hypo_page.html#start_and_end_length_anchor";
550 else if ( aHypType == "Deflection1D")
551 aHelpFileName = "a1d_meshing_hypo_page.html#deflection_1d_anchor";
552 else if ( aHypType == "AutomaticLength")
553 aHelpFileName = "a1d_meshing_hypo_page.html#automatic_length_anchor";
554 else if ( aHypType == "NumberOfSegments")
555 aHelpFileName = "a1d_meshing_hypo_page.html#number_of_segments_anchor";
556 else if ( aHypType == "ProjectionSource1D")
557 aHelpFileName = "projection_algos_page.html";
558 else if ( aHypType == "ProjectionSource2D")
559 aHelpFileName = "projection_algos_page.html";
560 else if ( aHypType == "ProjectionSource3D")
561 aHelpFileName = "projection_algos_page.html";
562 else if ( aHypType == "NumberOfLayers")
563 aHelpFileName = "radial_prism_algo_page.html";
564 else if ( aHypType == "NumberOfLayers2D")
565 aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
566 else if ( aHypType == "LayerDistribution")
567 aHelpFileName = "radial_prism_algo_page.html";
568 else if ( aHypType == "LayerDistribution2D")
569 aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
570 else if ( aHypType == "SegmentLengthAroundVertex")
571 aHelpFileName = "segments_around_vertex_algo_page.html";
572 else if ( aHypType == "QuadrangleParams")
573 aHelpFileName = "a2d_meshing_hypo_page.html#hypo_quad_params_anchor";
574 else if ( aHypType == "ViscousLayers")
575 aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
576 else if ( aHypType == "ViscousLayers2D")
577 aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
578 else if ( aHypType == "ImportSource1D" || aHypType == "ImportSource2D")
579 aHelpFileName = "import_algos_page.html";
580 return aHelpFileName;
583 SMESHGUI_HypothesisDlg::SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator* creator, QWidget* parent )
584 : QtxDialog( parent, false, true ),
587 setAttribute(Qt::WA_DeleteOnClose, true);
588 // setMinimumSize( 300, height() );
589 // setFixedSize( 300, height() );
590 QVBoxLayout* topLayout = new QVBoxLayout( mainFrame() );
591 topLayout->setMargin( 0 );
592 topLayout->setSpacing( 0 );
594 QFrame* titFrame = new QFrame( mainFrame() );
595 QHBoxLayout* titLay = new QHBoxLayout( titFrame );
596 titLay->setMargin( 0 );
597 titLay->setSpacing( SPACING );
599 myIconLabel = new QLabel( titFrame );
600 myIconLabel->setScaledContents( false );
601 myIconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
602 myTypeLabel = new QLabel( titFrame );
604 myTypeLabel->setText( creator->hypType() );
606 titLay->addWidget( myIconLabel, 0 );
607 titLay->addWidget( myTypeLabel, 0 );
608 titLay->addStretch( 1 );
610 topLayout->addWidget( titFrame, 0 );
612 myHelpFileName = creator->helpPage();
614 connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
617 SMESHGUI_HypothesisDlg::~SMESHGUI_HypothesisDlg()
622 void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f )
626 f->setParent( mainFrame() );
627 qobject_cast<QVBoxLayout*>( mainFrame()->layout() )->insertWidget( 1, f, 1 );
631 void SMESHGUI_HypothesisDlg::accept()
634 if ( myCreator && !myCreator->checkParams( msg ) )
636 QString str( tr( "SMESH_INCORRECT_INPUT" ) );
637 if ( !msg.isEmpty() )
639 SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
645 void SMESHGUI_HypothesisDlg::reject()
647 if ( myCreator ) myCreator->onReject();
651 void SMESHGUI_HypothesisDlg::onHelp()
653 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
655 QString name = "SMESH";
657 QVariant pluginName = myCreator->property( PLUGIN_NAME );
658 if( pluginName.isValid() ) {
659 QString rootDir = pluginName.toString() + "PLUGIN_ROOT_DIR";
660 QString varValue = QString( getenv(rootDir.toLatin1().constData()));
661 if(!varValue.isEmpty())
662 name = pluginName.toString() + "PLUGIN";
665 app->onHelpContextModule(name, myHelpFileName);
670 platform = "winapplication";
672 platform = "application";
674 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
675 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
676 arg(app->resourceMgr()->stringValue("ExternalBrowser",
678 arg(myHelpFileName));
682 void SMESHGUI_HypothesisDlg::setHIcon( const QPixmap& p )
684 myIconLabel->setPixmap( p );
687 void SMESHGUI_HypothesisDlg::setType( const QString& t )
689 myTypeLabel->setText( t );
692 HypothesisData::HypothesisData( const QString& theTypeName,
693 const QString& thePluginName,
694 const QString& theServerLibName,
695 const QString& theClientLibName,
696 const QString& theLabel,
697 const QString& theIconId,
698 const QList<int>& theDim,
700 const QStringList& theNeededHypos,
701 const QStringList& theOptionalHypos,
702 const QStringList& theInputTypes,
703 const QStringList& theOutputTypes,
704 const bool theIsNeedGeometry,
705 const bool supportSub)
706 : TypeName( theTypeName ),
707 PluginName( thePluginName ),
708 ServerLibName( theServerLibName ),
709 ClientLibName( theClientLibName ),
714 NeededHypos( theNeededHypos ),
715 OptionalHypos( theOptionalHypos ),
716 InputTypes( theInputTypes ),
717 OutputTypes( theOutputTypes ),
718 IsNeedGeometry( theIsNeedGeometry ),
719 IsSupportSubmeshes( supportSub )
723 HypothesesSet::HypothesesSet( const QString& theSetName )
724 : myHypoSetName( theSetName ),
730 HypothesesSet::HypothesesSet( const QString& theSetName,
731 const QStringList& theHypoList,
732 const QStringList& theAlgoList )
733 : myHypoSetName( theSetName ),
734 myHypoList( theHypoList ),
735 myAlgoList( theAlgoList ),
741 QStringList* HypothesesSet::list(bool is_algo) const
743 return const_cast<QStringList*>( &( is_algo ? myAlgoList : myHypoList ) );
746 QStringList* HypothesesSet::list() const
748 return list( myIsAlgo );
751 QString HypothesesSet::name() const
753 return myHypoSetName;
756 void HypothesesSet::set( bool isAlgo, const QStringList& lst )
761 int HypothesesSet::count( bool isAlgo ) const
763 return list(isAlgo)->count();
766 bool HypothesesSet::isAlgo() const
771 void HypothesesSet::init( bool isAlgo )
777 bool HypothesesSet::more() const
779 return myIndex < list()->count();
782 void HypothesesSet::next()
787 QString HypothesesSet::current() const
789 return list()->at(myIndex);
792 void HypothesesSet::setIsCustom( bool isCustom )
794 myIsCustom = isCustom;
797 bool HypothesesSet::getIsCustom() const
802 int HypothesesSet::maxDim() const
804 HypothesesSet * thisSet = (HypothesesSet*) this;
806 for ( int isAlgo = 0; isAlgo < 2; ++isAlgo )
808 thisSet->init( isAlgo );
809 while ( thisSet->next(), thisSet->more() )
810 if ( HypothesisData* hypData = SMESH::GetHypothesisData( thisSet->current() ))
811 for ( int i = 0; i < hypData->Dim.count(); ++i )
812 dim = qMax( dim, hypData->Dim[i] );