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