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:
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 
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
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
vtkRenderingGL2PSModule.h
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)
vtkgl::b
GLboolean GLboolean GLboolean b
Definition: vtkgl.h:12312
vtkGL2PSExporter::PointSizeFactor
float PointSizeFactor
Definition: vtkGL2PSExporter.h:392
vtkIdType
int vtkIdType
Definition: vtkType.h:275
vtkGL2PSUtilities::TextPropertyToPSFontName
static const char * TextPropertyToPSFontName(vtkTextProperty *tprop)
vtkGL2PSUtilities::FinishExport
static void FinishExport()
vtkGL2PSUtilities::GetRenderWindow
static vtkRenderWindow * GetRenderWindow()
Definition: vtkGL2PSUtilities.h:63
vtkgl::scale
GLenum GLenum GLenum GLenum GLenum scale
Definition: vtkgl.h:15942
vtkGL2PSUtilities::SetTextAsPath
static void SetTextAsPath(bool b)
Definition: vtkGL2PSUtilities.h:124
vtkPath
concrete dataset representing a path defined by Bezier curves.
Definition: vtkPath.h:35
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkGL2PSUtilities::TextPropertyToGL2PSAlignment
static int TextPropertyToGL2PSAlignment(vtkTextProperty *tprop)
vtkGL2PSUtilities::vtkGL2PSUtilities
vtkGL2PSUtilities()
Definition: vtkGL2PSUtilities.h:147
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkGL2PSExporter
export a scene as a PostScript file using GL2PS.
Definition: vtkGL2PSExporter.h:107
VTKRENDERINGGL2PS_EXPORT
#define VTKRENDERINGGL2PS_EXPORT
Definition: vtkRenderingGL2PSModule.h:15
vtkGL2PSUtilities::SetPointSizeFactor
static void SetPointSizeFactor(float f)
Definition: vtkGL2PSUtilities.h:118
vtkgl::points
GLsizei const GLfloat * points
Definition: vtkgl.h:14786
vtkGL2PSUtilities
Helper functions for using GL2PS within VTK.
Definition: vtkGL2PSUtilities.h:37
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:391
vtkGL2PSUtilities::GetLineWidthFactor
static float GetLineWidthFactor()
Definition: vtkGL2PSUtilities.h:108
vtkX3D::point
@ point
Definition: vtkX3D.h:236
vtkGL2PSUtilities::New
static vtkGL2PSUtilities * New()
vtkGL2PSUtilities::GetTextAsPath
static bool GetTextAsPath()
Definition: vtkGL2PSUtilities.h:97
vtkGL2PSUtilities::DrawString
static void DrawString(const char *str, vtkTextProperty *tprop, double pos[3], double backgroundDepth)
vtkGL2PSExporter::LineWidthFactor
float LineWidthFactor
Definition: vtkGL2PSExporter.h:393
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:39
vtkgl::path
GLsizei const GLchar ** path
Definition: vtkgl.h:13835
vtkgl::f
GLclampf f
Definition: vtkgl.h:14181
vtkGL2PSUtilities::SetLineWidthFactor
static void SetLineWidthFactor(float f)
Definition: vtkGL2PSUtilities.h:121
vtkObject.h
vtkGL2PSUtilities::StartExport
static void StartExport()
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:39
vtkGL2PSUtilities::SetRenderWindow
static void SetRenderWindow(vtkRenderWindow *renWin)
Definition: vtkGL2PSUtilities.h:129
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)
vtkObjectBase::PrintSelf
virtual void PrintSelf(ostream &os, vtkIndent indent)
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)
vtkgl::void
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
vtkGL2PSUtilities::GetPointSizeFactor
static float GetPointSizeFactor()
Definition: vtkGL2PSUtilities.h:106
vtkRenderWindow
create a window for renderers to draw into
Definition: vtkRenderWindow.h:89
vtkExporter::RenderWindow
vtkRenderWindow * RenderWindow
Definition: vtkExporter.h:92
vtkGL2PSUtilities::~vtkGL2PSUtilities
~vtkGL2PSUtilities()
Definition: vtkGL2PSUtilities.h:148