1 // Copyright (C) 2007-2014 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 <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 anAlgo.out(); // avoid unused variable warning
106 SMESH::SMESH_Hypothesis_var aHypothesis =
107 SMESH::CreateHypothesis( hypType(), theHypName, false );
108 editHypothesis( aHypothesis.in(), theHypName, theParent, obj, slot );
112 void SMESHGUI_GenericHypothesisCreator::edit( SMESH::SMESH_Hypothesis_ptr theHypothesis,
113 const QString& theHypName,
114 QWidget* theParent, QObject* obj, const QString& slot )
116 if( CORBA::is_nil( theHypothesis ) )
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 );
133 SMESHGUI_HypothesisDlg* Dlg = new SMESHGUI_HypothesisDlg( this, theParent );
134 connect( Dlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
135 connect( this, SIGNAL( finished( int ) ), obj, slot.toLatin1().constData() );
136 connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalCloseAllDialogs() ), Dlg, SLOT( reject() ));
139 QFrame* fr = buildFrame();
142 Dlg->setCustomFrame( fr );
143 Dlg->setWindowTitle( caption() );
144 Dlg->setObjectName( theHypName );
145 Dlg->setHIcon( icon() );
146 Dlg->setType( type() );
149 Dlg->resize( Dlg->minimumSizeHint() );
152 emit finished( QDialog::Accepted );
157 QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
159 if( CORBA::is_nil( hypothesis() ) )
162 ListOfStdParams params;
163 if( !stdParams( params ) || params.isEmpty() )
166 QFrame* fr = new QFrame( 0 );
167 QVBoxLayout* lay = new QVBoxLayout( fr );
169 lay->setSpacing( 0 );
171 QGroupBox* GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), fr );
172 lay->addWidget( GroupC1 );
174 QGridLayout* GroupC1Layout = new QGridLayout( GroupC1 );
175 GroupC1Layout->setSpacing( SPACING );
176 GroupC1Layout->setMargin( MARGIN );
178 ListOfStdParams::const_iterator anIt = params.begin(), aLast = params.end();
179 for( int i=0; anIt!=aLast; anIt++, i++ )
181 QLabel* lab = new QLabel( (*anIt).myName, GroupC1 );
182 GroupC1Layout->addWidget( lab, i, 0 );
183 myParamLabels << lab;
185 QWidget* w = getCustomWidget( *anIt, GroupC1, i );
187 switch( (*anIt).myValue.type() )
191 SalomeApp_IntSpinBox* sb = new SalomeApp_IntSpinBox( GroupC1 );
192 sb->setObjectName( (*anIt).myName );
193 attuneStdWidget( sb, i );
194 sb->setValue( (*anIt).myValue.toInt() );
195 connect( sb, SIGNAL( valueChanged( int ) ), this, SLOT( onValueChanged() ) );
199 case QVariant::Double:
201 SalomeApp_DoubleSpinBox* sb = new SMESHGUI_SpinBox( GroupC1 );
202 sb->setObjectName( (*anIt).myName );
203 attuneStdWidget( sb, i );
204 sb->setValue( (*anIt).myValue.toDouble() );
205 connect( sb, SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged() ) );
209 case QVariant::String:
211 if((*anIt).isVariable) {
212 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
213 QString aVar = (*anIt).myValue.toString();
214 if(aStudy->IsInteger(aVar.toLatin1().constData())){
215 SalomeApp_IntSpinBox* sb = new SalomeApp_IntSpinBox( GroupC1 );
216 sb->setObjectName( (*anIt).myName );
217 attuneStdWidget( sb, i );
219 connect( sb, SIGNAL( valueChanged( int ) ), this, SLOT( onValueChanged() ) );
222 else if(aStudy->IsReal(aVar.toLatin1().constData())){
223 SalomeApp_DoubleSpinBox* sb = new SMESHGUI_SpinBox( GroupC1 );
224 sb->setObjectName( (*anIt).myName );
225 attuneStdWidget( sb, i );
227 connect( sb, SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged() ) );
232 QLineEdit* le = new QLineEdit( GroupC1 );
233 le->setObjectName( (*anIt).myName );
234 attuneStdWidget( le, i );
235 le->setText( (*anIt).myValue.toString() );
236 connect( le, SIGNAL( textChanged( const QString& ) ), this, SLOT( onValueChanged() ) );
245 GroupC1Layout->addWidget( w, i, 1 );
246 changeWidgets().append( w );
253 void SMESHGUI_GenericHypothesisCreator::onValueChanged()
255 valueChanged( (QWidget*) sender() );
258 void SMESHGUI_GenericHypothesisCreator::valueChanged( QWidget* )
262 void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int result )
264 bool res = result==QDialog::Accepted;
267 /*QString paramValues = */storeParams();
268 // No longer needed since NoteBook appears and "Value" OB field shows names of variable
269 // if ( !paramValues.isEmpty() ) {
270 // if ( _PTR(SObject) SHyp = SMESH::FindSObject( myHypo ))
271 // SMESH::SetValue( SHyp, paramValues );
275 changeWidgets().clear();
277 if( myIsCreate && !res )
279 //remove just created hypothesis
280 _PTR(SObject) aHypSObject = SMESH::FindSObject( myHypo );
281 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
282 if( aStudy && !aStudy->GetProperties()->IsLocked() )
284 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
285 aBuilder->RemoveObjectWithChildren( aHypSObject );
288 else if( !myIsCreate && res )
290 SMESH::SObjectList listSOmesh = SMESH::GetMeshesUsingAlgoOrHypothesis( myHypo );
291 if( listSOmesh.size() > 0 )
292 for( int i = 0; i < listSOmesh.size(); i++ )
294 _PTR(SObject) submSO = listSOmesh[i];
295 SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( submSO );
296 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( submSO );
297 if( !aSubMesh->_is_nil() )
298 aMesh = aSubMesh->GetFather();
299 _PTR(SObject) meshSO = SMESH::FindSObject( aMesh );
300 SMESH::ModifiedMesh( meshSO, false, aMesh->NbNodes()==0);
303 SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
304 myHypo->UnRegister();
305 myHypo = SMESH::SMESH_Hypothesis::_nil();
306 myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
308 disconnect( myDlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
310 //delete myDlg; since WA_DeleteOnClose==true
312 emit finished( result );
315 bool SMESHGUI_GenericHypothesisCreator::stdParams( ListOfStdParams& ) const
320 bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& params ) const
324 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
325 for( ; anIt!=aLast; anIt++ )
327 item.myName = (*anIt)->objectName();
328 if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) )
330 SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
331 item.myValue = sb->value();
332 item.myText = sb->text();
333 params.append( item );
335 else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
337 SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
338 item.myValue = sb->value();
339 item.myText = sb->text();
340 params.append( item );
342 else if( (*anIt)->inherits( "QLineEdit" ) )
344 QLineEdit* line = ( QLineEdit* )( *anIt );
345 item.myValue = item.myText = line->text();
346 params.append( item );
348 else if ( getParamFromCustomWidget( item, *anIt ))
350 params.append( item );
358 QString SMESHGUI_GenericHypothesisCreator::getVariableName(const char* methodName) const
360 SMESH::SMESH_Hypothesis_var h = hypothesis();
363 CORBA::String_var aVaribaleName = h->GetVarParameter( methodName );
364 return QString( aVaribaleName.in() );
369 QStringList SMESHGUI_GenericHypothesisCreator::getVariablesFromDlg() const
372 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
373 for( ; anIt!=aLast; anIt++ ) {
374 if( (*anIt)->inherits( "QAbstractSpinBox" ) ) {
375 QAbstractSpinBox* sb = ( QAbstractSpinBox* )( *anIt );
376 aResult.append(sb->text());
382 QString SMESHGUI_GenericHypothesisCreator::stdParamValues( const ListOfStdParams& params)
384 QString valueStr = "";
385 ListOfStdParams::const_iterator param = params.begin(), aLast = params.end();
387 for( int i=0; param!=aLast; param++, i++ )
389 if ( valueStr.length() > len0 ) {
391 len0 = valueStr.length();
393 switch( (*param).myValue.type() )
396 valueStr += valueStr.number( (*param).myValue.toInt() );
398 case QVariant::Double:
399 valueStr += valueStr.number( (*param).myValue.toDouble() );
401 case QVariant::String:
402 valueStr += (*param).myValue.toString();
405 QVariant valCopy = (*param).myValue;
406 valueStr += valCopy.toString();
412 SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::hypothesis() const
417 void SMESHGUI_GenericHypothesisCreator::setShapeEntry( const QString& theEntry )
419 myShapeEntry = theEntry;
422 //================================================================================
424 * \brief Return hypothesis containing initial parameters
425 * \param strictly - if true, always return myInitParamsHypo,
426 * else, return myInitParamsHypo only in creation mode and if it
429 //================================================================================
431 SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::initParamsHypothesis(const bool strictly) const
434 return myInitParamsHypo;
435 if ( !isCreation() || CORBA::is_nil( myInitParamsHypo ))
437 return myInitParamsHypo;
440 bool SMESHGUI_GenericHypothesisCreator::hasInitParamsHypothesis() const
442 return !CORBA::is_nil( myInitParamsHypo );
445 QString SMESHGUI_GenericHypothesisCreator::hypType() const
450 QString SMESHGUI_GenericHypothesisCreator::hypName() const
455 const SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCreator::widgets() const
457 return myParamWidgets;
460 SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCreator::changeWidgets()
462 return myParamWidgets;
465 //================================================================================
467 * \brief Returns a QLabel of a spesified parameter.
468 * If isCreation(), the 1st label (supposed to be "Name") is not countered.
470 //================================================================================
472 QLabel* SMESHGUI_GenericHypothesisCreator::getLabel(int i) const
476 if ( i < myParamLabels.size() )
477 return (QLabel*) myParamLabels.at(i);
481 QtxDialog* SMESHGUI_GenericHypothesisCreator:: dlg() const
486 bool SMESHGUI_GenericHypothesisCreator::isCreation() const
491 void SMESHGUI_GenericHypothesisCreator::attuneStdWidget( QWidget*, const int ) const
495 QString SMESHGUI_GenericHypothesisCreator::caption() const
500 QPixmap SMESHGUI_GenericHypothesisCreator::icon() const
505 QString SMESHGUI_GenericHypothesisCreator::type() const
509 QWidget* SMESHGUI_GenericHypothesisCreator::getCustomWidget( const StdParam & /*param*/,
511 const int /*index*/) const
515 bool SMESHGUI_GenericHypothesisCreator::getParamFromCustomWidget( StdParam&, QWidget* ) const
520 bool SMESHGUI_GenericHypothesisCreator::checkParams( QString& msg ) const
523 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
524 for( ; anIt!=aLast; anIt++ )
526 if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) )
528 SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
529 ok = sb->isValid( msg, true ) && ok;
531 else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
533 SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
534 ok = sb->isValid( msg, true ) && ok;
540 void SMESHGUI_GenericHypothesisCreator::onReject()
544 QString SMESHGUI_GenericHypothesisCreator::helpPage() const
546 QString aHypType = hypType();
547 QString aHelpFileName = "";
548 if ( aHypType == "LocalLength" )
549 aHelpFileName = "a1d_meshing_hypo_page.html#average_length_anchor";
550 else if ( aHypType == "MaxLength" )
551 aHelpFileName = "a1d_meshing_hypo_page.html#max_length_anchor";
552 else if ( aHypType == "Arithmetic1D")
553 aHelpFileName = "a1d_meshing_hypo_page.html#arithmetic_1d_anchor";
554 else if ( aHypType == "GeometricProgression")
555 aHelpFileName = "a1d_meshing_hypo_page.html#geometric_1d_anchor";
556 else if ( aHypType == "FixedPoints1D")
557 aHelpFileName = "a1d_meshing_hypo_page.html#fixed_points_1d_anchor";
558 else if ( aHypType == "MaxElementArea")
559 aHelpFileName = "a2d_meshing_hypo_page.html#max_element_area_anchor";
560 else if ( aHypType == "MaxElementVolume")
561 aHelpFileName = "max_element_volume_hypo_page.html";
562 else if ( aHypType == "StartEndLength")
563 aHelpFileName = "a1d_meshing_hypo_page.html#start_and_end_length_anchor";
564 else if ( aHypType == "Deflection1D")
565 aHelpFileName = "a1d_meshing_hypo_page.html#deflection_1d_anchor";
566 else if ( aHypType == "Adaptive1D")
567 aHelpFileName = "a1d_meshing_hypo_page.html#adaptive_1d_anchor";
568 else if ( aHypType == "AutomaticLength")
569 aHelpFileName = "a1d_meshing_hypo_page.html#automatic_length_anchor";
570 else if ( aHypType == "NumberOfSegments")
571 aHelpFileName = "a1d_meshing_hypo_page.html#number_of_segments_anchor";
572 else if ( aHypType == "ProjectionSource1D")
573 aHelpFileName = "projection_algos_page.html";
574 else if ( aHypType == "ProjectionSource2D")
575 aHelpFileName = "projection_algos_page.html";
576 else if ( aHypType == "ProjectionSource3D")
577 aHelpFileName = "projection_algos_page.html";
578 else if ( aHypType == "NumberOfLayers")
579 aHelpFileName = "radial_prism_algo_page.html";
580 else if ( aHypType == "NumberOfLayers2D")
581 aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
582 else if ( aHypType == "LayerDistribution")
583 aHelpFileName = "radial_prism_algo_page.html";
584 else if ( aHypType == "LayerDistribution2D")
585 aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
586 else if ( aHypType == "SegmentLengthAroundVertex")
587 aHelpFileName = "segments_around_vertex_algo_page.html";
588 else if ( aHypType == "QuadrangleParams")
589 aHelpFileName = "a2d_meshing_hypo_page.html#hypo_quad_params_anchor";
590 else if ( aHypType == "ViscousLayers")
591 aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
592 else if ( aHypType == "ViscousLayers2D")
593 aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
594 else if ( aHypType == "ImportSource1D" || aHypType == "ImportSource2D")
595 aHelpFileName = "import_algos_page.html";
596 return aHelpFileName;
599 SMESHGUI_HypothesisDlg::SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator* creator, QWidget* parent )
600 : QtxDialog( parent, false, true ),
603 setAttribute(Qt::WA_DeleteOnClose, true);
604 // setMinimumSize( 300, height() );
605 // setFixedSize( 300, height() );
606 QVBoxLayout* topLayout = new QVBoxLayout( mainFrame() );
607 topLayout->setMargin( 0 );
608 topLayout->setSpacing( 0 );
610 QFrame* titFrame = new QFrame( mainFrame() );
611 QHBoxLayout* titLay = new QHBoxLayout( titFrame );
612 titLay->setMargin( 0 );
613 titLay->setSpacing( SPACING );
615 myIconLabel = new QLabel( titFrame );
616 myIconLabel->setScaledContents( false );
617 myIconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
618 myTypeLabel = new QLabel( titFrame );
620 myTypeLabel->setText( creator->hypType() );
622 titLay->addWidget( myIconLabel, 0 );
623 titLay->addWidget( myTypeLabel, 0 );
624 titLay->addStretch( 1 );
626 topLayout->addWidget( titFrame, 0 );
628 myHelpFileName = creator->helpPage();
630 connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
633 SMESHGUI_HypothesisDlg::~SMESHGUI_HypothesisDlg()
638 void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f )
642 f->setParent( mainFrame() );
643 qobject_cast<QVBoxLayout*>( mainFrame()->layout() )->insertWidget( 1, f, 1 );
647 void SMESHGUI_HypothesisDlg::accept()
650 if ( myCreator && !myCreator->checkParams( msg ) )
652 QString str( tr( "SMESH_INCORRECT_INPUT" ) );
653 if ( !msg.isEmpty() )
655 SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
661 void SMESHGUI_HypothesisDlg::reject()
663 if ( myCreator ) myCreator->onReject();
667 void SMESHGUI_HypothesisDlg::onHelp()
669 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
671 QString name = "SMESH";
673 QVariant pluginName = myCreator->property( PLUGIN_NAME );
674 if( pluginName.isValid() ) {
675 QString rootDir = pluginName.toString() + "PLUGIN_ROOT_DIR";
676 QString varValue = QString( getenv(rootDir.toLatin1().constData()));
677 if(!varValue.isEmpty())
678 name = pluginName.toString() + "PLUGIN";
681 app->onHelpContextModule(name, myHelpFileName);
686 platform = "winapplication";
688 platform = "application";
690 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
691 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
692 arg(app->resourceMgr()->stringValue("ExternalBrowser",
694 arg(myHelpFileName));
698 void SMESHGUI_HypothesisDlg::setHIcon( const QPixmap& p )
700 myIconLabel->setPixmap( p );
703 void SMESHGUI_HypothesisDlg::setType( const QString& t )
705 myTypeLabel->setText( t );
708 HypothesisData::HypothesisData( const QString& theTypeName,
709 const QString& thePluginName,
710 const QString& theServerLibName,
711 const QString& theClientLibName,
712 const QString& theLabel,
713 const QString& theIconId,
714 const QString& theContext,
715 const QList<int>& theDim,
716 const bool theIsAuxOrNeedHyp,
717 const QStringList& theBasicHypos,
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 ),
729 Context( theContext ),
731 IsAuxOrNeedHyp( theIsAuxOrNeedHyp ),
732 BasicHypos( theBasicHypos ),
733 OptionalHypos( theOptionalHypos ),
734 InputTypes( theInputTypes ),
735 OutputTypes( theOutputTypes ),
736 IsNeedGeometry( theIsNeedGeometry ),
737 IsSupportSubmeshes( supportSub )
741 HypothesesSet::HypothesesSet( const QString& theSetName )
742 : myHypoSetName( theSetName ),
748 HypothesesSet::HypothesesSet( const QString& theSetName,
749 const QStringList& theHypoList,
750 const QStringList& theAlgoList )
751 : myHypoSetName( theSetName ),
752 myHypoList( theHypoList ),
753 myAlgoList( theAlgoList ),
759 QStringList* HypothesesSet::list(bool is_algo) const
761 return const_cast<QStringList*>( &( is_algo ? myAlgoList : myHypoList ) );
764 QStringList* HypothesesSet::list() const
766 return list( myIsAlgo );
769 QString HypothesesSet::name() const
771 return myHypoSetName;
774 void HypothesesSet::set( bool isAlgo, const QStringList& lst )
779 int HypothesesSet::count( bool isAlgo ) const
781 return list(isAlgo)->count();
784 bool HypothesesSet::isAlgo() const
789 void HypothesesSet::init( bool isAlgo )
795 bool HypothesesSet::more() const
797 return myIndex < list()->count();
800 void HypothesesSet::next()
805 QString HypothesesSet::current() const
807 return list()->at(myIndex);
810 void HypothesesSet::setIsCustom( bool isCustom )
812 myIsCustom = isCustom;
815 bool HypothesesSet::getIsCustom() const
820 int HypothesesSet::maxDim() const
822 HypothesesSet * thisSet = (HypothesesSet*) this;
824 for ( int isAlgo = 0; isAlgo < 2; ++isAlgo )
826 thisSet->init( isAlgo );
827 while ( thisSet->next(), thisSet->more() )
828 if ( HypothesisData* hypData = SMESH::GetHypothesisData( thisSet->current() ))
829 for ( int i = 0; i < hypData->Dim.count(); ++i )
830 dim = qMax( dim, hypData->Dim[i] );