00001
00030 #ifndef __vtkInteractorStyleCAD_h
00031 #define __vtkInteractorStyleCAD_h
00032
00033 #include <vtkInteractorStyle.h>
00034 #include <vtkCellPicker.h>
00035
00036 class vtkPolyData;
00037 class vtkDataSetMapper;
00038 class vtkGeometryFilter;
00039
00040
00041 #define VTKIS_USERINTERACTION 8
00042
00043 class VTK_EXPORT vtkInteractorStyleCAD : public vtkInteractorStyle
00044 {
00045 public:
00047 static vtkInteractorStyleCAD *New();
00048 vtkTypeMacro(vtkInteractorStyleCAD,vtkInteractorStyle);
00049 void PrintSelf(ostream& os, vtkIndent indent);
00050
00055 void StartUserInteraction();
00056 void EndUserInteraction();
00057
00062 void SetUserInteractionMethod(void (*f)(void *), void *arg);
00063 void SetUserInteractionMethodArgDelete(void (*f)(void *));
00064
00069 vtkGetVector2Macro(LastPos,int);
00070
00074 vtkGetVector2Macro(OldPos,int);
00075
00078 vtkGetMacro(ShiftKey,int);
00079 vtkGetMacro(CtrlKey,int);
00080
00082 vtkGetMacro(Char,int);
00083
00086 vtkGetStringMacro(KeySym);
00087
00088 void OnMouseMove(int ctrl, int shift, int x, int y);
00089 void OnRightButtonDown(int ctrl, int shift, int x, int y);
00090 void OnRightButtonUp(int ctrl, int shift, int x, int y);
00091 void OnMiddleButtonDown(int ctrl, int shift, int x, int y);
00092 void OnMiddleButtonUp(int ctrl, int shift, int x, int y);
00093 void OnLeftButtonDown(int ctrl, int shift, int x, int y);
00094 void OnLeftButtonUp(int ctrl, int shift, int x, int y);
00095
00096 void OnKeyPress(int ctrl, int shift, char keycode, char *keysym, int repeatcount);
00097 void OnKeyRelease(int ctrl, int shift, char keycode, char *keysym, int repeatcount);
00098 void OnChar(int ctrl, int shift, char keycode, int repeatcount);
00099
00100
00105 void HighlightGeometry(vtkActor *a, vtkDataSet *ds, int minId, int maxId);
00106 void HighlightGeometry(vtkActor *a, vtkDataSet *ds, int *ids);
00107
00109 vtkSetMacro(CellHighlight,int);
00110 vtkGetMacro(CellHighlight,int);
00111 vtkBooleanMacro(CellHighlight,int);
00112
00114 vtkGetObjectMacro(CellPicker,vtkCellPicker);
00115
00117 vtkGetObjectMacro(HighlightGeomFilter,vtkGeometryFilter);
00118
00119 protected:
00120 vtkInteractorStyleCAD();
00121 ~vtkInteractorStyleCAD();
00122 vtkInteractorStyleCAD(const vtkInteractorStyleCAD&) {};
00123 void operator=(const vtkInteractorStyleCAD&) {};
00124
00125 void OnTimer();
00126
00127 void RotateCamera(int x, int y);
00128 void SpinCamera(int x, int y);
00129 void PanCamera(int x, int y);
00130 void DollyCamera(int x, int y);
00131
00132 void (*UserInteractionMethod)(void *);
00133 void (*UserInteractionMethodArgDelete)(void *);
00134 void *UserInteractionMethodArg;
00135
00136 vtkCellPicker *CellPicker;
00137 vtkGeometryFilter *HighlightGeomFilter;
00138 vtkPolyDataMapper *CellMapper;
00139 vtkActor *CellActor;
00140 vtkActor *CurrentActor;
00141 vtkActor *ActorPicked;
00142
00143 int OldPos[2];
00144 int Char;
00145 char *KeySym;
00146 float SpinFrameWidth;
00147
00148 float OldX;
00149 float OldY;
00150 float RadianToDegree;
00151 float NewPickPoint[4];
00152 float OldPickPoint[4];
00153 float MotionVector[3];
00154 float MotionFactor;
00155 int Preprocess;
00156 int CellHighlight;
00157 double ViewFocus[3];
00158 double ViewPoint[3];
00159
00160 };
00161
00162 inline void vtkInteractorStyleCAD::HighlightGeometry(vtkActor *a, vtkDataSet *ds, int *ids)
00163 { this->HighlightGeometry( a, ds, ids[0], ids[1]); }
00164
00165 #endif // __vtkInteractorStyleCAD_h