Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | 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 =========================================================================*/
00087 #ifndef __vtkOrientationMarkerWidget_h
00088 #define __vtkOrientationMarkerWidget_h
00089 
00090 #include "vtkInteractorObserver.h"
00091 
00092 class vtkActor2D;
00093 class vtkPolyData;
00094 class vtkProp;
00095 class vtkOrientationMarkerWidgetObserver;
00096 class vtkRenderer;
00097 
00098 class VTK_HYBRID_EXPORT vtkOrientationMarkerWidget : public vtkInteractorObserver
00099 {
00100 public:
00101   static vtkOrientationMarkerWidget* New();
00102   vtkTypeRevisionMacro(vtkOrientationMarkerWidget, vtkInteractorObserver);
00103   void PrintSelf(ostream& os, vtkIndent indent);
00104 
00106 
00107   virtual void SetOrientationMarker(vtkProp *prop);
00108   vtkGetObjectMacro(OrientationMarker, vtkProp);
00110 
00112   virtual void SetEnabled(int);
00113 
00116   void ExecuteCameraUpdateEvent(vtkObject *o, unsigned long event, void *calldata);
00117 
00119 
00121   void SetInteractive(int state);
00122   vtkGetMacro(Interactive, int);
00123   vtkBooleanMacro(Interactive, int);
00125 
00127 
00129   void SetOutlineColor(double r, double g, double b);
00130   double *GetOutlineColor();
00132 
00134 
00135   void SetViewport(double minX, double minY, double maxX, double maxY);
00136   double* GetViewport();
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   // ProcessEvents() dispatches to these methods.
00154   void OnLeftButtonDown();
00155   void OnLeftButtonUp();
00156   void OnMouseMove();
00157 
00158   // observer to update the renderer's camera
00159   vtkOrientationMarkerWidgetObserver *Observer;
00160 
00161   int Interactive;
00162 
00163   // used to compute relative movements
00164   int StartPosition[2];
00165 
00166 //BTX - manage the state of the widget
00167   int State;
00168   enum WidgetState
00169   {
00170     Outside = 0,
00171     Inside,
00172     Moving,
00173     AdjustingP1,
00174     AdjustingP2,
00175     AdjustingP3,
00176     AdjustingP4
00177   };
00178 //ETX
00179 
00180 
00181   // use to determine what state the mouse is over, edge1 p1, etc.
00182   // returns a state from the WidgetState enum above
00183   int ComputeStateBasedOnPosition(int X, int Y, int *pos1, int *pos2);
00184 
00185   // set the cursor to the correct shape based on State argument
00186   void SetCursor(int state);
00187 
00188   // adjust the viewport depending on state
00189   void MoveWidget(int X, int Y);
00190   void ResizeTopLeft(int X, int Y);
00191   void ResizeTopRight(int X, int Y);
00192   void ResizeBottomLeft(int X, int Y);
00193   void ResizeBottomRight(int X, int Y);
00194 
00195   void SquareRenderer();
00196   void UpdateOutline();
00197 
00198 private:
00199   vtkOrientationMarkerWidget(const vtkOrientationMarkerWidget&);  // Not implemented
00200   void operator=(const vtkOrientationMarkerWidget&);  // Not implemented
00201 };
00202 
00203 #endif