]> SALOME platform Git repositories - modules/visu.git/blob - src/VVTK/VVTK_SegmentationCursorDlg.h
Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/visu.git] / src / VVTK / VVTK_SegmentationCursorDlg.h
1 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3 // 
4 //  This library is free software; you can redistribute it and/or 
5 //  modify it under the terms of the GNU Lesser General Public 
6 //  License as published by the Free Software Foundation; either 
7 //  version 2.1 of the License. 
8 // 
9 //  This library is distributed in the hope that it will be useful, 
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 //  Lesser General Public License for more details. 
13 // 
14 //  You should have received a copy of the GNU Lesser General Public 
15 //  License along with this library; if not, write to the Free Software 
16 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
17 // 
18 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 //  File   : VVTK_SegmentationCursorDlg.h
21 //  Author : Oleg Uvarov
22 //  Module : VISU
23
24 #ifndef VVTK_SEGMENTATIONCURSORDLG_H
25 #define VVTK_SEGMENTATIONCURSORDLG_H
26
27 #include "VVTK.h"
28
29 #include "VISU_GaussPtsDeviceActor.h"
30
31 #include <qdialog.h>
32
33 #include <vtkObject.h>
34 #include <vtkSmartPointer.h>
35
36 class vtkActorCollection;
37 class vtkCallbackCommand;
38 class vtkImageData;
39
40 class QLabel;
41 class QLineEdit;
42 class QPushButton;
43 class QRadioButton;
44 class QTabWidget;
45 class QGroupBox;
46 class QVBox;
47
48 class QtxAction;
49 class QtxDblSpinBox;
50 class QtxIntSpinBox;
51
52 class VISU_GaussPtsAct1;
53 class VISU_InsideCursorSettings;
54 class VISU_OutsideCursorSettings;
55 class VISU_WidgetCtrl;
56
57 class VVTK_PrimitiveBox;
58 class VVTK_SizeBox;
59
60 class SVTK_RenderWindowInteractor;
61
62
63 //! Segmentation Cursor Dialog.
64 /*!
65  * Uses for set up Segmentation and Outside Cursor Gauss Points preferenses
66  * and apply them to all actors in the current renderer.
67  */
68 class VVTK_SegmentationCursorDlg : public QDialog
69 {
70   Q_OBJECT
71
72 public:
73   VVTK_SegmentationCursorDlg( QWidget* parent = 0, const char* name = 0 );
74   ~VVTK_SegmentationCursorDlg();
75
76   void             SetWidgetCtrl( VISU_WidgetCtrl* );
77   void             SetPlaneAction( QtxAction* theAction ) { myPlaneAction = theAction; }
78   void             SetSphereAction( QtxAction* theAction ) { mySphereAction = theAction; }
79
80   bool             GetIsPlaneSegmentation() const { return myIsPlaneSegmentation; }
81   void             SetIsPlaneSegmentation( bool on ) { myIsPlaneSegmentation = on; }
82
83   //! Update contents of the Segmentation tab.
84   void             UpdateSegmentation();
85   void             UpdateInsideGaussPoints();
86   void             UpdateOutsideGaussPoints();
87
88   //! Update contents of the Outside Cursor tab.
89   void             UpdateOutsideCursor();
90
91   VISU_InsideCursorSettings*  GetInsideCursorSettings();
92   VISU_OutsideCursorSettings* GetOutsideCursorSettings();
93
94   vtkSmartPointer<vtkCallbackCommand> GetEventCallbackCommand() { return myEventCallbackCommand; }
95
96   void             SetInteractor( SVTK_RenderWindowInteractor* theInteractor ) { myInteractor = theInteractor; }
97
98 public:
99   float            getMagnification() const;
100   void             setMagnification( float );
101
102   float            getIncrement() const;
103   void             setIncrement( float );
104
105 protected:
106   void             ApplySegmentationCursor();
107   void             ApplyInsideGaussPoints();
108   void             ApplyOutsideGaussPoints();
109
110   bool             CheckNumberOfFaces();
111
112   VISU::TTextureValue
113   MakeImageData( bool theInside,
114                  const QString& theMainTexture, 
115                  const QString& theAlphaTexture );
116
117 private:
118   static void      ProcessEvents(vtkObject* theObject, 
119                                  unsigned long theEvent,
120                                  void* theClientData, 
121                                  void* theCallData);
122   
123   void             keyPressEvent( QKeyEvent* e );
124
125 protected slots:
126   virtual void     done( int );
127   void             onParentShow();
128   void             onParentHide();
129
130   void             onClickApply();
131   void             onClickClose();
132   void             onClickHelp();
133
134 signals:
135   void             scgClose();
136
137 private:
138   SVTK_RenderWindowInteractor* myInteractor;
139
140   QTabWidget*      myTabBox;
141
142   // Segmentation cursor
143   QVBox*           mySegmentationCursorBox;
144
145   QGroupBox*       myOriginGroup;
146   QtxDblSpinBox*   myXOriginSpinBox;
147   QtxDblSpinBox*   myYOriginSpinBox;
148   QtxDblSpinBox*   myZOriginSpinBox;
149
150   QGroupBox*       myDirectionGroup;
151   QtxDblSpinBox*   myDXDirectionSpinBox;
152   QtxDblSpinBox*   myDYDirectionSpinBox;
153   QtxDblSpinBox*   myDZDirectionSpinBox;
154
155   QGroupBox*       myDepthGroup;
156   QtxDblSpinBox*   myDepthSpinBox;
157
158   QGroupBox*       myRadiusGroup;
159   QtxDblSpinBox*   myRadiusSpinBox;
160   QtxDblSpinBox*   myRatioSpinBox;
161
162   bool             myIsPlaneSegmentation;
163
164   float            myPriority;
165   vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
166
167   VISU_WidgetCtrl* myWidgetCtrl;
168   QtxAction*       myPlaneAction;
169   QtxAction*       mySphereAction;
170
171   // Gauss Points
172   QVBox*           myGaussPointsBox;
173
174   VVTK_PrimitiveBox* myInsidePrimitiveBox;
175   VVTK_SizeBox*    myInsideSizeBox;
176
177   QString          myInsideMainTexture;
178   QString          myInsideAlphaTexture;
179
180   vtkSmartPointer<VISU_InsideCursorSettings> myInsideCursorSettings;
181
182   VVTK_PrimitiveBox* myOutsidePrimitiveBox;
183   VVTK_SizeBox*    myOutsideSizeBox;
184
185   QString          myOutsideMainTexture;
186   QString          myOutsideAlphaTexture;
187
188   vtkSmartPointer<VISU_OutsideCursorSettings> myOutsideCursorSettings;
189
190   QLabel*          myMagnificationLabel;
191   QtxIntSpinBox*   myMagnificationSpinBox;
192   QLabel*          myIncrementLabel;
193   QtxDblSpinBox*   myIncrementSpinBox;
194 };
195
196 #endif