Salome HOME
Update in accordance with changes in QtxComboBox.
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_Measurements.h
1 // Copyright (C) 2007-2016  CEA/DEN, EDF R&D, 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 //  File   : SMESHGUI_Measurements.h
23 //  Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
24
25 #ifndef SMESHGUI_MEASUREMENTS_H
26 #define SMESHGUI_MEASUREMENTS_H
27
28 #include "SMESH_SMESHGUI.hxx"
29
30 #include <QDialog>
31
32 class QButtonGroup;
33 class QLineEdit;
34 class QTabWidget;
35 class QGroupBox;
36 class SUIT_SelectionFilter;
37 class SALOME_Actor;
38 class SMESH_Actor;
39 class SMESHGUI_IdValidator;
40
41 #include <SALOMEconfig.h>
42 #include CORBA_SERVER_HEADER(SMESH_Mesh)
43
44 class SMESHGUI_EXPORT SMESHGUI_MinDistance : public QWidget
45 {
46   Q_OBJECT;
47
48   enum { NoTgt, FirstTgt, SecondTgt };
49   enum { OriginTgt, NodeTgt, ElementTgt, ObjectTgt };
50
51 public:
52   SMESHGUI_MinDistance( QWidget* = 0 );
53   ~SMESHGUI_MinDistance();
54
55   bool eventFilter( QObject*, QEvent* );
56   void updateSelection();
57   void deactivate();
58
59 private: 
60   void setTarget( int );
61   void erasePreview();
62   void displayPreview();
63   void createPreview( double, double, double, double, double, double );
64
65 private slots:
66   void selectionChanged();
67   void firstChanged();
68   void secondChanged();
69   void firstEdited();
70   void secondEdited();
71   void compute();
72   void clear();
73
74 private:
75   QButtonGroup*             myFirst;
76   QButtonGroup*             mySecond;
77   QLineEdit*                myFirstTgt;
78   QLineEdit*                mySecondTgt;
79   QLineEdit*                myDX;
80   QLineEdit*                myDY;
81   QLineEdit*                myDZ;
82   QLineEdit*                myDistance;
83   int                       myCurrentTgt;
84   SMESH::SMESH_IDSource_var myFirstSrc;
85   SMESH::SMESH_IDSource_var mySecondSrc;
86   SMESH_Actor*              myFirstActor;
87   SMESH_Actor*              mySecondActor;
88   SMESHGUI_IdValidator*     myValidator;
89   SUIT_SelectionFilter*     myFilter;
90   SALOME_Actor*             myPreview;
91 };
92
93 class SMESHGUI_EXPORT SMESHGUI_BoundingBox : public QWidget
94 {
95   Q_OBJECT;
96
97   enum { ObjectsSrc, NodesSrc, ElementsSrc };
98   
99 public:
100   SMESHGUI_BoundingBox( QWidget* = 0 );
101   ~SMESHGUI_BoundingBox();
102
103   void updateSelection();
104   void deactivate();
105   void erasePreview();
106
107 private:
108   void displayPreview();
109   void createPreview( double, double, double, double, double, double );
110
111 private slots:
112   void selectionChanged();
113   void sourceChanged();
114   void sourceEdited();
115   void compute();
116   void clear();
117
118 private:
119   typedef QList<SMESH::SMESH_IDSource_var> SourceList;
120   QButtonGroup*             mySourceMode;
121   QLineEdit*                mySource;
122   QLineEdit*                myXmin;
123   QLineEdit*                myXmax;
124   QLineEdit*                myDX;
125   QLineEdit*                myYmin;
126   QLineEdit*                myYmax;
127   QLineEdit*                myDY;
128   QLineEdit*                myZmin;
129   QLineEdit*                myZmax;
130   QLineEdit*                myDZ;
131   SourceList                mySrc;
132   SMESH_Actor*              myActor;
133   SMESHGUI_IdValidator*     myValidator;
134   QString                   myIDs;
135   SUIT_SelectionFilter*     myFilter;
136   SALOME_Actor*             myPreview;
137 };
138
139 class SMESHGUI_EXPORT SMESHGUI_BasicProperties : public QWidget
140 {
141   Q_OBJECT;
142   
143 public:
144   //! Property type
145   enum Mode { Length, Area, Volume };
146
147   SMESHGUI_BasicProperties( QWidget* = 0 );
148   ~SMESHGUI_BasicProperties();
149
150   void setMode( const Mode );
151
152   void updateSelection();
153   void deactivate();
154
155 private slots:
156   void selectionChanged();
157   void modeChanged( int);
158   void compute();
159   void clear();
160
161 private:
162   QButtonGroup*             myMode;
163   QLineEdit*                mySource;
164   QGroupBox*                myResultGrp;
165   QLineEdit*                myResult;
166   SMESH::SMESH_IDSource_var mySrc;
167   SUIT_SelectionFilter*     myFilter;
168 };
169
170 class SMESHGUI_EXPORT SMESHGUI_MeasureDlg : public QDialog
171
172   Q_OBJECT;
173
174   enum { NodeMode, ElemMode };
175
176 public:
177   //! Measurement type
178   enum { 
179     MinDistance,   //!< minimum distance
180     BoundingBox,   //!< bounding box
181     Length,        //!< length
182     Area,          //!< area
183     Volume         //!< volume
184   };
185
186   SMESHGUI_MeasureDlg( QWidget* = 0, int = MinDistance );
187   ~SMESHGUI_MeasureDlg();
188
189   void reject();
190
191 protected:
192   void keyPressEvent( QKeyEvent* );
193   void enterEvent( QEvent* );
194
195 private slots:
196   void help();
197   void updateSelection();
198   void activate();
199   void deactivate();
200
201 private:
202   QTabWidget*           myTabWidget;
203   SMESHGUI_MinDistance* myMinDist;   
204   SMESHGUI_BoundingBox* myBndBox;
205   SMESHGUI_BasicProperties* myBasicProps;
206 };
207
208 #endif // SMESHGUI_MEASUREMENTS_H