1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef __VISU_SphereWidget_h
21 #define __VISU_SphereWidget_h
23 #include "VISUPipeline.hxx"
24 #include "VISU_ImplicitFunctionWidget.hxx"
26 class VISU_UnScaledActor;
29 class vtkPolyDataMapper;
32 class vtkSphereSource;
38 class vtkImplicitFunction;
40 class VISU_PIPELINE_EXPORT VISU_SphereWidget : public VISU_ImplicitFunctionWidget
44 // Instantiate the object.
45 static VISU_SphereWidget *New();
46 vtkTypeRevisionMacro(VISU_SphereWidget,VISU_ImplicitFunctionWidget);
47 void PrintSelf(ostream& os, vtkIndent indent);
49 virtual vtkImplicitFunction* ImplicitFunction();
52 // Methods that satisfy the superclass' API.
53 virtual void SetEnabled(int);
56 virtual void PlaceWidget(vtkFloatingPointType bounds[6]);
59 // Set/Get the resolution of the sphere in the Theta direction.
60 void SetThetaResolution(int r);
61 int GetThetaResolution();
63 // Set/Get the resolution of the sphere in the Phi direction.
64 void SetPhiResolution(int r);
65 int GetPhiResolution();
68 // Set/Get the radius of sphere. Default is .5.
69 void SetRadius(vtkFloatingPointType r);
70 vtkFloatingPointType GetRadius();
74 // Set/Get the center of the sphere.
75 void SetCenter(vtkFloatingPointType x,
76 vtkFloatingPointType y,
77 vtkFloatingPointType z);
78 void SetCenter(vtkFloatingPointType x[3]);
80 vtkFloatingPointType* GetCenter();
81 void GetCenter(vtkFloatingPointType xyz[3]);
84 // Set the ratio of the radius changing.
85 void SetRatio(vtkFloatingPointType r) { myRatio = r; }
86 vtkFloatingPointType GetRatio() { return myRatio; }
88 void ChangeRadius(bool up);
90 void GetPolyData(vtkPolyData *pd);
92 void GetSphere(vtkSphere *sphere);
95 vtkProperty* GetSphereProperty ();
96 vtkProperty* GetSelectedSphereProperty ();
101 ~VISU_SphereWidget();
104 static void ProcessEvents(vtkObject* object,
109 // ProcessEvents() dispatches to these methods.
110 void OnLeftButtonDown();
111 void OnLeftButtonUp();
112 void OnMiddleButtonDown();
113 void OnMiddleButtonUp();
116 void HighlightSphere(int highlight);
118 // Methods to manipulate the sphere widget
119 void Translate(double *p1, double *p2);
120 void Scale(double *p1, double *p2, int X, int Y);
122 //virtual void SizeHandles();
123 void CreateDefaultProperties();
125 //BTX - manage the state of the widget
137 vtkActor *mySphereActor;
138 vtkPolyDataMapper *mySphereMapper;
139 vtkSphereSource *mySphereSource;
142 vtkCellPicker *myPicker;
143 // Properties used to control the appearance of selected objects and
144 // the manipulator in general.
145 vtkProperty *mySphereProperty;
146 vtkProperty *mySelectedSphereProperty;
147 vtkFloatingPointType myRmin;
149 vtkImplicitSum* myImplicitSum;
150 vtkFloatingPointType myRatio;
152 VISU_SphereWidget(const VISU_SphereWidget&); //Not implemented
153 void operator=(const VISU_SphereWidget&); //Not implemented