VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkGL2PSUtilities.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 =========================================================================*/ 00023 #ifndef __vtkGL2PSUtilities_h 00024 #define __vtkGL2PSUtilities_h 00025 00026 #include "vtkObject.h" 00027 #include "vtkRenderingGL2PSModule.h" // For export macro 00028 00029 class vtkImageData; 00030 class vtkMatrix4x4; 00031 class vtkPath; 00032 class vtkPoints; 00033 class vtkRenderWindow; 00034 class vtkTextProperty; 00035 00036 class VTKRENDERINGGL2PS_EXPORT vtkGL2PSUtilities : public vtkObject 00037 { 00038 public: 00039 static vtkGL2PSUtilities *New(); 00040 vtkTypeMacro(vtkGL2PSUtilities, vtkObject) 00041 void PrintSelf(ostream& os, vtkIndent indent) 00042 { 00043 this->Superclass::PrintSelf(os, indent); 00044 } 00045 00048 static void DrawString(const char *str, vtkTextProperty *tprop, double pos[3]); 00049 00051 static const char * TextPropertyToPSFontName(vtkTextProperty *tprop); 00052 00055 static int TextPropertyToGL2PSAlignment(vtkTextProperty *tprop); 00056 00058 00059 static vtkRenderWindow *GetRenderWindow() 00060 { 00061 return vtkGL2PSUtilities::RenderWindow; 00062 } 00064 00066 00070 static void Draw3DPath(vtkPath *path, vtkMatrix4x4 *actorMatrix, 00071 double rasterPos[3], unsigned char actorColor[4], 00072 const char *label = NULL); 00074 00075 00085 static void DrawPath(vtkPath *path, double rasterPos[3], double windowPos[2], 00086 unsigned char rgba[4], double scale[2] = NULL, 00087 double rotateAngle = 0.0, float strokeWidth = -1, 00088 const char *label = NULL); 00090 00092 00093 static bool GetTextAsPath() 00094 { 00095 return vtkGL2PSUtilities::TextAsPath; 00096 } 00098 00100 00102 static float GetPointSizeFactor() 00103 { return vtkGL2PSUtilities::PointSizeFactor; } 00104 static float GetLineWidthFactor() 00105 { return vtkGL2PSUtilities::LineWidthFactor; } 00107 00108 protected: 00109 friend class vtkGL2PSExporter; 00110 00111 static void StartExport(); 00112 static void FinishExport(); 00113 00114 static void SetPointSizeFactor(float f) 00115 { vtkGL2PSUtilities::PointSizeFactor = f; } 00116 00117 static void SetLineWidthFactor(float f) 00118 { vtkGL2PSUtilities::LineWidthFactor = f; } 00119 00120 static void SetTextAsPath(bool b) 00121 { 00122 vtkGL2PSUtilities::TextAsPath = b; 00123 } 00124 00125 static void SetRenderWindow(vtkRenderWindow *renWin) 00126 { 00127 vtkGL2PSUtilities::RenderWindow = renWin; 00128 } 00129 00130 static void DrawPathPS(vtkPath *path, double rasterPos[3], 00131 double windowPos[2], unsigned char rgba[4], 00132 double scale[2] = NULL, double rotateAngle = 0.0, 00133 float strokeWidth = -1, const char *label = NULL); 00134 static void DrawPathPDF(vtkPath *path, double rasterPos[3], 00135 double windowPos[2], unsigned char rgba[4], 00136 double scale[2] = NULL, double rotateAngle = 0.0, 00137 float strokeWidth = -1, const char *label = NULL); 00138 static void DrawPathSVG(vtkPath *path, double rasterPos[3], 00139 double windowPos[2], unsigned char rgba[4], 00140 double scale[2] = NULL, double rotateAngle = 0.0, 00141 float strokeWidth = -1, const char *label = NULL); 00142 00143 vtkGL2PSUtilities() {} 00144 ~vtkGL2PSUtilities() {} 00145 00146 private: 00147 vtkGL2PSUtilities(const vtkGL2PSUtilities &); // Not implemented 00148 void operator=(const vtkGL2PSUtilities&); // Not implemented 00149 00150 static vtkRenderWindow *RenderWindow; 00151 static bool TextAsPath; 00152 static float PointSizeFactor; 00153 static float LineWidthFactor; 00154 00156 00157 static void ProjectPoint(double point[3], vtkMatrix4x4 *actorMatrix = NULL); 00158 static void ProjectPoint(double point[4], vtkMatrix4x4 * transformMatrix, 00159 double viewportOrigin[2], double halfWidth, 00160 double halfHeight, double zfact1, double zfact2); 00161 static void ProjectPoints(vtkPoints *points, 00162 vtkMatrix4x4 *actorMatrix = NULL); 00163 }; 00165 00166 #endif