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 =========================================================================*/
24 #ifndef vtkGL2PSUtilities_h
25 #define vtkGL2PSUtilities_h
26 
27 #include "vtkObject.h"
28 #include "vtkRenderingGL2PSModule.h" // For export macro
29 
30 class vtkImageData;
31 class vtkMatrix4x4;
32 class vtkPath;
33 class vtkPoints;
34 class vtkRenderWindow;
35 class vtkTextProperty;
36 
37 class VTKRENDERINGGL2PS_EXPORT vtkGL2PSUtilities : public vtkObject
38 {
39 public:
40  static vtkGL2PSUtilities *New();
42  void PrintSelf(ostream& os, vtkIndent indent)
43  {
44  this->Superclass::PrintSelf(os, indent);
45  }
46 
51  static void DrawString(const char *str, vtkTextProperty *tprop, double pos[3],
52  double backgroundDepth);
53 
57  static const char * TextPropertyToPSFontName(vtkTextProperty *tprop);
58 
62  static int TextPropertyToGL2PSAlignment(vtkTextProperty *tprop);
63 
68  {
69  return vtkGL2PSUtilities::RenderWindow;
70  }
71 
77  static void Draw3DPath(vtkPath *path, vtkMatrix4x4 *actorMatrix,
78  double rasterPos[3], unsigned char actorColor[4],
79  const char *label = NULL);
91  static void DrawPath(vtkPath *path, double rasterPos[3], double windowPos[2],
92  unsigned char rgba[4], double scale[2] = NULL,
93  double rotateAngle = 0.0, float strokeWidth = -1,
94  const char *label = NULL);
95 
99  static bool GetTextAsPath()
100  {
101  return vtkGL2PSUtilities::TextAsPath;
102  }
103 
108  static float GetPointSizeFactor()
109  { return vtkGL2PSUtilities::PointSizeFactor; }
110  static float GetLineWidthFactor()
111  { return vtkGL2PSUtilities::LineWidthFactor; }
112 
113 protected:
115 
116  static void StartExport();
117  static void FinishExport();
118 
119  static void SetPointSizeFactor(float f)
120  { vtkGL2PSUtilities::PointSizeFactor = f; }
121 
122  static void SetLineWidthFactor(float f)
123  { vtkGL2PSUtilities::LineWidthFactor = f; }
124 
125  static void SetTextAsPath(bool b)
126  {
127  vtkGL2PSUtilities::TextAsPath = b;
128  }
129 
130  static void SetRenderWindow(vtkRenderWindow *renWin)
131  {
132  vtkGL2PSUtilities::RenderWindow = renWin;
133  }
134 
135  static void DrawPathPS(vtkPath *path, double rasterPos[3],
136  double windowPos[2], unsigned char rgba[4],
137  double scale[2] = NULL, double rotateAngle = 0.0,
138  float strokeWidth = -1, const char *label = NULL);
139  static void DrawPathPDF(vtkPath *path, double rasterPos[3],
140  double windowPos[2], unsigned char rgba[4],
141  double scale[2] = NULL, double rotateAngle = 0.0,
142  float strokeWidth = -1, const char *label = NULL);
143  static void DrawPathSVG(vtkPath *path, double rasterPos[3],
144  double windowPos[2], unsigned char rgba[4],
145  double scale[2] = NULL, double rotateAngle = 0.0,
146  float strokeWidth = -1, const char *label = NULL);
147 
150 
151 private:
152  vtkGL2PSUtilities(const vtkGL2PSUtilities &) VTK_DELETE_FUNCTION;
153  void operator=(const vtkGL2PSUtilities&) VTK_DELETE_FUNCTION;
154 
156  static bool TextAsPath;
157  static float PointSizeFactor;
158  static float LineWidthFactor;
159 
161 
164  static void ProjectPoint(double point[4], vtkMatrix4x4 *actorMatrix = NULL);
165  static void ProjectPoint(double point[4], vtkMatrix4x4 * transformMatrix,
166  double viewportOrigin[2], double halfWidth,
167  double halfHeight, double zfact1, double zfact2);
168  static void ProjectPoints(vtkPoints *points,
169  vtkMatrix4x4 *actorMatrix = NULL);
171 
173 
177  static void UnprojectPoint(double point[4], vtkMatrix4x4 *invTransformMatrix,
178  double viewportOrigin[2], double halfWidth,
179  double halfHeight, double zfact1, double zfact2);
180  static void UnprojectPoints(double *points3D, vtkIdType numPoints,
181  vtkMatrix4x4 *actorMatrix = NULL);
182 };
184 
185 #endif
Helper functions for using GL2PS within VTK.
abstract base class for most VTK objects
Definition: vtkObject.h:59
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
static float GetPointSizeFactor()
Get a scaling factor for the point size or line width used by GL2PS.
concrete dataset representing a path defined by Bezier curves.
Definition: vtkPath.h:35
static bool GetTextAsPath()
Get whether all text will be exported as paths.
int vtkIdType
Definition: vtkType.h:287
static void SetLineWidthFactor(float f)
static void SetRenderWindow(vtkRenderWindow *renWin)
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
static float GetLineWidthFactor()
OpenGL2 implementation of GL2PS exporter.
represent text properties.
vtkWeakPointer< vtkRenderWindow > RenderWindow
create a window for renderers to draw into
static void SetTextAsPath(bool b)
static vtkRenderWindow * GetRenderWindow()
Get the current RenderWindow that is being exported.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
represent and manipulate 3D points
Definition: vtkPoints.h:39
static void SetPointSizeFactor(float f)