VTK
vtkPointHandleRepresentation3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPointHandleRepresentation3D.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 vtkPointHandleRepresentation3D_h
30 #define vtkPointHandleRepresentation3D_h
31 
32 #include "vtkInteractionWidgetsModule.h" // For export macro
34 #include "vtkCursor3D.h" // Needed for delegation to cursor3D
35 
36 class vtkCursor3D;
37 class vtkProperty;
38 class vtkActor;
39 class vtkPolyDataMapper;
40 class vtkCellPicker;
41 
43 {
44 public:
47 
49 
51  void PrintSelf(ostream& os, vtkIndent indent);
53 
55 
60  virtual void SetWorldPosition(double p[3]);
61  virtual void SetDisplayPosition(double p[3]);
63 
65 
66  void SetOutline(int o)
67  {this->Cursor3D->SetOutline(o);}
68  int GetOutline()
69  {return this->Cursor3D->GetOutline();}
70  void OutlineOn()
71  {this->Cursor3D->OutlineOn();}
72  void OutlineOff()
73  {this->Cursor3D->OutlineOff();}
75 
77 
78  void SetXShadows(int o)
79  {this->Cursor3D->SetXShadows(o);}
81  {return this->Cursor3D->GetXShadows();}
82  void XShadowsOn()
83  {this->Cursor3D->XShadowsOn();}
84  void XShadowsOff()
85  {this->Cursor3D->XShadowsOff();}
87 
89 
90  void SetYShadows(int o)
91  {this->Cursor3D->SetYShadows(o);}
93  {return this->Cursor3D->GetYShadows();}
94  void YShadowsOn()
95  {this->Cursor3D->YShadowsOn();}
96  void YShadowsOff()
97  {this->Cursor3D->YShadowsOff();}
99 
101 
102  void SetZShadows(int o)
103  {this->Cursor3D->SetZShadows(o);}
105  {return this->Cursor3D->GetZShadows();}
106  void ZShadowsOn()
107  {this->Cursor3D->ZShadowsOn();}
108  void ZShadowsOff()
109  {this->Cursor3D->ZShadowsOff();}
111 
113 
123  void SetTranslationMode(int mode);
124  vtkGetMacro(TranslationMode,int);
125  vtkBooleanMacro(TranslationMode,int);
127 
129 
130  void AllOn()
131  {
132  this->OutlineOn();
133  this->XShadowsOn();
134  this->YShadowsOn();
135  this->ZShadowsOn();
136  }
137  void AllOff()
138  {
139  this->OutlineOff();
140  this->XShadowsOff();
141  this->YShadowsOff();
142  this->ZShadowsOff();
143  }
145 
147 
148  void SetProperty(vtkProperty*);
149  void SetSelectedProperty(vtkProperty*);
150  vtkGetObjectMacro(Property,vtkProperty);
151  vtkGetObjectMacro(SelectedProperty,vtkProperty);
153 
155 
159  vtkSetClampMacro(HotSpotSize,double,0.0,1.0);
160  vtkGetMacro(HotSpotSize,double);
162 
165  virtual void SetHandleSize(double size);
166 
168 
170  virtual double *GetBounds();
171  virtual void BuildRepresentation();
172  virtual void StartWidgetInteraction(double eventPos[2]);
173  virtual void WidgetInteraction(double eventPos[2]);
174  virtual int ComputeInteractionState(int X, int Y, int modify=0);
175  virtual void PlaceWidget(double bounds[6]);
177 
179 
180  virtual void ShallowCopy(vtkProp *prop);
181  virtual void DeepCopy(vtkProp *prop);
182  virtual void GetActors(vtkPropCollection *);
183  virtual void ReleaseGraphicsResources(vtkWindow *);
184  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
185  virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport);
186  virtual int HasTranslucentPolygonalGeometry();
188 
189  void Highlight(int highlight);
190 
192 
202  vtkSetMacro( SmoothMotion, int );
203  vtkGetMacro( SmoothMotion, int );
204  vtkBooleanMacro( SmoothMotion, int );
206 
207 protected:
210 
211  // the cursor3D
215 
216 
217  // Do the picking
219  double LastPickPosition[3];
220  double LastEventPosition[2];
221 
222  // Register internal Pickers within PickingManager
223  virtual void RegisterPickers();
224 
225  // Methods to manipulate the cursor
227  void Translate(double *p1, double *p2);
228  void Scale(double *p1, double *p2, double eventPos[2]);
229  void MoveFocus(double *p1, double *p2);
230  void SizeBounds();
231 
232  // Given a motion vector defined by p1 --> p2 (p1 and p2 are in
233  // world coordinates), the new display position of the handle center is
234  // populated into requestedDisplayPos. This is again only a request for the
235  // new display position. It is up to the point placer to deduce the
236  // appropriate world co-ordinates that this display position will map into.
237  // The placer may even disallow such a movement.
238  // If "SmoothMotion" is OFF, the returned requestedDisplayPos is the same
239  // as the event position, ie the location of the mouse cursor. If its OFF,
240  // incremental offsets as described above are used to compute it.
241  void MoveFocusRequest( double *p1, double *p2,
242  double eventPos[2], double requestedDisplayPos[3] );
243 
244  // Properties used to control the appearance of selected objects and
245  // the manipulator in general.
248  void CreateDefaultProperties();
249 
250  // The size of the hot spot.
251  double HotSpotSize;
252  int DetermineConstraintAxis(int constraint, double *x, double *startPoint);
255 
256  // Current handle sized (may reflect scaling)
258 
259  // Control how translation works
261 
263 
264 private:
266  void operator=(const vtkPointHandleRepresentation3D&); //Not implemented
267 };
268 
269 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
virtual void SetWorldPosition(double pos[3])
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract class for representing widget handles
represent the position of a point in 3D space
abstract specification for Viewports
Definition: vtkViewport.h:46
represent surface properties of a geometric object
Definition: vtkProperty.h:63
virtual void StartWidgetInteraction(double eventPos[2])
virtual void SetHandleSize(double)
virtual void ReleaseGraphicsResources(vtkWindow *)
virtual void BuildRepresentation()=0
a list of Props
virtual void ShallowCopy(vtkProp *prop)
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
#define VTKINTERACTIONWIDGETS_EXPORT
virtual int HasTranslucentPolygonalGeometry()
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual void RegisterPickers()
virtual void WidgetInteraction(double newEventPos[2])
virtual void GetActors(vtkPropCollection *)
void PrintSelf(ostream &os, vtkIndent indent)
virtual void DeepCopy(vtkProp *prop)
map vtkPolyData to graphics primitives
virtual int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport))
virtual void PlaceWidget(double *vtkNotUsed(bounds[6]))
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:68
virtual void Highlight(int vtkNotUsed(highlightOn))
generate a 3D cursor representation
Definition: vtkCursor3D.h:38
static vtkObject * New()
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport))
virtual void SetDisplayPosition(double pos[3])