00001 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE 00002 // 00003 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, 00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 00005 // 00006 // This library is free software; you can redistribute it and/or 00007 // modify it under the terms of the GNU Lesser General Public 00008 // License as published by the Free Software Foundation; either 00009 // version 2.1 of the License. 00010 // 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 // Lesser General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU Lesser General Public 00017 // License along with this library; if not, write to the Free Software 00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 // 00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com 00021 // 00022 00023 // SALOME VTKViewer : build VTK viewer into Salome desktop 00024 // File : VISU_WidgetCtrl.hxx 00025 // Author : Peter KURNEV 00026 // Module : SALOME 00027 // $Header: /home/server/cvs/VISU/VISU_SRC/src/PIPELINE/VISU_WidgetCtrl.hxx,v 1.6.2.1.6.1.8.1 2011-06-02 06:00:20 vsr Exp $ 00028 // 00029 #ifndef __VISU_WidgetCtrl_hxx 00030 #define __VISU_WidgetCtrl_hxx 00031 00032 #include "VISUPipeline.hxx" 00033 #include <vtkImplicitFunction.h> 00034 00035 #include "VTKViewer.h" 00036 00037 class vtkImplicitFunction; 00038 class vtkObject; 00039 class vtkRenderWindowInteractor; 00040 class vtkCommand; 00041 class vtkCallbackCommand; 00042 00043 class VISU_PlanesWidget; 00044 class VISU_SphereWidget; 00045 class VISU_ImplicitFunctionWidget; 00046 00047 class VISU_PIPELINE_EXPORT VISU_WidgetCtrl : public vtkImplicitFunction 00048 { 00049 public: 00050 static VISU_WidgetCtrl *New(); 00051 vtkTypeRevisionMacro(VISU_WidgetCtrl,vtkObject); 00052 00053 vtkImplicitFunction* ImplicitFunction(); 00054 00055 virtual 00056 vtkFloatingPointType 00057 EvaluateFunction(vtkFloatingPointType theX[3]); 00058 00059 virtual 00060 void 00061 EvaluateGradient(vtkFloatingPointType theX[3], 00062 vtkFloatingPointType theG[3]); 00063 00064 virtual 00065 unsigned long 00066 GetMTime(); 00067 00068 void PlaceWidget(vtkFloatingPointType theBounds[6]); 00069 void SetEnabled(int theFlag); 00070 int GetEnabled(); 00071 void On() {SetEnabled(1);} 00072 void Off(){SetEnabled(0);} 00073 00074 void SetInteractor(vtkRenderWindowInteractor* theRWI); 00075 vtkRenderWindowInteractor* GetInteractor(); 00076 // 00077 void 00078 SetPlaceFactor(vtkFloatingPointType theFactor); 00079 00080 vtkFloatingPointType 00081 GetPlaceFactor(); 00082 // 00083 void SetActiveIndex(const int theFlag); 00084 int GetActiveIndex()const; 00085 bool HasActiveIndex()const; 00086 bool IsPlanesActive()const; 00087 bool IsSphereActive()const; 00088 00089 00090 VISU_ImplicitFunctionWidget* GetActiveWidget(); 00091 VISU_ImplicitFunctionWidget* GetWidget(const int); 00092 00093 int GetNbWidgets()const; 00094 int GetDisableAll()const; 00095 00096 // 00097 VISU_PlanesWidget * GetPlanesWidget(); 00098 VISU_SphereWidget * GetSphereWidget(); 00099 // 00100 static void ProcessEvents(vtkObject* theObject, 00101 unsigned long theEvent, 00102 void* theClientData, 00103 void* theCalldata); 00104 // 00105 protected: 00106 VISU_WidgetCtrl(); 00107 ~VISU_WidgetCtrl(); 00108 00109 protected: 00110 int myNbWidgets; 00111 int myActiveIndex; 00112 int myCounter; 00113 int myDisableAll; 00114 vtkFloatingPointType myPriority; 00115 VISU_ImplicitFunctionWidget *myWidgets[2]; 00116 VISU_ImplicitFunctionWidget *myDummyWidget; 00117 VISU_PlanesWidget *myPlanesWidget; 00118 VISU_SphereWidget *mySphereWidget; 00119 vtkCallbackCommand *myEventCallbackCommand; 00120 00121 private: 00122 VISU_WidgetCtrl(const VISU_WidgetCtrl&); //Not implemented 00123 void operator=(const VISU_WidgetCtrl&); //Not implemented 00124 }; 00125 00126 #endif