Salome HOME
Fix for Bug IPAL8945
[modules/visu.git] / src / PIPELINE / VISU_WidgetCtrl.hxx
1 //  SALOME VTKViewer : build VTK viewer into Salome desktop
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   : VISU_WidgetCtrl.hxx
25 //  Author : Peter KURNEV
26 //  Module : SALOME
27 //  $Header$
28
29 #ifndef __VISU_WidgetCtrl_hxx
30 #define __VISU_WidgetCtrl_hxx
31
32
33 #include <vtkImplicitFunction.h>
34
35 class vtkImplicitFunction;
36 class vtkObject;
37 class vtkRenderWindowInteractor;
38 class vtkCommand;
39 class vtkCallbackCommand;
40
41 class VISU_PlanesWidget;
42 class VISU_SphereWidget;
43 class VISU_ImplicitFunctionWidget;
44
45 class VISU_WidgetCtrl : public vtkImplicitFunction
46 {
47 public:
48   static VISU_WidgetCtrl *New();
49   vtkTypeRevisionMacro(VISU_WidgetCtrl,vtkObject);
50
51   vtkImplicitFunction* ImplicitFunction();
52
53   virtual
54   float         
55   EvaluateFunction(float theX[3]);
56
57   virtual
58   void  
59   EvaluateGradient(float theX[3], float theG[3]);
60
61   virtual
62   unsigned long
63   GetMTime();
64
65   void PlaceWidget(float theBounds[6]);
66   void SetEnabled(int theFlag);
67   int  GetEnabled();
68   void On() {SetEnabled(1);}
69   void Off(){SetEnabled(0);}
70   
71   void SetInteractor(vtkRenderWindowInteractor* theRWI);
72   vtkRenderWindowInteractor* GetInteractor();
73   //
74   void  SetPlaceFactor(float theFactor);
75   float GetPlaceFactor();
76   //
77   void SetActiveIndex(const int theFlag);
78   int  GetActiveIndex()const;
79   bool HasActiveIndex()const;
80   bool IsPlanesActive()const;
81   bool IsSphereActive()const;
82
83   
84   VISU_ImplicitFunctionWidget* GetActiveWidget();
85   VISU_ImplicitFunctionWidget* GetWidget(const int);
86
87   int GetNbWidgets()const;
88   int GetDisableAll()const;
89   
90   //
91   VISU_PlanesWidget * GetPlanesWidget();
92   VISU_SphereWidget * GetSphereWidget();
93   //
94   static void ProcessEvents(vtkObject* theObject, 
95                             unsigned long theEvent,
96                             void* theClientData, 
97                             void* theCalldata);
98   //
99 protected:
100   VISU_WidgetCtrl();
101   ~VISU_WidgetCtrl();
102
103 protected:
104   int myNbWidgets;
105   int myActiveIndex;
106   int myCounter;
107   int myDisableAll;
108   float myPriority;
109   VISU_ImplicitFunctionWidget *myWidgets[2];
110   VISU_ImplicitFunctionWidget *myDummyWidget;
111   VISU_PlanesWidget *myPlanesWidget;
112   VISU_SphereWidget *mySphereWidget;
113   vtkCallbackCommand *myEventCallbackCommand;
114
115 private:
116   VISU_WidgetCtrl(const VISU_WidgetCtrl&);  //Not implemented
117   void operator=(const VISU_WidgetCtrl&);   //Not implemented
118 };
119
120 #endif