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 "vtkRenderingCoreModule.h" // For export macro 00036 #include "vtkProp.h" 00037 00038 class vtkRenderer; 00039 class vtkTransform; 00040 class vtkLinearTransform; 00041 00042 class VTKRENDERINGCORE_EXPORT vtkProp3D : public vtkProp 00043 { 00044 public: 00045 vtkTypeMacro(vtkProp3D,vtkProp); 00046 void PrintSelf(ostream& os, vtkIndent indent); 00047 00049 void ShallowCopy(vtkProp *prop); 00050 00052 00053 virtual void SetPosition(double x, double y, double z) 00054 { 00055 vtkDebugMacro(<< this->GetClassName() << " (" << this << 00056 "): setting Position to (" << x << "," << y << "," << 00057 z << ")"); 00058 if ((this->Position[0] != x)|| 00059 (this->Position[1] != y)|| 00060 (this->Position[2] != z)) 00061 { 00062 this->Position[0] = x; 00063 this->Position[1] = y; 00064 this->Position[2] = z; 00065 this->Modified(); 00066 this->IsIdentity = 0; 00067 } 00068 }; 00070 00071 virtual void SetPosition(double pos[3]) 00072 { this->SetPosition(pos[0], pos[1], pos[2]); } 00073 vtkGetVectorMacro(Position, double, 3); 00074 void AddPosition(double deltaPosition[3]); 00075 void AddPosition(double deltaX, double deltaY, double deltaZ); 00076 00078 00080 virtual void SetOrigin(double x, double y, double z) 00081 { 00082 vtkDebugMacro(<< this->GetClassName() << " (" << this << 00083 "): setting Origin to (" << x << "," << y << "," << 00084 z << ")"); 00085 if ((this->Origin[0] != x)|| 00086 (this->Origin[1] != y)|| 00087 (this->Origin[2] != z)) 00088 { 00089 this->Origin[0] = x; 00090 this->Origin[1] = y; 00091 this->Origin[2] = z; 00092 this->Modified(); 00093 this->IsIdentity = 0; 00094 } 00095 }; 00096 virtual void SetOrigin(const double pos[3]) 00097 { this->SetOrigin(pos[0], pos[1], pos[2]); } 00098 vtkGetVectorMacro(Origin, double, 3); 00100 00102 00105 virtual void SetScale(double x, double y, double z) 00106 { 00107 vtkDebugMacro(<< this->GetClassName() << " (" << this << 00108 "): setting Scale to (" << x << "," << y << "," << 00109 z << ")"); 00110 if (this->Scale[0] != x || 00111 this->Scale[1] != y || 00112 this->Scale[2] != z ) 00113 { 00114 this->Scale[0] = x; 00115 this->Scale[1] = y; 00116 this->Scale[2] = z; 00117 this->Modified(); 00118 this->IsIdentity = 0; 00119 } 00120 }; 00121 virtual void SetScale(double scale[3]) 00122 { this->SetScale(scale[0], scale[1], scale[2]); } 00123 vtkGetVectorMacro(Scale, double, 3); 00125 00127 00128 void SetScale(double s) 00129 { this->SetScale(s, s, s); } 00131 00133 00142 void SetUserTransform(vtkLinearTransform *transform); 00143 vtkGetObjectMacro(UserTransform, vtkLinearTransform); 00145 00147 00148 void SetUserMatrix(vtkMatrix4x4 *matrix); 00149 vtkMatrix4x4 *GetUserMatrix(); 00151 00153 00156 virtual void GetMatrix(vtkMatrix4x4 *m); 00157 virtual void GetMatrix(double m[16]); 00159 00164 void GetBounds(double bounds[6]); 00165 virtual double *GetBounds() = 0; 00167 00169 double *GetCenter(); 00170 00172 double *GetXRange(); 00173 00175 double *GetYRange(); 00176 00178 double *GetZRange(); 00179 00181 double GetLength(); 00182 00188 void RotateX(double); 00189 00195 void RotateY(double); 00196 00202 void RotateZ(double); 00203 00207 void RotateWXYZ(double w, double x, double y, double z); 00208 00212 void SetOrientation(double x, double y, double z); 00213 00217 void SetOrientation(double orientation[3]); 00218 00220 00224 double *GetOrientation(); 00225 void GetOrientation(double orentation[3]); 00227 00229 double *GetOrientationWXYZ(); 00230 00234 void AddOrientation(double x, double y, double z); 00235 00239 void AddOrientation(double orentation[3]); 00240 00249 void PokeMatrix(vtkMatrix4x4 *matrix); 00250 00253 void InitPathTraversal(); 00254 00256 unsigned long int GetMTime(); 00257 00259 unsigned long int GetUserTransformMatrixMTime(); 00260 00262 virtual void ComputeMatrix(); 00263 00265 00266 vtkMatrix4x4 *GetMatrix() 00267 { 00268 this->ComputeMatrix(); 00269 return this->Matrix; 00270 } 00272 00274 00275 vtkGetMacro(IsIdentity, int); 00277 00278 protected: 00279 vtkProp3D(); 00280 ~vtkProp3D(); 00281 00282 vtkLinearTransform *UserTransform; 00283 vtkMatrix4x4 *UserMatrix; 00284 vtkMatrix4x4 *Matrix; 00285 vtkTimeStamp MatrixMTime; 00286 double Origin[3]; 00287 double Position[3]; 00288 double Orientation[3]; 00289 double Scale[3]; 00290 double Center[3]; 00291 vtkTransform *Transform; 00292 double Bounds[6]; 00293 vtkProp3D *CachedProp3D; //support the PokeMatrix() method 00294 int IsIdentity; 00295 private: 00296 vtkProp3D(const vtkProp3D&); // Not implemented. 00297 void operator=(const vtkProp3D&); // Not implemented. 00298 }; 00299 00300 #endif