VTK
vtkSphereWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSphereWidget.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
61 #ifndef vtkSphereWidget_h
62 #define vtkSphereWidget_h
63 
64 #include "vtkInteractionWidgetsModule.h" // For export macro
65 #include "vtk3DWidget.h"
66 #include "vtkSphereSource.h" // Needed for faster access to the sphere source
67 
68 class vtkActor;
69 class vtkPolyDataMapper;
70 class vtkPoints;
71 class vtkPolyData;
72 class vtkSphereSource;
73 class vtkSphere;
74 class vtkCellPicker;
75 class vtkProperty;
76 
77 #define VTK_SPHERE_OFF 0
78 #define VTK_SPHERE_WIREFRAME 1
79 #define VTK_SPHERE_SURFACE 2
80 
82 {
83 public:
85  static vtkSphereWidget *New();
86 
88  void PrintSelf(ostream& os, vtkIndent indent);
89 
91 
92  virtual void SetEnabled(int);
93  virtual void PlaceWidget(double bounds[6]);
94  void PlaceWidget()
95  {this->Superclass::PlaceWidget();}
96  void PlaceWidget(double xmin, double xmax, double ymin, double ymax,
97  double zmin, double zmax)
98  {this->Superclass::PlaceWidget(xmin,xmax,ymin,ymax,zmin,zmax);}
100 
102 
106  vtkGetMacro(Representation,int);
108  { this->SetRepresentation(VTK_SPHERE_OFF);}
110  { this->SetRepresentation(VTK_SPHERE_WIREFRAME);}
112  { this->SetRepresentation(VTK_SPHERE_SURFACE);}
114 
116 
119  { this->SphereSource->SetThetaResolution(r); }
121  { return this->SphereSource->GetThetaResolution(); }
123 
125 
127  void SetPhiResolution(int r)
128  { this->SphereSource->SetPhiResolution(r); }
130  { return this->SphereSource->GetPhiResolution(); }
132 
134 
135  void SetRadius(double r)
136  {
137  if ( r <= 0 )
138  {
139  r = .00001;
140  }
141  this->SphereSource->SetRadius(r);
142  }
143  double GetRadius()
144  { return this->SphereSource->GetRadius(); }
146 
148 
149  void SetCenter(double x, double y, double z)
150  {
151  this->SphereSource->SetCenter(x,y,z);
152  }
153  void SetCenter(double x[3])
154  {
155  this->SetCenter(x[0], x[1], x[2]);
156  }
157  double* GetCenter()
158  {return this->SphereSource->GetCenter();}
159  void GetCenter(double xyz[3])
160  {this->SphereSource->GetCenter(xyz);}
162 
164 
166  vtkSetMacro(Translation,int);
167  vtkGetMacro(Translation,int);
168  vtkBooleanMacro(Translation,int);
169  vtkSetMacro(Scale,int);
170  vtkGetMacro(Scale,int);
171  vtkBooleanMacro(Scale,int);
173 
175 
179  vtkSetMacro(HandleVisibility,int);
180  vtkGetMacro(HandleVisibility,int);
181  vtkBooleanMacro(HandleVisibility,int);
183 
185 
188  vtkSetVector3Macro(HandleDirection,double);
189  vtkGetVector3Macro(HandleDirection,double);
191 
193 
194  vtkGetVector3Macro(HandlePosition,double);
196 
204 
209  void GetSphere(vtkSphere *sphere);
210 
212 
215  vtkGetObjectMacro(SelectedSphereProperty,vtkProperty);
217 
219 
223  vtkGetObjectMacro(SelectedHandleProperty,vtkProperty);
225 
226 protected:
229 
230 //BTX - manage the state of the widget
231  int State;
233  {
234  Start=0,
238  Outside
239  };
240 //ETX
241 
242  //handles the events
243  static void ProcessEvents(vtkObject* object,
244  unsigned long event,
245  void* clientdata,
246  void* calldata);
247 
248  // ProcessEvents() dispatches to these methods.
253  void OnMouseMove();
254 
255  // the sphere
259  void HighlightSphere(int highlight);
261 
262  // The representation of the sphere
264 
265  // Do the picking
267 
268  // Register internal Pickers within PickingManager
269  virtual void RegisterPickers();
270 
271  // Methods to manipulate the sphere widget
273  int Scale;
274  void Translate(double *p1, double *p2);
275  void ScaleSphere(double *p1, double *p2, int X, int Y);
276  void MoveHandle(double *p1, double *p2, int X, int Y);
277  void PlaceHandle(double *center, double radius);
278 
279  // Properties used to control the appearance of selected objects and
280  // the manipulator in general.
286 
287  // Managing the handle
291  void HighlightHandle(int);
293  double HandleDirection[3];
294  double HandlePosition[3];
295  virtual void SizeHandles();
296 
297 private:
298  vtkSphereWidget(const vtkSphereWidget&); //Not implemented
299  void operator=(const vtkSphereWidget&); //Not implemented
300 };
301 
302 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:42
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
vtkSphereWidget::OnMouseMove
void OnMouseMove()
vtkSphereWidget::SphereSource
vtkSphereSource * SphereSource
Definition: vtkSphereWidget.h:258
vtkgl::z
GLdouble GLdouble z
Definition: vtkgl.h:11754
vtkSphereWidget::vtkSphereWidget
vtkSphereWidget()
vtkGetObjectMacro
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:232
vtkSphereWidget::Picker
vtkCellPicker * Picker
Definition: vtkSphereWidget.h:266
vtkSphereWidget::ScaleSphere
void ScaleSphere(double *p1, double *p2, int X, int Y)
vtkSphereWidget::SetRadius
void SetRadius(double r)
Definition: vtkSphereWidget.h:135
vtkSphereWidget::PlaceWidget
void PlaceWidget()
Definition: vtkSphereWidget.h:94
vtkSphereWidget::PlaceHandle
void PlaceHandle(double *center, double radius)
vtkSphereWidget::GetCenter
double * GetCenter()
Definition: vtkSphereWidget.h:157
vtkSetVector3Macro
#define vtkSetVector3Macro(name, type)
Definition: vtkSetGet.h:287
vtkSphereWidget::SetThetaResolution
void SetThetaResolution(int r)
Definition: vtkSphereWidget.h:118
vtkSphereWidget::Translation
int Translation
Definition: vtkSphereWidget.h:272
vtkSphereWidget::HighlightHandle
void HighlightHandle(int)
vtkSphereWidget::WidgetState
WidgetState
Definition: vtkSphereWidget.h:233
vtkSphereWidget::HandleVisibility
int HandleVisibility
Definition: vtkSphereWidget.h:292
vtkSphereWidget::Moving
@ Moving
Definition: vtkSphereWidget.h:235
VTK_SPHERE_OFF
#define VTK_SPHERE_OFF
Definition: vtkSphereWidget.h:77
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkSphereWidget::SelectedHandleProperty
vtkProperty * SelectedHandleProperty
Definition: vtkSphereWidget.h:284
vtkInteractionWidgetsModule.h
VTK_SPHERE_WIREFRAME
#define VTK_SPHERE_WIREFRAME
Definition: vtkSphereWidget.h:78
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkSphereWidget::HandleMapper
vtkPolyDataMapper * HandleMapper
Definition: vtkSphereWidget.h:289
vtkX3D::center
@ center
Definition: vtkX3D.h:230
vtkSphereWidget::ProcessEvents
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
vtkSphereWidget::HandleProperty
vtkProperty * HandleProperty
Definition: vtkSphereWidget.h:283
vtkSphere
implicit function for a sphere
Definition: vtkSphere.h:37
vtkSphereWidget::Representation
int Representation
Definition: vtkSphereWidget.h:263
vtkSphereWidget::HighlightSphere
void HighlightSphere(int highlight)
vtkgl::event
struct _cl_event * event
Definition: vtkgl.h:14387
vtkSphereWidget::GetThetaResolution
int GetThetaResolution()
Definition: vtkSphereWidget.h:120
vtkSphereWidget::MoveHandle
void MoveHandle(double *p1, double *p2, int X, int Y)
vtkSetClampMacro
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:143
vtkGetVector3Macro
#define vtkGetVector3Macro(name, type)
Definition: vtkSetGet.h:304
vtkSphereWidget::SphereProperty
vtkProperty * SphereProperty
Definition: vtkSphereWidget.h:281
vtkSphereWidget::CreateDefaultProperties
void CreateDefaultProperties()
vtkSphereWidget::SelectedSphereProperty
vtkProperty * SelectedSphereProperty
Definition: vtkSphereWidget.h:282
vtkSphereSource
create a polygonal sphere centered at the origin
Definition: vtkSphereSource.h:46
vtkSphereWidget::GetCenter
void GetCenter(double xyz[3])
Definition: vtkSphereWidget.h:159
vtkSphereWidget::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkSphereWidget::Scaling
@ Scaling
Definition: vtkSphereWidget.h:236
VTK_SPHERE_SURFACE
#define VTK_SPHERE_SURFACE
Definition: vtkSphereWidget.h:79
vtkSphereWidget::SetPhiResolution
void SetPhiResolution(int r)
Definition: vtkSphereWidget.h:127
vtk3DWidget
an abstract superclass for 3D widgets
Definition: vtk3DWidget.h:70
vtkSphereWidget::SphereActor
vtkActor * SphereActor
Definition: vtkSphereWidget.h:256
vtkSphereSource.h
vtkSphereWidget::GetPolyData
void GetPolyData(vtkPolyData *pd)
vtkSphereWidget::SetEnabled
virtual void SetEnabled(int)
vtkSphereWidget::OnLeftButtonUp
void OnLeftButtonUp()
vtkSphereWidget::OnRightButtonDown
void OnRightButtonDown()
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkSphereWidget::~vtkSphereWidget
~vtkSphereWidget()
vtkgl::zmax
GLclampd zmax
Definition: vtkgl.h:17479
vtkSphereWidget::SelectRepresentation
void SelectRepresentation()
vtkSphereWidget::GetRadius
double GetRadius()
Definition: vtkSphereWidget.h:143
vtkSphereWidget::SizeHandles
virtual void SizeHandles()
vtkSphereWidget::GetSphere
void GetSphere(vtkSphere *sphere)
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
vtkSphereWidget::RegisterPickers
virtual void RegisterPickers()
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkSphereWidget::Translate
void Translate(double *p1, double *p2)
vtkgl::r
GLdouble GLdouble GLdouble r
Definition: vtkgl.h:11610
VTKINTERACTIONWIDGETS_EXPORT
#define VTKINTERACTIONWIDGETS_EXPORT
Definition: vtkInteractionWidgetsModule.h:15
vtkgl::y
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
vtkSphereWidget::PlaceWidget
virtual void PlaceWidget(double bounds[6])
vtkSphereWidget::State
int State
Definition: vtkSphereWidget.h:231
vtkSphereWidget::SetCenter
void SetCenter(double x[3])
Definition: vtkSphereWidget.h:153
vtkSphereWidget::SetRepresentationToWireframe
void SetRepresentationToWireframe()
Definition: vtkSphereWidget.h:109
vtkSphereWidget::SetRepresentationToSurface
void SetRepresentationToSurface()
Definition: vtkSphereWidget.h:111
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
vtkSphereWidget
3D widget for manipulating a sphere
Definition: vtkSphereWidget.h:82
vtkSphereWidget::New
static vtkSphereWidget * New()
vtkSphereWidget::SetRepresentationToOff
void SetRepresentationToOff()
Definition: vtkSphereWidget.h:107
vtkSphereWidget::GetPhiResolution
int GetPhiResolution()
Definition: vtkSphereWidget.h:129
vtkSphereWidget::SetCenter
void SetCenter(double x, double y, double z)
Definition: vtkSphereWidget.h:149
vtkSphereWidget::Scale
int Scale
Definition: vtkSphereWidget.h:273
vtkSphereWidget::PlaceWidget
void PlaceWidget(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax)
Definition: vtkSphereWidget.h:96
vtkSphereWidget::HandleActor
vtkActor * HandleActor
Definition: vtkSphereWidget.h:288
vtkSphereWidget::SphereMapper
vtkPolyDataMapper * SphereMapper
Definition: vtkSphereWidget.h:257
vtk3DWidget.h
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:64
vtkSphereWidget::OnLeftButtonDown
void OnLeftButtonDown()
vtkSphereWidget::OnRightButtonUp
void OnRightButtonUp()
vtkX3D::radius
@ radius
Definition: vtkX3D.h:252
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:69
vtkSphereWidget::Positioning
@ Positioning
Definition: vtkSphereWidget.h:237
vtkSphereWidget::HandleSource
vtkSphereSource * HandleSource
Definition: vtkSphereWidget.h:290