00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00088
#ifndef __vtkBoxWidget_h
00089
#define __vtkBoxWidget_h
00090
00091
#include "vtk3DWidget.h"
00092
00093
class vtkActor;
00094
class vtkCellPicker;
00095
class vtkPlanes;
00096
class vtkPoints;
00097
class vtkPolyData;
00098
class vtkPolyDataMapper;
00099
class vtkProp;
00100
class vtkProperty;
00101
class vtkSphereSource;
00102
class vtkTransform;
00103
00104 class VTK_HYBRID_EXPORT vtkBoxWidget :
public vtk3DWidget
00105 {
00106
public:
00108
static vtkBoxWidget *
New();
00109
00110 vtkTypeRevisionMacro(vtkBoxWidget,
vtk3DWidget);
00111
void PrintSelf(ostream& os,
vtkIndent indent);
00112
00114
00115
virtual void SetEnabled(
int);
00116
virtual void PlaceWidget(
double bounds[6]);
00117 void PlaceWidget()
00118 {this->Superclass::PlaceWidget();}
00119 void PlaceWidget(
double xmin,
double xmax,
double ymin,
double ymax,
00120
double zmin,
double zmax)
00121 {this->Superclass::PlaceWidget(xmin,xmax,ymin,ymax,zmin,zmax);}
00123
00130
void GetPlanes(
vtkPlanes *planes);
00131
00133
00136 vtkSetMacro(InsideOut,
int);
00137 vtkGetMacro(InsideOut,
int);
00138 vtkBooleanMacro(InsideOut,
int);
00140
00146
virtual void GetTransform(
vtkTransform *t);
00147
00152
virtual void SetTransform(
vtkTransform* t);
00153
00162
void GetPolyData(
vtkPolyData *pd);
00163
00165
00167 vtkGetObjectMacro(HandleProperty,
vtkProperty);
00168 vtkGetObjectMacro(SelectedHandleProperty,
vtkProperty);
00170
00172
00174
void HandlesOn();
00175
void HandlesOff();
00177
00179
00181 vtkGetObjectMacro(FaceProperty,
vtkProperty);
00182 vtkGetObjectMacro(SelectedFaceProperty,
vtkProperty);
00184
00186
00188 vtkGetObjectMacro(OutlineProperty,
vtkProperty);
00189 vtkGetObjectMacro(SelectedOutlineProperty,
vtkProperty);
00191
00193
00195
void SetOutlineFaceWires(
int);
00196 vtkGetMacro(OutlineFaceWires,
int);
00197 void OutlineFaceWiresOn() {this->SetOutlineFaceWires(1);}
00198 void OutlineFaceWiresOff() {this->SetOutlineFaceWires(0);}
00200
00202
00205
void SetOutlineCursorWires(
int);
00206 vtkGetMacro(OutlineCursorWires,
int);
00207 void OutlineCursorWiresOn() {this->SetOutlineCursorWires(1);}
00208 void OutlineCursorWiresOff() {this->SetOutlineCursorWires(0);}
00210
00212
00214 vtkSetMacro(TranslationEnabled,
int);
00215 vtkGetMacro(TranslationEnabled,
int);
00216 vtkBooleanMacro(TranslationEnabled,
int);
00217 vtkSetMacro(ScalingEnabled,
int);
00218 vtkGetMacro(ScalingEnabled,
int);
00219 vtkBooleanMacro(ScalingEnabled,
int);
00220 vtkSetMacro(RotationEnabled,
int);
00221 vtkGetMacro(RotationEnabled,
int);
00222 vtkBooleanMacro(RotationEnabled,
int);
00224
00225
protected:
00226 vtkBoxWidget();
00227 ~vtkBoxWidget();
00228
00229
00230 int State;
00231 enum WidgetState
00232 {
00233 Start=0,
00234 Moving,
00235 Scaling,
00236 Outside
00237 };
00238
00239
00240
00241
static void ProcessEvents(
vtkObject* object,
00242
unsigned long event,
00243
void* clientdata,
00244
void* calldata);
00245
00246
00247
virtual void OnMouseMove();
00248
virtual void OnLeftButtonDown();
00249
virtual void OnLeftButtonUp();
00250
virtual void OnMiddleButtonDown();
00251
virtual void OnMiddleButtonUp();
00252
virtual void OnRightButtonDown();
00253
virtual void OnRightButtonUp();
00254
00255
00256 vtkActor *HexActor;
00257 vtkPolyDataMapper *HexMapper;
00258 vtkPolyData *HexPolyData;
00259 vtkPoints *Points;
00260 double N[6][3];
00261
00262
00263 vtkActor *HexFace;
00264 vtkPolyDataMapper *HexFaceMapper;
00265 vtkPolyData *HexFacePolyData;
00266
00267
00268 vtkActor **Handle;
00269 vtkPolyDataMapper **HandleMapper;
00270 vtkSphereSource **HandleGeometry;
00271
virtual void PositionHandles();
00272
int HighlightHandle(
vtkProp *prop);
00273
void HighlightFace(
int cellId);
00274
void HighlightOutline(
int highlight);
00275
void ComputeNormals();
00276
virtual void SizeHandles();
00277
00278
00279 vtkActor *HexOutline;
00280 vtkPolyDataMapper *OutlineMapper;
00281 vtkPolyData *OutlinePolyData;
00282
00283
00284 vtkCellPicker *HandlePicker;
00285 vtkCellPicker *HexPicker;
00286 vtkActor *CurrentHandle;
00287 int CurrentHexFace;
00288
00289
00290
virtual void Translate(
double *p1,
double *p2);
00291
virtual void Scale(
double *p1,
double *p2,
int X,
int Y);
00292
virtual void Rotate(
int X,
int Y,
double *p1,
double *p2,
double *vpn);
00293
void MovePlusXFace(
double *p1,
double *p2);
00294
void MoveMinusXFace(
double *p1,
double *p2);
00295
void MovePlusYFace(
double *p1,
double *p2);
00296
void MoveMinusYFace(
double *p1,
double *p2);
00297
void MovePlusZFace(
double *p1,
double *p2);
00298
void MoveMinusZFace(
double *p1,
double *p2);
00299
00300
void MoveFace(
double *p1,
double *p2,
double *h1,
double *h2,
00301
double *x1,
double *x2,
double *x3,
double *x4,
00302
double *x5);
00303
00304
00305 vtkTransform *Transform;
00306
00307
00308
00309 vtkProperty *HandleProperty;
00310 vtkProperty *SelectedHandleProperty;
00311 vtkProperty *FaceProperty;
00312 vtkProperty *SelectedFaceProperty;
00313 vtkProperty *OutlineProperty;
00314 vtkProperty *SelectedOutlineProperty;
00315
void CreateDefaultProperties();
00316
00317
00318 int InsideOut;
00319 int OutlineFaceWires;
00320 int OutlineCursorWires;
00321
void GenerateOutline();
00322
00323
00324 int TranslationEnabled;
00325 int ScalingEnabled;
00326 int RotationEnabled;
00327
00328
private:
00329 vtkBoxWidget(
const vtkBoxWidget&);
00330
void operator=(
const vtkBoxWidget&);
00331 };
00332
00333
#endif