Salome HOME
Fix for the "0051899: curves are not shown in opened study" issue.
[modules/visu.git] / src / VISUGUI / VisuGUI_CutPlanesDlg.h
1 // Copyright (C) 2007-2013  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.
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 //  VISU VISUGUI : GUI of VISU component
24 //  File   : VisuGUI_CutPlanesDlg.h
25 //  Author : Laurent CORNABE & Hubert ROLLAND
26 //  Module : VISU
27 //  $Header$
28 //
29 #ifndef VISUGUI_CUTPLANESDLG_H
30 #define VISUGUI_CUTPLANESDLG_H
31
32 #include "VisuGUI_Prs3dDlg.h"
33
34 #include <SALOME_Actor.h>
35 #include <SalomeApp_IntSpinBox.h>
36 #include <SalomeApp_DoubleSpinBox.h>
37
38 #include <QFrame>
39
40 class QRadioButton;
41 class QTabWidget;
42 class QTableWidget;
43 class QCheckBox;
44 class QComboBox;
45
46 #include "SALOMEconfig.h"
47 #include CORBA_CLIENT_HEADER(VISU_Gen)
48
49 #include <map>
50 #include <vector>
51
52 namespace VISU 
53 {
54   class CutPlanes_i;
55   class Result_i;
56 };
57
58 class SUIT_ViewWindow;
59 class SUIT_ViewManager;
60 class SalomeApp_Module;
61 class VisuGUI_InputPane;
62
63 class VisuGUI_CutPlanesPane : public QFrame
64 {
65     Q_OBJECT
66
67 public:
68     VisuGUI_CutPlanesPane (QWidget* parent);
69     ~VisuGUI_CutPlanesPane();
70
71     void   setNbPlanes( const int nbp ) {nbPlan->setValue( nbp );}
72     int    getNbPlanes() {return nbPlan->value();}
73     void   setPlanePos( const VISU::CutPlanes::Orientation orient/*, const double pos1, const double pos2 */);
74     VISU::CutPlanes::Orientation  getOrientaion();
75     void   setRotation( const double r1, const double r2 );
76     double getRotation1() {return Rot1->value();}
77     double getRotation2() {return Rot2->value();}
78
79     double getScaleFactor();
80     void   setScaleFactor(double factor);
81
82     void   initFromPrsObject(VISU::CutPlanes_i* thePrs);
83     int    storeToPrsObject(VISU::CutPlanes_i* thePrs);
84
85 private:
86     typedef std::vector<QString> TVectorialFieldsList;
87     typedef std::map<VISU::Entity, TVectorialFieldsList> TEntity2VectorialFields;
88     typedef std::pair<VISU::Entity,TVectorialFieldsList> TEntVectPair;
89     TEntity2VectorialFields myEntity2VectorialFields;
90
91     void createPlanes();
92     void deletePlanes();
93
94     void InitEntity2VectorialFieldsMap(VISU::ColoredPrs3d_i* thePrs);
95     void InsertAllVectorialFields();
96     void InitVectorialField();
97
98     QLabel* LabelRot1;
99     QLabel* LabelRot2;
100     QGroupBox* GDeformation;
101     SalomeApp_IntSpinBox* nbPlan;
102     SalomeApp_DoubleSpinBox* Rot1;
103     SalomeApp_DoubleSpinBox* Rot2;
104     QRadioButton* RBzx;
105     QRadioButton* RByz;
106     QRadioButton* RBxy;
107     SalomeApp_DoubleSpinBox* myPosSpn;
108     QTableWidget* myPosTable;
109     SALOME::GenericObjPtr<VISU::CutPlanes_i> myCutPlanes;
110     QCheckBox* myPreviewCheck;
111     QComboBox* myVectorialFieldCombo;
112     SalomeApp_DoubleSpinBox* myScaleSpn;
113     double          X1, X2;
114     double          Y1, Y2;
115     double          Z1, Z2;
116     bool hasInit;
117
118     SALOME_Actor* myPreviewActor;
119
120 private slots:
121     void orientationChanged( int );
122     void DrawTable();
123     void setDefault( int all = -1);
124     void onValueChanged(int theRow, int theCol);
125     void onRotation(double theValue);
126     void onPreviewCheck(bool thePreview);
127     void onScaleFactorChanged(double);
128     void onDeformationCheck(bool);
129     void onVectorialFieldChanged(int);
130 };
131
132
133 class VisuGUI_CutPlanesDlg : public VisuGUI_ScalarBarBaseDlg
134 {
135     Q_OBJECT
136
137 public:
138     VisuGUI_CutPlanesDlg (SalomeApp_Module* theModule);
139     ~VisuGUI_CutPlanesDlg();
140
141     virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
142                                     bool theInit );
143
144     virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
145
146 protected:
147     virtual QString        GetContextHelpFilePath();
148
149 protected slots:
150     void accept();
151     void reject();
152
153 private:
154     QTabWidget*            myTabBox;
155     VisuGUI_CutPlanesPane* myCutPane;
156     VisuGUI_InputPane*     myInputPane;
157     SALOME::GenericObjPtr<VISU::CutPlanes_i> myPrsCopy;
158 };
159
160
161 /*class VisuGUI_NumEditItem: public QTableItem
162 {
163 public:
164     VisuGUI_NumEditItem(QTableWidget* table, const QString& text ):
165       QTableItem(table, et, text) {};
166     ~VisuGUI_NumEditItem() {};
167
168     QWidget* createEditor() const;
169 };*/
170
171 #endif // VISUGUI_CUTPLANESDLG_H