VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkPolygonalHandleRepresentation3D.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 =========================================================================*/ 00030 #ifndef __vtkPolygonalHandleRepresentation3D_h 00031 #define __vtkPolygonalHandleRepresentation3D_h 00032 00033 #include "vtkHandleRepresentation.h" 00034 00035 class vtkProperty; 00036 class vtkActor; 00037 class vtkPolyDataMapper; 00038 class vtkCellPicker; 00039 class vtkTransformPolyDataFilter; 00040 class vtkMatrixToLinearTransform; 00041 class vtkMatrix4x4; 00042 class vtkPolyData; 00043 class vtkAbstractTransform; 00044 class vtkFollower; 00045 class vtkVectorText; 00046 00047 class VTK_WIDGETS_EXPORT vtkPolygonalHandleRepresentation3D 00048 : public vtkHandleRepresentation 00049 { 00050 public: 00052 static vtkPolygonalHandleRepresentation3D *New(); 00053 00055 00056 vtkTypeRevisionMacro(vtkPolygonalHandleRepresentation3D,vtkHandleRepresentation); 00057 void PrintSelf(ostream& os, vtkIndent indent); 00059 00061 00066 virtual void SetWorldPosition(double p[3]); 00067 virtual void SetDisplayPosition(double p[3]); 00069 00071 00072 void SetHandle( vtkPolyData * ); 00073 vtkPolyData * GetHandle(); 00075 00077 00079 vtkSetVector3Macro( Offset, double ); 00080 vtkGetVector3Macro( Offset, double ); 00082 00084 00085 void SetProperty(vtkProperty*); 00086 void SetSelectedProperty(vtkProperty*); 00087 vtkGetObjectMacro(Property,vtkProperty); 00088 vtkGetObjectMacro(SelectedProperty,vtkProperty); 00090 00093 virtual vtkAbstractTransform * GetTransform(); 00094 00096 00098 virtual void BuildRepresentation(); 00099 virtual void StartWidgetInteraction(double eventPos[2]); 00100 virtual void WidgetInteraction(double eventPos[2]); 00101 virtual int ComputeInteractionState(int X, int Y, int modify=0); 00103 00105 00106 virtual void ShallowCopy(vtkProp *prop); 00107 virtual void GetActors(vtkPropCollection *); 00108 virtual void ReleaseGraphicsResources(vtkWindow *); 00109 virtual int RenderOpaqueGeometry(vtkViewport *viewport); 00110 virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport); 00111 virtual int HasTranslucentPolygonalGeometry(); 00112 virtual double *GetBounds(); 00114 00116 00118 vtkSetMacro( LabelVisibility, int ); 00119 vtkGetMacro( LabelVisibility, int ); 00120 vtkBooleanMacro( LabelVisibility, int ); 00121 virtual void SetLabelText( const char * label ); 00123 00125 00126 virtual void SetLabelTextScale( double scale[3] ); 00127 virtual double * GetLabelTextScale(); 00129 00130 protected: 00131 vtkPolygonalHandleRepresentation3D(); 00132 ~vtkPolygonalHandleRepresentation3D(); 00133 00134 vtkActor * Actor; 00135 vtkPolyDataMapper * Mapper; 00136 vtkTransformPolyDataFilter * HandleTransformFilter; 00137 vtkMatrixToLinearTransform * HandleTransform; 00138 vtkMatrix4x4 * HandleTransformMatrix; 00139 vtkCellPicker * HandlePicker; 00140 double LastPickPosition[3]; 00141 double LastEventPosition[2]; 00142 double Offset[3]; 00143 int ConstraintAxis; 00144 vtkProperty * Property; 00145 vtkProperty * SelectedProperty; 00146 int WaitingForMotion; 00147 int WaitCount; 00148 00149 void Highlight(int highlight); 00150 00151 // Methods to manipulate the cursor 00152 void Translate(double *p1, double *p2); 00153 void Scale(double *p1, double *p2, double eventPos[2]); 00154 void MoveFocus(double *p1, double *p2); 00155 00156 void CreateDefaultProperties(); 00157 00158 // Given a motion vector defined by p1 --> p2 (p1 and p2 are in 00159 // world coordinates), the new display position of the handle center is 00160 // populated into requestedDisplayPos. This is again only a request for the 00161 // new display position. It is up to the point placer to deduce the 00162 // appropriate world co-ordinates that this display position will map into. 00163 // The placer may even disallow such a movement. 00164 void MoveFocusRequest( 00165 double *p1, double *p2, double requestedDisplayPos[3] ); 00166 00167 int DetermineConstraintAxis(int constraint, double *x, double *startPickPos); 00168 00169 // Handle the label. 00170 int LabelVisibility; 00171 vtkFollower *LabelTextActor; 00172 vtkPolyDataMapper *LabelTextMapper; 00173 vtkVectorText *LabelTextInput; 00174 bool LabelAnnotationTextScaleInitialized; 00175 00176 private: 00177 vtkPolygonalHandleRepresentation3D(const vtkPolygonalHandleRepresentation3D&); //Not implemented 00178 void operator=(const vtkPolygonalHandleRepresentation3D&); //Not implemented 00179 }; 00180 00181 #endif