VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkAxesTransformRepresentation.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 =========================================================================*/ 00031 #ifndef __vtkAxesTransformRepresentation_h 00032 #define __vtkAxesTransformRepresentation_h 00033 00034 #include "vtkInteractionWidgetsModule.h" // For export macro 00035 #include "vtkWidgetRepresentation.h" 00036 00037 class vtkHandleRepresentation; 00038 class vtkPoints; 00039 class vtkPolyData; 00040 class vtkPolyDataMapper; 00041 class vtkActor; 00042 class vtkVectorText; 00043 class vtkFollower; 00044 class vtkBox; 00045 class vtkCylinderSource; 00046 class vtkGlyph3D; 00047 class vtkDoubleArray; 00048 class vtkTransformPolyDataFilter; 00049 class vtkProperty; 00050 00051 00052 class VTKINTERACTIONWIDGETS_EXPORT vtkAxesTransformRepresentation : public vtkWidgetRepresentation 00053 { 00054 public: 00056 static vtkAxesTransformRepresentation *New(); 00057 00059 00060 vtkTypeMacro(vtkAxesTransformRepresentation,vtkWidgetRepresentation); 00061 void PrintSelf(ostream& os, vtkIndent indent); 00063 00065 00068 vtkGetObjectMacro(OriginRepresentation,vtkHandleRepresentation); 00069 vtkGetObjectMacro(SelectionRepresentation,vtkHandleRepresentation); 00071 00073 00076 double* GetOriginWorldPosition(); 00077 void GetOriginWorldPosition(double pos[3]); 00078 void SetOriginWorldPosition(double pos[3]); 00079 void SetOriginDisplayPosition(double pos[3]); 00080 void GetOriginDisplayPosition(double pos[3]); 00082 00090 vtkSetClampMacro(Tolerance,int,1,100); 00091 vtkGetMacro(Tolerance,int); 00093 00095 00098 vtkSetStringMacro(LabelFormat); 00099 vtkGetStringMacro(LabelFormat); 00101 00103 enum {Outside=0,OnOrigin,OnX,OnY,OnZ,OnXEnd,OnYEnd,OnZEnd}; 00104 00106 00113 vtkSetClampMacro(InteractionState,int,Outside,OnZEnd); 00115 00117 00118 virtual void BuildRepresentation(); 00119 virtual int ComputeInteractionState(int X, int Y, int modify=0); 00120 virtual void StartWidgetInteraction(double e[2]); 00121 virtual void WidgetInteraction(double e[2]); 00122 virtual double *GetBounds(); 00124 00126 00127 virtual void ReleaseGraphicsResources(vtkWindow *w); 00128 virtual int RenderOpaqueGeometry(vtkViewport *viewport); 00129 virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport); 00131 00133 00135 void SetLabelScale(double x, double y, double z) 00136 { 00137 double scale[3]; 00138 scale[0] = x; 00139 scale[1] = y; 00140 scale[2] = z; 00141 this->SetLabelScale(scale); 00142 } 00143 virtual void SetLabelScale( double scale[3] ); 00144 virtual double * GetLabelScale(); 00146 00148 virtual vtkProperty *GetLabelProperty(); 00149 00150 protected: 00151 vtkAxesTransformRepresentation(); 00152 ~vtkAxesTransformRepresentation(); 00153 00154 // The handle and the rep used to close the handles 00155 vtkHandleRepresentation *OriginRepresentation; 00156 vtkHandleRepresentation *SelectionRepresentation; 00157 00158 // Selection tolerance for the handles 00159 int Tolerance; 00160 00161 // Format for printing the distance 00162 char *LabelFormat; 00163 00164 // The line 00165 vtkPoints *LinePoints; 00166 vtkPolyData *LinePolyData; 00167 vtkPolyDataMapper *LineMapper; 00168 vtkActor *LineActor; 00169 00170 // The distance label 00171 vtkVectorText *LabelText; 00172 vtkPolyDataMapper *LabelMapper; 00173 vtkFollower *LabelActor; 00174 00175 // The 3D disk tick marks 00176 vtkPoints *GlyphPoints; 00177 vtkDoubleArray *GlyphVectors; 00178 vtkPolyData *GlyphPolyData; 00179 vtkCylinderSource *GlyphCylinder; 00180 vtkTransformPolyDataFilter *GlyphXForm; 00181 vtkGlyph3D *Glyph3D; 00182 vtkPolyDataMapper *GlyphMapper; 00183 vtkActor *GlyphActor; 00184 00185 // Support GetBounds() method 00186 vtkBox *BoundingBox; 00187 00188 double LastEventPosition[3]; 00189 00190 private: 00191 vtkAxesTransformRepresentation(const vtkAxesTransformRepresentation&); //Not implemented 00192 void operator=(const vtkAxesTransformRepresentation&); //Not implemented 00193 }; 00194 00195 #endif