VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkSeedRepresentation.h,v $ 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 vtkTypeRevisionMacro(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 00111 virtual void BuildRepresentation(); 00112 virtual int ComputeInteractionState( int X, int Y, int modify = 0 ); 00114 00115 protected: 00116 vtkSeedRepresentation(); 00117 ~vtkSeedRepresentation(); 00118 00119 // The handle and the rep used to close the handles 00120 vtkHandleRepresentation *HandleRepresentation; 00121 vtkHandleList *Handles; 00122 00123 // Selection tolerance for the handles 00124 int Tolerance; 00125 00126 // The active seed (handle) based on the last ComputeInteractionState() 00127 int ActiveHandle; 00128 00129 private: 00130 vtkSeedRepresentation(const vtkSeedRepresentation&); //Not implemented 00131 void operator=(const vtkSeedRepresentation&); //Not implemented 00132 }; 00133 00134 #endif