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 =========================================================================*/
29 #ifndef __vtkSphereHandleRepresentation_h
30 #define __vtkSphereHandleRepresentation_h
31 
32 #include "vtkInteractionWidgetsModule.h" // For export macro
34 #include "vtkSphereSource.h" // Needed for delegation to sphere
35 
36 class vtkSphereSource;
37 class vtkProperty;
38 class vtkActor;
39 class vtkPolyDataMapper;
40 class vtkCellPicker;
41 
42 class VTKINTERACTIONWIDGETS_EXPORT vtkSphereHandleRepresentation
44 {
45 public:
48 
50 
52  void PrintSelf(ostream& os, vtkIndent indent);
54 
56 
61  virtual void SetWorldPosition(double p[3]);
62  virtual void SetDisplayPosition(double p[3]);
64 
66 
72  vtkSetMacro(TranslationMode,int);
73  vtkGetMacro(TranslationMode,int);
74  vtkBooleanMacro(TranslationMode,int);
76 
77  void SetSphereRadius(double);
78  double GetSphereRadius();
79 
81 
82  void SetProperty(vtkProperty*);
83  void SetSelectedProperty(vtkProperty*);
84  vtkGetObjectMacro(Property,vtkProperty);
85  vtkGetObjectMacro(SelectedProperty,vtkProperty);
87 
89 
93  vtkSetClampMacro(HotSpotSize,double,0.0,1.0);
94  vtkGetMacro(HotSpotSize,double);
96 
99  virtual void SetHandleSize(double size);
100 
102 
104  virtual double *GetBounds();
105  virtual void BuildRepresentation();
106  virtual void StartWidgetInteraction(double eventPos[2]);
107  virtual void WidgetInteraction(double eventPos[2]);
108  virtual int ComputeInteractionState(int X, int Y, int modify=0);
109  virtual void PlaceWidget(double bounds[6]);
111 
113 
114  virtual void ShallowCopy(vtkProp *prop);
115  virtual void DeepCopy(vtkProp *prop);
116  virtual void GetActors(vtkPropCollection *);
117  virtual void ReleaseGraphicsResources(vtkWindow *);
118  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
119  virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport);
120  virtual int HasTranslucentPolygonalGeometry();
122 
123  void Highlight(int highlight);
124 protected:
127 
128  // the cursor3D
132  // void Highlight(int highlight);
133 
134  // Do the picking
136  double LastPickPosition[3];
137  double LastEventPosition[2];
138 
139  // Methods to manipulate the cursor
141  void Translate(double *p1, double *p2);
142  void Scale(double *p1, double *p2, double eventPos[2]);
143  void MoveFocus(double *p1, double *p2);
144  void SizeBounds();
145 
146  // Properties used to control the appearance of selected objects and
147  // the manipulator in general.
150  void CreateDefaultProperties();
151 
152  // The size of the hot spot.
153  double HotSpotSize;
154  int DetermineConstraintAxis(int constraint, double *x);
157 
158  // Current handle sized (may reflect scaling)
160 
161  // Control how translation works
163 
164 private:
166  void operator=(const vtkSphereHandleRepresentation&); //Not implemented
167 };
168 
169 #endif