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