VTK
dox/Interaction/Widgets/vtkResliceCursorPicker.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkPicker.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 =========================================================================*/
00032 #ifndef __vtkResliceCursorPicker_h
00033 #define __vtkResliceCursorPicker_h
00034 
00035 #include "vtkInteractionWidgetsModule.h" // For export macro
00036 #include "vtkPicker.h"
00037 
00038 class vtkPolyData;
00039 class vtkGenericCell;
00040 class vtkResliceCursorPolyDataAlgorithm;
00041 class vtkIdList;
00042 class vtkMatrix4x4;
00043 class vtkPlane;
00044 
00045 class VTKINTERACTIONWIDGETS_EXPORT vtkResliceCursorPicker : public vtkPicker
00046 {
00047 public:
00048   static vtkResliceCursorPicker *New();
00049   vtkTypeMacro(vtkResliceCursorPicker, vtkPicker);
00050   void PrintSelf(ostream& os, vtkIndent indent);
00051 
00053 
00057   virtual int Pick(double selectionX, double selectionY, double selectionZ,
00058                    vtkRenderer *renderer);
00060 
00062 
00063   vtkGetMacro( PickedAxis1, int );
00064   vtkGetMacro( PickedAxis2, int );
00065   vtkGetMacro( PickedCenter, int );
00067 
00069 
00070   virtual void SetResliceCursorAlgorithm(
00071       vtkResliceCursorPolyDataAlgorithm * );
00072   vtkGetObjectMacro( ResliceCursorAlgorithm,
00073                      vtkResliceCursorPolyDataAlgorithm );
00075 
00076   virtual void SetTransformMatrix( vtkMatrix4x4 * );
00077 
00079 
00082   void Pick(
00083     double displayPos[2], double world[3], vtkRenderer *ren );
00085 
00086 protected:
00087   vtkResliceCursorPicker();
00088   ~vtkResliceCursorPicker();
00089 
00090   virtual int IntersectPolyDataWithLine(
00091       double p1[3], double p2[3], vtkPolyData *, double tol );
00092   virtual int IntersectPointWithLine(
00093     double p1[3], double p2[3], double X[3], double tol );
00094 
00095   void TransformPlane();
00096   void TransformPoint( double pIn[4], double pOut[4] );
00097   void InverseTransformPoint( double pIn[4], double pOut[4] );
00098 
00099 private:
00100 
00101   vtkGenericCell *Cell; //used to accelerate picking
00102   vtkResliceCursorPolyDataAlgorithm * ResliceCursorAlgorithm;
00103 
00104   int PickedAxis1;
00105   int PickedAxis2;
00106   int PickedCenter;
00107   vtkIdList *PointIds;
00108   vtkMatrix4x4 * TransformMatrix;
00109   vtkPlane     * Plane;
00110 
00111 private:
00112   vtkResliceCursorPicker(const vtkResliceCursorPicker&);  // Not implemented.
00113   void operator=(const vtkResliceCursorPicker&);  // Not implemented.
00114 };
00115 
00116 #endif