VTK
dox/Widgets/vtkSeedRepresentation.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkSeedRepresentation.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 =========================================================================*/
00030 #ifndef __vtkSeedRepresentation_h
00031 #define __vtkSeedRepresentation_h
00032 
00033 #include "vtkWidgetRepresentation.h"
00034 
00035 class vtkHandleList;
00036 class vtkHandleRepresentation;
00037 
00038 
00039 class VTK_WIDGETS_EXPORT vtkSeedRepresentation : public vtkWidgetRepresentation
00040 {
00041 public:
00043   static vtkSeedRepresentation *New();
00044 
00046 
00047   vtkTypeMacro(vtkSeedRepresentation,vtkWidgetRepresentation);
00048   void PrintSelf(ostream& os, vtkIndent indent);
00050 
00052 
00055   virtual void GetSeedWorldPosition( unsigned int seedNum, double pos[3] );
00056   virtual void SetSeedDisplayPosition( unsigned int seedNum, double pos[3] );
00057   virtual void GetSeedDisplayPosition( unsigned int seedNum, double pos[3] );
00059 
00061   int GetNumberOfSeeds();
00062 
00069   void SetHandleRepresentation( vtkHandleRepresentation *handle );
00070 
00074   vtkHandleRepresentation *GetHandleRepresentation( unsigned int num );
00075 
00077 
00078   vtkHandleRepresentation *GetHandleRepresentation()
00079     {
00080     return this->HandleRepresentation;
00081     };
00083 
00085 
00088   vtkSetClampMacro( Tolerance, int, 1, 100 );
00089   vtkGetMacro( Tolerance, int );
00091 
00092 //BTX -- used to communicate about the state of the representation
00093   enum
00094     {
00095     Outside = 0,
00096     NearSeed
00097     };
00098 //ETX
00099 
00101 
00103   virtual int GetActiveHandle();
00104   // Returns the id of the seed created, -1 on failure. e is the display position.
00105   virtual int CreateHandle( double e[2] );
00106   // Delete last handle created
00107   virtual void RemoveLastHandle();
00108   // Delete the currently active handle
00109   virtual void RemoveActiveHandle();
00111 
00113   virtual void RemoveHandle( int n );
00114 
00116 
00117   virtual void BuildRepresentation();
00118   virtual int ComputeInteractionState( int X, int Y, int modify = 0 );
00120   
00121 protected:
00122   vtkSeedRepresentation();
00123   ~vtkSeedRepresentation();
00124 
00125   // The handle and the rep used to close the handles
00126   vtkHandleRepresentation  *HandleRepresentation;
00127   vtkHandleList            *Handles;
00128 
00129   // Selection tolerance for the handles
00130   int Tolerance;
00131   
00132   // The active seed (handle) based on the last ComputeInteractionState()
00133   int ActiveHandle;
00134 
00135 private:
00136   vtkSeedRepresentation(const vtkSeedRepresentation&);  //Not implemented
00137   void operator=(const vtkSeedRepresentation&);  //Not implemented
00138 };
00139 
00140 #endif