VTK  9.3.20240328
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 
25 VTK_ABI_NAMESPACE_BEGIN
26 class vtkSphereSource;
27 class vtkProperty;
28 class vtkActor;
29 class vtkPolyDataMapper;
30 class vtkCellPicker;
31 
32 class VTKINTERACTIONWIDGETS_EXPORT vtkSphereHandleRepresentation : public vtkHandleRepresentation
33 {
34 public:
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);
77  double GetSphereRadius();
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 
146 protected:
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 
185 private:
187  void operator=(const vtkSphereHandleRepresentation&) = delete;
188 };
189 
190 VTK_ABI_NAMESPACE_END
191 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:150
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:91
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:65
represent surface properties of a geometric object
Definition: vtkProperty.h:166
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.
static vtkSphereHandleRepresentation * New()
Instantiate this class.
void SetSelectedProperty(vtkProperty *)
Set/Get the handle properties when unselected and selected.
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.
void SetHandleSize(double size) override
Overload the superclasses SetHandleSize() method to update internal variables.
double * GetBounds() override
Methods to make this class properly act like a vtkWidgetRepresentation.
create a polygonal sphere centered at the origin
abstract specification for Viewports
Definition: vtkViewport.h:64
window superclass for vtkRenderWindow
Definition: vtkWindow.h:47
@ Sphere
Definition: vtkX3D.h:64
@ size
Definition: vtkX3D.h:253
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_SIZEHINT(...)