1 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SALOME VTKViewer : build VTK viewer into Salome desktop
24 // File : VISU_WidgetCtrl.hxx
25 // Author : Peter KURNEV
29 #ifndef __VISU_WidgetCtrl_hxx
30 #define __VISU_WidgetCtrl_hxx
32 #include "VISUPipeline.hxx"
33 #include <vtkImplicitFunction.h>
35 #include "VTKViewer.h"
37 class vtkImplicitFunction;
39 class vtkRenderWindowInteractor;
41 class vtkCallbackCommand;
43 class VISU_PlanesWidget;
44 class VISU_SphereWidget;
45 class VISU_ImplicitFunctionWidget;
47 class VISU_PIPELINE_EXPORT VISU_WidgetCtrl : public vtkImplicitFunction
50 static VISU_WidgetCtrl *New();
51 vtkTypeRevisionMacro(VISU_WidgetCtrl,vtkObject);
53 vtkImplicitFunction* ImplicitFunction();
57 EvaluateFunction(vtkFloatingPointType theX[3]);
61 EvaluateGradient(vtkFloatingPointType theX[3],
62 vtkFloatingPointType theG[3]);
68 void PlaceWidget(vtkFloatingPointType theBounds[6]);
69 void SetEnabled(int theFlag);
71 void On() {SetEnabled(1);}
72 void Off(){SetEnabled(0);}
74 void SetInteractor(vtkRenderWindowInteractor* theRWI);
75 vtkRenderWindowInteractor* GetInteractor();
78 SetPlaceFactor(vtkFloatingPointType theFactor);
83 void SetActiveIndex(const int theFlag);
84 int GetActiveIndex()const;
85 bool HasActiveIndex()const;
86 bool IsPlanesActive()const;
87 bool IsSphereActive()const;
90 VISU_ImplicitFunctionWidget* GetActiveWidget();
91 VISU_ImplicitFunctionWidget* GetWidget(const int);
93 int GetNbWidgets()const;
94 int GetDisableAll()const;
97 VISU_PlanesWidget * GetPlanesWidget();
98 VISU_SphereWidget * GetSphereWidget();
100 static void ProcessEvents(vtkObject* theObject,
101 unsigned long theEvent,
114 vtkFloatingPointType myPriority;
115 VISU_ImplicitFunctionWidget *myWidgets[2];
116 VISU_ImplicitFunctionWidget *myDummyWidget;
117 VISU_PlanesWidget *myPlanesWidget;
118 VISU_SphereWidget *mySphereWidget;
119 vtkCallbackCommand *myEventCallbackCommand;
122 VISU_WidgetCtrl(const VISU_WidgetCtrl&); //Not implemented
123 void operator=(const VISU_WidgetCtrl&); //Not implemented