]> SALOME platform Git repositories - modules/visu.git/blob - src/VVTK/VVTK_SegmentationCursorDlg.h
Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[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   void             onParentShow();
117   void             onParentHide();
118
119   void             onClickApply();
120   void             onClickClose();
121   void             onClickHelp();
122
123 signals:
124   void             scgClose();
125
126 private:
127   SVTK_RenderWindowInteractor* myInteractor;
128
129   QTabWidget*      myTabBox;
130
131   // Segmentation cursor
132   QVBox*           mySegmentationCursorBox;
133
134   QGroupBox*       myOriginGroup;
135   QtxDblSpinBox*   myXOriginSpinBox;
136   QtxDblSpinBox*   myYOriginSpinBox;
137   QtxDblSpinBox*   myZOriginSpinBox;
138
139   QGroupBox*       myDirectionGroup;
140   QtxDblSpinBox*   myDXDirectionSpinBox;
141   QtxDblSpinBox*   myDYDirectionSpinBox;
142   QtxDblSpinBox*   myDZDirectionSpinBox;
143
144   QGroupBox*       myDepthGroup;
145   QtxDblSpinBox*   myDepthSpinBox;
146
147   QGroupBox*       myRadiusGroup;
148   QtxDblSpinBox*   myRadiusSpinBox;
149   QtxDblSpinBox*   myRatioSpinBox;
150
151   bool             myIsPlaneSegmentation;
152
153   float            myPriority;
154   vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
155
156   VISU_WidgetCtrl* myWidgetCtrl;
157   QtxAction*       myPlaneAction;
158   QtxAction*       mySphereAction;
159
160   // Gauss Points
161   QVBox*           myGaussPointsBox;
162
163   VVTK_PrimitiveBox* myInsidePrimitiveBox;
164   VVTK_SizeBox*    myInsideSizeBox;
165
166   QString          myInsideMainTexture;
167   QString          myInsideAlphaTexture;
168
169   vtkSmartPointer<VISU_InsideCursorSettings> myInsideCursorSettings;
170
171   VVTK_PrimitiveBox* myOutsidePrimitiveBox;
172   VVTK_SizeBox*    myOutsideSizeBox;
173
174   QString          myOutsideMainTexture;
175   QString          myOutsideAlphaTexture;
176
177   vtkSmartPointer<VISU_OutsideCursorSettings> myOutsideCursorSettings;
178
179   QLabel*          myMagnificationLabel;
180   QtxIntSpinBox*   myMagnificationSpinBox;
181   QLabel*          myIncrementLabel;
182   QtxDblSpinBox*   myIncrementSpinBox;
183 };
184
185 #endif