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 =========================================================================*/
72 #ifndef vtkPointWidget_h
73 #define vtkPointWidget_h
74 
75 #include "vtkInteractionWidgetsModule.h" // For export macro
76 #include "vtk3DWidget.h"
77 #include "vtkCursor3D.h" // Needed for faster access to the Cursor3D
78 
79 class vtkActor;
80 class vtkPolyDataMapper;
81 class vtkCellPicker;
82 class vtkPolyData;
83 class vtkProperty;
84 
86 {
87 public:
89  static vtkPointWidget *New();
90 
91  vtkTypeMacro(vtkPointWidget,vtk3DWidget);
92  void PrintSelf(ostream& os, vtkIndent indent);
93 
95 
96  virtual void SetEnabled(int);
97  virtual void PlaceWidget(double bounds[6]);
98  void PlaceWidget()
99  {this->Superclass::PlaceWidget();}
100  void PlaceWidget(double xmin, double xmax, double ymin, double ymax,
101  double zmin, double zmax)
102  {this->Superclass::PlaceWidget(xmin,xmax,ymin,ymax,zmin,zmax);}
104 
107  void GetPolyData(vtkPolyData *pd);
108 
110 
113  void SetPosition(double x, double y, double z)
114  {this->Cursor3D->SetFocalPoint(x,y,z);}
115  void SetPosition(double x[3])
116  {this->SetPosition(x[0],x[1],x[2]);}
117  double* GetPosition()
118  {return this->Cursor3D->GetFocalPoint();}
119  void GetPosition(double xyz[3])
120  {this->Cursor3D->GetFocalPoint(xyz);}
122 
124 
125  void SetOutline(int o)
126  {this->Cursor3D->SetOutline(o);}
128  {return this->Cursor3D->GetOutline();}
129  void OutlineOn()
130  {this->Cursor3D->OutlineOn();}
131  void OutlineOff()
132  {this->Cursor3D->OutlineOff();}
134 
136 
137  void SetXShadows(int o)
138  {this->Cursor3D->SetXShadows(o);}
140  {return this->Cursor3D->GetXShadows();}
141  void XShadowsOn()
142  {this->Cursor3D->XShadowsOn();}
143  void XShadowsOff()
144  {this->Cursor3D->XShadowsOff();}
146 
148 
149  void SetYShadows(int o)
150  {this->Cursor3D->SetYShadows(o);}
152  {return this->Cursor3D->GetYShadows();}
153  void YShadowsOn()
154  {this->Cursor3D->YShadowsOn();}
155  void YShadowsOff()
156  {this->Cursor3D->YShadowsOff();}
158 
160 
161  void SetZShadows(int o)
162  {this->Cursor3D->SetZShadows(o);}
164  {return this->Cursor3D->GetZShadows();}
165  void ZShadowsOn()
166  {this->Cursor3D->ZShadowsOn();}
167  void ZShadowsOff()
168  {this->Cursor3D->ZShadowsOff();}
170 
172 
176  { this->Cursor3D->SetTranslationMode(mode); this->Cursor3D->Update(); }
178  { return this->Cursor3D->GetTranslationMode(); }
180  { this->SetTranslationMode(1); }
182  { this->SetTranslationMode(0); }
184 
186 
187  void AllOn()
188  {
189  this->OutlineOn();
190  this->XShadowsOn();
191  this->YShadowsOn();
192  this->ZShadowsOn();
193  }
194  void AllOff()
195  {
196  this->OutlineOff();
197  this->XShadowsOff();
198  this->YShadowsOff();
199  this->ZShadowsOff();
200  }
202 
204 
206  vtkGetObjectMacro(Property,vtkProperty);
207  vtkGetObjectMacro(SelectedProperty,vtkProperty);
209 
211 
215  vtkSetClampMacro(HotSpotSize,double,0.0,1.0);
216  vtkGetMacro(HotSpotSize,double);
218 
219 protected:
220  vtkPointWidget();
221  ~vtkPointWidget();
222 
223 //BTX - manage the state of the widget
224  friend class vtkLineWidget;
225 
226  int State;
228  {
229  Start=0,
234  };
235 //ETX
236 
237  // Handles the events
238  static void ProcessEvents(vtkObject* object,
239  unsigned long event,
240  void* clientdata,
241  void* calldata);
242 
243  // ProcessEvents() dispatches to these methods.
244  virtual void OnMouseMove();
245  virtual void OnLeftButtonDown();
246  virtual void OnLeftButtonUp();
247  virtual void OnMiddleButtonDown();
248  virtual void OnMiddleButtonUp();
249  virtual void OnRightButtonDown();
250  virtual void OnRightButtonUp();
251 
252  // the cursor3D
256  void Highlight(int highlight);
257 
258  // Do the picking
260 
261  // Register internal Pickers within PickingManager
262  virtual void RegisterPickers();
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:50
void TranslationModeOff()
abstract base class for most VTK objects
Definition: vtkObject.h:61
void OnLeftButtonDown()
represent surface properties of a geometric object
Definition: vtkProperty.h:63
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:83
void SetPosition(double x, double y, double z)
virtual void RegisterPickers()
void PlaceWidget(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax)
vtkCursor3D * Cursor3D
void CreateDefaultProperties()
vtkProperty * Property
#define VTKINTERACTIONWIDGETS_EXPORT
void GetPosition(double xyz[3])
a simple class to control print indentation
Definition: vtkIndent.h:38
3D widget for manipulating a line
Definition: vtkLineWidget.h:95
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:68
void TranslationModeOn()
void SetPosition(double x[3])
generate a 3D cursor representation
Definition: vtkCursor3D.h:38
void SetOutline(int o)
static vtkObject * New()
void OnRightButtonUp()
void PrintSelf(ostream &os, vtkIndent indent)
an abstract superclass for 3D widgets
Definition: vtk3DWidget.h:69
virtual void PlaceWidget()
void OnLeftButtonUp()
virtual void OnMouseMove()
vtkCellPicker * CursorPicker
void Scale(double *p1, double *p2, int X, int Y)