Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# vtkSphereWidget Class Reference

`#include <vtkSphereWidget.h>`

Inheritance diagram for vtkSphereWidget:

[legend]
Collaboration diagram for vtkSphereWidget:

[legend]
List of all members.

## Detailed Description

3D widget for manipulating a sphere

Date:
  2002/09/07 11:18:36

Revision:
  1.14

This 3D widget defines a sphere that can be interactively placed in a scene.

To use this object, just invoke SetInteractor() with the argument of the method a vtkRenderWindowInteractor. You may also wish to invoke "PlaceWidget()" to initially position the widget. The interactor will act normally until the "i" key (for "interactor") is pressed, at which point the vtkSphereWidget will appear. (See superclass documentation for information about changing this behavior.) Events that occur outside of the widget (i.e., no part of the widget is picked) are propagated to any other registered obsevers (such as the interaction style). Turn off the widget by pressing the "i" key again (or invoke the Off() method).

The vtkSphereWidget has several methods that can be used in conjunction with other VTK objects. The Set/GetThetaResolution() and Set/GetPhiResolution() methods control the number of subdivisions of the sphere in the theta and phi directions; the GetPolyData() method can be used to get the polygonal representation and can be used for things like seeding streamlines. The GetSphere() method returns a sphere implicit function that can be used for cutting and clipping. Typical usage of the widget is to make use of the StartInteractionEvent, InteractionEvent, and EndInteractionEvent events. The InteractionEvent is called on mouse motion; the other two events are called on button down and button up (any mouse button).

Some additional features of this class include the ability to control the properties of the widget. You can set the properties of the selected and unselected representations of the sphere.

Warning:
  Note that the sphere can be picked even when they are "behind" other actors. This is an intended feature and not a bug.

See also:
  vtk3DWidget vtkLineWidget vtkBoxWidget vtkPlaneWidget

Events:
  vtkCommand::EnableEvent vtkCommand::EndInteractionEvent vtkCommand::InteractionEvent vtkCommand::DisableEvent vtkCommand::StartInteractionEvent

Created by:
  - Schroeder, Will

CVS contributions (if > 5%):
  - Schroeder, Will (92%)

