VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkPointHandleRepresentation3D.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 __vtkPointHandleRepresentation3D_h 00030 #define __vtkPointHandleRepresentation3D_h 00031 00032 #include "vtkHandleRepresentation.h" 00033 #include "vtkCursor3D.h" // Needed for delegation to cursor3D 00034 00035 class vtkCursor3D; 00036 class vtkProperty; 00037 class vtkActor; 00038 class vtkPolyDataMapper; 00039 class vtkCellPicker; 00040 00041 class VTK_WIDGETS_EXPORT vtkPointHandleRepresentation3D : public vtkHandleRepresentation 00042 { 00043 public: 00045 static vtkPointHandleRepresentation3D *New(); 00046 00048 00049 vtkTypeMacro(vtkPointHandleRepresentation3D,vtkHandleRepresentation); 00050 void PrintSelf(ostream& os, vtkIndent indent); 00052 00054 00059 virtual void SetWorldPosition(double p[3]); 00060 virtual void SetDisplayPosition(double p[3]); 00062 00064 00065 void SetOutline(int o) 00066 {this->Cursor3D->SetOutline(o);} 00067 int GetOutline() 00068 {return this->Cursor3D->GetOutline();} 00069 void OutlineOn() 00070 {this->Cursor3D->OutlineOn();} 00071 void OutlineOff() 00072 {this->Cursor3D->OutlineOff();} 00074 00076 00077 void SetXShadows(int o) 00078 {this->Cursor3D->SetXShadows(o);} 00079 int GetXShadows() 00080 {return this->Cursor3D->GetXShadows();} 00081 void XShadowsOn() 00082 {this->Cursor3D->XShadowsOn();} 00083 void XShadowsOff() 00084 {this->Cursor3D->XShadowsOff();} 00086 00088 00089 void SetYShadows(int o) 00090 {this->Cursor3D->SetYShadows(o);} 00091 int GetYShadows() 00092 {return this->Cursor3D->GetYShadows();} 00093 void YShadowsOn() 00094 {this->Cursor3D->YShadowsOn();} 00095 void YShadowsOff() 00096 {this->Cursor3D->YShadowsOff();} 00098 00100 00101 void SetZShadows(int o) 00102 {this->Cursor3D->SetZShadows(o);} 00103 int GetZShadows() 00104 {return this->Cursor3D->GetZShadows();} 00105 void ZShadowsOn() 00106 {this->Cursor3D->ZShadowsOn();} 00107 void ZShadowsOff() 00108 {this->Cursor3D->ZShadowsOff();} 00110 00112 00122 vtkSetMacro(TranslationMode,int); 00123 vtkGetMacro(TranslationMode,int); 00124 vtkBooleanMacro(TranslationMode,int); 00126 00128 00129 void AllOn() 00130 { 00131 this->OutlineOn(); 00132 this->XShadowsOn(); 00133 this->YShadowsOn(); 00134 this->ZShadowsOn(); 00135 } 00136 void AllOff() 00137 { 00138 this->OutlineOff(); 00139 this->XShadowsOff(); 00140 this->YShadowsOff(); 00141 this->ZShadowsOff(); 00142 } 00144 00146 00147 void SetProperty(vtkProperty*); 00148 void SetSelectedProperty(vtkProperty*); 00149 vtkGetObjectMacro(Property,vtkProperty); 00150 vtkGetObjectMacro(SelectedProperty,vtkProperty); 00152 00154 00158 vtkSetClampMacro(HotSpotSize,double,0.0,1.0); 00159 vtkGetMacro(HotSpotSize,double); 00161 00164 virtual void SetHandleSize(double size); 00165 00167 00169 virtual double *GetBounds(); 00170 virtual void BuildRepresentation(); 00171 virtual void StartWidgetInteraction(double eventPos[2]); 00172 virtual void WidgetInteraction(double eventPos[2]); 00173 virtual int ComputeInteractionState(int X, int Y, int modify=0); 00174 virtual void PlaceWidget(double bounds[6]); 00176 00178 00179 virtual void ShallowCopy(vtkProp *prop); 00180 virtual void GetActors(vtkPropCollection *); 00181 virtual void ReleaseGraphicsResources(vtkWindow *); 00182 virtual int RenderOpaqueGeometry(vtkViewport *viewport); 00183 virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport); 00184 virtual int HasTranslucentPolygonalGeometry(); 00186 00187 protected: 00188 vtkPointHandleRepresentation3D(); 00189 ~vtkPointHandleRepresentation3D(); 00190 00191 // the cursor3D 00192 vtkActor *Actor; 00193 vtkPolyDataMapper *Mapper; 00194 vtkCursor3D *Cursor3D; 00195 void Highlight(int highlight); 00196 00197 // Do the picking 00198 vtkCellPicker *CursorPicker; 00199 double LastPickPosition[3]; 00200 double LastEventPosition[2]; 00201 00202 // Methods to manipulate the cursor 00203 int ConstraintAxis; 00204 void Translate(double *p1, double *p2); 00205 void Scale(double *p1, double *p2, double eventPos[2]); 00206 void MoveFocus(double *p1, double *p2); 00207 void SizeBounds(); 00208 00209 // Given a motion vector defined by p1 --> p2 (p1 and p2 are in 00210 // world coordinates), the new display position of the handle center is 00211 // populated into requestedDisplayPos. This is again only a request for the 00212 // new display position. It is up to the point placer to deduce the 00213 // appropriate world co-ordinates that this display position will map into. 00214 // The placer may even disallow such a movement. 00215 void MoveFocusRequest( 00216 double *p1, double *p2, double requestedDisplayPos[3] ); 00217 00218 // Properties used to control the appearance of selected objects and 00219 // the manipulator in general. 00220 vtkProperty *Property; 00221 vtkProperty *SelectedProperty; 00222 void CreateDefaultProperties(); 00223 00224 // The size of the hot spot. 00225 double HotSpotSize; 00226 int DetermineConstraintAxis(int constraint, double *x, double *startPoint); 00227 int WaitingForMotion; 00228 int WaitCount; 00229 00230 // Current handle sized (may reflect scaling) 00231 double CurrentHandleSize; 00232 00233 // Control how translation works 00234 int TranslationMode; 00235 00236 private: 00237 vtkPointHandleRepresentation3D(const vtkPointHandleRepresentation3D&); //Not implemented 00238 void operator=(const vtkPointHandleRepresentation3D&); //Not implemented 00239 }; 00240 00241 #endif