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