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 "vtkWidgetRepresentation.h" 00035 00036 class vtkHandleRepresentation; 00037 class vtkPoints; 00038 class vtkPolyData; 00039 class vtkPolyDataMapper; 00040 class vtkActor; 00041 class vtkVectorText; 00042 class vtkFollower; 00043 class vtkBox; 00044 class vtkCylinderSource; 00045 class vtkGlyph3D; 00046 class vtkDoubleArray; 00047 class vtkTransformPolyDataFilter; 00048 class vtkProperty; 00049 00050 00051 class VTK_WIDGETS_EXPORT vtkAxesTransformRepresentation : public vtkWidgetRepresentation 00052 { 00053 public: 00055 static vtkAxesTransformRepresentation *New(); 00056 00058 00059 vtkTypeMacro(vtkAxesTransformRepresentation,vtkWidgetRepresentation); 00060 void PrintSelf(ostream& os, vtkIndent indent); 00062 00064 00067 vtkGetObjectMacro(OriginRepresentation,vtkHandleRepresentation); 00068 vtkGetObjectMacro(SelectionRepresentation,vtkHandleRepresentation); 00070 00072 00075 double* GetOriginWorldPosition(); 00076 void GetOriginWorldPosition(double pos[3]); 00077 void SetOriginWorldPosition(double pos[3]); 00078 void SetOriginDisplayPosition(double pos[3]); 00079 void GetOriginDisplayPosition(double pos[3]); 00081 00089 vtkSetClampMacro(Tolerance,int,1,100); 00090 vtkGetMacro(Tolerance,int); 00092 00094 00097 vtkSetStringMacro(LabelFormat); 00098 vtkGetStringMacro(LabelFormat); 00100 00102 enum {Outside=0,OnOrigin,OnX,OnY,OnZ,OnXEnd,OnYEnd,OnZEnd}; 00103 00105 00112 vtkSetClampMacro(InteractionState,int,Outside,OnZEnd); 00114 00116 00117 virtual void BuildRepresentation(); 00118 virtual int ComputeInteractionState(int X, int Y, int modify=0); 00119 virtual void StartWidgetInteraction(double e[2]); 00120 virtual void WidgetInteraction(double e[2]); 00121 virtual double *GetBounds(); 00123 00125 00126 virtual void ReleaseGraphicsResources(vtkWindow *w); 00127 virtual int RenderOpaqueGeometry(vtkViewport *viewport); 00128 virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport); 00130 00132 00134 void SetLabelScale(double x, double y, double z) 00135 { 00136 double scale[3]; 00137 scale[0] = x; 00138 scale[1] = y; 00139 scale[2] = z; 00140 this->SetLabelScale(scale); 00141 } 00142 virtual void SetLabelScale( double scale[3] ); 00143 virtual double * GetLabelScale(); 00145 00147 virtual vtkProperty *GetLabelProperty(); 00148 00149 protected: 00150 vtkAxesTransformRepresentation(); 00151 ~vtkAxesTransformRepresentation(); 00152 00153 // The handle and the rep used to close the handles 00154 vtkHandleRepresentation *OriginRepresentation; 00155 vtkHandleRepresentation *SelectionRepresentation; 00156 00157 // Selection tolerance for the handles 00158 int Tolerance; 00159 00160 // Format for printing the distance 00161 char *LabelFormat; 00162 00163 // The line 00164 vtkPoints *LinePoints; 00165 vtkPolyData *LinePolyData; 00166 vtkPolyDataMapper *LineMapper; 00167 vtkActor *LineActor; 00168 00169 // The distance label 00170 vtkVectorText *LabelText; 00171 vtkPolyDataMapper *LabelMapper; 00172 vtkFollower *LabelActor; 00173 00174 // The 3D disk tick marks 00175 vtkPoints *GlyphPoints; 00176 vtkDoubleArray *GlyphVectors; 00177 vtkPolyData *GlyphPolyData; 00178 vtkCylinderSource *GlyphCylinder; 00179 vtkTransformPolyDataFilter *GlyphXForm; 00180 vtkGlyph3D *Glyph3D; 00181 vtkPolyDataMapper *GlyphMapper; 00182 vtkActor *GlyphActor; 00183 00184 // Support GetBounds() method 00185 vtkBox *BoundingBox; 00186 00187 double LastEventPosition[3]; 00188 00189 private: 00190 vtkAxesTransformRepresentation(const vtkAxesTransformRepresentation&); //Not implemented 00191 void operator=(const vtkAxesTransformRepresentation&); //Not implemented 00192 }; 00193 00194 #endif