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);}
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);}
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);}
104  {return this->Cursor3D->GetZShadows();}
105  void ZShadowsOn()
106  {this->Cursor3D->ZShadowsOn();}
107  void ZShadowsOff()
108  {this->Cursor3D->ZShadowsOff();}
110 
112 
122  vtkSetMacro(TranslationMode,int);
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 GetActors(vtkPropCollection *);
181  virtual void ReleaseGraphicsResources(vtkWindow *);
182  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
183  virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport);
184  virtual int HasTranslucentPolygonalGeometry();
186 
187  void Highlight(int highlight);
188 
189 protected:
192 
193  // the cursor3D
197 
198 
199  // Do the picking
201  double LastPickPosition[3];
202  double LastEventPosition[2];
203 
204  // Methods to manipulate the cursor
206  void Translate(double *p1, double *p2);
207  void Scale(double *p1, double *p2, double eventPos[2]);
208  void MoveFocus(double *p1, double *p2);
209  void SizeBounds();
210 
211  // Given a motion vector defined by p1 --> p2 (p1 and p2 are in
212  // world coordinates), the new display position of the handle center is
213  // populated into requestedDisplayPos. This is again only a request for the
214  // new display position. It is up to the point placer to deduce the
215  // appropriate world co-ordinates that this display position will map into.
216  // The placer may even disallow such a movement.
217  void MoveFocusRequest(
218  double *p1, double *p2, double requestedDisplayPos[3] );
219 
220  // Properties used to control the appearance of selected objects and
221  // the manipulator in general.
224  void CreateDefaultProperties();
225 
226  // The size of the hot spot.
227  double HotSpotSize;
228  int DetermineConstraintAxis(int constraint, double *x, double *startPoint);
231 
232  // Current handle sized (may reflect scaling)
234 
235  // Control how translation works
237 
238 private:
240  void operator=(const vtkPointHandleRepresentation3D&); //Not implemented
241 };
242 
243 #endif