VTK  9.2.6
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 =========================================================================*/
30 #ifndef vtkSphereHandleRepresentation_h
31 #define vtkSphereHandleRepresentation_h
32 
34 #include "vtkInteractionWidgetsModule.h" // For export macro
35 #include "vtkSphereSource.h" // Needed for delegation to sphere
36 
37 class vtkSphereSource;
38 class vtkProperty;
39 class vtkActor;
40 class vtkPolyDataMapper;
41 class vtkCellPicker;
42 
43 class VTKINTERACTIONWIDGETS_EXPORT vtkSphereHandleRepresentation : public vtkHandleRepresentation
44 {
45 public:
50 
52 
56  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
60 
62 
69  void SetWorldPosition(double p[3]) override;
70  void SetDisplayPosition(double p[3]) override;
72 
74 
82  vtkSetMacro(TranslationMode, vtkTypeBool);
83  vtkGetMacro(TranslationMode, vtkTypeBool);
84  vtkBooleanMacro(TranslationMode, vtkTypeBool);
86 
87  void SetSphereRadius(double);
88  double GetSphereRadius();
89 
91 
94  void SetProperty(vtkProperty*);
95  void SetSelectedProperty(vtkProperty*);
96  vtkGetObjectMacro(Property, vtkProperty);
97  vtkGetObjectMacro(SelectedProperty, vtkProperty);
99 
101 
107  vtkSetClampMacro(HotSpotSize, double, 0.0, 1.0);
108  vtkGetMacro(HotSpotSize, double);
110 
115  void SetHandleSize(double size) override;
116 
118 
121  double* GetBounds() VTK_SIZEHINT(6) override;
122  void BuildRepresentation() override;
123  void StartWidgetInteraction(double eventPos[2]) override;
124  void WidgetInteraction(double eventPos[2]) override;
125  int ComputeInteractionState(int X, int Y, int modify = 0) override;
126  void PlaceWidget(double bounds[6]) override;
128 
130 
133  void ShallowCopy(vtkProp* prop) override;
134  void DeepCopy(vtkProp* prop) override;
135  void GetActors(vtkPropCollection*) override;
136  void ReleaseGraphicsResources(vtkWindow*) override;
137  int RenderOpaqueGeometry(vtkViewport* viewport) override;
138  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
139  vtkTypeBool HasTranslucentPolygonalGeometry() override;
141 
142  void Highlight(int highlight) override;
143 
144  /*
145  * Register internal Pickers within PickingManager
146  */
147  void RegisterPickers() override;
148 
155  void SetVisibility(vtkTypeBool visible) override;
156 
157 protected:
159  ~vtkSphereHandleRepresentation() override;
160 
161  // the cursor3D
162  vtkActor* Actor;
165  // void Highlight(int highlight);
166 
167  // Do the picking
168  vtkCellPicker* CursorPicker;
169  double LastPickPosition[3];
170  double LastEventPosition[2];
171 
172  // Methods to manipulate the cursor
173  int ConstraintAxis;
174  void Translate(const double* p1, const double* p2) override;
175  void Scale(const double* p1, const double* p2, const double eventPos[2]);
176  void MoveFocus(const double* p1, const double* p2);
177  void SizeBounds();
178 
179  // Properties used to control the appearance of selected objects and
180  // the manipulator in general.
181  vtkProperty* Property;
182  vtkProperty* SelectedProperty;
183  void CreateDefaultProperties();
184 
185  // The size of the hot spot.
186  double HotSpotSize;
187  int WaitingForMotion;
188  int WaitCount;
189 
190  // Current handle sized (may reflect scaling)
191  double CurrentHandleSize;
192 
193  // Control how translation works
194  vtkTypeBool TranslationMode;
195 
196 private:
197  vtkSphereHandleRepresentation(const vtkSphereHandleRepresentation&) = delete;
198  void operator=(const vtkSphereHandleRepresentation&) = delete;
199 };
200 
201 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:56
virtual void SetWorldPosition(double pos[3])
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
abstract class for representing widget handles
abstract specification for Viewports
Definition: vtkViewport.h:55
represent surface properties of a geometric object
Definition: vtkProperty.h:67
virtual void SetHandleSize(double)
Set/Get the factor that controls the size of the handles that appear as part of the widget (if any)...
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
double * GetBounds() override
Methods to make this class behave as a vtkProp.
an ordered list of Props
int vtkTypeBool
Definition: vtkABI.h:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
create a polygonal sphere centered at the origin
a simple class to control print indentation
Definition: vtkIndent.h:39
#define VTK_SIZEHINT(...)
map vtkPolyData to graphics primitives
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:72
A spherical rendition of point in 3D space.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual void Translate(const double *p1, const double *p2)
Translates world position by vector p1p2 projected on the constraint axis if any. ...
virtual void SetDisplayPosition(double pos[3])
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...