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 );
188 myParamLabels << lab;
190 QWidget* w = getCustomWidget( *anIt, GroupC1, i );
192 switch( (*anIt).myValue.type() )
196 SalomeApp_IntSpinBox* sb = new SalomeApp_IntSpinBox( GroupC1 );
197 sb->setObjectName( (*anIt).myName );
198 attuneStdWidget( sb, i );
199 sb->setValue( (*anIt).myValue.toInt() );
200 connect( sb, SIGNAL( valueChanged( int ) ), this, SLOT( onValueChanged() ) );
204 case QVariant::Double:
206 SalomeApp_DoubleSpinBox* sb = new SMESHGUI_SpinBox( GroupC1 );
207 sb->setObjectName( (*anIt).myName );
208 attuneStdWidget( sb, i );
209 sb->setValue( (*anIt).myValue.toDouble() );
210 connect( sb, SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged() ) );
214 case QVariant::String:
216 if((*anIt).isVariable) {
217 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
218 QString aVar = (*anIt).myValue.toString();
219 if(aStudy->IsInteger(aVar.toLatin1().constData())){
220 SalomeApp_IntSpinBox* sb = new SalomeApp_IntSpinBox( GroupC1 );
221 sb->setObjectName( (*anIt).myName );
222 attuneStdWidget( sb, i );
224 connect( sb, SIGNAL( valueChanged( int ) ), this, SLOT( onValueChanged() ) );
227 else if(aStudy->IsReal(aVar.toLatin1().constData())){
228 SalomeApp_DoubleSpinBox* sb = new SMESHGUI_SpinBox( GroupC1 );
229 sb->setObjectName( (*anIt).myName );
230 attuneStdWidget( sb, i );
232 connect( sb, SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged() ) );
237 QLineEdit* le = new QLineEdit( GroupC1 );
238 le->setObjectName( (*anIt).myName );
239 attuneStdWidget( le, i );
240 le->setText( (*anIt).myValue.toString() );
241 connect( le, SIGNAL( textChanged( const QString& ) ), this, SLOT( onValueChanged() ) );
250 GroupC1Layout->addWidget( w, i, 1 );
251 changeWidgets().append( w );
258 void SMESHGUI_GenericHypothesisCreator::onValueChanged()
260 valueChanged( (QWidget*) sender() );
263 void SMESHGUI_GenericHypothesisCreator::valueChanged( QWidget* )
267 void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int result )
269 bool res = result==QDialog::Accepted;
272 /*QString paramValues = */storeParams();
273 // No longer needed since NoteBook appears and "Value" OB field shows names of variable
274 // if ( !paramValues.isEmpty() ) {
275 // if ( _PTR(SObject) SHyp = SMESH::FindSObject( myHypo ))
276 // SMESH::SetValue( SHyp, paramValues );
280 changeWidgets().clear();
282 if( myIsCreate && !res )
284 //remove just created hypothesis
285 _PTR(SObject) aHypSObject = SMESH::FindSObject( myHypo );
286 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
287 if( aStudy && !aStudy->GetProperties()->IsLocked() )
289 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
290 aBuilder->RemoveObjectWithChildren( aHypSObject );
293 else if( !myIsCreate && res )
295 SMESH::SObjectList listSOmesh = SMESH::GetMeshesUsingAlgoOrHypothesis( myHypo );
296 if( listSOmesh.size() > 0 )
297 for( int i = 0; i < listSOmesh.size(); i++ )
299 _PTR(SObject) submSO = listSOmesh[i];
300 SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( submSO );
301 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( submSO );
302 if( !aSubMesh->_is_nil() )
303 aMesh = aSubMesh->GetFather();
304 _PTR(SObject) meshSO = SMESH::FindSObject( aMesh );
305 SMESH::ModifiedMesh( meshSO, false, aMesh->NbNodes()==0);
308 SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
309 myHypo->UnRegister();
310 myHypo = SMESH::SMESH_Hypothesis::_nil();
311 myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
313 disconnect( myDlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
315 //delete myDlg; since WA_DeleteOnClose==true
317 emit finished( result );
320 bool SMESHGUI_GenericHypothesisCreator::stdParams( ListOfStdParams& ) const
325 bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& params ) const
329 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
330 for( ; anIt!=aLast; anIt++ )
332 item.myName = (*anIt)->objectName();
333 if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) )
335 SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
336 item.myValue = sb->value();
337 item.myText = sb->text();
338 params.append( item );
340 else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
342 SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
343 item.myValue = sb->value();
344 item.myText = sb->text();
345 params.append( item );
347 else if( (*anIt)->inherits( "QLineEdit" ) )
349 QLineEdit* line = ( QLineEdit* )( *anIt );
350 item.myValue = item.myText = line->text();
351 params.append( item );
353 else if ( getParamFromCustomWidget( item, *anIt ))
355 params.append( item );
363 QString SMESHGUI_GenericHypothesisCreator::getVariableName(const char* methodName) const
365 SMESH::SMESH_Hypothesis_var h = hypothesis();
368 CORBA::String_var aVaribaleName = h->GetVarParameter( methodName );
369 return QString( aVaribaleName.in() );
374 QStringList SMESHGUI_GenericHypothesisCreator::getVariablesFromDlg() const
377 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
378 for( ; anIt!=aLast; anIt++ ) {
379 if( (*anIt)->inherits( "QAbstractSpinBox" ) ) {
380 QAbstractSpinBox* sb = ( QAbstractSpinBox* )( *anIt );
381 aResult.append(sb->text());
387 QString SMESHGUI_GenericHypothesisCreator::stdParamValues( const ListOfStdParams& params)
389 QString valueStr = "";
390 ListOfStdParams::const_iterator param = params.begin(), aLast = params.end();
392 for( int i=0; param!=aLast; param++, i++ )
394 if ( valueStr.length() > len0 ) {
396 len0 = valueStr.length();
398 switch( (*param).myValue.type() )
401 valueStr += valueStr.number( (*param).myValue.toInt() );
403 case QVariant::Double:
404 valueStr += valueStr.number( (*param).myValue.toDouble() );
406 case QVariant::String:
407 valueStr += (*param).myValue.toString();
410 QVariant valCopy = (*param).myValue;
411 valueStr += valCopy.toString();
417 SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::hypothesis() const
422 void SMESHGUI_GenericHypothesisCreator::setShapeEntry( const QString& theEntry )
424 myShapeEntry = theEntry;
427 //================================================================================
429 * \brief Return hypothesis containing initial parameters
430 * \param strictly - if true, always return myInitParamsHypo,
431 * else, return myInitParamsHypo only in creation mode and if it
434 //================================================================================
436 SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::initParamsHypothesis(const bool strictly) const
439 return myInitParamsHypo;
440 if ( !isCreation() || CORBA::is_nil( myInitParamsHypo ))
442 return myInitParamsHypo;
445 bool SMESHGUI_GenericHypothesisCreator::hasInitParamsHypothesis() const
447 return !CORBA::is_nil( myInitParamsHypo );
450 QString SMESHGUI_GenericHypothesisCreator::hypType() const
455 QString SMESHGUI_GenericHypothesisCreator::hypName() const
460 const SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCreator::widgets() const
462 return myParamWidgets;
465 SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCreator::changeWidgets()
467 return myParamWidgets;
470 //================================================================================
472 * \brief Returns a QLabel of a spesified parameter.
473 * If isCreation(), the 1st label (supposed to be "Name") is not countered.
475 //================================================================================
477 QLabel* SMESHGUI_GenericHypothesisCreator::getLabel(int i) const
481 if ( i < myParamLabels.size() )
482 return (QLabel*) myParamLabels.at(i);
486 QtxDialog* SMESHGUI_GenericHypothesisCreator:: dlg() const
491 bool SMESHGUI_GenericHypothesisCreator::isCreation() const
496 void SMESHGUI_GenericHypothesisCreator::attuneStdWidget( QWidget*, const int ) const
500 QString SMESHGUI_GenericHypothesisCreator::caption() const
505 QPixmap SMESHGUI_GenericHypothesisCreator::icon() const
510 QString SMESHGUI_GenericHypothesisCreator::type() const
514 QWidget* SMESHGUI_GenericHypothesisCreator::getCustomWidget( const StdParam & /*param*/,
516 const int /*index*/) const
520 bool SMESHGUI_GenericHypothesisCreator::getParamFromCustomWidget( StdParam&, QWidget* ) const
525 bool SMESHGUI_GenericHypothesisCreator::checkParams( QString& msg ) const
528 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
529 for( ; anIt!=aLast; anIt++ )
531 if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) )
533 SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
534 ok = sb->isValid( msg, true ) && ok;
536 else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
538 SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
539 ok = sb->isValid( msg, true ) && ok;
545 void SMESHGUI_GenericHypothesisCreator::onReject()
549 QString SMESHGUI_GenericHypothesisCreator::helpPage() const
551 QString aHypType = hypType();
552 QString aHelpFileName = "";
553 if ( aHypType == "LocalLength" )
554 aHelpFileName = "a1d_meshing_hypo_page.html#average_length_anchor";
555 else if ( aHypType == "MaxLength" )
556 aHelpFileName = "a1d_meshing_hypo_page.html#max_length_anchor";
557 else if ( aHypType == "Arithmetic1D")
558 aHelpFileName = "a1d_meshing_hypo_page.html#arithmetic_1d_anchor";
559 else if ( aHypType == "FixedPoints1D")
560 aHelpFileName = "a1d_meshing_hypo_page.html#fixed_points_1d_anchor";
561 else if ( aHypType == "MaxElementArea")
562 aHelpFileName = "a2d_meshing_hypo_page.html#max_element_area_anchor";
563 else if ( aHypType == "MaxElementVolume")
564 aHelpFileName = "max_element_volume_hypo_page.html";
565 else if ( aHypType == "StartEndLength")
566 aHelpFileName = "a1d_meshing_hypo_page.html#start_and_end_length_anchor";
567 else if ( aHypType == "Deflection1D")
568 aHelpFileName = "a1d_meshing_hypo_page.html#deflection_1d_anchor";
569 else if ( aHypType == "AutomaticLength")
570 aHelpFileName = "a1d_meshing_hypo_page.html#automatic_length_anchor";
571 else if ( aHypType == "NumberOfSegments")
572 aHelpFileName = "a1d_meshing_hypo_page.html#number_of_segments_anchor";
573 else if ( aHypType == "ProjectionSource1D")
574 aHelpFileName = "projection_algos_page.html";
575 else if ( aHypType == "ProjectionSource2D")
576 aHelpFileName = "projection_algos_page.html";
577 else if ( aHypType == "ProjectionSource3D")
578 aHelpFileName = "projection_algos_page.html";
579 else if ( aHypType == "NumberOfLayers")
580 aHelpFileName = "radial_prism_algo_page.html";
581 else if ( aHypType == "NumberOfLayers2D")
582 aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
583 else if ( aHypType == "LayerDistribution")
584 aHelpFileName = "radial_prism_algo_page.html";
585 else if ( aHypType == "LayerDistribution2D")
586 aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
587 else if ( aHypType == "SegmentLengthAroundVertex")
588 aHelpFileName = "segments_around_vertex_algo_page.html";
589 else if ( aHypType == "QuadrangleParams")
590 aHelpFileName = "a2d_meshing_hypo_page.html#hypo_quad_params_anchor";
591 else if ( aHypType == "ViscousLayers")
592 aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
593 else if ( aHypType == "ViscousLayers2D")
594 aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
595 else if ( aHypType == "ImportSource1D" || aHypType == "ImportSource2D")
596 aHelpFileName = "import_algos_page.html";
597 return aHelpFileName;
600 SMESHGUI_HypothesisDlg::SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator* creator, QWidget* parent )
601 : QtxDialog( parent, false, true ),
604 setAttribute(Qt::WA_DeleteOnClose, true);
605 // setMinimumSize( 300, height() );
606 // setFixedSize( 300, height() );
607 QVBoxLayout* topLayout = new QVBoxLayout( mainFrame() );
608 topLayout->setMargin( 0 );
609 topLayout->setSpacing( 0 );
611 QFrame* titFrame = new QFrame( mainFrame() );
612 QHBoxLayout* titLay = new QHBoxLayout( titFrame );
613 titLay->setMargin( 0 );
614 titLay->setSpacing( SPACING );
616 myIconLabel = new QLabel( titFrame );
617 myIconLabel->setScaledContents( false );
618 myIconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
619 myTypeLabel = new QLabel( titFrame );
621 myTypeLabel->setText( creator->hypType() );
623 titLay->addWidget( myIconLabel, 0 );
624 titLay->addWidget( myTypeLabel, 0 );
625 titLay->addStretch( 1 );
627 topLayout->addWidget( titFrame, 0 );
629 myHelpFileName = creator->helpPage();
631 connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
634 SMESHGUI_HypothesisDlg::~SMESHGUI_HypothesisDlg()
639 void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f )
643 f->setParent( mainFrame() );
644 qobject_cast<QVBoxLayout*>( mainFrame()->layout() )->insertWidget( 1, f, 1 );
648 void SMESHGUI_HypothesisDlg::accept()
651 if ( myCreator && !myCreator->checkParams( msg ) )
653 QString str( tr( "SMESH_INCORRECT_INPUT" ) );
654 if ( !msg.isEmpty() )
656 SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
662 void SMESHGUI_HypothesisDlg::reject()
664 if ( myCreator ) myCreator->onReject();
668 void SMESHGUI_HypothesisDlg::onHelp()
670 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
672 QString name = "SMESH";
674 QVariant pluginName = myCreator->property( PLUGIN_NAME );
675 if( pluginName.isValid() ) {
676 QString rootDir = pluginName.toString() + "PLUGIN_ROOT_DIR";
677 QString varValue = QString( getenv(rootDir.toLatin1().constData()));
678 if(!varValue.isEmpty())
679 name = pluginName.toString() + "PLUGIN";
682 app->onHelpContextModule(name, myHelpFileName);
687 platform = "winapplication";
689 platform = "application";
691 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
692 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
693 arg(app->resourceMgr()->stringValue("ExternalBrowser",
695 arg(myHelpFileName));
699 void SMESHGUI_HypothesisDlg::setHIcon( const QPixmap& p )
701 myIconLabel->setPixmap( p );
704 void SMESHGUI_HypothesisDlg::setType( const QString& t )
706 myTypeLabel->setText( t );
709 HypothesisData::HypothesisData( const QString& theTypeName,
710 const QString& thePluginName,
711 const QString& theServerLibName,
712 const QString& theClientLibName,
713 const QString& theLabel,
714 const QString& theIconId,
715 const QList<int>& theDim,
717 const QStringList& theNeededHypos,
718 const QStringList& theOptionalHypos,
719 const QStringList& theInputTypes,
720 const QStringList& theOutputTypes,
721 const bool theIsNeedGeometry,
722 const bool supportSub)
723 : TypeName( theTypeName ),
724 PluginName( thePluginName ),
725 ServerLibName( theServerLibName ),
726 ClientLibName( theClientLibName ),
731 NeededHypos( theNeededHypos ),
732 OptionalHypos( theOptionalHypos ),
733 InputTypes( theInputTypes ),
734 OutputTypes( theOutputTypes ),
735 IsNeedGeometry( theIsNeedGeometry ),
736 IsSupportSubmeshes( supportSub )
740 HypothesesSet::HypothesesSet( const QString& theSetName )
741 : myHypoSetName( theSetName ),
747 HypothesesSet::HypothesesSet( const QString& theSetName,
748 const QStringList& theHypoList,
749 const QStringList& theAlgoList )
750 : myHypoSetName( theSetName ),
751 myHypoList( theHypoList ),
752 myAlgoList( theAlgoList ),
758 QStringList* HypothesesSet::list(bool is_algo) const
760 return const_cast<QStringList*>( &( is_algo ? myAlgoList : myHypoList ) );
763 QStringList* HypothesesSet::list() const
765 return list( myIsAlgo );
768 QString HypothesesSet::name() const
770 return myHypoSetName;
773 void HypothesesSet::set( bool isAlgo, const QStringList& lst )
778 int HypothesesSet::count( bool isAlgo ) const
780 return list(isAlgo)->count();
783 bool HypothesesSet::isAlgo() const
788 void HypothesesSet::init( bool isAlgo )
794 bool HypothesesSet::more() const
796 return myIndex < list()->count();
799 void HypothesesSet::next()
804 QString HypothesesSet::current() const
806 return list()->at(myIndex);
809 void HypothesesSet::setIsCustom( bool isCustom )
811 myIsCustom = isCustom;
814 bool HypothesesSet::getIsCustom() const
819 int HypothesesSet::maxDim() const
821 HypothesesSet * thisSet = (HypothesesSet*) this;
823 for ( int isAlgo = 0; isAlgo < 2; ++isAlgo )
825 thisSet->init( isAlgo );
826 while ( thisSet->next(), thisSet->more() )
827 if ( HypothesisData* hypData = SMESH::GetHypothesisData( thisSet->current() ))
828 for ( int i = 0; i < hypData->Dim.count(); ++i )
829 dim = qMax( dim, hypData->Dim[i] );