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 // File : StdMeshersGUI_CartesianParamCreator.h
24 // Author : Open CASCADE S.A.S.
26 #ifndef STDMESHERSGUI_CartesianParamCreator_H
27 #define STDMESHERSGUI_CartesianParamCreator_H
30 #include "SMESH_StdMeshersGUI.hxx"
32 #include "StdMeshersGUI_StdHypothesisCreator.h"
35 #include <SALOMEconfig.h>
36 #include CORBA_SERVER_HEADER(SMESH_Mesh)
37 #include CORBA_SERVER_HEADER(SMESH_Hypothesis)
40 #include <QItemDelegate>
42 class SMESHGUI_SpinBox;
45 class QTreeWidgetItem;
50 class QStyleOptionViewItem;
52 class QAbstractItemModel;
53 class QListWidgetItem;
55 namespace StdMeshersGUI
57 void getFromItem(QTreeWidgetItem * item, double& t0, double& t1, QString& fun );
58 QTreeWidgetItem* setToItem (double t0, double t1, const QString& fun, QTreeWidgetItem* item=0);
60 double coordFromItem( QListWidgetItem * );
61 QListWidgetItem* coordToItem( double coord, QListWidgetItem * item=0);
64 * \brief Widget defining the grid in one direction
66 class GridAxisTab : public QFrame
70 GridAxisTab( QWidget* parent, const int axisIndex );
73 void setCoordinates( SMESH::double_array_var coords );
74 void setSpacing( SMESH::string_array_var funs, SMESH::double_array_var points );
76 bool checkParams(QString& msg, SMESH::SMESH_Hypothesis_var& hyp) const;
77 bool isGridBySpacing() const;
78 SMESH::double_array* getCoordinates();
79 void getSpacing(SMESH::string_array_out funs, SMESH::double_array_out points) const;
91 QButtonGroup* myModeGroup;
92 QTreeWidget* mySpacingTreeWdg;
93 QListWidget* myCoordList;
94 QPushButton* myInsertBtn;
95 QPushButton* myDeleteBtn;
96 SMESHGUI_SpinBox* myStepSpin;
101 * \brief : Custom item delegate
103 class LineDelegate : public QItemDelegate
107 LineDelegate( QWidget* parent );
110 QWidget* createEditor( QWidget*, const QStyleOptionViewItem&, const QModelIndex& ) const;
111 void setEditorData ( QWidget * editor, const QModelIndex & index ) const;
112 void setModelData( QWidget* editor, QAbstractItemModel* model, const QModelIndex& index ) const;
115 QTreeWidget* mySpacingTreeWdg;
116 QListWidget* myCoordList;
120 class STDMESHERSGUI_EXPORT StdMeshersGUI_CartesianParamCreator : public StdMeshersGUI_StdHypothesisCreator
125 StdMeshersGUI_CartesianParamCreator( const QString& aHypType );
126 virtual ~StdMeshersGUI_CartesianParamCreator();
128 virtual bool checkParams( QString& ) const;
129 virtual QString helpPage() const;
132 virtual QFrame* buildFrame();
133 virtual void retrieveParams() const;
134 virtual QString storeParams() const;
138 SMESHGUI_SpinBox* myThreshold;
139 StdMeshersGUI::GridAxisTab* myAxisTabs[3];
142 #endif // STDMESHERSGUI_CartesianParamCreator_H