Salome HOME
0651f73872fc2dd189f578a227153dc1275d013d
[modules/visu.git] / src / VISUGUI / VisuGUI_CutPlanesDlg.h
1 //  VISU VISUGUI : GUI of VISU component
2 //
3 //  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
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 "QAD_SpinBoxDbl.h"
33 #include "QAD_StudyFrame.h"
34
35 #include "VisuGUI_ScalarBarDlg.h"
36 #include "VISU_CutPlanes_i.hh"
37 #include <SALOME_Actor.h>
38
39 #include <qradiobutton.h>
40 #include <qtable.h>
41
42 #include "SALOMEconfig.h"
43 #include CORBA_CLIENT_HEADER(VISU_Gen)
44
45
46 class VisuGUI_CutPlanesPane : public QFrame
47 {
48     Q_OBJECT
49
50 public:
51     VisuGUI_CutPlanesPane(QWidget* theParent, QAD_Study * theStudy);
52     ~VisuGUI_CutPlanesPane();
53
54     void   setNbPlanes( const int nbp ) {nbPlan->setValue( nbp );}
55     int    getNbPlanes() {return nbPlan->value();}
56     void   setPlanePos( const VISU::CutPlanes::Orientation orient/*, const double pos1, const double pos2 */);
57     VISU::CutPlanes::Orientation  getOrientaion();
58     void   setRotation( const double r1, const double r2 );
59     double getRotation1() {return Rot1->value();}
60     double getRotation2() {return Rot2->value();}
61
62     void initFromPrsObject(VISU::CutPlanes_i* thePrs);
63     int storeToPrsObject(VISU::CutPlanes_i* thePrs);
64
65 private:
66     void createPlanes();
67     void deletePlanes();
68
69
70     QLabel* LabelRot1;
71     QLabel* LabelRot2;
72     QSpinBox* nbPlan;
73     QAD_SpinBoxDbl* Rot1;
74     QAD_SpinBoxDbl* Rot2;
75     QRadioButton* RBzx;
76     QRadioButton* RByz;
77     QRadioButton* RBxy;
78     QAD_SpinBoxDbl* myPosSpn;
79     QTable* myPosTable;
80     VISU::CutPlanes_i* myCutPlanes;  
81     QCheckBox* myPreviewCheck;
82     double          X1, X2;
83     double          Y1, Y2;
84     double          Z1, Z2;
85     bool hasInit;
86     QAD_Study* myStudy;
87
88     //vector<SALOME_Actor*> myPreviewActors;
89     SALOME_Actor* myPreviewActor;
90
91 private slots:
92     void editScalarBar();
93     void orientationChanged( int );
94     void DrawTable();
95     void setDefault( int all = -1);
96     void onValueChanged(int theRow, int theCol);
97     void onRotation(double theValue);
98     void onPreviewCheck(bool thePreview);
99 };
100
101
102
103 class VisuGUI_CutPlanesDlg : public QDialog
104
105     Q_OBJECT
106
107 public:
108     VisuGUI_CutPlanesDlg(bool theIsCreation, bool theIsModal);
109     ~VisuGUI_CutPlanesDlg();
110
111     void initFromPrsObject(VISU::CutPlanes_i* thePrs)
112       {myPrs=thePrs; myScalarPane->initFromPrsObject(thePrs); myCutPane->initFromPrsObject(thePrs);}
113
114     int storeToPrsObject(VISU::CutPlanes_i* thePrs)
115       {return myScalarPane->storeToPrsObject(thePrs) && myCutPane->storeToPrsObject(thePrs);}
116    
117 protected slots:
118   void accept();
119   void reject();
120   void onFrameActivated( QAD_StudyFrame* theFrame);
121
122 private:
123     VisuGUI_CutPlanesPane* myCutPane;
124     VisuGUI_ScalarBarPane* myScalarPane;
125     VISU::CutPlanes_i* myPrs;
126     
127     bool myIsCreation;
128
129     QAD_Study  *myStudy;
130     QAD_StudyFrame *myStudyFrame;
131 };
132
133
134 class VisuGUI_NumEditItem: public QTableItem
135 {
136   //    Q_OBJECT
137
138 public:
139     VisuGUI_NumEditItem(QTable* table, EditType et, const QString& text ):
140       QTableItem(table, et, text) {};
141     ~VisuGUI_NumEditItem() {};
142
143     QWidget* createEditor() const;
144 };
145
146
147 #endif // VISUGUI_CUTPLANESDLG_H