2004-06-18 14:34:31 +06:00
|
|
|
// SMESH SMESHGUI : GUI for SMESH component
|
|
|
|
//
|
|
|
|
// Copyright (C) 2003 CEA
|
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2.1 of the License.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
//
|
2006-06-01 17:39:17 +06:00
|
|
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
2004-06-18 14:34:31 +06:00
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// File : SMESHGUI_Hypotheses.h
|
|
|
|
// Author : Julia DOROVSKIKH
|
|
|
|
// Module : SMESH
|
|
|
|
// $Header$
|
|
|
|
|
|
|
|
#ifndef SMESHGUI_Hypotheses_HeaderFile
|
|
|
|
#define SMESHGUI_Hypotheses_HeaderFile
|
|
|
|
|
2008-03-07 12:47:05 +05:00
|
|
|
#include "SMESH_SMESHGUI.hxx"
|
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
#include <SALOMEconfig.h>
|
2004-06-18 14:34:31 +06:00
|
|
|
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
|
|
|
|
|
2005-12-28 14:17:39 +05:00
|
|
|
#include <QtxDialog.h>
|
|
|
|
#include <qvariant.h>
|
|
|
|
|
|
|
|
class QVBoxLayout;
|
|
|
|
class QPixmap;
|
2004-06-18 14:34:31 +06:00
|
|
|
|
2005-08-23 14:52:20 +06:00
|
|
|
/*!
|
|
|
|
* \brief Auxiliary class for creation of hypotheses
|
|
|
|
*/
|
2008-03-07 12:47:05 +05:00
|
|
|
class SMESHGUI_EXPORT SMESHGUI_GenericHypothesisCreator : public QObject
|
2004-06-18 14:34:31 +06:00
|
|
|
{
|
2005-12-28 14:17:39 +05:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2008-03-07 12:47:05 +05:00
|
|
|
SMESHGUI_GenericHypothesisCreator( const QString& theHypType );
|
2005-12-28 14:17:39 +05:00
|
|
|
virtual ~SMESHGUI_GenericHypothesisCreator();
|
|
|
|
|
2008-03-07 12:47:05 +05:00
|
|
|
void create( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget*);
|
|
|
|
void create( bool isAlgo, const QString&, QWidget*);
|
|
|
|
void edit( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget*);
|
|
|
|
|
2005-12-28 14:17:39 +05:00
|
|
|
virtual bool checkParams() const = 0;
|
2008-03-07 12:47:05 +05:00
|
|
|
virtual void onReject();
|
2005-12-28 14:17:39 +05:00
|
|
|
|
2008-03-07 12:47:05 +05:00
|
|
|
QString hypType() const;
|
|
|
|
QString hypName() const;
|
|
|
|
bool isCreation() const;
|
2005-12-28 14:17:39 +05:00
|
|
|
|
|
|
|
protected:
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
QString myName;
|
|
|
|
QVariant myValue;
|
|
|
|
|
|
|
|
} StdParam;
|
|
|
|
|
|
|
|
typedef QValueList<StdParam> ListOfStdParams;
|
|
|
|
typedef QPtrList<QWidget> ListOfWidgets;
|
|
|
|
|
|
|
|
SMESH::SMESH_Hypothesis_var hypothesis() const;
|
2006-02-07 20:01:11 +05:00
|
|
|
SMESH::SMESH_Hypothesis_var initParamsHypothesis() const;
|
2005-12-28 14:17:39 +05:00
|
|
|
const ListOfWidgets& widgets() const;
|
|
|
|
ListOfWidgets& changeWidgets();
|
2008-03-07 12:47:05 +05:00
|
|
|
QtxDialog* dlg() const { return myDlg; }
|
2005-12-28 14:17:39 +05:00
|
|
|
|
|
|
|
virtual QFrame* buildFrame () = 0;
|
|
|
|
QFrame* buildStdFrame ();
|
|
|
|
virtual void retrieveParams() const = 0;
|
2006-02-07 20:01:11 +05:00
|
|
|
virtual QString storeParams () const = 0;
|
2005-12-28 14:17:39 +05:00
|
|
|
virtual bool stdParams ( ListOfStdParams& ) const;
|
|
|
|
bool getStdParamFromDlg( ListOfStdParams& ) const;
|
2006-02-07 20:01:11 +05:00
|
|
|
static QString stdParamValues( const ListOfStdParams& );
|
2005-12-28 14:17:39 +05:00
|
|
|
virtual void attuneStdWidget( QWidget*, const int ) const;
|
2008-03-07 12:47:05 +05:00
|
|
|
virtual QWidget* getCustomWidget( const StdParam &, QWidget*, const int ) const;
|
2006-02-07 20:01:11 +05:00
|
|
|
virtual bool getParamFromCustomWidget( StdParam& , QWidget* ) const;
|
2005-12-28 14:17:39 +05:00
|
|
|
virtual QString caption() const;
|
|
|
|
virtual QPixmap icon() const;
|
|
|
|
virtual QString type() const;
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
virtual void onValueChanged();
|
|
|
|
|
|
|
|
private:
|
2008-03-07 12:47:05 +05:00
|
|
|
bool editHypothesis( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget* );
|
2005-12-28 14:17:39 +05:00
|
|
|
|
|
|
|
private:
|
2006-02-07 20:01:11 +05:00
|
|
|
SMESH::SMESH_Hypothesis_var myHypo, myInitParamsHypo;
|
2008-03-07 12:47:05 +05:00
|
|
|
QString myHypName;
|
2005-12-28 14:17:39 +05:00
|
|
|
QString myHypType;
|
|
|
|
ListOfWidgets myParamWidgets;
|
|
|
|
bool myIsCreate;
|
2008-03-07 12:47:05 +05:00
|
|
|
QtxDialog* myDlg;
|
2005-12-28 14:17:39 +05:00
|
|
|
};
|
|
|
|
|
|
|
|
class SMESHGUI_HypothesisDlg : public QtxDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator*, QWidget* );
|
|
|
|
virtual ~SMESHGUI_HypothesisDlg();
|
|
|
|
|
2008-03-07 12:47:05 +05:00
|
|
|
void setHIcon( const QPixmap& );
|
|
|
|
void setCustomFrame( QFrame* );
|
|
|
|
void setType( const QString& );
|
2005-12-28 14:17:39 +05:00
|
|
|
|
|
|
|
protected slots:
|
|
|
|
virtual void accept();
|
2008-03-07 12:47:05 +05:00
|
|
|
virtual void reject();
|
2006-05-06 14:51:48 +06:00
|
|
|
void onHelp();
|
2005-12-28 14:17:39 +05:00
|
|
|
|
|
|
|
private:
|
|
|
|
SMESHGUI_GenericHypothesisCreator* myCreator;
|
|
|
|
QVBoxLayout* myLayout;
|
2008-03-07 12:47:05 +05:00
|
|
|
QLabel* myIconLabel;
|
|
|
|
QLabel* myTypeLabel;
|
2006-05-06 14:51:48 +06:00
|
|
|
QString myHelpFileName;
|
2004-06-18 14:34:31 +06:00
|
|
|
};
|
|
|
|
|
2005-08-23 14:52:20 +06:00
|
|
|
/*!
|
|
|
|
* \brief Class containing information about hypothesis
|
|
|
|
*/
|
2004-06-18 14:34:31 +06:00
|
|
|
class HypothesisData
|
|
|
|
{
|
|
|
|
public:
|
2006-05-06 14:51:48 +06:00
|
|
|
HypothesisData( const QString& theTypeName,
|
|
|
|
const QString& thePluginName,
|
2005-08-23 14:52:20 +06:00
|
|
|
const QString& theServerLibName,
|
|
|
|
const QString& theClientLibName,
|
|
|
|
const QString& theLabel,
|
|
|
|
const QString& theIconId,
|
|
|
|
const QValueList<int>& theDim,
|
2006-05-06 14:51:48 +06:00
|
|
|
const bool theIsAux,
|
|
|
|
const QStringList& theNeededHypos,
|
|
|
|
const QStringList& theOptionalHypos,
|
|
|
|
const QStringList& theInputTypes,
|
2008-03-07 12:47:05 +05:00
|
|
|
const QStringList& theOutputTypes,
|
|
|
|
const bool theIsNeedGeometry = true)
|
2006-05-06 14:51:48 +06:00
|
|
|
: TypeName( theTypeName ),
|
|
|
|
PluginName( thePluginName ),
|
|
|
|
ServerLibName( theServerLibName ),
|
|
|
|
ClientLibName( theClientLibName ),
|
|
|
|
Label( theLabel ),
|
|
|
|
IconId( theIconId ),
|
|
|
|
Dim( theDim ),
|
|
|
|
IsAux( theIsAux ),
|
|
|
|
NeededHypos( theNeededHypos ), OptionalHypos( theOptionalHypos ),
|
2008-03-07 12:47:05 +05:00
|
|
|
InputTypes( theInputTypes ), OutputTypes( theOutputTypes ),
|
|
|
|
IsNeedGeometry( theIsNeedGeometry )
|
2006-05-06 14:51:48 +06:00
|
|
|
{};
|
|
|
|
|
|
|
|
QString TypeName; //!< hypothesis type name
|
2005-08-23 14:52:20 +06:00
|
|
|
QString PluginName; //!< plugin name
|
|
|
|
QString ServerLibName; //!< server library name
|
|
|
|
QString ClientLibName; //!< client library name
|
|
|
|
QString Label; //!< label
|
|
|
|
QString IconId; //!< icon identifier
|
|
|
|
QValueList<int> Dim; //!< list of supported dimensions (see SMESH::Dimension enumeration)
|
|
|
|
bool IsAux; //!< TRUE if given hypothesis is auxiliary one, FALSE otherwise
|
2008-03-07 12:47:05 +05:00
|
|
|
bool IsNeedGeometry; //!< TRUE if for given hypothesis need shape, FALSE otherwise
|
2006-05-06 14:51:48 +06:00
|
|
|
|
|
|
|
// for algorithm only: dependencies algo <-> algo and algo -> hypos
|
|
|
|
QStringList NeededHypos; //!< list of obligatory hypotheses
|
|
|
|
QStringList OptionalHypos;//!< list of optional hypotheses
|
|
|
|
QStringList InputTypes; //!< list of element types required as a prerequisite
|
|
|
|
QStringList OutputTypes; //!< list of types of generated elements
|
2004-06-18 14:34:31 +06:00
|
|
|
};
|
|
|
|
|
2005-11-01 15:11:11 +05:00
|
|
|
/*!
|
|
|
|
* \brief Class containing set of hypotheses
|
|
|
|
*
|
|
|
|
* Actually it contains list of hypo types
|
|
|
|
*/
|
|
|
|
class HypothesesSet
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
HypothesesSet( const QString& theSetName )
|
|
|
|
: HypoSetName( theSetName ) {};
|
|
|
|
HypothesesSet( const QString& theSetName,
|
|
|
|
const QStringList& theHypoList,
|
|
|
|
const QStringList& theAlgoList )
|
|
|
|
: HypoSetName( theSetName ), HypoList(theHypoList), AlgoList(theAlgoList) {};
|
|
|
|
QString HypoSetName;
|
|
|
|
QStringList HypoList, AlgoList;
|
|
|
|
};
|
2004-06-18 14:34:31 +06:00
|
|
|
#endif
|