• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/Widgets/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 =========================================================================*/
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   // ProcessEvents() dispatches to these methods.
00149   void OnLeftButtonDown();
00150   void OnLeftButtonUp();
00151   void OnMouseMove();
00152 
00153   // observer to update the renderer's camera
00154   vtkOrientationMarkerWidgetObserver *Observer;
00155 
00156   int Interactive;
00157   int Tolerance;
00158   int Moving;
00159 
00160   // used to compute relative movements
00161   int StartPosition[2];
00162 
00163 //BTX - manage the state of the widget
00164   int State;
00165   enum WidgetState
00166   {
00167     Outside = 0,
00168     Inside,
00169     Translating,
00170     AdjustingP1,
00171     AdjustingP2,
00172     AdjustingP3,
00173     AdjustingP4
00174   };
00175 //ETX
00176 
00177 
00178   // use to determine what state the mouse is over, edge1 p1, etc.
00179   // returns a state from the WidgetState enum above
00180   int ComputeStateBasedOnPosition(int X, int Y, int *pos1, int *pos2);
00181 
00182   // set the cursor to the correct shape based on State argument
00183   void SetCursor(int state);
00184 
00185   // adjust the viewport depending on state
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&);  // Not implemented
00197   void operator=(const vtkOrientationMarkerWidget&);  // Not implemented
00198 };
00199 
00200 #endif

Generated by  doxygen 1.7.1