VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkProp3D.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 =========================================================================*/ 00032 #ifndef __vtkProp3D_h 00033 #define __vtkProp3D_h 00034 00035 #include "vtkProp.h" 00036 00037 class vtkRenderer; 00038 class vtkTransform; 00039 class vtkLinearTransform; 00040 00041 class VTK_RENDERING_EXPORT vtkProp3D : public vtkProp 00042 { 00043 public: 00044 vtkTypeMacro(vtkProp3D,vtkProp); 00045 void PrintSelf(ostream& os, vtkIndent indent); 00046 00048 void ShallowCopy(vtkProp *prop); 00049 00051 00052 virtual void SetPosition(double _arg1, double _arg2, double _arg3) 00053 { 00054 vtkDebugMacro(<< this->GetClassName() << " (" << this << 00055 "): setting Position to (" << _arg1 << "," << _arg2 << "," << 00056 _arg3 << ")"); 00057 if ((this->Position[0] != _arg1)|| 00058 (this->Position[1] != _arg2)|| 00059 (this->Position[2] != _arg3)) 00060 { 00061 this->Position[0] = _arg1; 00062 this->Position[1] = _arg2; 00063 this->Position[2] = _arg3; 00064 this->Modified(); 00065 this->IsIdentity = 0; 00066 } 00067 }; 00068 virtual void SetPosition (double _arg[3]) 00069 { 00070 this->SetPosition (_arg[0], _arg[1], _arg[2]); 00071 } 00072 vtkGetVectorMacro(Position,double,3); 00073 void AddPosition(double deltaPosition[3]); 00074 void AddPosition(double deltaX,double deltaY,double deltaZ); 00076 00078 00080 virtual void SetOrigin(double _arg1, double _arg2, double _arg3) 00081 { 00082 vtkDebugMacro(<< this->GetClassName() << " (" << this << 00083 "): setting Origin to (" << _arg1 << "," << _arg2 << "," << 00084 _arg3 << ")"); 00085 if ((this->Origin[0] != _arg1)|| 00086 (this->Origin[1] != _arg2)|| 00087 (this->Origin[2] != _arg3)) 00088 { 00089 this->Origin[0] = _arg1; 00090 this->Origin[1] = _arg2; 00091 this->Origin[2] = _arg3; 00092 this->Modified(); 00093 this->IsIdentity = 0; 00094 } 00095 }; 00096 virtual void SetOrigin(double _arg[3]) 00097 { 00098 this->SetOrigin (_arg[0], _arg[1], _arg[2]); 00099 } 00100 vtkGetVectorMacro(Origin,double,3); 00102 00104 00107 virtual void SetScale(double _arg1, double _arg2, double _arg3) 00108 { 00109 vtkDebugMacro(<< this->GetClassName() << " (" << this << 00110 "): setting Scale to (" << _arg1 << "," << _arg2 << "," << 00111 _arg3 << ")"); 00112 if (this->Scale[0] != _arg1 || 00113 this->Scale[1] != _arg2 || 00114 this->Scale[2] != _arg3 ) 00115 { 00116 this->Scale[0] = _arg1; 00117 this->Scale[1] = _arg2; 00118 this->Scale[2] = _arg3; 00119 this->Modified(); 00120 this->IsIdentity = 0; 00121 } 00122 }; 00123 virtual void SetScale (double _arg[3]) 00124 { 00125 this->SetScale (_arg[0], _arg[1], _arg[2]); 00126 } 00127 vtkGetVectorMacro(Scale,double,3); 00129 00131 void SetScale(double s) {this->SetScale(s,s,s);}; 00132 00134 00143 void SetUserTransform(vtkLinearTransform *transform); 00144 vtkGetObjectMacro(UserTransform,vtkLinearTransform); 00146 00148 00149 void SetUserMatrix(vtkMatrix4x4 *matrix); 00150 vtkMatrix4x4 *GetUserMatrix(); 00152 00154 00157 virtual void GetMatrix(vtkMatrix4x4 *m); 00158 virtual void GetMatrix(double m[16]); 00160 00165 void GetBounds(double bounds[6]); 00166 virtual double *GetBounds() = 0; 00168 00170 double *GetCenter(); 00171 00173 double *GetXRange(); 00174 00176 double *GetYRange(); 00177 00179 double *GetZRange(); 00180 00182 double GetLength(); 00183 00189 void RotateX(double); 00190 00196 void RotateY(double); 00197 00203 void RotateZ(double); 00204 00208 void RotateWXYZ(double,double,double,double); 00209 00213 void SetOrientation(double,double,double); 00214 00218 void SetOrientation(double a[3]); 00219 00221 00225 double *GetOrientation(); 00226 void GetOrientation(double o[3]); 00228 00230 double *GetOrientationWXYZ(); 00231 00235 void AddOrientation(double,double,double); 00236 00240 void AddOrientation(double a[3]); 00241 00250 void PokeMatrix(vtkMatrix4x4 *matrix); 00251 00254 void InitPathTraversal(); 00255 00257 unsigned long int GetMTime(); 00258 00260 unsigned long int GetUserTransformMatrixMTime(); 00261 00263 virtual void ComputeMatrix(); 00264 00266 00267 vtkMatrix4x4 *GetMatrix() 00268 { 00269 this->ComputeMatrix(); 00270 return this->Matrix; 00271 } 00273 00275 00276 vtkGetMacro(IsIdentity,int); 00278 00279 protected: 00280 vtkProp3D(); 00281 ~vtkProp3D(); 00282 00283 vtkLinearTransform *UserTransform; 00284 vtkMatrix4x4 *UserMatrix; 00285 vtkMatrix4x4 *Matrix; 00286 vtkTimeStamp MatrixMTime; 00287 double Origin[3]; 00288 double Position[3]; 00289 double Orientation[3]; 00290 double Scale[3]; 00291 double Center[3]; 00292 vtkTransform *Transform; 00293 double Bounds[6]; 00294 vtkProp3D *CachedProp3D; //support the PokeMatrix() method 00295 int IsIdentity; 00296 private: 00297 vtkProp3D(const vtkProp3D&); // Not implemented. 00298 void operator=(const vtkProp3D&); // Not implemented. 00299 }; 00300 00301 #endif 00302