CVS logs (CVSweb):
  - .`cxx` (`/Hybrid/vtkSphereWidget.cxx)`
  - .`h` (`/Hybrid/vtkSphereWidget.h)`

Examples:
  vtkSphereWidget (Examples)

Definition at line 95 of file vtkSphereWidget.h.

## Public Types
typedef vtk3DWidget | Superclass
## Public Methods
virtual const char * | GetClassName ()
virtual int | IsA (const char *type)
void | PrintSelf (ostream &os, vtkIndent indent)
void | GetPolyData (vtkPolyData *pd)
void | GetSphere (vtkSphere *sphere)
virtual void | SetEnabled (int)
virtual void | PlaceWidget (float bounds[6])
void | PlaceWidget ()
void | PlaceWidget (float xmin, float xmax, float ymin, float ymax, float zmin, float zmax)
virtual void | SetRepresentation (int)
virtual int | GetRepresentation ()
void | SetRepresentationToOff ()
void | SetRepresentationToWireframe ()
void | SetRepresentationToSurface ()
void | SetThetaResolution (int r)
int | GetThetaResolution ()
void | SetPhiResolution (int r)
int | GetPhiResolution ()
void | SetRadius (float r)
float | GetRadius ()
void | SetCenter (float x, float y, float z)
void | SetCenter (float x[3])
float * | GetCenter ()
void | GetCenter (float xyz[3])
virtual void | SetTranslation (int)
virtual int | GetTranslation ()
virtual void | TranslationOn ()
virtual void | TranslationOff ()
virtual void | SetScale (int)
virtual int | GetScale ()
virtual void | ScaleOn ()
virtual void | ScaleOff ()
virtual void | SetHandleVisibility (int)
virtual int | GetHandleVisibility ()
virtual void | HandleVisibilityOn ()
virtual void | HandleVisibilityOff ()
virtual void | SetHandleDirection (float, float, float)
virtual void | SetHandleDirection (float[3])
virtual float * | GetHandleDirection ()
virtual void | GetHandleDirection (float &, float &, float &)
virtual void | GetHandleDirection (float[3])
virtual float * | GetHandlePosition ()
virtual void | GetHandlePosition (float &, float &, float &)
virtual void | GetHandlePosition (float[3])
virtual vtkProperty * | GetSphereProperty ()
virtual vtkProperty * | GetSelectedSphereProperty ()
virtual vtkProperty * | GetHandleProperty ()
virtual vtkProperty * | GetSelectedHandleProperty ()
## Static Public Methods
vtkSphereWidget * | New ()
int | IsTypeOf (const char *type)
vtkSphereWidget * | SafeDownCast (vtkObject *o)
## Protected Types
enum | WidgetState { Start = 0, Moving, Scaling, Positioning, Outside }
## Protected Methods
| vtkSphereWidget ()
| ~vtkSphereWidget ()
void | OnLeftButtonDown ()
void | OnLeftButtonUp ()
void | OnRightButtonDown ()
void | OnRightButtonUp ()
void | OnMouseMove ()
void | HighlightSphere (int highlight)
void | SelectRepresentation ()
void | Translate (double *p1, double *p2)
void | ScaleSphere (double *p1, double *p2, int X, int Y)
void | MoveHandle (double *p1, double *p2, int X, int Y)
void | PlaceHandle (float *center, float radius)
void | CreateDefaultProperties ()
void | HighlightHandle (int)
virtual void | SizeHandles ()
## Static Protected Methods
void | ProcessEvents (vtkObject *object, unsigned long event, void *clientdata, void *calldata)
## Protected Attributes
int | State
vtkActor * | SphereActor
vtkPolyDataMapper * | SphereMapper
vtkSphereSource * | SphereSource
int | Representation
vtkCellPicker * | Picker
int | Translation
int | Scale
vtkProperty * | SphereProperty
vtkProperty * | SelectedSphereProperty
vtkProperty * | HandleProperty
vtkProperty * | SelectedHandleProperty
vtkActor * | HandleActor
vtkPolyDataMapper * | HandleMapper
vtkSphereSource * | HandleSource
int | HandleVisibility
float | HandleDirection [3]
float | HandlePosition [3]

## Member Typedef Documentation

typedef vtk3DWidget vtkSphereWidget::Superclass

| Reimplemented from vtk3DWidget. Definition at line 101 of file vtkSphereWidget.h.

## Member Enumeration Documentation

enum vtkSphereWidget::WidgetState`[protected]`

  | Enumeration values:
  Start |
  Moving |
  Scaling |
  Positioning |
  Outside |
Definition at line 242 of file vtkSphereWidget.h.

## Constructor & Destructor Documentation

vtkSphereWidget::vtkSphereWidget | ( |  | ) | `[protected]`

vtkSphereWidget::~vtkSphereWidget | ( |  | ) | `[protected]`

## Member Function Documentation

vtkSphereWidget* vtkSphereWidget::New | ( |  | ) | `[static]`

| Instantiate the object. Reimplemented from vtkObject.

virtual const char* vtkSphereWidget::GetClassName | ( |  | ) | `[virtual]`

| Reimplemented from vtk3DWidget.

int vtkSphereWidget::IsTypeOf | ( | const char * | type | ) | `[static]`

| Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h. Reimplemented from vtk3DWidget.

virtual int vtkSphereWidget::IsA | ( | const char * | type | ) | `[virtual]`

| Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h. Reimplemented from vtk3DWidget.

vtkSphereWidget* vtkSphereWidget::SafeDownCast | ( | vtkObject * | o | ) | `[static]`

| Reimplemented from vtk3DWidget.

void vtkSphereWidget::PrintSelf | ( | ostream & | os,
|  | vtkIndent | indent
| ) | `[virtual]`

| Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes. Reimplemented from vtk3DWidget.

virtual void vtkSphereWidget::SetEnabled | ( | int |  | ) | `[virtual]`

| Methods that satisfy the superclass' API. Implements vtkInteractorObserver.

virtual void vtkSphereWidget::PlaceWidget | ( | float | bounds[6] | ) | `[virtual]`

| Methods that satisfy the superclass' API. Implements vtk3DWidget.

void vtkSphereWidget::PlaceWidget | ( |  | ) | `[inline]`

| Methods that satisfy the superclass' API. Reimplemented from vtk3DWidget. Definition at line 108 of file vtkSphereWidget.h.

void vtkSphereWidget::PlaceWidget | ( | float | xmin,
|  | float | xmax,
|  | float | ymin,
|  | float | ymax,
|  | float | zmin,
|  | float | zmax
| ) | `[inline]`

| Methods that satisfy the superclass' API. Reimplemented from vtk3DWidget. Definition at line 110 of file vtkSphereWidget.h.

virtual void vtkSphereWidget::SetRepresentation | ( | int |  | ) | `[virtual]`

| Set the representation of the sphere. Different representations are useful depending on the application.

virtual int vtkSphereWidget::GetRepresentation | ( |  | ) | `[virtual]`

| Set the representation of the sphere. Different representations are useful depending on the application.

void vtkSphereWidget::SetRepresentationToOff | ( |  | ) | `[inline]`

| Set the representation of the sphere. Different representations are useful depending on the application. Definition at line 120 of file vtkSphereWidget.h. References VTK_SPHERE_OFF.

void vtkSphereWidget::SetRepresentationToWireframe | ( |  | ) | `[inline]`

| Set the representation of the sphere. Different representations are useful depending on the application. Definition at line 122 of file vtkSphereWidget.h. References VTK_SPHERE_WIREFRAME.

void vtkSphereWidget::SetRepresentationToSurface | ( |  | ) | `[inline]`

| Set the representation of the sphere. Different representations are useful depending on the application. Definition at line 124 of file vtkSphereWidget.h. References VTK_SPHERE_SURFACE.

void vtkSphereWidget::SetThetaResolution | ( | int | r | ) | `[inline]`

| Set/Get the resolution of the sphere in the Theta direction. Definition at line 130 of file vtkSphereWidget.h.

int vtkSphereWidget::GetThetaResolution | ( |  | ) | `[inline]`

| Set/Get the resolution of the sphere in the Theta direction. Definition at line 132 of file vtkSphereWidget.h.

void vtkSphereWidget::SetPhiResolution | ( | int | r | ) | `[inline]`

| Set/Get the resolution of the sphere in the Phi direction. Definition at line 138 of file vtkSphereWidget.h.

int vtkSphereWidget::GetPhiResolution | ( |  | ) | `[inline]`

| Set/Get the resolution of the sphere in the Phi direction. Definition at line 140 of file vtkSphereWidget.h.

void vtkSphereWidget::SetRadius | ( | float | r | ) | `[inline]`

| Set/Get the radius of sphere. Default is .5. Definition at line 146 of file vtkSphereWidget.h.

float vtkSphereWidget::GetRadius | ( |  | ) | `[inline]`

| Set/Get the radius of sphere. Default is .5. Definition at line 154 of file vtkSphereWidget.h.

void vtkSphereWidget::SetCenter | ( | float | x,
|  | float | y,
|  | float | z
| ) | `[inline]`

| Set/Get the center of the sphere. Definition at line 160 of file vtkSphereWidget.h.

void vtkSphereWidget::SetCenter | ( | float | x[3] | ) | `[inline]`

| Set/Get the center of the sphere. Definition at line 164 of file vtkSphereWidget.h.

float* vtkSphereWidget::GetCenter | ( |  | ) | `[inline]`

| Set/Get the center of the sphere. Definition at line 168 of file vtkSphereWidget.h.

void vtkSphereWidget::GetCenter | ( | float | xyz[3] | ) | `[inline]`

| Set/Get the center of the sphere. Definition at line 170 of file vtkSphereWidget.h.

virtual void vtkSphereWidget::SetTranslation | ( | int |  | ) | `[virtual]`

| Enable translation and scaling of the widget. By default, the widget can be translated and rotated.

virtual int vtkSphereWidget::GetTranslation | ( |  | ) | `[virtual]`

| Enable translation and scaling of the widget. By default, the widget can be translated and rotated.

virtual void vtkSphereWidget::TranslationOn | ( |  | ) | `[virtual]`

| Enable translation and scaling of the widget. By default, the widget can be translated and rotated.

virtual void vtkSphereWidget::TranslationOff | ( |  | ) | `[virtual]`

| Enable translation and scaling of the widget. By default, the widget can be translated and rotated.

virtual void vtkSphereWidget::SetScale | ( | int |  | ) | `[virtual]`

| Enable translation and scaling of the widget. By default, the widget can be translated and rotated.

virtual int vtkSphereWidget::GetScale | ( |  | ) | `[virtual]`

| Enable translation and scaling of the widget. By default, the widget can be translated and rotated.

virtual void vtkSphereWidget::ScaleOn | ( |  | ) | `[virtual]`

| Enable translation and scaling of the widget. By default, the widget can be translated and rotated.

virtual void vtkSphereWidget::ScaleOff | ( |  | ) | `[virtual]`

| Enable translation and scaling of the widget. By default, the widget can be translated and rotated.

virtual void vtkSphereWidget::SetHandleVisibility | ( | int |  | ) | `[virtual]`

| The handle sits on the surface of the sphere and may be moved around the surface by picking (left mouse) and then moving. The position of the handle can be retrieved, this is useful for positioning cameras and lights. By default, the handle is turned off.

virtual int vtkSphereWidget::GetHandleVisibility | ( |  | ) | `[virtual]`

| The handle sits on the surface of the sphere and may be moved around the surface by picking (left mouse) and then moving. The position of the handle can be retrieved, this is useful for positioning cameras and lights. By default, the handle is turned off.

virtual void vtkSphereWidget::HandleVisibilityOn | ( |  | ) | `[virtual]`

| The handle sits on the surface of the sphere and may be moved around the surface by picking (left mouse) and then moving. The position of the handle can be retrieved, this is useful for positioning cameras and lights. By default, the handle is turned off.

virtual void vtkSphereWidget::HandleVisibilityOff | ( |  | ) | `[virtual]`

| The handle sits on the surface of the sphere and may be moved around the surface by picking (left mouse) and then moving. The position of the handle can be retrieved, this is useful for positioning cameras and lights. By default, the handle is turned off.

virtual void vtkSphereWidget::SetHandleDirection | ( | float | ,
|  | float | ,
|  | float |
| ) | `[virtual]`

| Set/Get the direction vector of the handle relative to the center of the sphere.

virtual void vtkSphereWidget::SetHandleDirection | ( | float | [3] | ) | `[virtual]`

| Set/Get the direction vector of the handle relative to the center of the sphere.

virtual float* vtkSphereWidget::GetHandleDirection | ( |  | ) | `[virtual]`

| Set/Get the direction vector of the handle relative to the center of the sphere.

virtual void vtkSphereWidget::GetHandleDirection | ( | float & | ,
|  | float & | ,
|  | float & |
| ) | `[virtual]`

| Set/Get the direction vector of the handle relative to the center of the sphere.

virtual void vtkSphereWidget::GetHandleDirection | ( | float | [3] | ) | `[virtual]`

| Set/Get the direction vector of the handle relative to the center of the sphere.

virtual float* vtkSphereWidget::GetHandlePosition | ( |  | ) | `[virtual]`

| Get the position of the handle.

virtual void vtkSphereWidget::GetHandlePosition | ( | float & | ,
|  | float & | ,
|  | float & |
| ) | `[virtual]`

| Get the position of the handle.

virtual void vtkSphereWidget::GetHandlePosition | ( | float | [3] | ) | `[virtual]`

| Get the position of the handle.

void vtkSphereWidget::GetPolyData | ( | vtkPolyData * | pd | ) |

| Grab the polydata (including points) that defines the sphere. The polydata consists of n+1 points, where n is the resolution of the sphere. These point values are guaranteed to be up-to-date when either the InteractionEvent or EndInteraction events are invoked. The user provides the vtkPolyData and the points and polysphere are added to it.

void vtkSphereWidget::GetSphere | ( | vtkSphere * | sphere | ) |

| Get the spherical implicit function defined by this widget. Note that vtkPlanes is a subclass of vtkImplicitFunction, meaning that it can be used by a variety of filters to perform clipping, cutting, and selection of data.

virtual vtkProperty* vtkSphereWidget::GetSphereProperty | ( |  | ) | `[virtual]`

| Get the sphere properties. The properties of the sphere when selected and unselected can be manipulated.

virtual vtkProperty* vtkSphereWidget::GetSelectedSphereProperty | ( |  | ) | `[virtual]`

| Get the sphere properties. The properties of the sphere when selected and unselected can be manipulated.

virtual vtkProperty* vtkSphereWidget::GetHandleProperty | ( |  | ) | `[virtual]`

| Get the handle properties (the little ball on the sphere is the handle). The properties of the handle when selected and unselected can be manipulated.

virtual vtkProperty* vtkSphereWidget::GetSelectedHandleProperty | ( |  | ) | `[virtual]`

| Get the handle properties (the little ball on the sphere is the handle). The properties of the handle when selected and unselected can be manipulated.

void vtkSphereWidget::ProcessEvents | ( | vtkObject * | object,
|  | unsigned long | event,
|  | void * | clientdata,
|  | void * | calldata
| ) | `[static, protected]`

| Handles the char widget activation event. Also handles the delete event. Reimplemented from vtkInteractorObserver.

void vtkSphereWidget::OnLeftButtonDown | ( |  | ) | `[protected]`

void vtkSphereWidget::OnLeftButtonUp | ( |  | ) | `[protected]`

void vtkSphereWidget::OnRightButtonDown | ( |  | ) | `[protected]`

void vtkSphereWidget::OnRightButtonUp | ( |  | ) | `[protected]`

void vtkSphereWidget::OnMouseMove | ( |  | ) | `[protected]`

void vtkSphereWidget::HighlightSphere | ( | int | highlight | ) | `[protected]`

void vtkSphereWidget::SelectRepresentation | ( |  | ) | `[protected]`

void vtkSphereWidget::Translate | ( | double * | p1,
|  | double * | p2
| ) | `[protected]`

void vtkSphereWidget::ScaleSphere | ( | double * | p1,
|  | double * | p2,
|  | int | X,
|  | int | Y
| ) | `[protected]`

void vtkSphereWidget::MoveHandle | ( | double * | p1,
|  | double * | p2,
|  | int | X,
|  | int | Y
| ) | `[protected]`

void vtkSphereWidget::PlaceHandle | ( | float * | center,
|  | float | radius
| ) | `[protected]`

void vtkSphereWidget::CreateDefaultProperties | ( |  | ) | `[protected]`

void vtkSphereWidget::HighlightHandle | ( | int |  | ) | `[protected]`

virtual void vtkSphereWidget::SizeHandles | ( |  | ) | `[protected, virtual]`

| Reimplemented from vtk3DWidget.

## Member Data Documentation

int vtkSphereWidget::State`[protected]`

| Definition at line 241 of file vtkSphereWidget.h.

vtkActor* vtkSphereWidget::SphereActor`[protected]`

| Definition at line 266 of file vtkSphereWidget.h.

vtkPolyDataMapper* vtkSphereWidget::SphereMapper`[protected]`

| Definition at line 267 of file vtkSphereWidget.h.

vtkSphereSource* vtkSphereWidget::SphereSource`[protected]`

| Definition at line 268 of file vtkSphereWidget.h.

int vtkSphereWidget::Representation`[protected]`

| Definition at line 273 of file vtkSphereWidget.h.

vtkCellPicker* vtkSphereWidget::Picker`[protected]`

| Definition at line 276 of file vtkSphereWidget.h.

int vtkSphereWidget::Translation`[protected]`

| Definition at line 279 of file vtkSphereWidget.h.

int vtkSphereWidget::Scale`[protected]`

| Definition at line 280 of file vtkSphereWidget.h.

vtkProperty* vtkSphereWidget::SphereProperty`[protected]`

| Definition at line 288 of file vtkSphereWidget.h.

vtkProperty* vtkSphereWidget::SelectedSphereProperty`[protected]`

| Definition at line 289 of file vtkSphereWidget.h.

vtkProperty* vtkSphereWidget::HandleProperty`[protected]`

| Definition at line 290 of file vtkSphereWidget.h.

vtkProperty* vtkSphereWidget::SelectedHandleProperty`[protected]`

| Definition at line 291 of file vtkSphereWidget.h.

vtkActor* vtkSphereWidget::HandleActor`[protected]`

| Definition at line 295 of file vtkSphereWidget.h.

vtkPolyDataMapper* vtkSphereWidget::HandleMapper`[protected]`

| Definition at line 296 of file vtkSphereWidget.h.

vtkSphereSource* vtkSphereWidget::HandleSource`[protected]`

| Definition at line 297 of file vtkSphereWidget.h.

int vtkSphereWidget::HandleVisibility`[protected]`

| Definition at line 299 of file vtkSphereWidget.h.

float vtkSphereWidget::HandleDirection[3]`[protected]`

| Definition at line 300 of file vtkSphereWidget.h.

float vtkSphereWidget::HandlePosition[3]`[protected]`

| Definition at line 301 of file vtkSphereWidget.h.

The documentation for this class was generated from the following file:

- Hybrid/vtkSphereWidget.h