VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkSphereHandleRepresentation.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 =========================================================================*/ 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 vtkTypeRevisionMacro(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 GetActors(vtkPropCollection *); 00115 virtual void ReleaseGraphicsResources(vtkWindow *); 00116 virtual int RenderOpaqueGeometry(vtkViewport *viewport); 00117 virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport); 00118 virtual int HasTranslucentPolygonalGeometry(); 00120 00121 protected: 00122 vtkSphereHandleRepresentation(); 00123 ~vtkSphereHandleRepresentation(); 00124 00125 // the cursor3D 00126 vtkActor *Actor; 00127 vtkPolyDataMapper *Mapper; 00128 vtkSphereSource *Sphere; 00129 void Highlight(int highlight); 00130 00131 // Do the picking 00132 vtkCellPicker *CursorPicker; 00133 double LastPickPosition[3]; 00134 double LastEventPosition[2]; 00135 00136 // Methods to manipulate the cursor 00137 int ConstraintAxis; 00138 void Translate(double *p1, double *p2); 00139 void Scale(double *p1, double *p2, double eventPos[2]); 00140 void MoveFocus(double *p1, double *p2); 00141 void SizeBounds(); 00142 00143 // Properties used to control the appearance of selected objects and 00144 // the manipulator in general. 00145 vtkProperty *Property; 00146 vtkProperty *SelectedProperty; 00147 void CreateDefaultProperties(); 00148 00149 // The size of the hot spot. 00150 double HotSpotSize; 00151 int DetermineConstraintAxis(int constraint, double *x); 00152 int WaitingForMotion; 00153 int WaitCount; 00154 00155 // Current handle sized (may reflect scaling) 00156 double CurrentHandleSize; 00157 00158 // Control how translation works 00159 int TranslationMode; 00160 00161 private: 00162 vtkSphereHandleRepresentation(const vtkSphereHandleRepresentation&); //Not implemented 00163 void operator=(const vtkSphereHandleRepresentation&); //Not implemented 00164 }; 00165 00166 #endif