VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
53 
55  bool GetBoundingBox(vtkTextProperty *tprop, const char *str,
56  unsigned int dpi, int bbox[4]);
58 
60 
65  bool RenderString(const char *str, vtkImageData *data, vtkTextProperty *tprop,
66  unsigned int dpi, int textDims[2] = NULL);
68 
71  bool StringToPath(const char *str, vtkPath *path, vtkTextProperty *tprop);
72 
74 
77  vtkSetMacro(ScaleToPowerOfTwo, bool);
78  vtkGetMacro(ScaleToPowerOfTwo, bool);
80 
81 protected:
84 
85  bool InitializeMaskParser();
86  bool InitializePathParser();
87  bool InitializeFontPropertiesClass();
88 
89  bool CheckForError();
90  bool CheckForError(PyObject *object);
91 
94  PyObject * GetFontProperties(vtkTextProperty *tprop);
95 
100  void CleanupPythonObjects();
101 
102  vtkPythonInterpreter* Interpreter;
106 
107  // Rotate the 4 2D corner points by the specified angle (degrees) around the
108  // origin and calculate the bounding box
109  void RotateCorners(double angleDeg, double corners[4][2], double bbox[4]);
110 
112 
114  {
115  NOT_TESTED = 0,
117  UNAVAILABLE
118  };
120 
122  bool PrepareImageData(vtkImageData *data, int bbox[4]);
123 
124  // Function used to check MPL availability and update MPLMathTextAvailable.
125  // This will do tests only the first time this method is called.
126  static void CheckMPLAvailability();
127  static void DisableMPL()
128  {
129  MPLMathTextAvailable = UNAVAILABLE;
130  };
131 
132 private:
134  void operator=(const vtkMatplotlibMathTextUtilities&); // Not implemented.
135 
136 
137  static Availablity MPLMathTextAvailable;
138 };
139 
140 #endif
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: vtkgl.h:11339
#define VTKRENDERINGMATPLOTLIB_EXPORT
virtual bool RenderString(const char *str, vtkImageData *data, vtkTextProperty *tprop, unsigned int dpi, int textDims[2]=NULL)=0
concrete dataset representing a path defined by Bezier curves.
Definition: vtkPath.h:34
Access to MatPlotLib MathText rendering.
a simple class to control print indentation
Definition: vtkIndent.h:38
void PrintSelf(ostream &os, vtkIndent indent)
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
GLsizei const GLchar ** path
Definition: vtkgl.h:13835
represent text properties.
Abstract interface to equation rendering.
static vtkMathTextUtilities * New()
struct _object PyObject
virtual bool StringToPath(const char *str, vtkPath *path, vtkTextProperty *tprop)=0
virtual bool GetBoundingBox(vtkTextProperty *tprop, const char *str, unsigned int dpi, int bbox[4])=0