Version: 9.12.0
StdMeshersGUI_CartesianParamCreator.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 // File : StdMeshersGUI_CartesianParamCreator.h
24 // Author : Open CASCADE S.A.S.
25 //
26 #ifndef STDMESHERSGUI_CartesianParamCreator_H
27 #define STDMESHERSGUI_CartesianParamCreator_H
28 
29 // SMESH includes
30 #include "SMESH_StdMeshersGUI.hxx"
31 
33 
34 // IDL includes
35 #include <SALOMEconfig.h>
36 #include CORBA_SERVER_HEADER(SMESH_Mesh)
37 #include CORBA_SERVER_HEADER(SMESH_Hypothesis)
38 
39 #include <QFrame>
40 #include <QItemDelegate>
41 
42 class QAbstractItemModel;
43 class QButtonGroup;
44 class QCheckBox;
45 class QGroupBox;
46 class QLineEdit;
47 class QListWidget;
48 class QListWidgetItem;
49 class QModelIndex;
50 class QString;
51 class QStyleOptionViewItem;
52 class QTreeWidget;
53 class QTreeWidgetItem;
54 class QWidget;
56 class SMESHGUI_SpinBox;
57 
58 namespace StdMeshersGUI
59 {
60  void getFromItem(QTreeWidgetItem * item, double& t0, double& t1, QString& fun );
61  QTreeWidgetItem* setToItem (double t0, double t1, const QString& fun, QTreeWidgetItem* item=0);
62 
63  double coordFromItem( QListWidgetItem * );
64  QListWidgetItem* coordToItem( double coord, QListWidgetItem * item=0);
65 
69  class GridAxisTab : public QFrame
70  {
71  Q_OBJECT
72  public:
73  GridAxisTab( QWidget* parent, const int axisIndex );
75 
76  void setCoordinates( SMESH::double_array_var coords );
77  void setSpacing( SMESH::string_array_var funs, SMESH::double_array_var points );
78 
79  bool checkParams(QString& msg, SMESH::SMESH_Hypothesis_var& hyp) const;
80  bool isGridBySpacing() const;
82  void getSpacing(SMESH::string_array_out funs, SMESH::double_array_out points) const;
83 
84  signals:
85  void gridModeChanged(int);
86 
87  private slots:
88  void onInsert();
89  void onDelete();
90  void onMode(int);
91  void onStepChange();
92  void updateButtons();
93 
94  private:
95 
97  QButtonGroup* myModeGroup;
99  QListWidget* myCoordList;
100  QPushButton* myInsertBtn;
101  QPushButton* myDeleteBtn;
104  double myStep;
105  };
106  /*
107  * \brief : Custom item delegate
108  */
110  {
111  Q_OBJECT
112  public:
113  LineDelegate( QWidget* parent );
115 
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;
119 
120  private:
122  QListWidget* myCoordList;
123  };
124 }
125 
127 {
128  Q_OBJECT
129 
130 public:
131  StdMeshersGUI_CartesianParamCreator( const QString& aHypType );
133 
134  virtual bool checkParams( QString& ) const;
135  virtual QString helpPage() const;
136 
137 protected:
138  virtual QFrame* buildFrame();
139  virtual void retrieveParams() const;
140  virtual QString storeParams() const;
141 
142 private slots:
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);
150 
151 private:
152  QLineEdit* myName;
154  QCheckBox* myAddEdges;
155  QCheckBox* myCreateFaces;
158 
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];
168  double myOrigin[3];
169  double myAxesLen;
170  int myDirTic[3];
171 };
172 
173 #endif // STDMESHERSGUI_CartesianParamCreator_H
#define STDMESHERSGUI_EXPORT
Definition: SMESH_StdMeshersGUI.hxx:36
virtual QString helpPage() const
Definition: SMESHGUI_Hypotheses.cxx:591
Displayer of the mesh edition preview.
Definition: SMESHGUI_MeshEditPreview.h:47
Definition: SMESHGUI_SpinBox.h:48
Widget defining the grid in one direction.
Definition: StdMeshersGUI_CartesianParamCreator.h:70
QTreeWidget * mySpacingTreeWdg
Definition: StdMeshersGUI_CartesianParamCreator.h:98
void onInsert()
SLOT onInsert.
Definition: StdMeshersGUI_CartesianParamCreator.cxx:231
bool isGridBySpacing() const
Checks grid definition mode.
Definition: StdMeshersGUI_CartesianParamCreator.cxx:437
QButtonGroup * myModeGroup
Definition: StdMeshersGUI_CartesianParamCreator.h:97
SMESH::double_array * getCoordinates()
Returns coordinates to set to a hypothesis.
Definition: StdMeshersGUI_CartesianParamCreator.cxx:448
bool checkParams(QString &msg, SMESH::SMESH_Hypothesis_var &hyp) const
Verifies parameters.
Definition: StdMeshersGUI_CartesianParamCreator.cxx:489
void onDelete()
SLOT onDelete.
Definition: StdMeshersGUI_CartesianParamCreator.cxx:285
GridAxisTab(QWidget *parent, const int axisIndex)
Constructor.
Definition: StdMeshersGUI_CartesianParamCreator.cxx:151
QPushButton * myInsertBtn
Definition: StdMeshersGUI_CartesianParamCreator.h:100
void getSpacing(SMESH::string_array_out funs, SMESH::double_array_out points) const
Returns spacing to set to a hypothesis.
Definition: StdMeshersGUI_CartesianParamCreator.cxx:464
void onMode(int)
SLOT onMode.
Definition: StdMeshersGUI_CartesianParamCreator.cxx:320
double myStep
Definition: StdMeshersGUI_CartesianParamCreator.h:104
~GridAxisTab()
Definition: StdMeshersGUI_CartesianParamCreator.h:74
QPushButton * myDeleteBtn
Definition: StdMeshersGUI_CartesianParamCreator.h:101
QListWidget * myCoordList
Definition: StdMeshersGUI_CartesianParamCreator.h:99
void setSpacing(SMESH::string_array_var funs, SMESH::double_array_var points)
Sets spacing got from hypothesis.
Definition: StdMeshersGUI_CartesianParamCreator.cxx:418
int myAxisIndex
Definition: StdMeshersGUI_CartesianParamCreator.h:96
QLabel * myStepLabel
Definition: StdMeshersGUI_CartesianParamCreator.h:103
void setCoordinates(SMESH::double_array_var coords)
Inserts coordinates into myCoordList.
Definition: StdMeshersGUI_CartesianParamCreator.cxx:402
void updateButtons()
Enables/disables buttons.
Definition: StdMeshersGUI_CartesianParamCreator.cxx:372
void onStepChange()
SLOT onStepChange.
Definition: StdMeshersGUI_CartesianParamCreator.cxx:356
SMESHGUI_SpinBox * myStepSpin
Definition: StdMeshersGUI_CartesianParamCreator.h:102
Definition: StdMeshersGUI_CartesianParamCreator.h:110
QListWidget * myCoordList
Definition: StdMeshersGUI_CartesianParamCreator.h:122
QTreeWidget * mySpacingTreeWdg
Definition: StdMeshersGUI_CartesianParamCreator.h:121
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
Definition: StdMeshersGUI_CartesianParamCreator.cxx:604
QWidget * createEditor(QWidget *, const QStyleOptionViewItem &, const QModelIndex &) const
Creates an editor depending on a current item.
Definition: StdMeshersGUI_CartesianParamCreator.cxx:536
~LineDelegate()
Definition: StdMeshersGUI_CartesianParamCreator.h:114
void setEditorData(QWidget *editor, const QModelIndex &index) const
Limit value range in the spin of a neighbor range.
Definition: StdMeshersGUI_CartesianParamCreator.cxx:575
LineDelegate(QWidget *parent)
LineDelegate constructor.
Definition: StdMeshersGUI_CartesianParamCreator.cxx:523
Definition: StdMeshersGUI_CartesianParamCreator.h:127
QCheckBox * myOrthogonalChk
Definition: StdMeshersGUI_CartesianParamCreator.h:162
QButtonGroup * myAxisBtnGrp
Definition: StdMeshersGUI_CartesianParamCreator.h:163
SMESHGUI_MeshEditPreview * myAxesPreview
Definition: StdMeshersGUI_CartesianParamCreator.h:167
QLineEdit * myName
Definition: StdMeshersGUI_CartesianParamCreator.h:152
QCheckBox * myUseThresholdForInternalFaces
Definition: StdMeshersGUI_CartesianParamCreator.h:157
SMESHGUI_SpinBox * myThreshold
Definition: StdMeshersGUI_CartesianParamCreator.h:153
QCheckBox * myAddEdges
Definition: StdMeshersGUI_CartesianParamCreator.h:154
QCheckBox * myConsiderInternalFaces
Definition: StdMeshersGUI_CartesianParamCreator.h:156
QCheckBox * myCreateFaces
Definition: StdMeshersGUI_CartesianParamCreator.h:155
QGroupBox * myFixedPointGrp
Definition: StdMeshersGUI_CartesianParamCreator.h:160
double myAxesLen
Definition: StdMeshersGUI_CartesianParamCreator.h:169
Class for creation of standard hypotheses.
Definition: StdMeshersGUI_StdHypothesisCreator.h:38
virtual void retrieveParams() const
Initialise parameter values in controls.
Definition: StdMeshersGUI_StdHypothesisCreator.cxx:159
virtual QFrame * buildFrame()
Builds dlg layout.
Definition: StdMeshersGUI_StdHypothesisCreator.cxx:148
virtual QString storeParams() const
Store params from GUI controls to a hypothesis.
Definition: StdMeshersGUI_StdHypothesisCreator.cxx:506
virtual bool checkParams(QString &) const
Check parameter values before accept()
Definition: StdMeshersGUI_StdHypothesisCreator.cxx:429
sequence< double > double_array
Definition: SMESH_Mesh.idl:43
Definition: StdMeshersGUI_CartesianParamCreator.cxx:81
void getFromItem(QTreeWidgetItem *item, double &t0, double &t1, QString &fun)
get spacing definition from a tree item
Definition: StdMeshersGUI_CartesianParamCreator.cxx:90
double coordFromItem(QListWidgetItem *item)
Retrieves coordinate value from a list item.
Definition: StdMeshersGUI_CartesianParamCreator.cxx:122
QTreeWidgetItem * setToItem(double t0, double t1, const QString &fun, QTreeWidgetItem *item)
set spacing definition to a tree item
Definition: StdMeshersGUI_CartesianParamCreator.cxx:106
QListWidgetItem * coordToItem(double coord, QListWidgetItem *item)
Sets coordinate value to a list item.
Definition: StdMeshersGUI_CartesianParamCreator.cxx:133