VTK
dox/Rendering/GL2PS/vtkGL2PSUtilities.h
Go to the documentation of this file.
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 
00068   static void Draw3DPath(vtkPath *path, vtkMatrix4x4 *actorMatrix,
00069                          double rasterPos[3], unsigned char actorColor[4]);
00071 
00072 
00080   static void DrawPath(vtkPath *path, double rasterPos[3], double windowPos[2],
00081                        unsigned char rgba[4], double scale[2] = NULL,
00082                        double rotateAngle = 0.0, float strokeWidth = -1);
00084 
00086 
00087   static bool GetTextAsPath()
00088   {
00089     return vtkGL2PSUtilities::TextAsPath;
00090   }
00092 
00094 
00096   static float GetPointSizeFactor()
00097     { return vtkGL2PSUtilities::PointSizeFactor; }
00098   static float GetLineWidthFactor()
00099     { return vtkGL2PSUtilities::LineWidthFactor; }
00101 
00102 protected:
00103   friend class vtkGL2PSExporter;
00104 
00105   static void StartExport();
00106   static void FinishExport();
00107 
00108   static void SetPointSizeFactor(float f)
00109     { vtkGL2PSUtilities::PointSizeFactor = f; }
00110 
00111   static void SetLineWidthFactor(float f)
00112     { vtkGL2PSUtilities::LineWidthFactor = f; }
00113 
00114   static void SetTextAsPath(bool b)
00115   {
00116     vtkGL2PSUtilities::TextAsPath = b;
00117   }
00118 
00119   static void SetRenderWindow(vtkRenderWindow *renWin)
00120   {
00121     vtkGL2PSUtilities::RenderWindow = renWin;
00122   }
00123 
00124   static void DrawPathPS(vtkPath *path, double rasterPos[3],
00125                          double windowPos[2], unsigned char rgba[4],
00126                          double scale[2] = NULL, double rotateAngle = 0.0,
00127                          float strokeWidth = -1);
00128   static void DrawPathPDF(vtkPath *path, double rasterPos[3],
00129                           double windowPos[2], unsigned char rgba[4],
00130                           double scale[2] = NULL, double rotateAngle = 0.0,
00131                           float strokeWidth = -1);
00132   static void DrawPathSVG(vtkPath *path, double rasterPos[3],
00133                           double windowPos[2], unsigned char rgba[4],
00134                           double scale[2] = NULL, double rotateAngle = 0.0,
00135                           float strokeWidth = -1);
00136 
00137   vtkGL2PSUtilities() {}
00138   ~vtkGL2PSUtilities() {}
00139 
00140 private:
00141   vtkGL2PSUtilities(const vtkGL2PSUtilities &); // Not implemented
00142   void operator=(const vtkGL2PSUtilities&); // Not implemented
00143 
00144   static vtkRenderWindow *RenderWindow;
00145   static bool TextAsPath;
00146   static float PointSizeFactor;
00147   static float LineWidthFactor;
00148 
00150 
00151   static void ProjectPoint(double point[3], vtkMatrix4x4 *actorMatrix = NULL);
00152   static void ProjectPoint(double point[4], vtkMatrix4x4 * transformMatrix,
00153                            double viewportOrigin[2], double halfWidth,
00154                            double halfHeight, double zfact1, double zfact2);
00155   static void ProjectPoints(vtkPoints *points,
00156                             vtkMatrix4x4 *actorMatrix = NULL);
00157 };
00159 
00160 #endif