00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00077 #ifndef __vtkOrientationMarkerWidget_h
00078 #define __vtkOrientationMarkerWidget_h
00079
00080 #include "vtkInteractorObserver.h"
00081
00082 class vtkActor2D;
00083 class vtkPolyData;
00084 class vtkProp;
00085 class vtkOrientationMarkerWidgetObserver;
00086 class vtkRenderer;
00087
00088 class VTK_WIDGETS_EXPORT vtkOrientationMarkerWidget : public vtkInteractorObserver
00089 {
00090 public:
00091 static vtkOrientationMarkerWidget* New();
00092 vtkTypeMacro(vtkOrientationMarkerWidget, vtkInteractorObserver);
00093 void PrintSelf(ostream& os, vtkIndent indent);
00094
00096
00097 virtual void SetOrientationMarker(vtkProp *prop);
00098 vtkGetObjectMacro(OrientationMarker, vtkProp);
00100
00102 virtual void SetEnabled(int);
00103
00106 void ExecuteCameraUpdateEvent(vtkObject *o, unsigned long event, void *calldata);
00107
00109
00111 void SetInteractive(int state);
00112 vtkGetMacro(Interactive, int);
00113 vtkBooleanMacro(Interactive, int);
00115
00117
00120 void SetOutlineColor(double r, double g, double b);
00121 double *GetOutlineColor();
00123
00125
00127 void SetViewport(double minX, double minY, double maxX, double maxY);
00128 double* GetViewport();
00130
00132
00135 vtkSetClampMacro(Tolerance,int,1,10);
00136 vtkGetMacro(Tolerance,int);
00138
00139 protected:
00140 vtkOrientationMarkerWidget();
00141 ~vtkOrientationMarkerWidget();
00142
00143 vtkRenderer *Renderer;
00144 vtkProp *OrientationMarker;
00145 vtkPolyData *Outline;
00146 vtkActor2D *OutlineActor;
00147
00148 unsigned long StartEventObserverId;
00149
00150 static void ProcessEvents(vtkObject *object, unsigned long event,
00151 void *clientdata, void *calldata);
00152
00153
00154 void OnLeftButtonDown();
00155 void OnLeftButtonUp();
00156 void OnMouseMove();
00157
00158
00159 vtkOrientationMarkerWidgetObserver *Observer;
00160
00161 int Interactive;
00162 int Tolerance;
00163 int Moving;
00164
00165
00166 int StartPosition[2];
00167
00168
00169 int State;
00170 enum WidgetState
00171 {
00172 Outside = 0,
00173 Inside,
00174 Translating,
00175 AdjustingP1,
00176 AdjustingP2,
00177 AdjustingP3,
00178 AdjustingP4
00179 };
00180
00181
00182
00183
00184
00185 int ComputeStateBasedOnPosition(int X, int Y, int *pos1, int *pos2);
00186
00187
00188 void SetCursor(int state);
00189
00190
00191 void MoveWidget(int X, int Y);
00192 void ResizeTopLeft(int X, int Y);
00193 void ResizeTopRight(int X, int Y);
00194 void ResizeBottomLeft(int X, int Y);
00195 void ResizeBottomRight(int X, int Y);
00196
00197 void SquareRenderer();
00198 void UpdateOutline();
00199
00200 private:
00201 vtkOrientationMarkerWidget(const vtkOrientationMarkerWidget&);
00202 void operator=(const vtkOrientationMarkerWidget&);
00203 };
00204
00205 #endif