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:
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 
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
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:40
vtkGL2PSUtilities::DrawPathPS
static void DrawPathPS(vtkPath *path, double rasterPos[3], double windowPos[2], unsigned char rgba[4], double scale[2]=NULL, double rotateAngle=0.0, float strokeWidth=-1, const char *label=NULL)
vtkGL2PSUtilities::Draw3DPath
static void Draw3DPath(vtkPath *path, vtkMatrix4x4 *actorMatrix, double rasterPos[3], unsigned char actorColor[4], const char *label=NULL)
Transform the path using the actor's matrix and current GL state, then draw it to GL2PS.
vtkX3D::scale
@ scale
Definition: vtkX3D.h:229
vtkGL2PSExporter::PointSizeFactor
float PointSizeFactor
Definition: vtkGL2PSExporter.h:379
vtkIdType
int vtkIdType
Definition: vtkType.h:287
vtkOpenGLGL2PSExporter
OpenGL2 implementation of GL2PS exporter.
Definition: vtkOpenGLGL2PSExporter.h:108
vtkGL2PSUtilities::TextPropertyToPSFontName
static const char * TextPropertyToPSFontName(vtkTextProperty *tprop)
Translate the tprop's fontname into a Postscript font name.
vtkGL2PSUtilities::FinishExport
static void FinishExport()
vtkGL2PSUtilities::GetRenderWindow
static vtkRenderWindow * GetRenderWindow()
Get the current RenderWindow that is being exported.
Definition: vtkGL2PSUtilities.h:67
vtkGL2PSUtilities::SetTextAsPath
static void SetTextAsPath(bool b)
Definition: vtkGL2PSUtilities.h:125
vtkPath
concrete dataset representing a path defined by Bezier curves.
Definition: vtkPath.h:36
vtkGL2PSUtilities::TextPropertyToGL2PSAlignment
static int TextPropertyToGL2PSAlignment(vtkTextProperty *tprop)
Convert the alignment hint in tprop to a GL2PS text alignment constant.
vtkGL2PSUtilities::vtkGL2PSUtilities
vtkGL2PSUtilities()
Definition: vtkGL2PSUtilities.h:148
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkGL2PSUtilities::SetPointSizeFactor
static void SetPointSizeFactor(float f)
Definition: vtkGL2PSUtilities.h:119
vtkGL2PSUtilities
Helper functions for using GL2PS within VTK.
Definition: vtkGL2PSUtilities.h:38
vtkGL2PSUtilities::DrawPathSVG
static void DrawPathSVG(vtkPath *path, double rasterPos[3], double windowPos[2], unsigned char rgba[4], double scale[2]=NULL, double rotateAngle=0.0, float strokeWidth=-1, const char *label=NULL)
vtkGL2PSExporter::TextAsPath
bool TextAsPath
Definition: vtkGL2PSExporter.h:378
vtkGL2PSUtilities::GetLineWidthFactor
static float GetLineWidthFactor()
Definition: vtkGL2PSUtilities.h:110
vtkX3D::points
@ points
Definition: vtkX3D.h:446
vtkX3D::point
@ point
Definition: vtkX3D.h:236
vtkGL2PSUtilities::New
static vtkGL2PSUtilities * New()
vtkGL2PSUtilities::GetTextAsPath
static bool GetTextAsPath()
Get whether all text will be exported as paths.
Definition: vtkGL2PSUtilities.h:99
vtkGL2PSUtilities::DrawString
static void DrawString(const char *str, vtkTextProperty *tprop, double pos[3], double backgroundDepth)
Format the text in str according to tprop and instruct GL2PS to draw it at world coordinate pos.
vtkGL2PSExporter::LineWidthFactor
float LineWidthFactor
Definition: vtkGL2PSExporter.h:380
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:42
vtkGL2PSUtilities::SetLineWidthFactor
static void SetLineWidthFactor(float f)
Definition: vtkGL2PSUtilities.h:122
vtkObject.h
vtkGL2PSUtilities::StartExport
static void StartExport()
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:40
vtkGL2PSUtilities::SetRenderWindow
static void SetRenderWindow(vtkRenderWindow *renWin)
Definition: vtkGL2PSUtilities.h:130
vtkGL2PSUtilities::DrawPath
static void DrawPath(vtkPath *path, double rasterPos[3], double windowPos[2], unsigned char rgba[4], double scale[2]=NULL, double rotateAngle=0.0, float strokeWidth=-1, const char *label=NULL)
Generate PS, EPS, or SVG markup from a vtkPath object, and then inject it into the output using the g...
vtkGL2PSUtilities::DrawPathPDF
static void DrawPathPDF(vtkPath *path, double rasterPos[3], double windowPos[2], unsigned char rgba[4], double scale[2]=NULL, double rotateAngle=0.0, float strokeWidth=-1, const char *label=NULL)
vtkGL2PSUtilities::GetPointSizeFactor
static float GetPointSizeFactor()
Get a scaling factor for the point size or line width used by GL2PS.
Definition: vtkGL2PSUtilities.h:108
vtkRenderWindow
create a window for renderers to draw into
Definition: vtkRenderWindow.h:87
vtkExporter::RenderWindow
vtkRenderWindow * RenderWindow
Definition: vtkExporter.h:111
vtkGL2PSUtilities::~vtkGL2PSUtilities
~vtkGL2PSUtilities()
Definition: vtkGL2PSUtilities.h:149