VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkSphereHandleRepresentation.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 =========================================================================*/ 00029 #ifndef __vtkSphereHandleRepresentation_h 00030 #define __vtkSphereHandleRepresentation_h 00031 00032 #include "vtkHandleRepresentation.h" 00033 #include "vtkSphereSource.h" // Needed for delegation to sphere 00034 00035 class vtkSphereSource; 00036 class vtkProperty; 00037 class vtkActor; 00038 class vtkPolyDataMapper; 00039 class vtkCellPicker; 00040 00041 class VTK_WIDGETS_EXPORT vtkSphereHandleRepresentation 00042 : public vtkHandleRepresentation 00043 { 00044 public: 00046 static vtkSphereHandleRepresentation *New(); 00047 00049 00050 vtkTypeMacro(vtkSphereHandleRepresentation,vtkHandleRepresentation); 00051 void PrintSelf(ostream& os, vtkIndent indent); 00053 00055 00060 virtual void SetWorldPosition(double p[3]); 00061 virtual void SetDisplayPosition(double p[3]); 00063 00065 00071 vtkSetMacro(TranslationMode,int); 00072 vtkGetMacro(TranslationMode,int); 00073 vtkBooleanMacro(TranslationMode,int); 00075 00076 void SetSphereRadius(double); 00077 double GetSphereRadius(); 00078 00080 00081 void SetProperty(vtkProperty*); 00082 void SetSelectedProperty(vtkProperty*); 00083 vtkGetObjectMacro(Property,vtkProperty); 00084 vtkGetObjectMacro(SelectedProperty,vtkProperty); 00086 00088 00092 vtkSetClampMacro(HotSpotSize,double,0.0,1.0); 00093 vtkGetMacro(HotSpotSize,double); 00095 00098 virtual void SetHandleSize(double size); 00099 00101 00103 virtual double *GetBounds(); 00104 virtual void BuildRepresentation(); 00105 virtual void StartWidgetInteraction(double eventPos[2]); 00106 virtual void WidgetInteraction(double eventPos[2]); 00107 virtual int ComputeInteractionState(int X, int Y, int modify=0); 00108 virtual void PlaceWidget(double bounds[6]); 00110 00112 00113 virtual void ShallowCopy(vtkProp *prop); 00114 virtual void DeepCopy(vtkProp *prop); 00115 virtual void GetActors(vtkPropCollection *); 00116 virtual void ReleaseGraphicsResources(vtkWindow *); 00117 virtual int RenderOpaqueGeometry(vtkViewport *viewport); 00118 virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport); 00119 virtual int HasTranslucentPolygonalGeometry(); 00121 00122 void Highlight(int highlight); 00123 protected: 00124 vtkSphereHandleRepresentation(); 00125 ~vtkSphereHandleRepresentation(); 00126 00127 // the cursor3D 00128 vtkActor *Actor; 00129 vtkPolyDataMapper *Mapper; 00130 vtkSphereSource *Sphere; 00131 // void Highlight(int highlight); 00132 00133 // Do the picking 00134 vtkCellPicker *CursorPicker; 00135 double LastPickPosition[3]; 00136 double LastEventPosition[2]; 00137 00138 // Methods to manipulate the cursor 00139 int ConstraintAxis; 00140 void Translate(double *p1, double *p2); 00141 void Scale(double *p1, double *p2, double eventPos[2]); 00142 void MoveFocus(double *p1, double *p2); 00143 void SizeBounds(); 00144 00145 // Properties used to control the appearance of selected objects and 00146 // the manipulator in general. 00147 vtkProperty *Property; 00148 vtkProperty *SelectedProperty; 00149 void CreateDefaultProperties(); 00150 00151 // The size of the hot spot. 00152 double HotSpotSize; 00153 int DetermineConstraintAxis(int constraint, double *x); 00154 int WaitingForMotion; 00155 int WaitCount; 00156 00157 // Current handle sized (may reflect scaling) 00158 double CurrentHandleSize; 00159 00160 // Control how translation works 00161 int TranslationMode; 00162 00163 private: 00164 vtkSphereHandleRepresentation(const vtkSphereHandleRepresentation&); //Not implemented 00165 void operator=(const vtkSphereHandleRepresentation&); //Not implemented 00166 }; 00167 00168 #endif