1 // Copyright (C) 2007-2015 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, or (at your option) any later version.
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 <LightApp_Application.h>
39 #include <SUIT_MessageBox.h>
40 #include <SUIT_OverrideCursor.h>
41 #include <SUIT_ResourceMgr.h>
42 #include <SUIT_Session.h>
43 #include <SalomeApp_IntSpinBox.h>
50 #include <QVBoxLayout>
55 SMESHGUI_GenericHypothesisCreator::SMESHGUI_GenericHypothesisCreator( const QString& theHypType )
56 : myToDeleteInitParamsHypo( false ),
57 myHypType( theHypType ),
63 SMESHGUI_GenericHypothesisCreator::~SMESHGUI_GenericHypothesisCreator()
65 if ( myToDeleteInitParamsHypo && !myInitParamsHypo->_is_nil() )
66 myInitParamsHypo->UnRegister();
69 void SMESHGUI_GenericHypothesisCreator::setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr hyp)
71 if ( !CORBA::is_nil( hyp ) ) {
72 if ( myToDeleteInitParamsHypo && !myInitParamsHypo->_is_nil() )
73 myInitParamsHypo->UnRegister();
74 CORBA::String_var hypName = hyp->GetName();
75 if ( hypType() == hypName.in() )
77 myInitParamsHypo = SMESH::SMESH_Hypothesis::_duplicate( hyp );
78 myToDeleteInitParamsHypo = !SMESH::FindSObject( myInitParamsHypo );
83 void SMESHGUI_GenericHypothesisCreator::create( SMESH::SMESH_Hypothesis_ptr initParamsHyp,
84 const QString& theHypName,
85 QWidget* parent, QObject* obj, const QString& slot )
87 MESSAGE( "Creation of hypothesis with initial params" );
88 setInitParamsHypothesis( initParamsHyp );
89 create( false, theHypName, parent, obj, slot );
92 void SMESHGUI_GenericHypothesisCreator::create( bool isAlgo,
93 const QString& theHypName,
94 QWidget* theParent, QObject* obj, const QString& slot )
96 MESSAGE( "Creation of hypothesis" );
100 // Create hypothesis/algorithm
102 SMESH::SMESH_Hypothesis_var anAlgo =
103 SMESH::CreateHypothesis( hypType(), theHypName, isAlgo );
104 anAlgo.out(); // avoid unused variable warning
107 SMESH::SMESH_Hypothesis_var aHypothesis =
108 SMESH::CreateHypothesis( hypType(), theHypName, false );
109 editHypothesis( aHypothesis.in(), theHypName, theParent, obj, slot );
113 void SMESHGUI_GenericHypothesisCreator::edit( SMESH::SMESH_Hypothesis_ptr theHypothesis,
114 const QString& theHypName,
115 QWidget* theParent, QObject* obj, const QString& slot )
117 if( CORBA::is_nil( theHypothesis ) )
122 editHypothesis( theHypothesis, theHypName, theParent, obj, slot );
125 void SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_ptr h,
126 const QString& theHypName,
128 QObject* obj, const QString& slot )
130 myHypName = theHypName;
131 myHypo = SMESH::SMESH_Hypothesis::_duplicate( h );
134 SMESHGUI_HypothesisDlg* Dlg = new SMESHGUI_HypothesisDlg( this, theParent );
135 connect( Dlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
136 connect( this, SIGNAL( finished( int ) ), obj, slot.toLatin1().constData() );
137 connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalCloseAllDialogs() ), Dlg, SLOT( reject() ));
140 QFrame* fr = buildFrame();
143 Dlg->setCustomFrame( fr );
144 Dlg->setWindowTitle( caption() );
145 Dlg->setObjectName( theHypName );
146 Dlg->setHIcon( icon() );
147 Dlg->setType( type() );
150 Dlg->resize( Dlg->minimumSizeHint() );
153 emit finished( QDialog::Accepted );
158 QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
160 if( CORBA::is_nil( hypothesis() ) )
163 ListOfStdParams params;
164 if( !stdParams( params ) || params.isEmpty() )
167 QFrame* fr = new QFrame( 0 );
168 QVBoxLayout* lay = new QVBoxLayout( fr );
170 lay->setSpacing( 0 );
172 QGroupBox* GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), fr );
173 lay->addWidget( GroupC1 );
175 QGridLayout* GroupC1Layout = new QGridLayout( GroupC1 );
176 GroupC1Layout->setSpacing( SPACING );
177 GroupC1Layout->setMargin( MARGIN );
179 ListOfStdParams::const_iterator anIt = params.begin(), aLast = params.end();
180 for( int i=0; anIt!=aLast; anIt++, i++ )
182 QLabel* lab = new QLabel( (*anIt).myName, GroupC1 );
183 GroupC1Layout->addWidget( lab, i, 0 );
184 myParamLabels << lab;
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() ) );
244 } // switch( (*anIt).myValue.type() )
248 GroupC1Layout->addWidget( w, i, 1 );
249 changeWidgets().append( w );
252 if ( QWidget* w = getHelperWidget() )
255 w->move( QPoint( 0, 0 ) );
262 void SMESHGUI_GenericHypothesisCreator::onValueChanged()
264 valueChanged( (QWidget*) sender() );
267 void SMESHGUI_GenericHypothesisCreator::valueChanged( QWidget* )
271 void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int result )
273 bool res = result==QDialog::Accepted;
276 SUIT_OverrideCursor wc;
277 /*QString paramValues = */storeParams();
278 // No longer needed since NoteBook appears and "Value" OB field shows names of variable
279 // if ( !paramValues.isEmpty() ) {
280 // if ( _PTR(SObject) SHyp = SMESH::FindSObject( myHypo ))
281 // SMESH::SetValue( SHyp, paramValues );
285 changeWidgets().clear();
287 if( myIsCreate && !res )
289 //remove just created hypothesis
290 _PTR(SObject) aHypSObject = SMESH::FindSObject( myHypo );
291 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
292 if( aStudy && !aStudy->GetProperties()->IsLocked() )
294 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
295 aBuilder->RemoveObjectWithChildren( aHypSObject );
298 else if( !myIsCreate && res )
300 SMESH::SObjectList listSOmesh = SMESH::GetMeshesUsingAlgoOrHypothesis( myHypo );
301 if( listSOmesh.size() > 0 )
302 for( size_t i = 0; i < listSOmesh.size(); i++ )
304 _PTR(SObject) submSO = listSOmesh[i];
305 SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( submSO );
306 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( submSO );
307 if( !aSubMesh->_is_nil() )
308 aMesh = aSubMesh->GetFather();
309 _PTR(SObject) meshSO = SMESH::FindSObject( aMesh );
310 SMESH::ModifiedMesh( meshSO, false, aMesh->NbNodes()==0);
313 SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
314 myHypo->UnRegister();
315 myHypo = SMESH::SMESH_Hypothesis::_nil();
316 myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
318 disconnect( myDlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
320 //delete myDlg; since WA_DeleteOnClose==true
322 emit finished( result );
325 bool SMESHGUI_GenericHypothesisCreator::stdParams( ListOfStdParams& ) const
330 bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& params ) const
334 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
335 for( ; anIt!=aLast; anIt++ )
337 item.myName = (*anIt)->objectName();
338 if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) )
340 SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
341 item.myValue = sb->value();
342 item.myText = sb->text();
343 params.append( item );
345 else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
347 SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
348 item.myValue = sb->value();
349 item.myText = sb->text();
350 params.append( item );
352 else if( (*anIt)->inherits( "QLineEdit" ) )
354 QLineEdit* line = ( QLineEdit* )( *anIt );
355 item.myValue = item.myText = line->text();
356 params.append( item );
358 else if ( getParamFromCustomWidget( item, *anIt ))
360 params.append( item );
368 QString SMESHGUI_GenericHypothesisCreator::getVariableName(const char* methodName) const
370 SMESH::SMESH_Hypothesis_var h = hypothesis();
373 CORBA::String_var aVaribaleName = h->GetVarParameter( methodName );
374 return QString( aVaribaleName.in() );
379 QStringList SMESHGUI_GenericHypothesisCreator::getVariablesFromDlg() const
382 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
383 for( ; anIt!=aLast; anIt++ ) {
384 if( (*anIt)->inherits( "QAbstractSpinBox" ) ) {
385 QAbstractSpinBox* sb = ( QAbstractSpinBox* )( *anIt );
386 aResult.append(sb->text());
392 QString SMESHGUI_GenericHypothesisCreator::stdParamValues( const ListOfStdParams& params)
394 QString valueStr = "";
395 ListOfStdParams::const_iterator param = params.begin(), aLast = params.end();
397 for ( ; param != aLast; param++ )
399 if ( valueStr.length() > len0 ) {
401 len0 = valueStr.length();
403 switch( (*param).myValue.type() )
406 valueStr += valueStr.number( (*param).myValue.toInt() );
408 case QVariant::Double:
409 valueStr += valueStr.number( (*param).myValue.toDouble() );
411 case QVariant::String:
412 valueStr += (*param).myValue.toString();
415 QVariant valCopy = (*param).myValue;
416 valueStr += valCopy.toString();
422 SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::hypothesis() const
427 void SMESHGUI_GenericHypothesisCreator::setShapeEntry( const QString& theEntry )
429 myShapeEntry = theEntry;
432 //================================================================================
434 * \brief Return hypothesis containing initial parameters
435 * \param strictly - if true, always return myInitParamsHypo,
436 * else, return myInitParamsHypo only in creation mode and if it
439 //================================================================================
441 SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::initParamsHypothesis(const bool strictly) const
444 return myInitParamsHypo;
445 if ( !isCreation() || CORBA::is_nil( myInitParamsHypo ))
447 return myInitParamsHypo;
450 bool SMESHGUI_GenericHypothesisCreator::hasInitParamsHypothesis() const
452 return !CORBA::is_nil( myInitParamsHypo );
455 QString SMESHGUI_GenericHypothesisCreator::hypType() const
460 QString SMESHGUI_GenericHypothesisCreator::hypName() const
465 const SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCreator::widgets() const
467 return myParamWidgets;
470 SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCreator::changeWidgets()
472 return myParamWidgets;
475 //================================================================================
477 * \brief Returns a QLabel of a spesified parameter.
478 * If isCreation(), the 1st label (supposed to be "Name") is not countered.
480 //================================================================================
482 QLabel* SMESHGUI_GenericHypothesisCreator::getLabel(int i) const
486 if ( i < myParamLabels.size() )
487 return (QLabel*) myParamLabels.at(i);
491 QtxDialog* SMESHGUI_GenericHypothesisCreator:: dlg() const
496 bool SMESHGUI_GenericHypothesisCreator::isCreation() const
501 void SMESHGUI_GenericHypothesisCreator::attuneStdWidget( QWidget*, const int ) const
505 QString SMESHGUI_GenericHypothesisCreator::caption() const
510 QPixmap SMESHGUI_GenericHypothesisCreator::icon() const
515 QString SMESHGUI_GenericHypothesisCreator::type() const
519 QWidget* SMESHGUI_GenericHypothesisCreator::getCustomWidget( const StdParam & /*param*/,
521 const int /*index*/) const
525 //================================================================================
527 * \brief Returns a widget representing not a hypothesis parameter but some helper widget
529 //================================================================================
531 QWidget* SMESHGUI_GenericHypothesisCreator::getHelperWidget() const
536 bool SMESHGUI_GenericHypothesisCreator::getParamFromCustomWidget( StdParam&, QWidget* ) const
541 bool SMESHGUI_GenericHypothesisCreator::checkParams( QString& msg ) const
544 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
545 for( ; anIt!=aLast; anIt++ )
547 if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) )
549 SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
550 ok = sb->isValid( msg, true ) && ok;
552 else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
554 SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
555 ok = sb->isValid( msg, true ) && ok;
561 void SMESHGUI_GenericHypothesisCreator::onReject()
565 QString SMESHGUI_GenericHypothesisCreator::helpPage() const
567 QString aHypType = hypType();
568 QString aHelpFileName = "";
569 if ( aHypType == "LocalLength" )
570 aHelpFileName = "a1d_meshing_hypo_page.html#average_length_anchor";
571 else if ( aHypType == "MaxLength" )
572 aHelpFileName = "a1d_meshing_hypo_page.html#max_length_anchor";
573 else if ( aHypType == "Arithmetic1D")
574 aHelpFileName = "a1d_meshing_hypo_page.html#arithmetic_1d_anchor";
575 else if ( aHypType == "GeometricProgression")
576 aHelpFileName = "a1d_meshing_hypo_page.html#geometric_1d_anchor";
577 else if ( aHypType == "FixedPoints1D")
578 aHelpFileName = "a1d_meshing_hypo_page.html#fixed_points_1d_anchor";
579 else if ( aHypType == "MaxElementArea")
580 aHelpFileName = "a2d_meshing_hypo_page.html#max_element_area_anchor";
581 else if ( aHypType == "MaxElementVolume")
582 aHelpFileName = "max_element_volume_hypo_page.html";
583 else if ( aHypType == "StartEndLength")
584 aHelpFileName = "a1d_meshing_hypo_page.html#start_and_end_length_anchor";
585 else if ( aHypType == "Deflection1D")
586 aHelpFileName = "a1d_meshing_hypo_page.html#deflection_1d_anchor";
587 else if ( aHypType == "Adaptive1D")
588 aHelpFileName = "a1d_meshing_hypo_page.html#adaptive_1d_anchor";
589 else if ( aHypType == "AutomaticLength")
590 aHelpFileName = "a1d_meshing_hypo_page.html#automatic_length_anchor";
591 else if ( aHypType == "NumberOfSegments")
592 aHelpFileName = "a1d_meshing_hypo_page.html#number_of_segments_anchor";
593 else if ( aHypType == "ProjectionSource1D")
594 aHelpFileName = "projection_algos_page.html";
595 else if ( aHypType == "ProjectionSource2D")
596 aHelpFileName = "projection_algos_page.html";
597 else if ( aHypType == "ProjectionSource3D")
598 aHelpFileName = "projection_algos_page.html";
599 else if ( aHypType == "NumberOfLayers")
600 aHelpFileName = "radial_prism_algo_page.html";
601 else if ( aHypType == "NumberOfLayers2D")
602 aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
603 else if ( aHypType == "LayerDistribution")
604 aHelpFileName = "radial_prism_algo_page.html";
605 else if ( aHypType == "LayerDistribution2D")
606 aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
607 else if ( aHypType == "SegmentLengthAroundVertex")
608 aHelpFileName = "segments_around_vertex_algo_page.html";
609 else if ( aHypType == "QuadrangleParams")
610 aHelpFileName = "a2d_meshing_hypo_page.html#hypo_quad_params_anchor";
611 else if ( aHypType == "ViscousLayers")
612 aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
613 else if ( aHypType == "ViscousLayers2D")
614 aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
615 else if ( aHypType == "ImportSource1D" || aHypType == "ImportSource2D")
616 aHelpFileName = "import_algos_page.html";
617 return aHelpFileName;
620 SMESHGUI_HypothesisDlg::SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator* creator, QWidget* parent )
621 : QtxDialog( parent, false, true ),
624 setAttribute(Qt::WA_DeleteOnClose, true);
625 // setMinimumSize( 300, height() );
626 // setFixedSize( 300, height() );
627 QVBoxLayout* topLayout = new QVBoxLayout( mainFrame() );
628 topLayout->setMargin( 0 );
629 topLayout->setSpacing( 0 );
631 QFrame* titFrame = new QFrame( mainFrame() );
632 QHBoxLayout* titLay = new QHBoxLayout( titFrame );
633 titLay->setMargin( 0 );
634 titLay->setSpacing( SPACING );
636 myIconLabel = new QLabel( titFrame );
637 myIconLabel->setScaledContents( false );
638 myIconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
639 myTypeLabel = new QLabel( titFrame );
641 myTypeLabel->setText( creator->hypType() );
643 titLay->addWidget( myIconLabel, 0 );
644 titLay->addWidget( myTypeLabel, 0 );
645 titLay->addStretch( 1 );
647 topLayout->addWidget( titFrame, 0 );
649 myHelpFileName = creator->helpPage();
651 connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
654 SMESHGUI_HypothesisDlg::~SMESHGUI_HypothesisDlg()
659 void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f )
663 f->setParent( mainFrame() );
664 qobject_cast<QVBoxLayout*>( mainFrame()->layout() )->insertWidget( 1, f, 1 );
668 void SMESHGUI_HypothesisDlg::accept()
670 SUIT_OverrideCursor wc; // some creators temporary set params to a hyp which can be long
672 if ( myCreator && !myCreator->checkParams( msg ) )
674 QString str( tr( "SMESH_INCORRECT_INPUT" ) );
675 if ( !msg.isEmpty() )
677 SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
683 void SMESHGUI_HypothesisDlg::reject()
685 if ( myCreator ) myCreator->onReject();
689 void SMESHGUI_HypothesisDlg::onHelp()
691 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
693 QString name = "SMESH";
695 QVariant pluginName = myCreator->property( SMESH::Plugin_Name() );
696 if( pluginName.isValid() ) {
697 QString rootDir = pluginName.toString() + "PLUGIN_ROOT_DIR";
698 QString varValue = QString( getenv(rootDir.toLatin1().constData()));
699 if(!varValue.isEmpty())
700 name = pluginName.toString() + "PLUGIN";
703 app->onHelpContextModule(name, myHelpFileName);
708 platform = "winapplication";
710 platform = "application";
712 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
713 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
714 arg(app->resourceMgr()->stringValue("ExternalBrowser",
716 arg(myHelpFileName));
720 void SMESHGUI_HypothesisDlg::setHIcon( const QPixmap& p )
722 myIconLabel->setPixmap( p );
725 void SMESHGUI_HypothesisDlg::setType( const QString& t )
727 myTypeLabel->setText( t );
730 HypothesisData::HypothesisData( const QString& theTypeName,
731 const QString& thePluginName,
732 const QString& theServerLibName,
733 const QString& theClientLibName,
734 const QString& theLabel,
735 const QString& theIconId,
736 const QString& theContext,
737 const QList<int>& theDim,
738 const bool theIsAuxOrNeedHyp,
739 const QStringList& theBasicHypos,
740 const QStringList& theOptionalHypos,
741 const QStringList& theInputTypes,
742 const QStringList& theOutputTypes,
743 const bool theIsNeedGeometry,
744 const bool supportSub)
745 : TypeName( theTypeName ),
746 PluginName( thePluginName ),
747 ServerLibName( theServerLibName ),
748 ClientLibName( theClientLibName ),
751 Context( theContext ),
753 IsAuxOrNeedHyp( theIsAuxOrNeedHyp ),
754 IsNeedGeometry( theIsNeedGeometry ),
755 IsSupportSubmeshes( supportSub ),
756 BasicHypos( theBasicHypos ),
757 OptionalHypos( theOptionalHypos ),
758 InputTypes( theInputTypes ),
759 OutputTypes( theOutputTypes )
763 HypothesesSet::HypothesesSet( const QString& theSetName )
764 : myHypoSetName( theSetName ),
770 HypothesesSet::HypothesesSet( const QString& theSetName,
771 const QStringList& theHypoList,
772 const QStringList& theAlgoList )
773 : myHypoSetName( theSetName ),
774 myHypoList( theHypoList ),
775 myAlgoList( theAlgoList ),
781 QStringList* HypothesesSet::list(bool is_algo) const
783 return const_cast<QStringList*>( &( is_algo ? myAlgoList : myHypoList ) );
786 QStringList* HypothesesSet::list() const
788 return list( myIsAlgo );
791 QString HypothesesSet::name() const
793 return myHypoSetName;
796 void HypothesesSet::set( bool isAlgo, const QStringList& lst )
801 int HypothesesSet::count( bool isAlgo ) const
803 return list(isAlgo)->count();
806 bool HypothesesSet::isAlgo() const
811 void HypothesesSet::init( bool isAlgo )
817 bool HypothesesSet::more() const
819 return myIndex < list()->count();
822 void HypothesesSet::next()
827 QString HypothesesSet::current() const
829 return list()->at(myIndex);
832 void HypothesesSet::setIsCustom( bool isCustom )
834 myIsCustom = isCustom;
837 bool HypothesesSet::getIsCustom() const
842 int HypothesesSet::maxDim() const
844 HypothesesSet * thisSet = (HypothesesSet*) this;
846 for ( int isAlgo = 0; isAlgo < 2; ++isAlgo )
848 thisSet->init( isAlgo );
849 while ( thisSet->next(), thisSet->more() )
850 if ( HypothesisData* hypData = SMESH::GetHypothesisData( thisSet->current() ))
851 for ( int i = 0; i < hypData->Dim.count(); ++i )
852 dim = qMax( dim, hypData->Dim[i] );