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 
53 
58  bool GetBoundingBox(vtkTextProperty *tprop, const char *str,
59  unsigned int dpi, int bbox[4]);
61 
62  bool GetMetrics(vtkTextProperty *tprop, const char *str,
63  unsigned int dpi, vtkTextRenderer::Metrics &metrics);
64 
66 
74  bool RenderString(const char *str, vtkImageData *data, vtkTextProperty *tprop,
75  unsigned int dpi, int textDims[2] = NULL);
77 
82  bool StringToPath(const char *str, vtkPath *path, vtkTextProperty *tprop);
83 
85 
88  vtkSetMacro(ScaleToPowerOfTwo, bool);
89  vtkGetMacro(ScaleToPowerOfTwo, bool);
91 
92 protected:
95 
96  bool InitializeMaskParser();
97  bool InitializePathParser();
98  bool InitializeFontPropertiesClass();
99 
100  bool CheckForError();
101  bool CheckForError(PyObject *object);
102 
105  PyObject * GetFontProperties(vtkTextProperty *tprop);
106 
111  void CleanupPythonObjects();
112 
113  vtkPythonInterpreter* Interpreter;
117 
118  static void GetJustifiedBBox(int rows, int cols, vtkTextProperty *tprop,
119  int bbox[4]);
120 
121  // Rotate the 4 2D corner points by the specified angle (degrees) around the
122  // origin and calculate the bounding box
123  static void RotateCorners(double angleDeg, double corners[4][2],
124  double bbox[4]);
125 
127 
129  {
130  NOT_TESTED = 0,
132  UNAVAILABLE
133  };
135 
137  bool PrepareImageData(vtkImageData *data, int bbox[4]);
138 
139  // Function used to check MPL availability and update MPLMathTextAvailable.
140  // This will do tests only the first time this method is called.
141  static void CheckMPLAvailability();
142  static void DisableMPL()
143  {
144  MPLMathTextAvailable = UNAVAILABLE;
145  };
146 
147 private:
149  void operator=(const vtkMatplotlibMathTextUtilities&); // Not implemented.
150 
151 
152  static Availablity MPLMathTextAvailable;
153 };
154 
155 #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
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
virtual bool GetMetrics(vtkTextProperty *tprop, const char *str, unsigned int dpi, vtkTextRenderer::Metrics &metrics)=0
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:632
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
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69