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 "vtkInteractionWidgetsModule.h" // For export macro 00034 #include "vtkWidgetRepresentation.h" 00035 00036 class vtkHandleList; 00037 class vtkHandleRepresentation; 00038 00039 00040 class VTKINTERACTIONWIDGETS_EXPORT vtkSeedRepresentation : public vtkWidgetRepresentation 00041 { 00042 public: 00044 static vtkSeedRepresentation *New(); 00045 00047 00048 vtkTypeMacro(vtkSeedRepresentation,vtkWidgetRepresentation); 00049 void PrintSelf(ostream& os, vtkIndent indent); 00051 00053 00056 virtual void GetSeedWorldPosition( unsigned int seedNum, double pos[3] ); 00057 virtual void SetSeedDisplayPosition( unsigned int seedNum, double pos[3] ); 00058 virtual void GetSeedDisplayPosition( unsigned int seedNum, double pos[3] ); 00060 00062 int GetNumberOfSeeds(); 00063 00070 void SetHandleRepresentation( vtkHandleRepresentation *handle ); 00071 00075 vtkHandleRepresentation *GetHandleRepresentation( unsigned int num ); 00076 00078 00079 vtkHandleRepresentation *GetHandleRepresentation() 00080 { 00081 return this->HandleRepresentation; 00082 }; 00084 00086 00089 vtkSetClampMacro( Tolerance, int, 1, 100 ); 00090 vtkGetMacro( Tolerance, int ); 00092 00093 //BTX -- used to communicate about the state of the representation 00094 enum 00095 { 00096 Outside = 0, 00097 NearSeed 00098 }; 00099 //ETX 00100 00102 00104 virtual int GetActiveHandle(); 00105 // Returns the id of the seed created, -1 on failure. e is the display position. 00106 virtual int CreateHandle( double e[2] ); 00107 // Delete last handle created 00108 virtual void RemoveLastHandle(); 00109 // Delete the currently active handle 00110 virtual void RemoveActiveHandle(); 00112 00114 virtual void RemoveHandle( int n ); 00115 00117 00118 virtual void BuildRepresentation(); 00119 virtual int ComputeInteractionState( int X, int Y, int modify = 0 ); 00121 00122 protected: 00123 vtkSeedRepresentation(); 00124 ~vtkSeedRepresentation(); 00125 00126 // The handle and the rep used to close the handles 00127 vtkHandleRepresentation *HandleRepresentation; 00128 vtkHandleList *Handles; 00129 00130 // Selection tolerance for the handles 00131 int Tolerance; 00132 00133 // The active seed (handle) based on the last ComputeInteractionState() 00134 int ActiveHandle; 00135 00136 private: 00137 vtkSeedRepresentation(const vtkSeedRepresentation&); //Not implemented 00138 void operator=(const vtkSeedRepresentation&); //Not implemented 00139 }; 00140 00141 #endif