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 =========================================================================*/
30 #ifndef vtkSphereHandleRepresentation_h
31 #define vtkSphereHandleRepresentation_h
32 
33 #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
45 {
46 public:
51 
53 
57  void PrintSelf(ostream& os, vtkIndent indent) override;
59 
61 
68  void SetWorldPosition(double p[3]) override;
69  void SetDisplayPosition(double p[3]) override;
71 
73 
81  vtkSetMacro(TranslationMode,vtkTypeBool);
82  vtkGetMacro(TranslationMode,vtkTypeBool);
83  vtkBooleanMacro(TranslationMode,vtkTypeBool);
85 
86  void SetSphereRadius(double);
87  double GetSphereRadius();
88 
90 
93  void SetProperty(vtkProperty*);
94  void SetSelectedProperty(vtkProperty*);
95  vtkGetObjectMacro(Property,vtkProperty);
96  vtkGetObjectMacro(SelectedProperty,vtkProperty);
98 
100 
106  vtkSetClampMacro(HotSpotSize,double,0.0,1.0);
107  vtkGetMacro(HotSpotSize,double);
109 
114  void SetHandleSize(double size) override;
115 
117 
120  double *GetBounds() VTK_SIZEHINT(6) override;
121  void BuildRepresentation() override;
122  void StartWidgetInteraction(double eventPos[2]) override;
123  void WidgetInteraction(double eventPos[2]) override;
124  int ComputeInteractionState(int X, int Y, int modify=0) override;
125  void PlaceWidget(double bounds[6]) override;
127 
129 
132  void ShallowCopy(vtkProp *prop) override;
133  void DeepCopy(vtkProp *prop) override;
134  void GetActors(vtkPropCollection *) override;
135  void ReleaseGraphicsResources(vtkWindow *) override;
136  int RenderOpaqueGeometry(vtkViewport *viewport) override;
137  int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override;
138  vtkTypeBool HasTranslucentPolygonalGeometry() override;
140 
141  void Highlight(int highlight) override;
142 
143  /*
144  * Register internal Pickers within PickingManager
145  */
146  void RegisterPickers() override;
147 
148 protected:
150  ~vtkSphereHandleRepresentation() override;
151 
152  // the cursor3D
153  vtkActor *Actor;
156  // void Highlight(int highlight);
157 
158  // Do the picking
159  vtkCellPicker *CursorPicker;
160  double LastPickPosition[3];
161  double LastEventPosition[2];
162 
163  // Methods to manipulate the cursor
164  int ConstraintAxis;
165  void Translate(double *p1, double *p2);
166  void Scale(double *p1, double *p2, double eventPos[2]);
167  void MoveFocus(double *p1, double *p2);
168  void SizeBounds();
169 
170  // Properties used to control the appearance of selected objects and
171  // the manipulator in general.
172  vtkProperty *Property;
173  vtkProperty *SelectedProperty;
174  void CreateDefaultProperties();
175 
176  // The size of the hot spot.
177  double HotSpotSize;
178  int DetermineConstraintAxis(int constraint, double *x);
179  int WaitingForMotion;
180  int WaitCount;
181 
182  // Current handle sized (may reflect scaling)
183  double CurrentHandleSize;
184 
185  // Control how translation works
186  vtkTypeBool TranslationMode;
187 
188 private:
189  vtkSphereHandleRepresentation(const vtkSphereHandleRepresentation&) = delete;
190  void operator=(const vtkSphereHandleRepresentation&) = delete;
191 };
192 
193 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
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:47
represent surface properties of a geometric object
Definition: vtkProperty.h:66
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:37
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:69
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)...