VTK  9.1.0
vtkSphereHandleRepresentation.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkSphereHandleRepresentation.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=========================================================================*/
27#ifndef vtkSphereHandleRepresentation_h
28#define vtkSphereHandleRepresentation_h
29
31#include "vtkInteractionWidgetsModule.h" // For export macro
32#include "vtkSphereSource.h" // Needed for delegation to sphere
33
34class vtkSphereSource;
35class vtkProperty;
36class vtkActor;
38class vtkCellPicker;
39
40class VTKINTERACTIONWIDGETS_EXPORT vtkSphereHandleRepresentation : public vtkHandleRepresentation
41{
42public:
47
49
53 void PrintSelf(ostream& os, vtkIndent indent) override;
55
57
59
66 void SetWorldPosition(double p[3]) override;
67 void SetDisplayPosition(double p[3]) override;
69
71
79 vtkSetMacro(TranslationMode, vtkTypeBool);
80 vtkGetMacro(TranslationMode, vtkTypeBool);
81 vtkBooleanMacro(TranslationMode, vtkTypeBool);
83
84 void SetSphereRadius(double);
86
88
93 vtkGetObjectMacro(Property, vtkProperty);
94 vtkGetObjectMacro(SelectedProperty, vtkProperty);
96
98
104 vtkSetClampMacro(HotSpotSize, double, 0.0, 1.0);
105 vtkGetMacro(HotSpotSize, double);
107
112 void SetHandleSize(double size) override;
113
115
118 double* GetBounds() VTK_SIZEHINT(6) override;
119 void BuildRepresentation() override;
120 void StartWidgetInteraction(double eventPos[2]) override;
121 void WidgetInteraction(double eventPos[2]) override;
122 int ComputeInteractionState(int X, int Y, int modify = 0) override;
123 void PlaceWidget(double bounds[6]) override;
125
127
130 void ShallowCopy(vtkProp* prop) override;
131 void DeepCopy(vtkProp* prop) override;
132 void GetActors(vtkPropCollection*) override;
133 void ReleaseGraphicsResources(vtkWindow*) override;
134 int RenderOpaqueGeometry(vtkViewport* viewport) override;
135 int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
136 vtkTypeBool HasTranslucentPolygonalGeometry() override;
138
139 void Highlight(int highlight) override;
140
141 /*
142 * Register internal Pickers within PickingManager
143 */
144 void RegisterPickers() override;
145
152 void SetVisibility(vtkTypeBool visible) override;
153
154protected:
157
158 // the cursor3D
159 vtkActor* Actor;
162 // void Highlight(int highlight);
163
164 // Do the picking
165 vtkCellPicker* CursorPicker;
166 double LastPickPosition[3];
167 double LastEventPosition[2];
168
169 // Methods to manipulate the cursor
170 int ConstraintAxis;
171 void Translate(const double* p1, const double* p2) override;
172 void Scale(const double* p1, const double* p2, const double eventPos[2]);
173 void MoveFocus(const double* p1, const double* p2);
174 void SizeBounds();
175
176 // Properties used to control the appearance of selected objects and
177 // the manipulator in general.
178 vtkProperty* Property;
179 vtkProperty* SelectedProperty;
180 void CreateDefaultProperties();
181
182 // The size of the hot spot.
183 double HotSpotSize;
184 int WaitingForMotion;
185 int WaitCount;
186
187 // Current handle sized (may reflect scaling)
188 double CurrentHandleSize;
189
190 // Control how translation works
191 vtkTypeBool TranslationMode;
192
193private:
195 void operator=(const vtkSphereHandleRepresentation&) = delete;
196};
197
198#endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:96
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:113
map vtkPolyData to graphics primitives
an ordered list of Props
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:76
represent surface properties of a geometric object
Definition: vtkProperty.h:171
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:47
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_SIZEHINT(...)