VTK
vtkPointWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPointWidget.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 =========================================================================*/
76 #ifndef __vtkPointWidget_h
77 #define __vtkPointWidget_h
78 
79 #include "vtk3DWidget.h"
80 #include "vtkCursor3D.h" // Needed for faster access to the Cursor3D
81 
82 class vtkActor;
83 class vtkPolyDataMapper;
84 class vtkCellPicker;
85 class vtkPolyData;
86 class vtkProperty;
87 
89 {
90 public:
92  static vtkPointWidget *New();
93 
94  vtkTypeMacro(vtkPointWidget,vtk3DWidget);
95  void PrintSelf(ostream& os, vtkIndent indent);
96 
98 
99  virtual void SetEnabled(int);
100  virtual void PlaceWidget(double bounds[6]);
101  void PlaceWidget()
102  {this->Superclass::PlaceWidget();}
103  void PlaceWidget(double xmin, double xmax, double ymin, double ymax,
104  double zmin, double zmax)
105  {this->Superclass::PlaceWidget(xmin,xmax,ymin,ymax,zmin,zmax);}
107 
110  void GetPolyData(vtkPolyData *pd);
111 
113 
116  void SetPosition(double x, double y, double z)
117  {this->Cursor3D->SetFocalPoint(x,y,z);}
118  void SetPosition(double x[3])
119  {this->SetPosition(x[0],x[1],x[2]);}
120  double* GetPosition()
121  {return this->Cursor3D->GetFocalPoint();}
122  void GetPosition(double xyz[3])
123  {this->Cursor3D->GetFocalPoint(xyz);}
125 
127 
128  void SetOutline(int o)
129  {this->Cursor3D->SetOutline(o);}
131  {return this->Cursor3D->GetOutline();}
132  void OutlineOn()
133  {this->Cursor3D->OutlineOn();}
134  void OutlineOff()
135  {this->Cursor3D->OutlineOff();}
137 
139 
140  void SetXShadows(int o)
141  {this->Cursor3D->SetXShadows(o);}
143  {return this->Cursor3D->GetXShadows();}
144  void XShadowsOn()
145  {this->Cursor3D->XShadowsOn();}
146  void XShadowsOff()
147  {this->Cursor3D->XShadowsOff();}
149 
151 
152  void SetYShadows(int o)
153  {this->Cursor3D->SetYShadows(o);}
155  {return this->Cursor3D->GetYShadows();}
156  void YShadowsOn()
157  {this->Cursor3D->YShadowsOn();}
158  void YShadowsOff()
159  {this->Cursor3D->YShadowsOff();}
161 
163 
164  void SetZShadows(int o)
165  {this->Cursor3D->SetZShadows(o);}
167  {return this->Cursor3D->GetZShadows();}
168  void ZShadowsOn()
169  {this->Cursor3D->ZShadowsOn();}
170  void ZShadowsOff()
171  {this->Cursor3D->ZShadowsOff();}
173 
175 
179  { this->Cursor3D->SetTranslationMode(mode); this->Cursor3D->Update(); }
181  { return this->Cursor3D->GetTranslationMode(); }
183  { this->SetTranslationMode(1); }
185  { this->SetTranslationMode(0); }
187 
189 
190  void AllOn()
191  {
192  this->OutlineOn();
193  this->XShadowsOn();
194  this->YShadowsOn();
195  this->ZShadowsOn();
196  }
197  void AllOff()
198  {
199  this->OutlineOff();
200  this->XShadowsOff();
201  this->YShadowsOff();
202  this->ZShadowsOff();
203  }
205 
207 
209  vtkGetObjectMacro(Property,vtkProperty);
210  vtkGetObjectMacro(SelectedProperty,vtkProperty);
212 
214 
218  vtkSetClampMacro(HotSpotSize,double,0.0,1.0);
219  vtkGetMacro(HotSpotSize,double);
221 
222 protected:
223  vtkPointWidget();
224  ~vtkPointWidget();
225 
226 //BTX - manage the state of the widget
227  friend class vtkLineWidget;
228 
229  int State;
231  {
232  Start=0,
237  };
238 //ETX
239 
240  // Handles the events
241  static void ProcessEvents(vtkObject* object,
242  unsigned long event,
243  void* clientdata,
244  void* calldata);
245 
246  // ProcessEvents() dispatches to these methods.
247  virtual void OnMouseMove();
248  virtual void OnLeftButtonDown();
249  virtual void OnLeftButtonUp();
250  virtual void OnMiddleButtonDown();
251  virtual void OnMiddleButtonUp();
252  virtual void OnRightButtonDown();
253  virtual void OnRightButtonUp();
254 
255  // the cursor3D
259  void Highlight(int highlight);
260 
261  // Do the picking
263 
264  // Methods to manipulate the cursor
266  void Translate(double *p1, double *p2);
267  void Scale(double *p1, double *p2, int X, int Y);
268  void MoveFocus(double *p1, double *p2);
270 
271  // Properties used to control the appearance of selected objects and
272  // the manipulator in general.
276 
277  // The size of the hot spot.
278  double HotSpotSize;
279  int DetermineConstraintAxis(int constraint, double *x);
282 
283 private:
284  vtkPointWidget(const vtkPointWidget&); //Not implemented
285  void operator=(const vtkPointWidget&); //Not implemented
286 };
287 
288 #endif
void OnRightButtonDown()
vtkProperty * SelectedProperty
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:49
void TranslationModeOff()
abstract base class for most VTK objects
Definition: vtkObject.h:60
void OnLeftButtonDown()
represent surface properties of a geometric object
Definition: vtkProperty.h:61
vtkActor * Actor
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
void OnMiddleButtonUp()
virtual void SetEnabled(int)
int GetTranslationMode()
void OnMiddleButtonDown()
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:81
void SetPosition(double x, double y, double z)
void PlaceWidget(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax)
vtkCursor3D * Cursor3D
void CreateDefaultProperties()
vtkProperty * Property
void GetPosition(double xyz[3])
a simple class to control print indentation
Definition: vtkIndent.h:37
3D widget for manipulating a line
Definition: vtkLineWidget.h:98
#define VTK_WIDGETS_EXPORT
void SetYShadows(int o)
double * GetPosition()
void SetZShadows(int o)
void SetXShadows(int o)
map vtkPolyData to graphics primitives
position a point in 3D space
vtkPolyDataMapper * Mapper
void SetTranslationMode(int mode)
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:66
void TranslationModeOn()
void SetPosition(double x[3])
generate a 3D cursor representation
Definition: vtkCursor3D.h:37
void SetOutline(int o)
static vtkObject * New()
void OnRightButtonUp()
void PrintSelf(ostream &os, vtkIndent indent)
an abstract superclass for 3D widgets
Definition: vtk3DWidget.h:66
virtual void PlaceWidget()
void OnLeftButtonUp()
virtual void OnMouseMove()
vtkCellPicker * CursorPicker
void Scale(double *p1, double *p2, int X, int Y)