VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkAbstractPolygonalHandleRepresentation3D.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 =========================================================================*/ 00033 #ifndef __vtkAbstractPolygonalHandleRepresentation3D_h 00034 #define __vtkAbstractPolygonalHandleRepresentation3D_h 00035 00036 #include "vtkHandleRepresentation.h" 00037 00038 class vtkProperty; 00039 class vtkPolyDataMapper; 00040 class vtkCellPicker; 00041 class vtkTransformPolyDataFilter; 00042 class vtkMatrixToLinearTransform; 00043 class vtkMatrix4x4; 00044 class vtkPolyData; 00045 class vtkAbstractTransform; 00046 class vtkActor; 00047 class vtkFollower; 00048 class vtkVectorText; 00049 00050 class VTK_WIDGETS_EXPORT vtkAbstractPolygonalHandleRepresentation3D 00051 : public vtkHandleRepresentation 00052 { 00053 public: 00054 00056 00057 vtkTypeMacro(vtkAbstractPolygonalHandleRepresentation3D,vtkHandleRepresentation); 00058 void PrintSelf(ostream& os, vtkIndent indent); 00060 00062 00063 virtual void SetWorldPosition(double p[3]); 00064 virtual void SetDisplayPosition(double p[3]); 00066 00068 00069 void SetHandle( vtkPolyData * ); 00070 vtkPolyData * GetHandle(); 00072 00074 00075 void SetProperty(vtkProperty*); 00076 void SetSelectedProperty(vtkProperty*); 00077 vtkGetObjectMacro(Property,vtkProperty); 00078 vtkGetObjectMacro(SelectedProperty,vtkProperty); 00080 00083 virtual vtkAbstractTransform * GetTransform(); 00084 00086 00088 virtual void BuildRepresentation(); 00089 virtual void StartWidgetInteraction(double eventPos[2]); 00090 virtual void WidgetInteraction(double eventPos[2]); 00091 virtual int ComputeInteractionState(int X, int Y, int modify=0); 00093 00095 00096 virtual void ShallowCopy(vtkProp *prop); 00097 virtual void DeepCopy(vtkProp *prop); 00098 virtual void GetActors(vtkPropCollection *); 00099 virtual void ReleaseGraphicsResources(vtkWindow *); 00100 virtual int RenderOpaqueGeometry(vtkViewport *viewport); 00101 virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport); 00102 virtual int HasTranslucentPolygonalGeometry(); 00103 virtual double *GetBounds(); 00105 00107 00109 vtkSetMacro( LabelVisibility, int ); 00110 vtkGetMacro( LabelVisibility, int ); 00111 vtkBooleanMacro( LabelVisibility, int ); 00112 virtual void SetLabelText( const char * label ); 00113 virtual char * GetLabelText(); 00115 00117 00118 virtual void SetLabelTextScale( double scale[3] ); 00119 void SetLabelTextScale(double x, double y, double z) 00120 { 00121 double scale[3] = {x, y, z}; 00122 this->SetLabelTextScale(scale); 00123 } 00124 virtual double * GetLabelTextScale(); 00126 00128 00129 vtkGetObjectMacro( LabelTextActor, vtkFollower ); 00131 00135 virtual void SetUniformScale( double scale ); 00136 00138 00139 vtkSetMacro( HandleVisibility, int ); 00140 vtkGetMacro( HandleVisibility, int ); 00141 vtkBooleanMacro( HandleVisibility, int ); 00143 00144 void Highlight(int highlight); 00145 00147 00157 vtkSetMacro( SmoothMotion, int ); 00158 vtkGetMacro( SmoothMotion, int ); 00159 vtkBooleanMacro( SmoothMotion, int ); 00161 00162 protected: 00163 vtkAbstractPolygonalHandleRepresentation3D(); 00164 ~vtkAbstractPolygonalHandleRepresentation3D(); 00165 00166 vtkActor * Actor; 00167 vtkPolyDataMapper * Mapper; 00168 vtkTransformPolyDataFilter * HandleTransformFilter; 00169 vtkMatrixToLinearTransform * HandleTransform; 00170 vtkMatrix4x4 * HandleTransformMatrix; 00171 vtkCellPicker * HandlePicker; 00172 double LastPickPosition[3]; 00173 double LastEventPosition[2]; 00174 int ConstraintAxis; 00175 vtkProperty * Property; 00176 vtkProperty * SelectedProperty; 00177 int WaitingForMotion; 00178 int WaitCount; 00179 int HandleVisibility; 00180 00181 00182 // Methods to manipulate the cursor 00183 virtual void Translate(double *p1, double *p2); 00184 virtual void Scale(double *p1, double *p2, double eventPos[2]); 00185 virtual void MoveFocus(double *p1, double *p2); 00186 00187 void CreateDefaultProperties(); 00188 00189 // Given a motion vector defined by p1 --> p2 (p1 and p2 are in 00190 // world coordinates), the new display position of the handle center is 00191 // populated into requestedDisplayPos. This is again only a request for the 00192 // new display position. It is up to the point placer to deduce the 00193 // appropriate world co-ordinates that this display position will map into. 00194 // The placer may even disallow such a movement. 00195 // If "SmoothMotion" is OFF, the returned requestedDisplayPos is the same 00196 // as the event position, ie the location of the mouse cursor. If its OFF, 00197 // incremental offsets as described above are used to compute it. 00198 void MoveFocusRequest( double *p1, double *p2, 00199 double eventPos[2], double requestedDisplayPos[3] ); 00200 00201 int DetermineConstraintAxis(int constraint, double *x, double *startPickPos); 00202 00210 virtual void UpdateHandle(); 00211 00213 virtual void UpdateLabel(); 00214 00215 // Handle the label. 00216 int LabelVisibility; 00217 vtkFollower *LabelTextActor; 00218 vtkPolyDataMapper *LabelTextMapper; 00219 vtkVectorText *LabelTextInput; 00220 bool LabelAnnotationTextScaleInitialized; 00221 int SmoothMotion; 00222 00223 private: 00224 vtkAbstractPolygonalHandleRepresentation3D(const vtkAbstractPolygonalHandleRepresentation3D&); //Not implemented 00225 void operator=(const vtkAbstractPolygonalHandleRepresentation3D&); //Not implemented 00226 }; 00227 00228 #endif 00229 00230