VTK
|
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 virtual int CreateHandle( double e[2] ); //returns the id of the seed created 00105 virtual void RemoveLastHandle(); //delete last handle created 00106 virtual void RemoveActiveHandle(); 00108 00110 virtual void RemoveHandle( int n ); 00111 00113 00114 virtual void BuildRepresentation(); 00115 virtual int ComputeInteractionState( int X, int Y, int modify = 0 ); 00117 00118 protected: 00119 vtkSeedRepresentation(); 00120 ~vtkSeedRepresentation(); 00121 00122 // The handle and the rep used to close the handles 00123 vtkHandleRepresentation *HandleRepresentation; 00124 vtkHandleList *Handles; 00125 00126 // Selection tolerance for the handles 00127 int Tolerance; 00128 00129 // The active seed (handle) based on the last ComputeInteractionState() 00130 int ActiveHandle; 00131 00132 private: 00133 vtkSeedRepresentation(const vtkSeedRepresentation&); //Not implemented 00134 void operator=(const vtkSeedRepresentation&); //Not implemented 00135 }; 00136 00137 #endif