1 // Copyright (C) 2007-2016 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"
32 #include "SMESHGUI_VTKUtils.h"
33 #include "SMESH_Actor.h"
35 // SALOME KERNEL includes
36 #include <SALOMEDSClient_Study.hxx>
37 #include <utilities.h>
39 // SALOME GUI includes
40 #include <LightApp_Application.h>
41 #include <SUIT_MessageBox.h>
42 #include <SUIT_OverrideCursor.h>
43 #include <SUIT_ResourceMgr.h>
44 #include <SUIT_Session.h>
45 #include <SalomeApp_IntSpinBox.h>
46 #include <SalomeApp_Tools.h>
47 #include <SVTK_ViewWindow.h>
54 #include <QVBoxLayout>
59 SMESHGUI_GenericHypothesisCreator::SMESHGUI_GenericHypothesisCreator( const QString& theHypType )
60 : myToDeleteInitParamsHypo( false ),
61 myHypType( theHypType ),
67 SMESHGUI_GenericHypothesisCreator::~SMESHGUI_GenericHypothesisCreator()
69 if ( myToDeleteInitParamsHypo && !myInitParamsHypo->_is_nil() )
70 myInitParamsHypo->UnRegister();
73 void SMESHGUI_GenericHypothesisCreator::setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr hyp)
75 if ( !CORBA::is_nil( hyp ) ) {
76 if ( myToDeleteInitParamsHypo && !myInitParamsHypo->_is_nil() )
77 myInitParamsHypo->UnRegister();
78 CORBA::String_var hypName = hyp->GetName();
79 if ( hypType() == hypName.in() )
81 myInitParamsHypo = SMESH::SMESH_Hypothesis::_duplicate( hyp );
82 myToDeleteInitParamsHypo = !SMESH::FindSObject( myInitParamsHypo );
87 void SMESHGUI_GenericHypothesisCreator::create( SMESH::SMESH_Hypothesis_ptr initParamsHyp,
88 const QString& theHypName,
89 QWidget* parent, QObject* obj, const QString& slot )
91 setInitParamsHypothesis( initParamsHyp );
92 create( false, theHypName, parent, obj, slot );
95 void SMESHGUI_GenericHypothesisCreator::create( bool isAlgo,
96 const QString& theHypName,
103 // Create hypothesis/algorithm
105 SMESH::SMESH_Hypothesis_var anAlgo =
106 SMESH::CreateHypothesis( hypType(), theHypName, isAlgo );
107 anAlgo.out(); // avoid unused variable warning
110 SMESH::SMESH_Hypothesis_var aHypothesis =
111 SMESH::CreateHypothesis( hypType(), theHypName, false );
112 editHypothesis( aHypothesis.in(), theHypName, theParent, obj, slot );
116 void SMESHGUI_GenericHypothesisCreator::edit( SMESH::SMESH_Hypothesis_ptr theHypothesis,
117 const QString& theHypName,
118 QWidget* theParent, QObject* obj, const QString& slot )
120 if( CORBA::is_nil( theHypothesis ) )
125 editHypothesis( theHypothesis, theHypName, theParent, obj, slot );
128 void SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_ptr h,
129 const QString& theHypName,
131 QObject* obj, const QString& slot )
133 myHypName = theHypName;
134 myHypo = SMESH::SMESH_Hypothesis::_duplicate( h );
137 SMESHGUI_HypothesisDlg* Dlg = new SMESHGUI_HypothesisDlg( this, theParent );
138 connect( Dlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
139 connect( this, SIGNAL( finished( int ) ), obj, slot.toLatin1().constData() );
140 connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalCloseAllDialogs() ), Dlg, SLOT( reject() ));
143 QFrame* fr = buildFrame();
146 Dlg->setCustomFrame( fr );
147 Dlg->setWindowTitle( caption() );
148 Dlg->setObjectName( theHypName );
149 Dlg->setHIcon( icon() );
150 Dlg->setType( type() );
153 Dlg->resize( Dlg->minimumSizeHint() );
156 emit finished( QDialog::Accepted );
161 QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
163 if( CORBA::is_nil( hypothesis() ) )
166 ListOfStdParams params;
167 if( !stdParams( params ) || params.isEmpty() )
170 QFrame* fr = new QFrame( 0 );
171 QVBoxLayout* lay = new QVBoxLayout( fr );
173 lay->setSpacing( 0 );
175 QGroupBox* GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), fr );
176 lay->addWidget( GroupC1 );
178 QGridLayout* GroupC1Layout = new QGridLayout( GroupC1 );
179 GroupC1Layout->setSpacing( SPACING );
180 GroupC1Layout->setMargin( MARGIN );
182 ListOfStdParams::const_iterator anIt = params.begin(), aLast = params.end();
183 for( int i=0; anIt!=aLast; anIt++, i++ )
185 QLabel* lab = new QLabel( (*anIt).myName, GroupC1 );
186 GroupC1Layout->addWidget( lab, i, 0 );
187 myParamLabels << lab;
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() ) );
247 } // switch( (*anIt).myValue.type() )
251 GroupC1Layout->addWidget( w, i, 1 );
252 changeWidgets().append( w );
255 if ( QWidget* w = getHelperWidget() )
258 w->move( QPoint( 0, 0 ) );
265 void SMESHGUI_GenericHypothesisCreator::onValueChanged()
267 valueChanged( (QWidget*) sender() );
270 void SMESHGUI_GenericHypothesisCreator::valueChanged( QWidget* )
274 void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int result )
276 bool res = result==QDialog::Accepted;
281 SUIT_OverrideCursor wc;
283 // No longer needed since NoteBook appears and "Value" OB field shows names of variable
284 // QString paramValues = storeParams();
285 // if ( !paramValues.isEmpty() ) {
286 // if ( _PTR(SObject) SHyp = SMESH::FindSObject( myHypo ))
287 // SMESH::SetValue( SHyp, paramValues );
290 catch ( const SALOME::SALOME_Exception& S_ex ) {
291 SalomeApp_Tools::QtCatchCorbaException( S_ex );
295 changeWidgets().clear();
297 if( myIsCreate && !res )
299 //remove just created hypothesis
300 _PTR(SObject) aHypSObject = SMESH::FindSObject( myHypo );
301 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
302 if( aStudy && !aStudy->GetProperties()->IsLocked() )
304 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
305 aBuilder->RemoveObjectWithChildren( aHypSObject );
308 else if( !myIsCreate && res )
310 SMESH::SObjectList listSOmesh = SMESH::GetMeshesUsingAlgoOrHypothesis( myHypo );
311 if( listSOmesh.size() > 0 )
312 for( size_t i = 0; i < listSOmesh.size(); i++ )
314 _PTR(SObject) submSO = listSOmesh[i];
315 SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( submSO );
316 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( submSO );
317 if( !aSubMesh->_is_nil() )
318 aMesh = aSubMesh->GetFather();
319 _PTR(SObject) meshSO = SMESH::FindSObject( aMesh );
320 SMESH::ModifiedMesh( meshSO, false, aMesh->NbNodes()==0);
321 SMESH_Actor* actor = SMESH::FindActorByEntry( meshSO->GetID().c_str() );
322 if( actor && actor->GetVisibility() )
326 SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
327 myHypo->UnRegister();
328 myHypo = SMESH::SMESH_Hypothesis::_nil();
329 myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
331 disconnect( myDlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
333 //delete myDlg; since WA_DeleteOnClose==true
335 if (SVTK_ViewWindow* vf = SMESH::GetCurrentVtkView()) {
338 emit finished( result );
341 bool SMESHGUI_GenericHypothesisCreator::stdParams( ListOfStdParams& ) const
346 bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& params ) const
350 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
351 for( ; anIt!=aLast; anIt++ )
353 item.myName = (*anIt)->objectName();
354 if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) )
356 SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
357 item.myValue = sb->value();
358 item.myText = sb->text();
359 params.append( item );
361 else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
363 SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
364 item.myValue = sb->value();
365 item.myText = sb->text();
366 params.append( item );
368 else if( (*anIt)->inherits( "QLineEdit" ) )
370 QLineEdit* line = ( QLineEdit* )( *anIt );
371 item.myValue = item.myText = line->text();
372 params.append( item );
374 else if ( getParamFromCustomWidget( item, *anIt ))
376 params.append( item );
384 QString SMESHGUI_GenericHypothesisCreator::getVariableName(const char* methodName) const
386 SMESH::SMESH_Hypothesis_var h = hypothesis();
389 CORBA::String_var aVaribaleName = h->GetVarParameter( methodName );
390 return QString( aVaribaleName.in() );
395 QStringList SMESHGUI_GenericHypothesisCreator::getVariablesFromDlg() const
398 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
399 for( ; anIt!=aLast; anIt++ ) {
400 if( (*anIt)->inherits( "QAbstractSpinBox" ) ) {
401 QAbstractSpinBox* sb = ( QAbstractSpinBox* )( *anIt );
402 aResult.append(sb->text());
408 QString SMESHGUI_GenericHypothesisCreator::stdParamValues( const ListOfStdParams& params)
410 QString valueStr = "";
411 ListOfStdParams::const_iterator param = params.begin(), aLast = params.end();
413 for ( ; param != aLast; param++ )
415 if ( valueStr.length() > len0 ) {
417 len0 = valueStr.length();
419 switch( (*param).myValue.type() )
422 valueStr += valueStr.number( (*param).myValue.toInt() );
424 case QVariant::Double:
425 valueStr += valueStr.number( (*param).myValue.toDouble() );
427 case QVariant::String:
428 valueStr += (*param).myValue.toString();
431 QVariant valCopy = (*param).myValue;
432 valueStr += valCopy.toString();
438 SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::hypothesis() const
443 void SMESHGUI_GenericHypothesisCreator::setShapeEntry( const QString& theEntry )
445 myShapeEntry = theEntry;
448 //================================================================================
450 * \brief Return hypothesis containing initial parameters
451 * \param strictly - if true, always return myInitParamsHypo,
452 * else, return myInitParamsHypo only in creation mode and if it
455 //================================================================================
457 SMESH::SMESH_Hypothesis_var SMESHGUI_GenericHypothesisCreator::initParamsHypothesis(const bool strictly) const
460 return myInitParamsHypo;
461 if ( !isCreation() || CORBA::is_nil( myInitParamsHypo ))
463 return myInitParamsHypo;
466 bool SMESHGUI_GenericHypothesisCreator::hasInitParamsHypothesis() const
468 return !CORBA::is_nil( myInitParamsHypo );
471 QString SMESHGUI_GenericHypothesisCreator::hypType() const
476 QString SMESHGUI_GenericHypothesisCreator::hypName() const
481 const SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCreator::widgets() const
483 return myParamWidgets;
486 SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCreator::changeWidgets()
488 return myParamWidgets;
491 //================================================================================
493 * \brief Returns a QLabel of a spesified parameter.
494 * If isCreation(), the 1st label (supposed to be "Name") is not countered.
496 //================================================================================
498 QLabel* SMESHGUI_GenericHypothesisCreator::getLabel(int i) const
502 if ( i < myParamLabels.size() )
503 return (QLabel*) myParamLabels.at(i);
507 QtxDialog* SMESHGUI_GenericHypothesisCreator:: dlg() const
512 bool SMESHGUI_GenericHypothesisCreator::isCreation() const
517 void SMESHGUI_GenericHypothesisCreator::attuneStdWidget( QWidget*, const int ) const
521 QString SMESHGUI_GenericHypothesisCreator::caption() const
526 QPixmap SMESHGUI_GenericHypothesisCreator::icon() const
531 QString SMESHGUI_GenericHypothesisCreator::type() const
535 QWidget* SMESHGUI_GenericHypothesisCreator::getCustomWidget( const StdParam & /*param*/,
537 const int /*index*/) const
541 //================================================================================
543 * \brief Returns a widget representing not a hypothesis parameter but some helper widget
545 //================================================================================
547 QWidget* SMESHGUI_GenericHypothesisCreator::getHelperWidget() const
552 bool SMESHGUI_GenericHypothesisCreator::getParamFromCustomWidget( StdParam&, QWidget* ) const
557 bool SMESHGUI_GenericHypothesisCreator::checkParams( QString& msg ) const
560 ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
561 for( ; anIt!=aLast; anIt++ )
563 if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) )
565 SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
566 ok = sb->isValid( msg, true ) && ok;
568 else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
570 SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
571 ok = sb->isValid( msg, true ) && ok;
577 void SMESHGUI_GenericHypothesisCreator::onReject()
581 QString SMESHGUI_GenericHypothesisCreator::helpPage() const
583 QString aHypType = hypType();
584 QString aHelpFileName = "";
585 if ( aHypType == "LocalLength" )
586 aHelpFileName = "a1d_meshing_hypo_page.html#average_length_anchor";
587 else if ( aHypType == "MaxLength" )
588 aHelpFileName = "a1d_meshing_hypo_page.html#max_length_anchor";
589 else if ( aHypType == "Arithmetic1D")
590 aHelpFileName = "a1d_meshing_hypo_page.html#arithmetic_1d_anchor";
591 else if ( aHypType == "GeometricProgression")
592 aHelpFileName = "a1d_meshing_hypo_page.html#geometric_1d_anchor";
593 else if ( aHypType == "FixedPoints1D")
594 aHelpFileName = "a1d_meshing_hypo_page.html#fixed_points_1d_anchor";
595 else if ( aHypType == "MaxElementArea")
596 aHelpFileName = "a2d_meshing_hypo_page.html#max_element_area_anchor";
597 else if ( aHypType == "MaxElementVolume")
598 aHelpFileName = "max_element_volume_hypo_page.html";
599 else if ( aHypType == "StartEndLength")
600 aHelpFileName = "a1d_meshing_hypo_page.html#start_and_end_length_anchor";
601 else if ( aHypType == "Deflection1D")
602 aHelpFileName = "a1d_meshing_hypo_page.html#deflection_1d_anchor";
603 else if ( aHypType == "Adaptive1D")
604 aHelpFileName = "a1d_meshing_hypo_page.html#adaptive_1d_anchor";
605 else if ( aHypType == "AutomaticLength")
606 aHelpFileName = "a1d_meshing_hypo_page.html#automatic_length_anchor";
607 else if ( aHypType == "NumberOfSegments")
608 aHelpFileName = "a1d_meshing_hypo_page.html#number_of_segments_anchor";
609 else if ( aHypType == "ProjectionSource1D")
610 aHelpFileName = "projection_algos_page.html";
611 else if ( aHypType == "ProjectionSource2D")
612 aHelpFileName = "projection_algos_page.html";
613 else if ( aHypType == "ProjectionSource3D")
614 aHelpFileName = "projection_algos_page.html";
615 else if ( aHypType == "NumberOfLayers")
616 aHelpFileName = "radial_prism_algo_page.html";
617 else if ( aHypType == "NumberOfLayers2D")
618 aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
619 else if ( aHypType == "LayerDistribution")
620 aHelpFileName = "radial_prism_algo_page.html";
621 else if ( aHypType == "LayerDistribution2D")
622 aHelpFileName = "radial_quadrangle_1D2D_algo_page.html";
623 else if ( aHypType == "SegmentLengthAroundVertex")
624 aHelpFileName = "segments_around_vertex_algo_page.html";
625 else if ( aHypType == "QuadrangleParams")
626 aHelpFileName = "a2d_meshing_hypo_page.html#hypo_quad_params_anchor";
627 else if ( aHypType == "ViscousLayers")
628 aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
629 else if ( aHypType == "ViscousLayers2D")
630 aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
631 else if ( aHypType == "ImportSource1D" || aHypType == "ImportSource2D")
632 aHelpFileName = "import_algos_page.html";
633 return aHelpFileName;
636 SMESHGUI_HypothesisDlg::SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator* creator, QWidget* parent )
637 : QtxDialog( parent, false, true ),
640 setAttribute(Qt::WA_DeleteOnClose, true);
641 // setMinimumSize( 300, height() );
642 // setFixedSize( 300, height() );
643 QVBoxLayout* topLayout = new QVBoxLayout( mainFrame() );
644 topLayout->setMargin( 0 );
645 topLayout->setSpacing( 0 );
647 QFrame* titFrame = new QFrame( mainFrame() );
648 QHBoxLayout* titLay = new QHBoxLayout( titFrame );
649 titLay->setMargin( 0 );
650 titLay->setSpacing( SPACING );
652 myIconLabel = new QLabel( titFrame );
653 myIconLabel->setScaledContents( false );
654 myIconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
655 myTypeLabel = new QLabel( titFrame );
657 myTypeLabel->setText( creator->hypType() );
659 titLay->addWidget( myIconLabel, 0 );
660 titLay->addWidget( myTypeLabel, 0 );
661 titLay->addStretch( 1 );
663 topLayout->addWidget( titFrame, 0 );
665 myHelpFileName = creator->helpPage();
667 connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
670 SMESHGUI_HypothesisDlg::~SMESHGUI_HypothesisDlg()
675 void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f )
679 f->setParent( mainFrame() );
680 qobject_cast<QVBoxLayout*>( mainFrame()->layout() )->insertWidget( 1, f, 1 );
684 void SMESHGUI_HypothesisDlg::accept()
686 SUIT_OverrideCursor wc; // some creators temporary set params to a hyp which can be long
688 if ( myCreator && !myCreator->checkParams( msg ) )
690 QString str( tr( "SMESH_INCORRECT_INPUT" ) );
691 if ( !msg.isEmpty() )
693 SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
699 void SMESHGUI_HypothesisDlg::reject()
701 if ( myCreator ) myCreator->onReject();
705 void SMESHGUI_HypothesisDlg::onHelp()
707 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
709 QString name = "SMESH";
711 QVariant pluginName = myCreator->property( SMESH::Plugin_Name() );
712 if( pluginName.isValid() ) {
713 QString rootDir = pluginName.toString() + "PLUGIN_ROOT_DIR";
714 QString varValue = QString( getenv(rootDir.toLatin1().constData()));
715 if(!varValue.isEmpty())
716 name = pluginName.toString() + "PLUGIN";
719 app->onHelpContextModule(name, myHelpFileName);
724 platform = "winapplication";
726 platform = "application";
728 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
729 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
730 arg(app->resourceMgr()->stringValue("ExternalBrowser",
732 arg(myHelpFileName));
736 void SMESHGUI_HypothesisDlg::setHIcon( const QPixmap& p )
738 myIconLabel->setPixmap( p );
741 void SMESHGUI_HypothesisDlg::setType( const QString& t )
743 myTypeLabel->setText( t );
746 HypothesisData::HypothesisData( const QString& theTypeName,
747 const QString& thePluginName,
748 const QString& theServerLibName,
749 const QString& theClientLibName,
750 const QString& theLabel,
751 const QString& theIconId,
752 const QString& theContext,
753 const int theGroupID,
754 const int thePriority,
755 const QList<int>& theDim,
756 const bool theIsAuxOrNeedHyp,
757 const QStringList& theBasicHypos,
758 const QStringList& theOptionalHypos,
759 const QStringList& theInputTypes,
760 const QStringList& theOutputTypes,
761 const int theIsNeedGeometry,
762 const bool theSupportSub)
763 : TypeName( theTypeName ),
764 PluginName( thePluginName ),
765 ServerLibName( theServerLibName ),
766 ClientLibName( theClientLibName ),
769 Context( theContext ),
770 GroupID( theGroupID ),
771 Priority( thePriority ),
773 IsAuxOrNeedHyp( theIsAuxOrNeedHyp ),
774 IsNeedGeometry( theIsNeedGeometry ),
775 IsSupportSubmeshes( theSupportSub ),
776 BasicHypos( theBasicHypos ),
777 OptionalHypos( theOptionalHypos ),
778 InputTypes( theInputTypes ),
779 OutputTypes( theOutputTypes )
783 HypothesesSet::HypothesesSet( const QString& theSetName )
784 : myHypoSetName( theSetName ),
790 HypothesesSet::HypothesesSet( const QString& theSetName,
791 const QStringList& theHypoList,
792 const QStringList& theAlgoList )
793 : myHypoSetName( theSetName ),
794 myHypoList( theHypoList ),
795 myAlgoList( theAlgoList ),
801 QStringList* HypothesesSet::list(bool is_algo) const
803 return const_cast<QStringList*>( &( is_algo ? myAlgoList : myHypoList ) );
806 QStringList* HypothesesSet::list() const
808 return list( myIsAlgo );
811 QString HypothesesSet::name() const
813 return myHypoSetName;
816 void HypothesesSet::set( bool isAlgo, const QStringList& lst )
821 int HypothesesSet::count( bool isAlgo ) const
823 return list(isAlgo)->count();
826 bool HypothesesSet::isAlgo() const
831 void HypothesesSet::init( bool isAlgo )
837 bool HypothesesSet::more() const
839 return myIndex < list()->count();
842 void HypothesesSet::next()
847 QString HypothesesSet::current() const
849 return list()->at(myIndex);
852 void HypothesesSet::setIsCustom( bool isCustom )
854 myIsCustom = isCustom;
857 bool HypothesesSet::getIsCustom() const
862 int HypothesesSet::maxDim() const
864 HypothesesSet * thisSet = (HypothesesSet*) this;
866 for ( int isAlgo = 0; isAlgo < 2; ++isAlgo )
868 thisSet->init( isAlgo );
869 while ( thisSet->next(), thisSet->more() )
870 if ( HypothesisData* hypData = SMESH::GetHypothesisData( thisSet->current() ))
871 for ( int i = 0; i < hypData->Dim.count(); ++i )
872 dim = qMax( dim, hypData->Dim[i] );