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 void SetTranslationMode(int mode); 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 DeepCopy(vtkProp *prop); 00181 virtual void GetActors(vtkPropCollection *); 00182 virtual void ReleaseGraphicsResources(vtkWindow *); 00183 virtual int RenderOpaqueGeometry(vtkViewport *viewport); 00184 virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport); 00185 virtual int HasTranslucentPolygonalGeometry(); 00187 00188 void Highlight(int highlight); 00189 00191 00201 vtkSetMacro( SmoothMotion, int ); 00202 vtkGetMacro( SmoothMotion, int ); 00203 vtkBooleanMacro( SmoothMotion, int ); 00205 00206 protected: 00207 vtkPointHandleRepresentation3D(); 00208 ~vtkPointHandleRepresentation3D(); 00209 00210 // the cursor3D 00211 vtkActor *Actor; 00212 vtkPolyDataMapper *Mapper; 00213 vtkCursor3D *Cursor3D; 00214 00215 00216 // Do the picking 00217 vtkCellPicker *CursorPicker; 00218 double LastPickPosition[3]; 00219 double LastEventPosition[2]; 00220 00221 // Methods to manipulate the cursor 00222 int ConstraintAxis; 00223 void Translate(double *p1, double *p2); 00224 void Scale(double *p1, double *p2, double eventPos[2]); 00225 void MoveFocus(double *p1, double *p2); 00226 void SizeBounds(); 00227 00228 // Given a motion vector defined by p1 --> p2 (p1 and p2 are in 00229 // world coordinates), the new display position of the handle center is 00230 // populated into requestedDisplayPos. This is again only a request for the 00231 // new display position. It is up to the point placer to deduce the 00232 // appropriate world co-ordinates that this display position will map into. 00233 // The placer may even disallow such a movement. 00234 // If "SmoothMotion" is OFF, the returned requestedDisplayPos is the same 00235 // as the event position, ie the location of the mouse cursor. If its OFF, 00236 // incremental offsets as described above are used to compute it. 00237 void MoveFocusRequest( double *p1, double *p2, 00238 double eventPos[2], double requestedDisplayPos[3] ); 00239 00240 // Properties used to control the appearance of selected objects and 00241 // the manipulator in general. 00242 vtkProperty *Property; 00243 vtkProperty *SelectedProperty; 00244 void CreateDefaultProperties(); 00245 00246 // The size of the hot spot. 00247 double HotSpotSize; 00248 int DetermineConstraintAxis(int constraint, double *x, double *startPoint); 00249 int WaitingForMotion; 00250 int WaitCount; 00251 00252 // Current handle sized (may reflect scaling) 00253 double CurrentHandleSize; 00254 00255 // Control how translation works 00256 int TranslationMode; 00257 00258 int SmoothMotion; 00259 00260 private: 00261 vtkPointHandleRepresentation3D(const vtkPointHandleRepresentation3D&); //Not implemented 00262 void operator=(const vtkPointHandleRepresentation3D&); //Not implemented 00263 }; 00264 00265 #endif