VTK  9.0.1
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 
34 class vtkSphereSource;
35 class vtkProperty;
36 class vtkActor;
37 class vtkPolyDataMapper;
38 class vtkCellPicker;
39 
40 class VTKINTERACTIONWIDGETS_EXPORT vtkSphereHandleRepresentation : public vtkHandleRepresentation
41 {
42 public:
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);
85  double GetSphereRadius();
86 
88 
91  void SetProperty(vtkProperty*);
92  void SetSelectedProperty(vtkProperty*);
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 
154 protected:
156  ~vtkSphereHandleRepresentation() override;
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 
193 private:
195  void operator=(const vtkSphereHandleRepresentation&) = delete;
196 };
197 
198 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:36
vtkX3D::Sphere
@ Sphere
Definition: vtkX3D.h:70
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkHandleRepresentation::SetWorldPosition
virtual void SetWorldPosition(double pos[3])
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:55
vtkHandleRepresentation.h
vtkWidgetRepresentation::SetHandleSize
virtual void SetHandleSize(double)
Set/Get the factor that controls the size of the handles that appear as part of the widget (if any).
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkHandleRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkWidgetRepresentation::GetBounds
double * GetBounds() override
Methods to make this class behave as a vtkProp.
Definition: vtkWidgetRepresentation.h:208
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:45
vtkSphereSource
create a polygonal sphere centered at the origin
Definition: vtkSphereSource.h:40
vtkSphereHandleRepresentation
A spherical rendition of point in 3D space.
Definition: vtkSphereHandleRepresentation.h:40
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkX3D::size
@ size
Definition: vtkX3D.h:259
vtkSphereSource.h
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:44
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:53
vtkHandleRepresentation::Translate
virtual void Translate(const double *p1, const double *p2)
Translates world position by vector p1p2 projected on the constraint axis if any.
vtkHandleRepresentation::SetDisplayPosition
virtual void SetDisplayPosition(double pos[3])
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:61
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:35
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:66
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69