VTK  9.4.20250203
vtkSphereHandleRepresentation.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
18#ifndef vtkSphereHandleRepresentation_h
19#define vtkSphereHandleRepresentation_h
20
22#include "vtkInteractionWidgetsModule.h" // For export macro
23#include "vtkSphereSource.h" // Needed for delegation to sphere
24
25VTK_ABI_NAMESPACE_BEGIN
26class vtkSphereSource;
27class vtkProperty;
28class vtkActor;
30class vtkCellPicker;
31
32class VTKINTERACTIONWIDGETS_EXPORT vtkSphereHandleRepresentation : public vtkHandleRepresentation
33{
34public:
39
41
45 void PrintSelf(ostream& os, vtkIndent indent) override;
47
49
51
58 void SetWorldPosition(double p[3]) override;
59 void SetDisplayPosition(double p[3]) override;
61
63
71 vtkSetMacro(TranslationMode, vtkTypeBool);
72 vtkGetMacro(TranslationMode, vtkTypeBool);
73 vtkBooleanMacro(TranslationMode, vtkTypeBool);
75
76 void SetSphereRadius(double);
78
80
85 vtkGetObjectMacro(Property, vtkProperty);
86 vtkGetObjectMacro(SelectedProperty, vtkProperty);
88
90
96 vtkSetClampMacro(HotSpotSize, double, 0.0, 1.0);
97 vtkGetMacro(HotSpotSize, double);
99
104 void SetHandleSize(double size) override;
105
107
110 double* GetBounds() VTK_SIZEHINT(6) override;
111 void BuildRepresentation() override;
112 void StartWidgetInteraction(double eventPos[2]) override;
113 void WidgetInteraction(double eventPos[2]) override;
114 int ComputeInteractionState(int X, int Y, int modify = 0) override;
115 void PlaceWidget(double bounds[6]) override;
117
119
122 void ShallowCopy(vtkProp* prop) override;
123 void DeepCopy(vtkProp* prop) override;
124 void GetActors(vtkPropCollection*) override;
125 void ReleaseGraphicsResources(vtkWindow*) override;
126 int RenderOpaqueGeometry(vtkViewport* viewport) override;
127 int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
128 vtkTypeBool HasTranslucentPolygonalGeometry() override;
130
131 void Highlight(int highlight) override;
132
133 /*
134 * Register internal Pickers within PickingManager
135 */
136 void RegisterPickers() override;
137
144 void SetVisibility(vtkTypeBool visible) override;
145
146protected:
149
150 // the cursor3D
151 vtkActor* Actor;
154 // void Highlight(int highlight);
155
156 // Do the picking
157 vtkCellPicker* CursorPicker;
158 double LastPickPosition[3];
159 double LastEventPosition[2];
160
161 // Methods to manipulate the cursor
162 int ConstraintAxis;
163 void Translate(const double* p1, const double* p2) override;
164 void Scale(const double* p1, const double* p2, const double eventPos[2]);
165 void MoveFocus(const double* p1, const double* p2);
166 void SizeBounds();
167
168 // Properties used to control the appearance of selected objects and
169 // the manipulator in general.
170 vtkProperty* Property;
171 vtkProperty* SelectedProperty;
172 void CreateDefaultProperties();
173
174 // The size of the hot spot.
175 double HotSpotSize;
176 int WaitingForMotion;
177 int WaitCount;
178
179 // Current handle sized (may reflect scaling)
180 double CurrentHandleSize;
181
182 // Control how translation works
183 vtkTypeBool TranslationMode;
184
185private:
187 void operator=(const vtkSphereHandleRepresentation&) = delete;
188};
189
190VTK_ABI_NAMESPACE_END
191#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
ray-cast cell picker for all kinds of Prop3Ds
abstract class for representing widget handles
virtual void Translate(const double *p1, const double *p2)
Translates world position by vector p1p2 projected on the constraint axis if any.
a simple class to control print indentation
Definition vtkIndent.h:108
map vtkPolyData to graphics primitives
an ordered list of Props
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:66
represent surface properties of a geometric object
A spherical rendition of point in 3D space.
void SetDisplayPosition(double p[3]) override
Set the position of the point in world and display coordinates.
void SetProperty(vtkProperty *)
Set/Get the handle properties when unselected and selected.
void SetSelectedProperty(vtkProperty *)
Set/Get the handle properties when unselected and selected.
static vtkSphereHandleRepresentation * New()
Instantiate this class.
void SetWorldPosition(double p[3]) override
Set the position of the point in world and display coordinates.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
double * GetBounds() override
Methods to make this class properly act like a vtkWidgetRepresentation.
void SetHandleSize(double size) override
Overload the superclasses SetHandleSize() method to update internal variables.
create a polygonal sphere centered at the origin
abstract specification for Viewports
Definition vtkViewport.h:65
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_SIZEHINT(...)