vtkPointWidget.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00086 #ifndef __vtkPointWidget_h
00087 #define __vtkPointWidget_h
00088
00089 #include "vtk3DWidget.h"
00090 #include "vtkCursor3D.h"
00091
00092 class vtkActor;
00093 class vtkPolyDataMapper;
00094 class vtkCellPicker;
00095 class vtkPolyData;
00096 class vtkProperty;
00097
00098 class VTK_HYBRID_EXPORT vtkPointWidget : public vtk3DWidget
00099 {
00100 public:
00102 static vtkPointWidget *New();
00103
00104 vtkTypeRevisionMacro(vtkPointWidget,vtk3DWidget);
00105 void PrintSelf(ostream& os, vtkIndent indent);
00106
00108
00109 virtual void SetEnabled(int);
00110 virtual void PlaceWidget(double bounds[6]);
00111 void PlaceWidget()
00112 {this->Superclass::PlaceWidget();}
00113 void PlaceWidget(double xmin, double xmax, double ymin, double ymax,
00114 double zmin, double zmax)
00115 {this->Superclass::PlaceWidget(xmin,xmax,ymin,ymax,zmin,zmax);}
00117
00120 void GetPolyData(vtkPolyData *pd);
00121
00123
00126 void SetPosition(double x, double y, double z)
00127 {this->Cursor3D->SetFocalPoint(x,y,z);}
00128 void SetPosition(double x[3])
00129 {this->SetPosition(x[0],x[1],x[2]);}
00130 double* GetPosition()
00131 {return this->Cursor3D->GetFocalPoint();}
00132 void GetPosition(double xyz[3])
00133 {this->Cursor3D->GetFocalPoint(xyz);}
00135
00137
00138 void SetOutline(int o)
00139 {this->Cursor3D->SetOutline(o);}
00140 int GetOutline()
00141 {return this->Cursor3D->GetOutline();}
00142 void OutlineOn()
00143 {this->Cursor3D->OutlineOn();}
00144 void OutlineOff()
00145 {this->Cursor3D->OutlineOff();}
00147
00149
00150 void SetXShadows(int o)
00151 {this->Cursor3D->SetXShadows(o);}
00152 int GetXShadows()
00153 {return this->Cursor3D->GetXShadows();}
00154 void XShadowsOn()
00155 {this->Cursor3D->XShadowsOn();}
00156 void XShadowsOff()
00157 {this->Cursor3D->XShadowsOff();}
00159
00161
00162 void SetYShadows(int o)
00163 {this->Cursor3D->SetYShadows(o);}
00164 int GetYShadows()
00165 {return this->Cursor3D->GetYShadows();}
00166 void YShadowsOn()
00167 {this->Cursor3D->YShadowsOn();}
00168 void YShadowsOff()
00169 {this->Cursor3D->YShadowsOff();}
00171
00173
00174 void SetZShadows(int o)
00175 {this->Cursor3D->SetZShadows(o);}
00176 int GetZShadows()
00177 {return this->Cursor3D->GetZShadows();}
00178 void ZShadowsOn()
00179 {this->Cursor3D->ZShadowsOn();}
00180 void ZShadowsOff()
00181 {this->Cursor3D->ZShadowsOff();}
00183
00185
00188 void SetTranslationMode(int mode)
00189 { this->Cursor3D->SetTranslationMode(mode); this->Cursor3D->Update(); }
00190 int GetTranslationMode()
00191 { return this->Cursor3D->GetTranslationMode(); }
00192 void TranslationModeOn()
00193 { this->SetTranslationMode(1); }
00194 void TranslationModeOff()
00195 { this->SetTranslationMode(0); }
00197
00199
00200 void AllOn()
00201 {
00202 this->OutlineOn();
00203 this->XShadowsOn();
00204 this->YShadowsOn();
00205 this->ZShadowsOn();
00206 }
00207 void AllOff()
00208 {
00209 this->OutlineOff();
00210 this->XShadowsOff();
00211 this->YShadowsOff();
00212 this->ZShadowsOff();
00213 }
00215
00217
00219 vtkGetObjectMacro(Property,vtkProperty);
00220 vtkGetObjectMacro(SelectedProperty,vtkProperty);
00222
00224
00228 vtkSetClampMacro(HotSpotSize,double,0.0,1.0);
00229 vtkGetMacro(HotSpotSize,double);
00231
00232 protected:
00233 vtkPointWidget();
00234 ~vtkPointWidget();
00235
00236
00237 friend class vtkLineWidget;
00238
00239 int State;
00240 enum WidgetState
00241 {
00242 Start=0,
00243 Moving,
00244 Scaling,
00245 Translating,
00246 Outside
00247 };
00248
00249
00250
00251 static void ProcessEvents(vtkObject* object,
00252 unsigned long event,
00253 void* clientdata,
00254 void* calldata);
00255
00256
00257 virtual void OnMouseMove();
00258 virtual void OnLeftButtonDown();
00259 virtual void OnLeftButtonUp();
00260 virtual void OnMiddleButtonDown();
00261 virtual void OnMiddleButtonUp();
00262 virtual void OnRightButtonDown();
00263 virtual void OnRightButtonUp();
00264
00265
00266 vtkActor *Actor;
00267 vtkPolyDataMapper *Mapper;
00268 vtkCursor3D *Cursor3D;
00269 void Highlight(int highlight);
00270
00271
00272 vtkCellPicker *CursorPicker;
00273
00274
00275 int ConstraintAxis;
00276 void Translate(double *p1, double *p2);
00277 void Scale(double *p1, double *p2, int X, int Y);
00278 void MoveFocus(double *p1, double *p2);
00279 int TranslationMode;
00280
00281
00282
00283 vtkProperty *Property;
00284 vtkProperty *SelectedProperty;
00285 void CreateDefaultProperties();
00286
00287
00288 double HotSpotSize;
00289 int DetermineConstraintAxis(int constraint, double *x);
00290 int WaitingForMotion;
00291 int WaitCount;
00292
00293 private:
00294 vtkPointWidget(const vtkPointWidget&);
00295 void operator=(const vtkPointWidget&);
00296 };
00297
00298 #endif