1 // Copyright (C) 2007-2022 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
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 QAbstractItemModel;
48 class QListWidgetItem;
51 class QStyleOptionViewItem;
53 class QTreeWidgetItem;
55 class SMESHGUI_MeshEditPreview;
56 class SMESHGUI_SpinBox;
58 namespace StdMeshersGUI
60 void getFromItem(QTreeWidgetItem * item, double& t0, double& t1, QString& fun );
61 QTreeWidgetItem* setToItem (double t0, double t1, const QString& fun, QTreeWidgetItem* item=0);
63 double coordFromItem( QListWidgetItem * );
64 QListWidgetItem* coordToItem( double coord, QListWidgetItem * item=0);
67 * \brief Widget defining the grid in one direction
69 class GridAxisTab : public QFrame
73 GridAxisTab( QWidget* parent, const int axisIndex );
76 void setCoordinates( SMESH::double_array_var coords );
77 void setSpacing( SMESH::string_array_var funs, SMESH::double_array_var points );
79 bool checkParams(QString& msg, SMESH::SMESH_Hypothesis_var& hyp) const;
80 bool isGridBySpacing() const;
81 SMESH::double_array* getCoordinates();
82 void getSpacing(SMESH::string_array_out funs, SMESH::double_array_out points) const;
85 void gridModeChanged(int);
97 QButtonGroup* myModeGroup;
98 QTreeWidget* mySpacingTreeWdg;
99 QListWidget* myCoordList;
100 QPushButton* myInsertBtn;
101 QPushButton* myDeleteBtn;
102 SMESHGUI_SpinBox* myStepSpin;
107 * \brief : Custom item delegate
109 class LineDelegate : public QItemDelegate
113 LineDelegate( QWidget* parent );
116 QWidget* createEditor( QWidget*, const QStyleOptionViewItem&, const QModelIndex& ) const;
117 void setEditorData ( QWidget * editor, const QModelIndex & index ) const;
118 void setModelData( QWidget* editor, QAbstractItemModel* model, const QModelIndex& index ) const;
121 QTreeWidget* mySpacingTreeWdg;
122 QListWidget* myCoordList;
126 class STDMESHERSGUI_EXPORT StdMeshersGUI_CartesianParamCreator : public StdMeshersGUI_StdHypothesisCreator
131 StdMeshersGUI_CartesianParamCreator( const QString& aHypType );
132 virtual ~StdMeshersGUI_CartesianParamCreator();
134 virtual bool checkParams( QString& ) const;
135 virtual QString helpPage() const;
138 virtual QFrame* buildFrame();
139 virtual void retrieveParams() const;
140 virtual QString storeParams() const;
143 bool updateAxesPreview();
144 void onOrthogonalAxes(bool);
145 void onAxisDirChange(const QString&);
146 void onSelectionChange();
147 void onOptimalAxes(bool);
148 void onResetAxes(bool);
149 void onGridModeChanged(int);
153 SMESHGUI_SpinBox* myThreshold;
154 QCheckBox* myAddEdges;
155 QCheckBox* myCreateFaces;
156 QCheckBox* myConsiderInternalFaces;
157 QCheckBox* myUseThresholdForInternalFaces;
159 StdMeshersGUI::GridAxisTab* myAxisTabs[3];
160 QGroupBox* myFixedPointGrp;
161 SMESHGUI_SpinBox* myPointSpin[3];
162 QCheckBox* myOrthogonalChk;
163 QButtonGroup* myAxisBtnGrp;
164 SMESHGUI_SpinBox* myXDirSpin[3];
165 SMESHGUI_SpinBox* myYDirSpin[3];
166 SMESHGUI_SpinBox* myZDirSpin[3];
167 SMESHGUI_MeshEditPreview* myAxesPreview;
173 #endif // STDMESHERSGUI_CartesianParamCreator_H