VTK
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vtkGL2PSUtilities.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGL2PSUtilities.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
23 #ifndef __vtkGL2PSUtilities_h
24 #define __vtkGL2PSUtilities_h
25 
26 #include "vtkObject.h"
27 #include "vtkRenderingGL2PSModule.h" // For export macro
28 
29 class vtkImageData;
30 class vtkMatrix4x4;
31 class vtkPath;
32 class vtkPoints;
33 class vtkRenderWindow;
34 class vtkTextProperty;
35 
36 class VTKRENDERINGGL2PS_EXPORT vtkGL2PSUtilities : public vtkObject
37 {
38 public:
39  static vtkGL2PSUtilities *New();
40  vtkTypeMacro(vtkGL2PSUtilities, vtkObject)
41  void PrintSelf(ostream& os, vtkIndent indent)
42  {
43  this->Superclass::PrintSelf(os, indent);
44  }
45 
48  static void DrawString(const char *str, vtkTextProperty *tprop, double pos[3]);
49 
51  static const char * TextPropertyToPSFontName(vtkTextProperty *tprop);
52 
55  static int TextPropertyToGL2PSAlignment(vtkTextProperty *tprop);
56 
58 
59  static vtkRenderWindow *GetRenderWindow()
60  {
61  return vtkGL2PSUtilities::RenderWindow;
62  }
64 
66 
68  static void Draw3DPath(vtkPath *path, vtkMatrix4x4 *actorMatrix,
69  double rasterPos[3], unsigned char actorColor[4]);
71 
72 
80  static void DrawPath(vtkPath *path, double rasterPos[3], double windowPos[2],
81  unsigned char rgba[4], double scale[2] = NULL,
82  double rotateAngle = 0.0, float strokeWidth = -1);
84 
86 
87  static bool GetTextAsPath()
88  {
89  return vtkGL2PSUtilities::TextAsPath;
90  }
92 
94 
96  static float GetPointSizeFactor()
97  { return vtkGL2PSUtilities::PointSizeFactor; }
98  static float GetLineWidthFactor()
99  { return vtkGL2PSUtilities::LineWidthFactor; }
101 
102 protected:
103  friend class vtkGL2PSExporter;
104 
105  static void StartExport();
106  static void FinishExport();
107 
108  static void SetPointSizeFactor(float f)
109  { vtkGL2PSUtilities::PointSizeFactor = f; }
110 
111  static void SetLineWidthFactor(float f)
112  { vtkGL2PSUtilities::LineWidthFactor = f; }
113 
114  static void SetTextAsPath(bool b)
115  {
116  vtkGL2PSUtilities::TextAsPath = b;
117  }
118 
119  static void SetRenderWindow(vtkRenderWindow *renWin)
120  {
121  vtkGL2PSUtilities::RenderWindow = renWin;
122  }
123 
124  static void DrawPathPS(vtkPath *path, double rasterPos[3],
125  double windowPos[2], unsigned char rgba[4],
126  double scale[2] = NULL, double rotateAngle = 0.0,
127  float strokeWidth = -1);
128  static void DrawPathPDF(vtkPath *path, double rasterPos[3],
129  double windowPos[2], unsigned char rgba[4],
130  double scale[2] = NULL, double rotateAngle = 0.0,
131  float strokeWidth = -1);
132  static void DrawPathSVG(vtkPath *path, double rasterPos[3],
133  double windowPos[2], unsigned char rgba[4],
134  double scale[2] = NULL, double rotateAngle = 0.0,
135  float strokeWidth = -1);
136 
139 
140 private:
141  vtkGL2PSUtilities(const vtkGL2PSUtilities &); // Not implemented
142  void operator=(const vtkGL2PSUtilities&); // Not implemented
143 
144  static vtkRenderWindow *RenderWindow;
145  static bool TextAsPath;
146  static float PointSizeFactor;
147  static float LineWidthFactor;
148 
150 
151  static void ProjectPoint(double point[3], vtkMatrix4x4 *actorMatrix = NULL);
152  static void ProjectPoint(double point[4], vtkMatrix4x4 * transformMatrix,
153  double viewportOrigin[2], double halfWidth,
154  double halfHeight, double zfact1, double zfact2);
155  static void ProjectPoints(vtkPoints *points,
156  vtkMatrix4x4 *actorMatrix = NULL);
157 };
159 
160 #endif
Helper functions for using GL2PS within VTK.
static float GetPointSizeFactor()
static bool GetTextAsPath()
static void SetLineWidthFactor(float f)
static void SetRenderWindow(vtkRenderWindow *renWin)
static float GetLineWidthFactor()
static void SetTextAsPath(bool b)
static vtkRenderWindow * GetRenderWindow()
static void SetPointSizeFactor(float f)