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 class vtkStdString;
37 
38 class VTKRENDERINGGL2PS_EXPORT vtkGL2PSUtilities : public vtkObject
39 {
40 public:
41  static vtkGL2PSUtilities *New();
43  void PrintSelf(ostream& os, vtkIndent indent) override
44  {
45  this->Superclass::PrintSelf(os, indent);
46  }
47 
52  static void DrawString(const char *str, vtkTextProperty *tprop, double pos[3],
53  double backgroundDepth);
54 
58  static const char * TextPropertyToPSFontName(vtkTextProperty *tprop);
59 
63  static int TextPropertyToGL2PSAlignment(vtkTextProperty *tprop);
64 
69  {
70  return vtkGL2PSUtilities::RenderWindow;
71  }
72 
78  static void Draw3DPath(vtkPath *path, vtkMatrix4x4 *actorMatrix,
79  double rasterPos[3], unsigned char actorColor[4],
80  const char *label = NULL);
92  static void DrawPath(vtkPath *path, double rasterPos[3], double windowPos[2],
93  unsigned char rgba[4], double scale[2] = NULL,
94  double rotateAngle = 0.0, float strokeWidth = -1,
95  const char *label = NULL);
96 
100  static bool GetTextAsPath()
101  {
102  return vtkGL2PSUtilities::TextAsPath;
103  }
104 
109  static float GetPointSizeFactor()
110  { return vtkGL2PSUtilities::PointSizeFactor; }
111  static float GetLineWidthFactor()
112  { return vtkGL2PSUtilities::LineWidthFactor; }
113 
114 protected:
116 
117  static void StartExport();
118  static void FinishExport();
119 
120  static void SetPointSizeFactor(float f)
121  { vtkGL2PSUtilities::PointSizeFactor = f; }
122 
123  static void SetLineWidthFactor(float f)
124  { vtkGL2PSUtilities::LineWidthFactor = f; }
125 
126  static void SetTextAsPath(bool b)
127  {
128  vtkGL2PSUtilities::TextAsPath = b;
129  }
130 
131  static void SetRenderWindow(vtkRenderWindow *renWin)
132  {
133  vtkGL2PSUtilities::RenderWindow = renWin;
134  }
135 
136  static void DrawPathPS(vtkPath *path, double rasterPos[3],
137  double windowPos[2], unsigned char rgba[4],
138  double scale[2] = NULL, double rotateAngle = 0.0,
139  float strokeWidth = -1, const char *label = NULL);
140  static void DrawPathPDF(vtkPath *path, double rasterPos[3],
141  double windowPos[2], unsigned char rgba[4],
142  double scale[2] = NULL, double rotateAngle = 0.0,
143  float strokeWidth = -1, const char *label = NULL);
144  static void DrawPathSVG(vtkPath *path, double rasterPos[3],
145  double windowPos[2], unsigned char rgba[4],
146  double scale[2] = NULL, double rotateAngle = 0.0,
147  float strokeWidth = -1, const char *label = NULL);
148 
150  ~vtkGL2PSUtilities() override {}
151 
152 private:
153  vtkGL2PSUtilities(const vtkGL2PSUtilities &) = delete;
154  void operator=(const vtkGL2PSUtilities&) = delete;
155 
157  static bool TextAsPath;
158  static float PointSizeFactor;
159  static float LineWidthFactor;
160 
162 
165  static void ProjectPoint(double point[4], vtkMatrix4x4 *actorMatrix = NULL);
166  static void ProjectPoint(double point[4], vtkMatrix4x4 * transformMatrix,
167  double viewportOrigin[2], double halfWidth,
168  double halfHeight, double zfact1, double zfact2);
169  static void ProjectPoints(vtkPoints *points,
170  vtkMatrix4x4 *actorMatrix = NULL);
172 
174 
178  static void UnprojectPoint(double point[4], vtkMatrix4x4 *invTransformMatrix,
179  double viewportOrigin[2], double halfWidth,
180  double halfHeight, double zfact1, double zfact2);
181  static void UnprojectPoints(double *points3D, vtkIdType numPoints,
182  vtkMatrix4x4 *actorMatrix = NULL);
184 };
185 
186 
187 #endif
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:40
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:345
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
~vtkGL2PSUtilities() override
static float GetLineWidthFactor()
OpenGL2 implementation of GL2PS exporter.
represent text properties.
create a window for renderers to draw into
static void SetTextAsPath(bool b)
vtkRenderWindow * RenderWindow
Definition: vtkExporter.h:111
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)