VTK
vtkMatplotlibMathTextUtilities.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMatplotlibMathTextUtilities.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 =========================================================================*/
30 #ifndef vtkMatplotlibMathTextUtilities_h
31 #define vtkMatplotlibMathTextUtilities_h
32 
33 #include "vtkRenderingMatplotlibModule.h" // For export macro
34 #include "vtkMathTextUtilities.h"
35 
36 struct _object;
37 typedef struct _object PyObject;
38 class vtkImageData;
39 class vtkPath;
40 class vtkPythonInterpreter;
41 class vtkTextProperty;
42 
45 {
46 public:
48  void PrintSelf(ostream& os, vtkIndent indent);
49 
51 
52  virtual bool IsAvailable();
53 
55 
60  bool GetBoundingBox(vtkTextProperty *tprop, const char *str, int dpi,
61  int bbox[4]);
63 
64  bool GetMetrics(vtkTextProperty *tprop, const char *str, int dpi,
65  vtkTextRenderer::Metrics &metrics);
66 
68 
76  bool RenderString(const char *str, vtkImageData *data, vtkTextProperty *tprop,
77  int dpi, int textDims[2] = NULL);
79 
81 
85  bool StringToPath(const char *str, vtkPath *path, vtkTextProperty *tprop,
86  int dpi);
88 
90 
93  vtkSetMacro(ScaleToPowerOfTwo, bool);
94  vtkGetMacro(ScaleToPowerOfTwo, bool);
96 
97 protected:
100 
104 
106  bool CheckForError(PyObject *object);
107 
111 
117 
118  vtkPythonInterpreter* Interpreter;
122 
123  static void GetJustifiedBBox(int rows, int cols, vtkTextProperty *tprop,
124  int bbox[4]);
125 
126  // Rotate the 4 2D corner points by the specified angle (degrees) around the
127  // origin and calculate the bounding box
128  static void RotateCorners(double angleDeg, double corners[4][2],
129  double bbox[4]);
130 
132  bool PrepareImageData(vtkImageData *data, int bbox[4]);
133 
134 private:
136  void operator=(const vtkMatplotlibMathTextUtilities&); // Not implemented.
137 
139 
141  enum Availability
142  {
143  NOT_TESTED = 0,
144  AVAILABLE,
145  UNAVAILABLE
146  };
148 
150 
154  static Availability CheckMPLAvailability();
155  static void DisableMPL()
156  {
157  MPLMathTextAvailable = UNAVAILABLE;
158  };
160 
162 
163  static Availability MPLMathTextAvailable;
164 };
166 
167 #endif
vtkMatplotlibMathTextUtilities::New
static vtkMatplotlibMathTextUtilities * New()
vtkMatplotlibMathTextUtilities::GetFontProperties
PyObject * GetFontProperties(vtkTextProperty *tprop)
vtkgl::data
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: vtkgl.h:11339
vtkMatplotlibMathTextUtilities
Access to MatPlotLib MathText rendering.
Definition: vtkMatplotlibMathTextUtilities.h:45
vtkMatplotlibMathTextUtilities::GetBoundingBox
bool GetBoundingBox(vtkTextProperty *tprop, const char *str, int dpi, int bbox[4])
vtkMatplotlibMathTextUtilities::InitializeMaskParser
bool InitializeMaskParser()
vtkPath
concrete dataset representing a path defined by Bezier curves.
Definition: vtkPath.h:35
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkMatplotlibMathTextUtilities::MaskParser
PyObject * MaskParser
Definition: vtkMatplotlibMathTextUtilities.h:119
vtkMathTextUtilities
Abstract interface to equation rendering.
Definition: vtkMathTextUtilities.h:54
vtkMatplotlibMathTextUtilities::~vtkMatplotlibMathTextUtilities
virtual ~vtkMatplotlibMathTextUtilities()
PyObject
struct _object PyObject
Definition: vtkMatplotlibMathTextUtilities.h:37
vtkRenderingMatplotlibModule.h
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkMatplotlibMathTextUtilities::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkgl::path
GLsizei const GLchar ** path
Definition: vtkgl.h:13835
vtkMatplotlibMathTextUtilities::CheckForError
bool CheckForError(PyObject *object)
vtkMatplotlibMathTextUtilities::FontPropertiesClass
PyObject * FontPropertiesClass
Definition: vtkMatplotlibMathTextUtilities.h:121
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkMatplotlibMathTextUtilities::RotateCorners
static void RotateCorners(double angleDeg, double corners[4][2], double bbox[4])
vtkMatplotlibMathTextUtilities::PathParser
PyObject * PathParser
Definition: vtkMatplotlibMathTextUtilities.h:120
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:39
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkMatplotlibMathTextUtilities::InitializePathParser
bool InitializePathParser()
vtkMatplotlibMathTextUtilities::GetMetrics
bool GetMetrics(vtkTextProperty *tprop, const char *str, int dpi, vtkTextRenderer::Metrics &metrics)
vtkMatplotlibMathTextUtilities::CheckForError
bool CheckForError()
vtkMatplotlibMathTextUtilities::RenderString
bool RenderString(const char *str, vtkImageData *data, vtkTextProperty *tprop, int dpi, int textDims[2]=NULL)
vtkMatplotlibMathTextUtilities::StringToPath
bool StringToPath(const char *str, vtkPath *path, vtkTextProperty *tprop, int dpi)
vtkMatplotlibMathTextUtilities::vtkMatplotlibMathTextUtilities
vtkMatplotlibMathTextUtilities()
vtkMatplotlibMathTextUtilities::InitializeFontPropertiesClass
bool InitializeFontPropertiesClass()
vtkMatplotlibMathTextUtilities::CleanupPythonObjects
void CleanupPythonObjects()
vtkMathTextUtilities.h
vtkMatplotlibMathTextUtilities::IsAvailable
virtual bool IsAvailable()
vtkTextRenderer::Metrics
Definition: vtkTextRenderer.h:78
vtkMatplotlibMathTextUtilities::PrepareImageData
bool PrepareImageData(vtkImageData *data, int bbox[4])
VTKRENDERINGMATPLOTLIB_EXPORT
#define VTKRENDERINGMATPLOTLIB_EXPORT
Definition: vtkRenderingMatplotlibModule.h:15
vtkMatplotlibMathTextUtilities::Interpreter
vtkPythonInterpreter * Interpreter
Definition: vtkMatplotlibMathTextUtilities.h:118
vtkMatplotlibMathTextUtilities::ScaleToPowerOfTwo
bool ScaleToPowerOfTwo
Definition: vtkMatplotlibMathTextUtilities.h:131
vtkMatplotlibMathTextUtilities::GetJustifiedBBox
static void GetJustifiedBBox(int rows, int cols, vtkTextProperty *tprop, int bbox[4])