Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __VISU_SphereWidget_h
00024 #define __VISU_SphereWidget_h
00025
00026 #include "VISUPipeline.hxx"
00027 #include "VISU_ImplicitFunctionWidget.hxx"
00028
00029 class VISU_UnScaledActor;
00030
00031 class vtkActor;
00032 class vtkPolyDataMapper;
00033 class vtkPoints;
00034 class vtkPolyData;
00035 class vtkSphereSource;
00036 class vtkSphere;
00037 class vtkCellPicker;
00038 class vtkProperty;
00039 class vtkSphere;
00040 class vtkImplicitSum;
00041 class vtkImplicitFunction;
00042
00043 class VISU_PIPELINE_EXPORT VISU_SphereWidget : public VISU_ImplicitFunctionWidget
00044 {
00045 public:
00046
00047
00048 static VISU_SphereWidget *New();
00049 vtkTypeRevisionMacro(VISU_SphereWidget,VISU_ImplicitFunctionWidget);
00050 void PrintSelf(ostream& os, vtkIndent indent);
00051
00052 virtual vtkImplicitFunction* ImplicitFunction();
00053
00054
00055
00056 virtual void SetEnabled(int);
00057
00058
00059 virtual void PlaceWidget(vtkFloatingPointType bounds[6]);
00060
00061
00062
00063 void SetThetaResolution(int r);
00064 int GetThetaResolution();
00065
00066
00067 void SetPhiResolution(int r);
00068 int GetPhiResolution();
00069
00070
00071
00072 void SetRadius(vtkFloatingPointType r);
00073 vtkFloatingPointType GetRadius();
00074
00075
00076
00077
00078 void SetCenter(vtkFloatingPointType x,
00079 vtkFloatingPointType y,
00080 vtkFloatingPointType z);
00081 void SetCenter(vtkFloatingPointType x[3]);
00082
00083 vtkFloatingPointType* GetCenter();
00084 void GetCenter(vtkFloatingPointType xyz[3]);
00085
00086
00087
00088 void SetRatio(vtkFloatingPointType r) { myRatio = r; }
00089 vtkFloatingPointType GetRatio() { return myRatio; }
00090
00091 void ChangeRadius(bool up);
00092
00093 void GetPolyData(vtkPolyData *pd);
00094
00095 void GetSphere(vtkSphere *sphere);
00096
00097
00098 vtkProperty* GetSphereProperty ();
00099 vtkProperty* GetSelectedSphereProperty ();
00100
00101
00102 protected:
00103 VISU_SphereWidget();
00104 ~VISU_SphereWidget();
00105
00106
00107 static void ProcessEvents(vtkObject* object,
00108 unsigned long event,
00109 void* clientdata,
00110 void* calldata);
00111
00112
00113 void OnLeftButtonDown();
00114 void OnLeftButtonUp();
00115 void OnMiddleButtonDown();
00116 void OnMiddleButtonUp();
00117 void OnMouseMove();
00118
00119 void HighlightSphere(int highlight);
00120
00121
00122 void Translate(double *p1, double *p2);
00123 void Scale(double *p1, double *p2, int X, int Y);
00124
00125
00126 void CreateDefaultProperties();
00127
00128
00129 int myState;
00130 enum WidgetState
00131 {
00132 Start=0,
00133 Moving,
00134 Scaling,
00135 Positioning,
00136 Outside
00137 };
00138
00139
00140 vtkActor *mySphereActor;
00141 vtkPolyDataMapper *mySphereMapper;
00142 vtkSphereSource *mySphereSource;
00143
00144
00145 vtkCellPicker *myPicker;
00146
00147
00148 vtkProperty *mySphereProperty;
00149 vtkProperty *mySelectedSphereProperty;
00150 vtkFloatingPointType myRmin;
00151 vtkSphere *mySphere;
00152 vtkImplicitSum* myImplicitSum;
00153 vtkFloatingPointType myRatio;
00154 private:
00155 VISU_SphereWidget(const VISU_SphereWidget&);
00156 void operator=(const VISU_SphereWidget&);
00157 };
00158
00159 #endif