00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00029 #ifndef __vtkPointHandleRepresentation3D_h
00030 #define __vtkPointHandleRepresentation3D_h
00031 
00032 #include "vtkHandleRepresentation.h"
00033 #include "vtkCursor3D.h" 
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   void Highlight(int highlight);
00188   
00189 protected:
00190   vtkPointHandleRepresentation3D();
00191   ~vtkPointHandleRepresentation3D();
00192 
00193   
00194   vtkActor          *Actor;
00195   vtkPolyDataMapper *Mapper;
00196   vtkCursor3D       *Cursor3D;
00197 
00198 
00199   
00200   vtkCellPicker *CursorPicker;
00201   double LastPickPosition[3];
00202   double LastEventPosition[2];
00203   
00204   
00205   int  ConstraintAxis;
00206   void Translate(double *p1, double *p2);
00207   void Scale(double *p1, double *p2, double eventPos[2]);
00208   void MoveFocus(double *p1, double *p2);
00209   void SizeBounds();
00210   
00211   
00212   
00213   
00214   
00215   
00216   
00217   void MoveFocusRequest( 
00218       double *p1, double *p2, double requestedDisplayPos[3] );
00219 
00220   
00221   
00222   vtkProperty *Property;
00223   vtkProperty *SelectedProperty;
00224   void         CreateDefaultProperties();
00225   
00226   
00227   double HotSpotSize;
00228   int    DetermineConstraintAxis(int constraint, double *x, double *startPoint);
00229   int    WaitingForMotion;
00230   int    WaitCount;
00231   
00232   
00233   double CurrentHandleSize;
00234 
00235   
00236   int TranslationMode;
00237 
00238 private:
00239   vtkPointHandleRepresentation3D(const vtkPointHandleRepresentation3D&);  
00240   void operator=(const vtkPointHandleRepresentation3D&);  
00241 };
00242 
00243 #endif