1 // Copyright (C) 2007-2011 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
23 // SMESH SMESHGUI : GUI for SMESH component
24 // File : SMESHGUI_Hypotheses.h
25 // Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
27 #ifndef SMESHGUI_HYPOTHESES_H
28 #define SMESHGUI_HYPOTHESES_H
31 #include "SMESH_SMESHGUI.hxx"
32 #include "SMESHGUI_HypothesesUtils.h"
35 #include <QtxDialog.h>
39 #include <SALOMEconfig.h>
40 #include CORBA_SERVER_HEADER(SMESH_Hypothesis)
45 * \brief Auxiliary class for creation of hypotheses
47 class SMESHGUI_EXPORT SMESHGUI_GenericHypothesisCreator : public QObject
52 SMESHGUI_GenericHypothesisCreator( const QString& );
53 virtual ~SMESHGUI_GenericHypothesisCreator();
55 void create( SMESH::SMESH_Hypothesis_ptr,
56 const QString&, QWidget*, QObject*, const QString& );
57 void create( bool, const QString&, QWidget*, QObject*, const QString& );
58 void edit( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget*, QObject*, const QString& );
59 void setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr);
61 virtual bool checkParams( QString& ) const;
62 virtual void onReject();
63 virtual QString helpPage() const;
65 QString hypType() const;
66 QString hypName() const;
67 bool isCreation() const;
69 QString getShapeEntry() const { return myShapeEntry; }
70 void setShapeEntry( const QString& theEntry );
72 QString getMainShapeEntry() const { return myMainShapeEntry; }
73 void setMainShapeEntry( const QString& theEntry ) { myMainShapeEntry = theEntry; }
89 typedef QList<StdParam> ListOfStdParams;
90 typedef QList<QWidget*> ListOfWidgets;
92 SMESH::SMESH_Hypothesis_var hypothesis() const;
93 SMESH::SMESH_Hypothesis_var initParamsHypothesis(const bool strict=false) const;
94 bool hasInitParamsHypothesis() const;
95 const ListOfWidgets& widgets() const;
96 ListOfWidgets& changeWidgets();
97 QtxDialog* dlg() const;
99 virtual QFrame* buildFrame() = 0;
100 QFrame* buildStdFrame();
101 virtual void retrieveParams() const = 0;
102 virtual QString storeParams() const = 0;
103 virtual bool stdParams( ListOfStdParams& ) const;
104 bool getStdParamFromDlg( ListOfStdParams& ) const;
105 virtual QStringList getVariablesFromDlg() const;
106 static QString stdParamValues( const ListOfStdParams& );
107 virtual void attuneStdWidget( QWidget*, const int ) const;
108 virtual QWidget* getCustomWidget( const StdParam&,
109 QWidget*, const int ) const;
110 virtual bool getParamFromCustomWidget( StdParam&, QWidget* ) const;
111 virtual void valueChanged( QWidget* );
112 virtual QString caption() const;
113 virtual QPixmap icon() const;
114 virtual QString type() const;
117 virtual void onValueChanged();
120 virtual void onDialogFinished( int );
123 void editHypothesis( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget*, QObject* obj, const QString& );
126 SMESH::SMESH_Hypothesis_var myHypo, myInitParamsHypo;
129 ListOfWidgets myParamWidgets;
132 QString myShapeEntry;
133 QString myMainShapeEntry;
136 class SMESHGUI_HypothesisDlg : public QtxDialog
141 SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator*, QWidget* );
142 virtual ~SMESHGUI_HypothesisDlg();
144 void setHIcon( const QPixmap& );
145 void setCustomFrame( QFrame* );
146 void setType( const QString& );
149 virtual void accept();
150 virtual void reject();
154 SMESHGUI_GenericHypothesisCreator* myCreator;
155 QLabel *myIconLabel, *myTypeLabel;
156 QString myHelpFileName;
160 * \brief Class containing information about hypothesis
165 HypothesisData( const QString&, const QString&, const QString&,
166 const QString&, const QString&, const QString&,
167 const QList<int>&, const bool,
168 const QStringList&, const QStringList&,
169 const QStringList&, const QStringList&,
170 const bool=true, const bool supportSub=false );
172 QString TypeName; //!< hypothesis type name
173 QString PluginName; //!< plugin name
174 QString ServerLibName; //!< server library name
175 QString ClientLibName; //!< client library name
176 QString Label; //!< label
177 QString IconId; //!< icon identifier
178 QList<int> Dim; //!< list of supported dimensions (see SMESH::Dimension enumeration)
179 bool IsAux; //!< TRUE if given hypothesis is auxiliary one, FALSE otherwise
180 bool IsNeedGeometry; //!< TRUE if the algorithm works with shapes only, FALSE otherwise
181 bool IsSupportSubmeshes; //!< TRUE if the algo building all-dim elems supports submeshes
183 // for algorithm only: dependencies algo <-> algo and algo -> hypos
184 QStringList NeededHypos; //!< list of obligatory hypotheses
185 QStringList OptionalHypos;//!< list of optional hypotheses
186 QStringList InputTypes; //!< list of element types required as a prerequisite
187 QStringList OutputTypes; //!< list of types of generated elements
191 * \brief Class containing set of hypotheses
193 * Actually it contains list of hypo types
198 HypothesesSet( const QString& );
199 HypothesesSet( const QString&, const QStringList&, const QStringList& );
201 QString name() const;
202 void set( bool, const QStringList& );
203 int count( bool ) const;
205 void setIsCustom( bool );
206 bool getIsCustom() const;
211 //this method sets internal index to -1, thus before any data access it is necessary to call next()
216 QString current() const;
219 QStringList* list(bool) const;
220 QStringList* list() const;
223 QString myHypoSetName;
224 QStringList myHypoList, myAlgoList;
225 bool myIsAlgo, myIsCustom;
229 #endif // SMESHGUI_HYPOTHESES_H