Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkOrientationMarkerWidget.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkOrientationMarkerWidget.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
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   vtkTypeRevisionMacro(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 
00119   void SetOutlineColor(double r, double g, double b);
00120   double *GetOutlineColor();
00122 
00124 
00125   void SetViewport(double minX, double minY, double maxX, double maxY);
00126   double* GetViewport();
00128 
00129 protected:
00130   vtkOrientationMarkerWidget();
00131   ~vtkOrientationMarkerWidget();
00132 
00133   vtkRenderer *Renderer;
00134   vtkProp     *OrientationMarker;
00135   vtkPolyData *Outline;
00136   vtkActor2D  *OutlineActor;
00137 
00138   unsigned long StartEventObserverId;
00139   
00140   static void ProcessEvents(vtkObject *object, unsigned long event,
00141                             void *clientdata, void *calldata);
00142 
00143   // ProcessEvents() dispatches to these methods.
00144   void OnLeftButtonDown();
00145   void OnLeftButtonUp();
00146   void OnMouseMove();
00147 
00148   // observer to update the renderer's camera
00149   vtkOrientationMarkerWidgetObserver *Observer;
00150 
00151   int Interactive;
00152 
00153   // used to compute relative movements
00154   int StartPosition[2];
00155 
00156 //BTX - manage the state of the widget
00157   int State;
00158   enum WidgetState
00159   {
00160     Outside = 0,
00161     Inside,
00162     Moving,
00163     AdjustingP1,
00164     AdjustingP2,
00165     AdjustingP3,
00166     AdjustingP4
00167   };
00168 //ETX
00169 
00170 
00171   // use to determine what state the mouse is over, edge1 p1, etc.
00172   // returns a state from the WidgetState enum above
00173   int ComputeStateBasedOnPosition(int X, int Y, int *pos1, int *pos2);
00174 
00175   // set the cursor to the correct shape based on State argument
00176   void SetCursor(int state);
00177 
00178   // adjust the viewport depending on state
00179   void MoveWidget(int X, int Y);
00180   void ResizeTopLeft(int X, int Y);
00181   void ResizeTopRight(int X, int Y);
00182   void ResizeBottomLeft(int X, int Y);
00183   void ResizeBottomRight(int X, int Y);
00184 
00185   void SquareRenderer();
00186   void UpdateOutline();
00187 
00188 private:
00189   vtkOrientationMarkerWidget(const vtkOrientationMarkerWidget&);  // Not implemented
00190   void operator=(const vtkOrientationMarkerWidget&);  // Not implemented
00191 };
00192 
00193 #endif

Generated on Mon Jan 21 23:07:38 2008 for VTK by  doxygen 1.4.3-20050530