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
00116 void SetOutlineColor(double r, double g, double b);
00117 double *GetOutlineColor();
00119
00121
00122 void SetViewport(double minX, double minY, double maxX, double maxY);
00123 double* GetViewport();
00125
00127
00130 vtkSetClampMacro(Tolerance,int,1,10);
00131 vtkGetMacro(Tolerance,int);
00133
00134 protected:
00135 vtkOrientationMarkerWidget();
00136 ~vtkOrientationMarkerWidget();
00137
00138 vtkRenderer *Renderer;
00139 vtkProp *OrientationMarker;
00140 vtkPolyData *Outline;
00141 vtkActor2D *OutlineActor;
00142
00143 unsigned long StartEventObserverId;
00144
00145 static void ProcessEvents(vtkObject *object, unsigned long event,
00146 void *clientdata, void *calldata);
00147
00148
00149 void OnLeftButtonDown();
00150 void OnLeftButtonUp();
00151 void OnMouseMove();
00152
00153
00154 vtkOrientationMarkerWidgetObserver *Observer;
00155
00156 int Interactive;
00157 int Tolerance;
00158 int Moving;
00159
00160
00161 int StartPosition[2];
00162
00163
00164 int State;
00165 enum WidgetState
00166 {
00167 Outside = 0,
00168 Inside,
00169 Translating,
00170 AdjustingP1,
00171 AdjustingP2,
00172 AdjustingP3,
00173 AdjustingP4
00174 };
00175
00176
00177
00178
00179
00180 int ComputeStateBasedOnPosition(int X, int Y, int *pos1, int *pos2);
00181
00182
00183 void SetCursor(int state);
00184
00185
00186 void MoveWidget(int X, int Y);
00187 void ResizeTopLeft(int X, int Y);
00188 void ResizeTopRight(int X, int Y);
00189 void ResizeBottomLeft(int X, int Y);
00190 void ResizeBottomRight(int X, int Y);
00191
00192 void SquareRenderer();
00193 void UpdateOutline();
00194
00195 private:
00196 vtkOrientationMarkerWidget(const vtkOrientationMarkerWidget&);
00197 void operator=(const vtkOrientationMarkerWidget&);
00198 };
00199
00200 #endif