00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00073 #ifndef __vtkPointWidget_h
00074 #define __vtkPointWidget_h
00075
00076 #include "vtk3DWidget.h"
00077 #include "vtkCursor3D.h"
00078
00079 class vtkActor;
00080 class vtkPolyDataMapper;
00081 class vtkCellPicker;
00082 class vtkPolyData;
00083 class vtkProperty;
00084
00085 class VTK_WIDGETS_EXPORT vtkPointWidget : public vtk3DWidget
00086 {
00087 public:
00089 static vtkPointWidget *New();
00090
00091 vtkTypeRevisionMacro(vtkPointWidget,vtk3DWidget);
00092 void PrintSelf(ostream& os, vtkIndent indent);
00093
00095
00096 virtual void SetEnabled(int);
00097 virtual void PlaceWidget(double bounds[6]);
00098 void PlaceWidget()
00099 {this->Superclass::PlaceWidget();}
00100 void PlaceWidget(double xmin, double xmax, double ymin, double ymax,
00101 double zmin, double zmax)
00102 {this->Superclass::PlaceWidget(xmin,xmax,ymin,ymax,zmin,zmax);}
00104
00107 void GetPolyData(vtkPolyData *pd);
00108
00110
00113 void SetPosition(double x, double y, double z)
00114 {this->Cursor3D->SetFocalPoint(x,y,z);}
00115 void SetPosition(double x[3])
00116 {this->SetPosition(x[0],x[1],x[2]);}
00117 double* GetPosition()
00118 {return this->Cursor3D->GetFocalPoint();}
00119 void GetPosition(double xyz[3])
00120 {this->Cursor3D->GetFocalPoint(xyz);}
00122
00124
00125 void SetOutline(int o)
00126 {this->Cursor3D->SetOutline(o);}
00127 int GetOutline()
00128 {return this->Cursor3D->GetOutline();}
00129 void OutlineOn()
00130 {this->Cursor3D->OutlineOn();}
00131 void OutlineOff()
00132 {this->Cursor3D->OutlineOff();}
00134
00136
00137 void SetXShadows(int o)
00138 {this->Cursor3D->SetXShadows(o);}
00139 int GetXShadows()
00140 {return this->Cursor3D->GetXShadows();}
00141 void XShadowsOn()
00142 {this->Cursor3D->XShadowsOn();}
00143 void XShadowsOff()
00144 {this->Cursor3D->XShadowsOff();}
00146
00148
00149 void SetYShadows(int o)
00150 {this->Cursor3D->SetYShadows(o);}
00151 int GetYShadows()
00152 {return this->Cursor3D->GetYShadows();}
00153 void YShadowsOn()
00154 {this->Cursor3D->YShadowsOn();}
00155 void YShadowsOff()
00156 {this->Cursor3D->YShadowsOff();}
00158
00160
00161 void SetZShadows(int o)
00162 {this->Cursor3D->SetZShadows(o);}
00163 int GetZShadows()
00164 {return this->Cursor3D->GetZShadows();}
00165 void ZShadowsOn()
00166 {this->Cursor3D->ZShadowsOn();}
00167 void ZShadowsOff()
00168 {this->Cursor3D->ZShadowsOff();}
00170
00172
00175 void SetTranslationMode(int mode)
00176 { this->Cursor3D->SetTranslationMode(mode); this->Cursor3D->Update(); }
00177 int GetTranslationMode()
00178 { return this->Cursor3D->GetTranslationMode(); }
00179 void TranslationModeOn()
00180 { this->SetTranslationMode(1); }
00181 void TranslationModeOff()
00182 { this->SetTranslationMode(0); }
00184
00186
00187 void AllOn()
00188 {
00189 this->OutlineOn();
00190 this->XShadowsOn();
00191 this->YShadowsOn();
00192 this->ZShadowsOn();
00193 }
00194 void AllOff()
00195 {
00196 this->OutlineOff();
00197 this->XShadowsOff();
00198 this->YShadowsOff();
00199 this->ZShadowsOff();
00200 }
00202
00204
00206 vtkGetObjectMacro(Property,vtkProperty);
00207 vtkGetObjectMacro(SelectedProperty,vtkProperty);
00209
00211
00215 vtkSetClampMacro(HotSpotSize,double,0.0,1.0);
00216 vtkGetMacro(HotSpotSize,double);
00218
00219 protected:
00220 vtkPointWidget();
00221 ~vtkPointWidget();
00222
00223
00224 friend class vtkLineWidget;
00225
00226 int State;
00227 enum WidgetState
00228 {
00229 Start=0,
00230 Moving,
00231 Scaling,
00232 Translating,
00233 Outside
00234 };
00235
00236
00237
00238 static void ProcessEvents(vtkObject* object,
00239 unsigned long event,
00240 void* clientdata,
00241 void* calldata);
00242
00243
00244 virtual void OnMouseMove();
00245 virtual void OnLeftButtonDown();
00246 virtual void OnLeftButtonUp();
00247 virtual void OnMiddleButtonDown();
00248 virtual void OnMiddleButtonUp();
00249 virtual void OnRightButtonDown();
00250 virtual void OnRightButtonUp();
00251
00252
00253 vtkActor *Actor;
00254 vtkPolyDataMapper *Mapper;
00255 vtkCursor3D *Cursor3D;
00256 void Highlight(int highlight);
00257
00258
00259 vtkCellPicker *CursorPicker;
00260
00261
00262 int ConstraintAxis;
00263 void Translate(double *p1, double *p2);
00264 void Scale(double *p1, double *p2, int X, int Y);
00265 void MoveFocus(double *p1, double *p2);
00266 int TranslationMode;
00267
00268
00269
00270 vtkProperty *Property;
00271 vtkProperty *SelectedProperty;
00272 void CreateDefaultProperties();
00273
00274
00275 double HotSpotSize;
00276 int DetermineConstraintAxis(int constraint, double *x);
00277 int WaitingForMotion;
00278 int WaitCount;
00279
00280 private:
00281 vtkPointWidget(const vtkPointWidget&);
00282 void operator=(const vtkPointWidget&);
00283 };
00284
00285 #endif