VTK
vtkLabelRenderStrategy.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkLabelRenderStrategy.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 =========================================================================*/
22 #ifndef vtkLabelRenderStrategy_h
23 #define vtkLabelRenderStrategy_h
24 
25 #include "vtkRenderingLabelModule.h" // For export macro
26 #include "vtkObject.h"
27 
28 #include "vtkStdString.h" // For string support
29 #include "vtkUnicodeString.h" // For unicode string support
30 
31 class vtkRenderer;
32 class vtkWindow;
33 class vtkTextProperty;
34 
36 {
37  public:
38  void PrintSelf(ostream& os, vtkIndent indent);
40 
42 
45  virtual bool SupportsRotation()
46  { return true; }
48 
50 
55  virtual bool SupportsBoundedSize()
56  { return true; }
58 
60 
61  virtual void SetRenderer(vtkRenderer* ren);
62  vtkGetObjectMacro(Renderer, vtkRenderer);
64 
66 
67  virtual void SetDefaultTextProperty(vtkTextProperty* tprop);
68  vtkGetObjectMacro(DefaultTextProperty, vtkTextProperty);
70 
72 
75  virtual void ComputeLabelBounds(vtkTextProperty* tprop, vtkStdString label,
76  double bds[4])
77  { this->ComputeLabelBounds(tprop, vtkUnicodeString::from_utf8(label.c_str()),
78  bds); }
79  virtual void ComputeLabelBounds(vtkTextProperty* tprop, vtkUnicodeString label,
80  double bds[4]) = 0;
82 
84 
91  virtual void RenderLabel(int x[2], vtkTextProperty* tprop, vtkStdString label)
92  { this->RenderLabel(x, tprop, vtkUnicodeString::from_utf8(label)); }
93  virtual void RenderLabel(int x[2], vtkTextProperty* tprop, vtkStdString label,
94  int maxWidth)
95  { this->RenderLabel(x, tprop, vtkUnicodeString::from_utf8(label), maxWidth); }
96  virtual void RenderLabel(int x[2], vtkTextProperty* tprop,
97  vtkUnicodeString label) = 0;
98  virtual void RenderLabel(int x[2], vtkTextProperty* tprop,
99  vtkUnicodeString label, int vtkNotUsed(maxWidth))
100  { this->RenderLabel(x, tprop, label); }
102 
104  virtual void StartFrame() { }
105 
107  virtual void EndFrame() { }
108 
113 
114 protected:
117 
120 
121 private:
122  vtkLabelRenderStrategy(const vtkLabelRenderStrategy&); // Not implemented.
123  void operator=(const vtkLabelRenderStrategy&); // Not implemented.
124 };
125 
126 #endif
127 
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
Superclass for label rendering implementations.
abstract base class for most VTK objects
Definition: vtkObject.h:61
virtual void RenderLabel(int x[2], vtkTextProperty *tprop, vtkUnicodeString label, int vtkNotUsed(maxWidth))
abstract specification for renderers
Definition: vtkRenderer.h:63
virtual void ComputeLabelBounds(vtkTextProperty *tprop, vtkStdString label, double bds[4])
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
virtual void PrintSelf(ostream &os, vtkIndent indent)
static vtkUnicodeString from_utf8(const char *)
a simple class to control print indentation
Definition: vtkIndent.h:38
#define VTKRENDERINGLABEL_EXPORT
virtual void ReleaseGraphicsResources(vtkWindow *)
vtkTextProperty * DefaultTextProperty
represent text properties.
virtual void RenderLabel(int x[2], vtkTextProperty *tprop, vtkStdString label, int maxWidth)
virtual void RenderLabel(int x[2], vtkTextProperty *tprop, vtkStdString label)
String class that stores Unicode text.