VTK
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 
37 {
38 public:
39  static vtkGL2PSUtilities *New();
41  void PrintSelf(ostream& os, vtkIndent indent)
42  {
43  this->Superclass::PrintSelf(os, indent);
44  }
45 
47 
50  static void DrawString(const char *str, vtkTextProperty *tprop, double pos[3],
51  double backgroundDepth);
53 
55  static const char * TextPropertyToPSFontName(vtkTextProperty *tprop);
56 
59  static int TextPropertyToGL2PSAlignment(vtkTextProperty *tprop);
60 
62 
64  {
65  return vtkGL2PSUtilities::RenderWindow;
66  }
68 
70 
74  static void Draw3DPath(vtkPath *path, vtkMatrix4x4 *actorMatrix,
75  double rasterPos[3], unsigned char actorColor[4],
76  const char *label = NULL);
78 
79 
89  static void DrawPath(vtkPath *path, double rasterPos[3], double windowPos[2],
90  unsigned char rgba[4], double scale[2] = NULL,
91  double rotateAngle = 0.0, float strokeWidth = -1,
92  const char *label = NULL);
94 
96 
97  static bool GetTextAsPath()
98  {
99  return vtkGL2PSUtilities::TextAsPath;
100  }
102 
104 
106  static float GetPointSizeFactor()
107  { return vtkGL2PSUtilities::PointSizeFactor; }
108  static float GetLineWidthFactor()
109  { return vtkGL2PSUtilities::LineWidthFactor; }
111 
112 protected:
113  friend class vtkGL2PSExporter;
114 
115  static void StartExport();
116  static void FinishExport();
117 
118  static void SetPointSizeFactor(float f)
119  { vtkGL2PSUtilities::PointSizeFactor = f; }
120 
121  static void SetLineWidthFactor(float f)
122  { vtkGL2PSUtilities::LineWidthFactor = f; }
123 
124  static void SetTextAsPath(bool b)
125  {
126  vtkGL2PSUtilities::TextAsPath = b;
127  }
128 
129  static void SetRenderWindow(vtkRenderWindow *renWin)
130  {
131  vtkGL2PSUtilities::RenderWindow = renWin;
132  }
133 
134  static void DrawPathPS(vtkPath *path, double rasterPos[3],
135  double windowPos[2], unsigned char rgba[4],
136  double scale[2] = NULL, double rotateAngle = 0.0,
137  float strokeWidth = -1, const char *label = NULL);
138  static void DrawPathPDF(vtkPath *path, double rasterPos[3],
139  double windowPos[2], unsigned char rgba[4],
140  double scale[2] = NULL, double rotateAngle = 0.0,
141  float strokeWidth = -1, const char *label = NULL);
142  static void DrawPathSVG(vtkPath *path, double rasterPos[3],
143  double windowPos[2], unsigned char rgba[4],
144  double scale[2] = NULL, double rotateAngle = 0.0,
145  float strokeWidth = -1, const char *label = NULL);
146 
149 
150 private:
151  vtkGL2PSUtilities(const vtkGL2PSUtilities &); // Not implemented
152  void operator=(const vtkGL2PSUtilities&); // Not implemented
153 
155  static bool TextAsPath;
156  static float PointSizeFactor;
157  static float LineWidthFactor;
158 
160 
161  static void ProjectPoint(double point[3], vtkMatrix4x4 *actorMatrix = NULL);
162  static void ProjectPoint(double point[4], vtkMatrix4x4 * transformMatrix,
163  double viewportOrigin[2], double halfWidth,
164  double halfHeight, double zfact1, double zfact2);
165  static void ProjectPoints(vtkPoints *points,
166  vtkMatrix4x4 *actorMatrix = NULL);
168 
170 
172  static void UnprojectPoint(double point[4], vtkMatrix4x4 *invTransformMatrix,
173  double viewportOrigin[2], double halfWidth,
174  double halfHeight, double zfact1, double zfact2);
175  static void UnprojectPoints(double *points3D, vtkIdType numPoints,
176  vtkMatrix4x4 *actorMatrix = NULL);
177 };
179 
180 #endif
Helper functions for using GL2PS within VTK.
abstract base class for most VTK objects
Definition: vtkObject.h:61
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:38
export a scene as a PostScript file using GL2PS.
static float GetPointSizeFactor()
concrete dataset representing a path defined by Bezier curves.
Definition: vtkPath.h:34
static bool GetTextAsPath()
virtual void PrintSelf(ostream &os, vtkIndent indent)
int vtkIdType
Definition: vtkType.h:275
static void SetLineWidthFactor(float f)
static void SetRenderWindow(vtkRenderWindow *renWin)
a simple class to control print indentation
Definition: vtkIndent.h:38
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
static float GetLineWidthFactor()
represent text properties.
vtkWeakPointer< vtkRenderWindow > RenderWindow
create a window for renderers to draw into
static void SetTextAsPath(bool b)
static vtkRenderWindow * GetRenderWindow()
static vtkObject * New()
#define VTKRENDERINGGL2PS_EXPORT
represent and manipulate 3D points
Definition: vtkPoints.h:38
static void SetPointSizeFactor(float f)