VTK
dox/Widgets/vtkRectilinearWipeRepresentation.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkRectilinearWipeRepresentation.h
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 =========================================================================*/
00041 #ifndef __vtkRectilinearWipeRepresentation_h
00042 #define __vtkRectilinearWipeRepresentation_h
00043 
00044 #include "vtkWidgetRepresentation.h"
00045 
00046 class vtkImageRectilinearWipe;
00047 class vtkImageActor;
00048 class vtkPoints;
00049 class vtkCellArray;
00050 class vtkPolyData;
00051 class vtkProperty2D;
00052 class vtkPolyDataMapper2D;
00053 class vtkActor2D;
00054 
00055 
00056 class VTK_WIDGETS_EXPORT vtkRectilinearWipeRepresentation : public vtkWidgetRepresentation
00057 {
00058 public:
00060   static vtkRectilinearWipeRepresentation *New();
00061 
00063 
00064   vtkTypeMacro(vtkRectilinearWipeRepresentation,vtkWidgetRepresentation);
00065   void PrintSelf(ostream& os, vtkIndent indent);
00067 
00069 
00070   void SetRectilinearWipe(vtkImageRectilinearWipe *wipe);
00071   vtkGetObjectMacro(RectilinearWipe,vtkImageRectilinearWipe);
00073 
00075 
00076   void SetImageActor(vtkImageActor *imageActor);
00077   vtkGetObjectMacro(ImageActor,vtkImageActor);
00079   
00081 
00084   vtkSetClampMacro(Tolerance,int,1,10);
00085   vtkGetMacro(Tolerance,int);
00087 
00089 
00091   vtkGetObjectMacro(Property,vtkProperty2D);
00093 
00095 
00098   virtual void BuildRepresentation();
00099   virtual void StartWidgetInteraction(double eventPos[2]);
00100   virtual void WidgetInteraction(double eventPos[2]);
00101   virtual int ComputeInteractionState(int X, int Y, int modify=0);
00103 
00104 //BTX
00105   // Enums define the state of the prop relative to the mouse pointer
00106   // position. Used by ComputeInteractionState() to communicate with the
00107   // widget.
00108   enum _InteractionState
00109   {
00110     Outside=0,
00111     MovingHPane,
00112     MovingVPane,
00113     MovingCenter
00114   };
00115 //ETX
00116 
00118 
00119   virtual void GetActors2D(vtkPropCollection *);
00120   virtual void ReleaseGraphicsResources(vtkWindow *);
00121   virtual int RenderOverlay(vtkViewport *viewport);
00122   virtual int RenderOpaqueGeometry(vtkViewport *viewport);
00123   virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport);
00124   virtual int HasTranslucentPolygonalGeometry();
00126   
00127 protected:
00128   vtkRectilinearWipeRepresentation();
00129   ~vtkRectilinearWipeRepresentation();
00130 
00131   // Instances that this class manipulates
00132   vtkImageRectilinearWipe *RectilinearWipe;
00133   vtkImageActor           *ImageActor;
00134 
00135   // The pick tolerance of the widget in pixels
00136   int Tolerance;
00137   
00138   // This is used to track the beginning of interaction with the prop
00139   double StartWipePosition[2];
00140 
00141   // Indicates which part of widget is currently active based on the
00142   // state of the instance of the vtkImageRectilinearWipe.
00143   int  ActiveParts; 
00144 
00145   // Geometric structure of widget
00146   vtkPoints           *Points; // The nine points defining the widget geometry
00147   vtkCellArray        *Lines;  // lines defining the boundary
00148   vtkPolyData         *Wipe;
00149   vtkPolyDataMapper2D *WipeMapper;
00150   vtkActor2D          *WipeActor;
00151   vtkProperty2D       *Property;
00152 
00153   // These are used to track the coordinates (in display coordinate system)
00154   // of the mid-edge and center point of the widget
00155   double DP4[3];
00156   double DP5[3];
00157   double DP6[3];
00158   double DP7[3];
00159   double DP8[3];
00160 
00161   int Dims[3]; // Dimensions of the input image to the wipe
00162   int I; //the i-j define the plane that is being displayed
00163   int J;
00164   
00165 private:
00166   vtkRectilinearWipeRepresentation(const vtkRectilinearWipeRepresentation&);  //Not implemented
00167   void operator=(const vtkRectilinearWipeRepresentation&);  //Not implemented
00168 };
00169 
00170 #endif