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