VTK
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 
30 #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
42 {
43 public:
48 
50 
54  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
58 
65  void SetWorldPosition(double p[3]) override;
66  void SetDisplayPosition(double p[3]) override;
68 
70 
78  vtkSetMacro(TranslationMode,vtkTypeBool);
79  vtkGetMacro(TranslationMode,vtkTypeBool);
80  vtkBooleanMacro(TranslationMode,vtkTypeBool);
82 
83  void SetSphereRadius(double);
84  double GetSphereRadius();
85 
87 
90  void SetProperty(vtkProperty*);
91  void SetSelectedProperty(vtkProperty*);
92  vtkGetObjectMacro(Property,vtkProperty);
93  vtkGetObjectMacro(SelectedProperty,vtkProperty);
95 
97 
103  vtkSetClampMacro(HotSpotSize,double,0.0,1.0);
104  vtkGetMacro(HotSpotSize,double);
106 
111  void SetHandleSize(double size) override;
112 
114 
117  double *GetBounds() VTK_SIZEHINT(6) override;
118  void BuildRepresentation() override;
119  void StartWidgetInteraction(double eventPos[2]) override;
120  void WidgetInteraction(double eventPos[2]) override;
121  int ComputeInteractionState(int X, int Y, int modify=0) override;
122  void PlaceWidget(double bounds[6]) override;
124 
126 
129  void ShallowCopy(vtkProp *prop) override;
130  void DeepCopy(vtkProp *prop) override;
131  void GetActors(vtkPropCollection *) override;
132  void ReleaseGraphicsResources(vtkWindow *) override;
133  int RenderOpaqueGeometry(vtkViewport *viewport) override;
134  int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override;
135  int HasTranslucentPolygonalGeometry() override;
137 
138  void Highlight(int highlight) override;
139 protected:
141  ~vtkSphereHandleRepresentation() override;
142 
143  // the cursor3D
144  vtkActor *Actor;
147  // void Highlight(int highlight);
148 
149  // Do the picking
150  vtkCellPicker *CursorPicker;
151  double LastPickPosition[3];
152  double LastEventPosition[2];
153 
154  // Register internal Pickers within PickingManager
155  void RegisterPickers() override;
156 
157  // Methods to manipulate the cursor
158  int ConstraintAxis;
159  void Translate(double *p1, double *p2);
160  void Scale(double *p1, double *p2, double eventPos[2]);
161  void MoveFocus(double *p1, double *p2);
162  void SizeBounds();
163 
164  // Properties used to control the appearance of selected objects and
165  // the manipulator in general.
166  vtkProperty *Property;
167  vtkProperty *SelectedProperty;
168  void CreateDefaultProperties();
169 
170  // The size of the hot spot.
171  double HotSpotSize;
172  int DetermineConstraintAxis(int constraint, double *x);
173  int WaitingForMotion;
174  int WaitCount;
175 
176  // Current handle sized (may reflect scaling)
177  double CurrentHandleSize;
178 
179  // Control how translation works
180  vtkTypeBool TranslationMode;
181 
182 private:
184  void operator=(const vtkSphereHandleRepresentation&) = delete;
185 };
186 
187 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:44
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:45
abstract class for representing widget handles
abstract specification for Viewports
Definition: vtkViewport.h:44
represent surface properties of a geometric object
Definition: vtkProperty.h:60
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:34
create a polygonal sphere centered at the origin
a simple class to control print indentation
Definition: vtkIndent.h:33
#define VTK_SIZEHINT(...)
map vtkPolyData to graphics primitives
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:63
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 SetDisplayPosition(double pos[3])
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...