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 
33 #include "vtkCursor3D.h" // Needed for delegation to cursor3D
34 
35 class vtkCursor3D;
36 class vtkProperty;
37 class vtkActor;
38 class vtkPolyDataMapper;
39 class vtkCellPicker;
40 
42 {
43 public:
46 
48 
50  void PrintSelf(ostream& os, vtkIndent indent);
52 
54 
59  virtual void SetWorldPosition(double p[3]);
60  virtual void SetDisplayPosition(double p[3]);
62 
64 
65  void SetOutline(int o)
66  {this->Cursor3D->SetOutline(o);}
67  int GetOutline()
68  {return this->Cursor3D->GetOutline();}
69  void OutlineOn()
70  {this->Cursor3D->OutlineOn();}
71  void OutlineOff()
72  {this->Cursor3D->OutlineOff();}
74 
76 
77  void SetXShadows(int o)
78  {this->Cursor3D->SetXShadows(o);}
79  int GetXShadows()
80  {return this->Cursor3D->GetXShadows();}
81  void XShadowsOn()
82  {this->Cursor3D->XShadowsOn();}
83  void XShadowsOff()
84  {this->Cursor3D->XShadowsOff();}
86 
88 
89  void SetYShadows(int o)
90  {this->Cursor3D->SetYShadows(o);}
91  int GetYShadows()
92  {return this->Cursor3D->GetYShadows();}
93  void YShadowsOn()
94  {this->Cursor3D->YShadowsOn();}
95  void YShadowsOff()
96  {this->Cursor3D->YShadowsOff();}
98 
100 
101  void SetZShadows(int o)
102  {this->Cursor3D->SetZShadows(o);}
103  int GetZShadows()
104  {return this->Cursor3D->GetZShadows();}
105  void ZShadowsOn()
106  {this->Cursor3D->ZShadowsOn();}
107  void ZShadowsOff()
108  {this->Cursor3D->ZShadowsOff();}
110 
112 
122  void SetTranslationMode(int mode);
123  vtkGetMacro(TranslationMode,int);
124  vtkBooleanMacro(TranslationMode,int);
126 
128 
129  void AllOn()
130  {
131  this->OutlineOn();
132  this->XShadowsOn();
133  this->YShadowsOn();
134  this->ZShadowsOn();
135  }
136  void AllOff()
137  {
138  this->OutlineOff();
139  this->XShadowsOff();
140  this->YShadowsOff();
141  this->ZShadowsOff();
142  }
144 
146 
147  void SetProperty(vtkProperty*);
148  void SetSelectedProperty(vtkProperty*);
149  vtkGetObjectMacro(Property,vtkProperty);
150  vtkGetObjectMacro(SelectedProperty,vtkProperty);
152 
154 
158  vtkSetClampMacro(HotSpotSize,double,0.0,1.0);
159  vtkGetMacro(HotSpotSize,double);
161 
164  virtual void SetHandleSize(double size);
165 
167 
169  virtual double *GetBounds();
170  virtual void BuildRepresentation();
171  virtual void StartWidgetInteraction(double eventPos[2]);
172  virtual void WidgetInteraction(double eventPos[2]);
173  virtual int ComputeInteractionState(int X, int Y, int modify=0);
174  virtual void PlaceWidget(double bounds[6]);
176 
178 
179  virtual void ShallowCopy(vtkProp *prop);
180  virtual void DeepCopy(vtkProp *prop);
181  virtual void GetActors(vtkPropCollection *);
182  virtual void ReleaseGraphicsResources(vtkWindow *);
183  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
184  virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport);
185  virtual int HasTranslucentPolygonalGeometry();
187 
188  void Highlight(int highlight);
189 
191 
201  vtkSetMacro( SmoothMotion, int );
202  vtkGetMacro( SmoothMotion, int );
203  vtkBooleanMacro( SmoothMotion, int );
205 
206 protected:
209 
210  // the cursor3D
214 
215 
216  // Do the picking
218  double LastPickPosition[3];
219  double LastEventPosition[2];
220 
221  // Methods to manipulate the cursor
223  void Translate(double *p1, double *p2);
224  void Scale(double *p1, double *p2, double eventPos[2]);
225  void MoveFocus(double *p1, double *p2);
226  void SizeBounds();
227 
228  // Given a motion vector defined by p1 --> p2 (p1 and p2 are in
229  // world coordinates), the new display position of the handle center is
230  // populated into requestedDisplayPos. This is again only a request for the
231  // new display position. It is up to the point placer to deduce the
232  // appropriate world co-ordinates that this display position will map into.
233  // The placer may even disallow such a movement.
234  // If "SmoothMotion" is OFF, the returned requestedDisplayPos is the same
235  // as the event position, ie the location of the mouse cursor. If its OFF,
236  // incremental offsets as described above are used to compute it.
237  void MoveFocusRequest( double *p1, double *p2,
238  double eventPos[2], double requestedDisplayPos[3] );
239 
240  // Properties used to control the appearance of selected objects and
241  // the manipulator in general.
244  void CreateDefaultProperties();
245 
246  // The size of the hot spot.
247  double HotSpotSize;
248  int DetermineConstraintAxis(int constraint, double *x, double *startPoint);
251 
252  // Current handle sized (may reflect scaling)
254 
255  // Control how translation works
257 
259 
260 private:
262  void operator=(const vtkPointHandleRepresentation3D&); //Not implemented
263 };
264 
265 #endif