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() ) );
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 SUIT_OverrideCursor wc;
269 /*QString paramValues = */storeParams();
270 // No longer needed since NoteBook appears and "Value" OB field shows names of variable
271 // if ( !paramValues.isEmpty() ) {
272 // if ( _PTR(SObject) SHyp = SMESH::FindSObject( myHypo ))
273 // SMESH::SetValue( SHyp, paramValues );
277 changeWidgets().clear();
279 if( myIsCreate && !res )
281 //remove just created hypothesis
282 _PTR(SObject) aHypSObject = SMESH::FindSObject( myHypo );
283 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
284 if( aStudy && !aStudy->GetProperties()->IsLocked() )
286 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
287 aBuilder->RemoveObjectWithChildren( aHypSObject );
290 else if( !myIsCreate && res )
292 SMESH::SObjectList listSOmesh = SMESH::GetMeshesUsingAlgoOrHypothesis( myHypo );
293 if( listSOmesh.size() > 0 )
294 for( int i = 0; i < listSOmesh.size(); i++ )
296 _PTR(SObject) submSO = listSOmesh[i];
297 SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( submSO );
298 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( submSO );
299 if( !aSubMesh->_is_nil() )
300 aMesh = aSubMesh->GetFather();
301 _PTR(SObject) meshSO = SMESH::FindSObject( aMesh );
302 SMESH::ModifiedMesh( meshSO, false, aMesh->NbNodes()==0);
305 SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
306 myHypo->UnRegister();
307 myHypo = SMESH::SMESH_Hypothesis::_nil();
308 myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
310 disconnect( myDlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
312 //delete myDlg; since WA_DeleteOnClose==true
314 emit finished( result );
317 bool SMESHGUI_GenericHypothesisCreator::stdParams( ListOfStdParams& ) const
322 bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& params ) const
326 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
327 for( ; anIt!=aLast; anIt++ )
329 item.myName = (*anIt)->objectName();
330 if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) )
332 SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
333 item.myValue = sb->value();
334 item.myText = sb->text();
335 params.append( item );
337 else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
339 SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
340 item.myValue = sb->value();
341 item.myText = sb->text();
342 params.append( item );
344 else if( (*anIt)->inherits( "QLineEdit" ) )
346 QLineEdit* line = ( QLineEdit* )( *anIt );
347 item.myValue = item.myText = line->text();
348 params.append( item );
350 else if ( getParamFromCustomWidget( item, *anIt ))
352 params.append( item );
360 QString SMESHGUI_GenericHypothesisCreator::getVariableName(const char* methodName) const
362 SMESH::SMESH_Hypothesis_var h = hypothesis();
365 CORBA::String_var aVaribaleName = h->GetVarParameter( methodName );
366 return QString( aVaribaleName.in() );
371 QStringList SMESHGUI_GenericHypothesisCreator::getVariablesFromDlg() const
374 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
375 for( ; anIt!=aLast; anIt++ ) {
376 if( (*anIt)->inherits( "QAbstractSpinBox" ) ) {
377 QAbstractSpinBox* sb = ( QAbstractSpinBox* )( *anIt );
378 aResult.append(sb->text());
384 QString SMESHGUI_GenericHypothesisCreator::stdParamValues( const ListOfStdParams& params)
386 QString valueStr = "";
387 ListOfStdParams::const_iterator param = params.begin(), aLast = params.end();
389 for( int i=0; param!=aLast; param++, i++ )
391 if ( valueStr.length() > len0 ) {
393 len0 = valueStr.length();
395 switch( (*param).myValue.type() )
398 valueStr += valueStr.number( (*param).myValue.toInt() );
400 case QVariant::Double:
401 valueStr += valueStr.number( (*param).myValue.toDouble() );
403 case QVariant::String:
404 valueStr += (*param).myValue.toString();
407 QVariant valCopy = (*param).myValue;
408 valueStr += valCopy.toString();
414 SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::hypothesis() const
419 void SMESHGUI_GenericHypothesisCreator::setShapeEntry( const QString& theEntry )
421 myShapeEntry = theEntry;
424 //================================================================================
426 * \brief Return hypothesis containing initial parameters
427 * \param strictly - if true, always return myInitParamsHypo,
428 * else, return myInitParamsHypo only in creation mode and if it
431 //================================================================================
433 SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::initParamsHypothesis(const bool strictly) const
436 return myInitParamsHypo;
437 if ( !isCreation() || CORBA::is_nil( myInitParamsHypo ))
439 return myInitParamsHypo;
442 bool SMESHGUI_GenericHypothesisCreator::hasInitParamsHypothesis() const
444 return !CORBA::is_nil( myInitParamsHypo );
447 QString SMESHGUI_GenericHypothesisCreator::hypType() const
452 QString SMESHGUI_GenericHypothesisCreator::hypName() const
457 const SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCreator::widgets() const
459 return myParamWidgets;
462 SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCreator::changeWidgets()
464 return myParamWidgets;
467 //================================================================================
469 * \brief Returns a QLabel of a spesified parameter.
470 * If isCreation(), the 1st label (supposed to be "Name") is not countered.
472 //================================================================================
474 QLabel* SMESHGUI_GenericHypothesisCreator::getLabel(int i) const
478 if ( i < myParamLabels.size() )
479 return (QLabel*) myParamLabels.at(i);
483 QtxDialog* SMESHGUI_GenericHypothesisCreator:: dlg() const
488 bool SMESHGUI_GenericHypothesisCreator::isCreation() const
493 void SMESHGUI_GenericHypothesisCreator::attuneStdWidget( QWidget*, const int ) const
497 QString SMESHGUI_GenericHypothesisCreator::caption() const
502 QPixmap SMESHGUI_GenericHypothesisCreator::icon() const
507 QString SMESHGUI_GenericHypothesisCreator::type() const
511 QWidget* SMESHGUI_GenericHypothesisCreator::getCustomWidget( const StdParam & /*param*/,
513 const int /*index*/) const
517 bool SMESHGUI_GenericHypothesisCreator::getParamFromCustomWidget( StdParam&, QWidget* ) const
522 bool SMESHGUI_GenericHypothesisCreator::checkParams( QString& msg ) const
525 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
526 for( ; anIt!=aLast; anIt++ )
528 if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) )
530 SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
531 ok = sb->isValid( msg, true ) && ok;
533 else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
535 SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
536 ok = sb->isValid( msg, true ) && ok;
542 void SMESHGUI_GenericHypothesisCreator::onReject()
546 QString SMESHGUI_GenericHypothesisCreator::helpPage() const
548 QString aHypType = hypType();
549 QString aHelpFileName = "";
550 if ( aHypType == "LocalLength" )
551 aHelpFileName = "a1d_meshing_hypo_page.html#average_length_anchor";
552 else if ( aHypType == "MaxLength" )
553 aHelpFileName = "a1d_meshing_hypo_page.html#max_length_anchor";
554 else if ( aHypType == "Arithmetic1D")
555 aHelpFileName = "a1d_meshing_hypo_page.html#arithmetic_1d_anchor";
556 else if ( aHypType == "GeometricProgression")
557 aHelpFileName = "a1d_meshing_hypo_page.html#geometric_1d_anchor";
558 else if ( aHypType == "FixedPoints1D")
559 aHelpFileName = "a1d_meshing_hypo_page.html#fixed_points_1d_anchor";
560 else if ( aHypType == "MaxElementArea")
561 aHelpFileName = "a2d_meshing_hypo_page.html#max_element_area_anchor";
562 else if ( aHypType == "MaxElementVolume")
563 aHelpFileName = "max_element_volume_hypo_page.html";
564 else if ( aHypType == "StartEndLength")
565 aHelpFileName = "a1d_meshing_hypo_page.html#start_and_end_length_anchor";
566 else if ( aHypType == "Deflection1D")
567 aHelpFileName = "a1d_meshing_hypo_page.html#deflection_1d_anchor";
568 else if ( aHypType == "Adaptive1D")
569 aHelpFileName = "a1d_meshing_hypo_page.html#adaptive_1d_anchor";
570 else if ( aHypType == "AutomaticLength")
571 aHelpFileName = "a1d_meshing_hypo_page.html#automatic_length_anchor";
572 else if ( aHypType == "NumberOfSegments")
573 aHelpFileName = "a1d_meshing_hypo_page.html#number_of_segments_anchor";
574 else if ( aHypType == "ProjectionSource1D")
575 aHelpFileName = "projection_algos_page.html";
576 else if ( aHypType == "ProjectionSource2D")
577 aHelpFileName = "projection_algos_page.html";
578 else if ( aHypType == "ProjectionSource3D")
579 aHelpFileName = "projection_algos_page.html";
580 else if ( aHypType == "NumberOfLayers")
581 aHelpFileName = "radial_prism_algo_page.html";
582 else if ( aHypType == "NumberOfLayers2D")
583 aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
584 else if ( aHypType == "LayerDistribution")
585 aHelpFileName = "radial_prism_algo_page.html";
586 else if ( aHypType == "LayerDistribution2D")
587 aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
588 else if ( aHypType == "SegmentLengthAroundVertex")
589 aHelpFileName = "segments_around_vertex_algo_page.html";
590 else if ( aHypType == "QuadrangleParams")
591 aHelpFileName = "a2d_meshing_hypo_page.html#hypo_quad_params_anchor";
592 else if ( aHypType == "ViscousLayers")
593 aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
594 else if ( aHypType == "ViscousLayers2D")
595 aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
596 else if ( aHypType == "ImportSource1D" || aHypType == "ImportSource2D")
597 aHelpFileName = "import_algos_page.html";
598 return aHelpFileName;
601 SMESHGUI_HypothesisDlg::SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator* creator, QWidget* parent )
602 : QtxDialog( parent, false, true ),
605 setAttribute(Qt::WA_DeleteOnClose, true);
606 // setMinimumSize( 300, height() );
607 // setFixedSize( 300, height() );
608 QVBoxLayout* topLayout = new QVBoxLayout( mainFrame() );
609 topLayout->setMargin( 0 );
610 topLayout->setSpacing( 0 );
612 QFrame* titFrame = new QFrame( mainFrame() );
613 QHBoxLayout* titLay = new QHBoxLayout( titFrame );
614 titLay->setMargin( 0 );
615 titLay->setSpacing( SPACING );
617 myIconLabel = new QLabel( titFrame );
618 myIconLabel->setScaledContents( false );
619 myIconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
620 myTypeLabel = new QLabel( titFrame );
622 myTypeLabel->setText( creator->hypType() );
624 titLay->addWidget( myIconLabel, 0 );
625 titLay->addWidget( myTypeLabel, 0 );
626 titLay->addStretch( 1 );
628 topLayout->addWidget( titFrame, 0 );
630 myHelpFileName = creator->helpPage();
632 connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
635 SMESHGUI_HypothesisDlg::~SMESHGUI_HypothesisDlg()
640 void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f )
644 f->setParent( mainFrame() );
645 qobject_cast<QVBoxLayout*>( mainFrame()->layout() )->insertWidget( 1, f, 1 );
649 void SMESHGUI_HypothesisDlg::accept()
652 if ( myCreator && !myCreator->checkParams( msg ) )
654 QString str( tr( "SMESH_INCORRECT_INPUT" ) );
655 if ( !msg.isEmpty() )
657 SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
663 void SMESHGUI_HypothesisDlg::reject()
665 if ( myCreator ) myCreator->onReject();
669 void SMESHGUI_HypothesisDlg::onHelp()
671 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
673 QString name = "SMESH";
675 QVariant pluginName = myCreator->property( SMESH::Plugin_Name() );
676 if( pluginName.isValid() ) {
677 QString rootDir = pluginName.toString() + "PLUGIN_ROOT_DIR";
678 QString varValue = QString( getenv(rootDir.toLatin1().constData()));
679 if(!varValue.isEmpty())
680 name = pluginName.toString() + "PLUGIN";
683 app->onHelpContextModule(name, myHelpFileName);
688 platform = "winapplication";
690 platform = "application";
692 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
693 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
694 arg(app->resourceMgr()->stringValue("ExternalBrowser",
696 arg(myHelpFileName));
700 void SMESHGUI_HypothesisDlg::setHIcon( const QPixmap& p )
702 myIconLabel->setPixmap( p );
705 void SMESHGUI_HypothesisDlg::setType( const QString& t )
707 myTypeLabel->setText( t );
710 HypothesisData::HypothesisData( const QString& theTypeName,
711 const QString& thePluginName,
712 const QString& theServerLibName,
713 const QString& theClientLibName,
714 const QString& theLabel,
715 const QString& theIconId,
716 const QString& theContext,
717 const QList<int>& theDim,
718 const bool theIsAuxOrNeedHyp,
719 const QStringList& theBasicHypos,
720 const QStringList& theOptionalHypos,
721 const QStringList& theInputTypes,
722 const QStringList& theOutputTypes,
723 const bool theIsNeedGeometry,
724 const bool supportSub)
725 : TypeName( theTypeName ),
726 PluginName( thePluginName ),
727 ServerLibName( theServerLibName ),
728 ClientLibName( theClientLibName ),
731 Context( theContext ),
733 IsAuxOrNeedHyp( theIsAuxOrNeedHyp ),
734 BasicHypos( theBasicHypos ),
735 OptionalHypos( theOptionalHypos ),
736 InputTypes( theInputTypes ),
737 OutputTypes( theOutputTypes ),
738 IsNeedGeometry( theIsNeedGeometry ),
739 IsSupportSubmeshes( supportSub )
743 HypothesesSet::HypothesesSet( const QString& theSetName )
744 : myHypoSetName( theSetName ),
750 HypothesesSet::HypothesesSet( const QString& theSetName,
751 const QStringList& theHypoList,
752 const QStringList& theAlgoList )
753 : myHypoSetName( theSetName ),
754 myHypoList( theHypoList ),
755 myAlgoList( theAlgoList ),
761 QStringList* HypothesesSet::list(bool is_algo) const
763 return const_cast<QStringList*>( &( is_algo ? myAlgoList : myHypoList ) );
766 QStringList* HypothesesSet::list() const
768 return list( myIsAlgo );
771 QString HypothesesSet::name() const
773 return myHypoSetName;
776 void HypothesesSet::set( bool isAlgo, const QStringList& lst )
781 int HypothesesSet::count( bool isAlgo ) const
783 return list(isAlgo)->count();
786 bool HypothesesSet::isAlgo() const
791 void HypothesesSet::init( bool isAlgo )
797 bool HypothesesSet::more() const
799 return myIndex < list()->count();
802 void HypothesesSet::next()
807 QString HypothesesSet::current() const
809 return list()->at(myIndex);
812 void HypothesesSet::setIsCustom( bool isCustom )
814 myIsCustom = isCustom;
817 bool HypothesesSet::getIsCustom() const
822 int HypothesesSet::maxDim() const
824 HypothesesSet * thisSet = (HypothesesSet*) this;
826 for ( int isAlgo = 0; isAlgo < 2; ++isAlgo )
828 thisSet->init( isAlgo );
829 while ( thisSet->next(), thisSet->more() )
830 if ( HypothesisData* hypData = SMESH::GetHypothesisData( thisSet->current() ))
831 for ( int i = 0; i < hypData->Dim.count(); ++i )
832 dim = qMax( dim, hypData->Dim[i] );