Salome HOME
Fix for Bug IPAL8945
[modules/visu.git] / src / VVTK / VVTK_SegmentationCursorDlg.h
1 //  VISU VISUGUI : GUI of VISU component
2 //
3 //  Copyright (C) 2003  CEA/DEN, EDF R&D
4 //
5 //
6 //
7 //  File   : VVTK_SegmentationCursorDlg.h
8 //  Author : Oleg Uvarov
9 //  Module : VISU
10
11 #ifndef VVTK_SEGMENTATIONCURSORDLG_H
12 #define VVTK_SEGMENTATIONCURSORDLG_H
13
14 #include <qdialog.h>
15
16 #include <vtkObject.h>
17 #include <vtkSmartPointer.h>
18
19 class vtkActorCollection;
20 class vtkCallbackCommand;
21 class vtkImageData;
22
23 class QLabel;
24 class QLineEdit;
25 class QPushButton;
26 class QRadioButton;
27 class QTabWidget;
28 class QGroupBox;
29 class QVBox;
30
31 class QtxAction;
32 class QtxDblSpinBox;
33 class QtxIntSpinBox;
34
35 class VISU_GaussPtsAct1;
36 class VISU_InsideCursorSettings;
37 class VISU_OutsideCursorSettings;
38 class VISU_WidgetCtrl;
39
40 class VVTK_PrimitiveBox;
41 class VVTK_SizeBox;
42
43 class SVTK_RenderWindowInteractor;
44
45 namespace VISU
46 {
47   typedef vtkSmartPointer<vtkImageData> TTextureValue;
48
49   TTextureValue
50   GetTexture(const QString& theMainTexture, 
51              const QString& theAlphaTexture);
52 }
53
54 //! Segmentation Cursor Dialog.
55 /*!
56  * Uses for set up Segmentation and Outside Cursor Gauss Points preferenses
57  * and apply them to all actors in the current renderer.
58  */
59 class VVTK_SegmentationCursorDlg : public QDialog
60 {
61   Q_OBJECT
62
63 public:
64   VVTK_SegmentationCursorDlg( QWidget* parent = 0, const char* name = 0 );
65   ~VVTK_SegmentationCursorDlg();
66
67   void             SetWidgetCtrl( VISU_WidgetCtrl* );
68   void             SetPlaneAction( QtxAction* theAction ) { myPlaneAction = theAction; }
69   void             SetSphereAction( QtxAction* theAction ) { mySphereAction = theAction; }
70
71   bool             GetIsPlaneSegmentation() const { return myIsPlaneSegmentation; }
72   void             SetIsPlaneSegmentation( bool on ) { myIsPlaneSegmentation = on; }
73
74   //! Update contents of the Segmentation tab.
75   void             UpdateSegmentation();
76   void             UpdateInsideGaussPoints();
77   void             UpdateOutsideGaussPoints();
78
79   //! Update contents of the Outside Cursor tab.
80   void             UpdateOutsideCursor();
81
82   VISU_InsideCursorSettings*  GetInsideCursorSettings();
83   VISU_OutsideCursorSettings* GetOutsideCursorSettings();
84
85   vtkSmartPointer<vtkCallbackCommand> GetEventCallbackCommand() { return myEventCallbackCommand; }
86
87   void             SetInteractor( SVTK_RenderWindowInteractor* theInteractor ) { myInteractor = theInteractor; }
88
89 public:
90   float            getMagnification() const;
91   void             setMagnification( float );
92
93   float            getIncrement() const;
94   void             setIncrement( float );
95
96 protected:
97   void             ApplySegmentationCursor();
98   void             ApplyInsideGaussPoints();
99   void             ApplyOutsideGaussPoints();
100
101   bool             CheckNumberOfFaces();
102
103   VISU::TTextureValue
104   MakeImageData( bool theInside,
105                  const QString& theMainTexture, 
106                  const QString& theAlphaTexture );
107
108 private:
109   static void      ProcessEvents(vtkObject* theObject, 
110                                  unsigned long theEvent,
111                                  void* theClientData, 
112                                  void* theCallData);
113
114 protected slots:
115   virtual void     done( int );
116
117   void             onClickApply();
118   void             onClickClose();
119
120 signals:
121   void             scgClose();
122
123 private:
124   SVTK_RenderWindowInteractor* myInteractor;
125
126   QTabWidget*      myTabBox;
127
128   // Segmentation cursor
129   QVBox*           mySegmentationCursorBox;
130
131   QGroupBox*       myOriginGroup;
132   QtxDblSpinBox*   myXOriginSpinBox;
133   QtxDblSpinBox*   myYOriginSpinBox;
134   QtxDblSpinBox*   myZOriginSpinBox;
135
136   QGroupBox*       myDirectionGroup;
137   QtxDblSpinBox*   myDXDirectionSpinBox;
138   QtxDblSpinBox*   myDYDirectionSpinBox;
139   QtxDblSpinBox*   myDZDirectionSpinBox;
140
141   QGroupBox*       myDepthGroup;
142   QtxDblSpinBox*   myDepthSpinBox;
143
144   QGroupBox*       myRadiusGroup;
145   QtxDblSpinBox*   myRadiusSpinBox;
146   QtxDblSpinBox*   myRatioSpinBox;
147
148   bool             myIsPlaneSegmentation;
149
150   float            myPriority;
151   vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
152
153   VISU_WidgetCtrl* myWidgetCtrl;
154   QtxAction*       myPlaneAction;
155   QtxAction*       mySphereAction;
156
157   // Gauss Points
158   QVBox*           myGaussPointsBox;
159
160   VVTK_PrimitiveBox* myInsidePrimitiveBox;
161   VVTK_SizeBox*    myInsideSizeBox;
162
163   QString          myInsideMainTexture;
164   QString          myInsideAlphaTexture;
165
166   vtkSmartPointer<VISU_InsideCursorSettings> myInsideCursorSettings;
167
168   VVTK_PrimitiveBox* myOutsidePrimitiveBox;
169   VVTK_SizeBox*    myOutsideSizeBox;
170
171   QString          myOutsideMainTexture;
172   QString          myOutsideAlphaTexture;
173
174   vtkSmartPointer<VISU_OutsideCursorSettings> myOutsideCursorSettings;
175
176   QLabel*          myMagnificationLabel;
177   QtxIntSpinBox*   myMagnificationSpinBox;
178   QLabel*          myIncrementLabel;
179   QtxDblSpinBox*   myIncrementSpinBox;
180 };
181
182 #endif