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 =========================================================================*/
23 #ifndef vtkLabelRenderStrategy_h
24 #define vtkLabelRenderStrategy_h
25 
26 #include "vtkRenderingLabelModule.h" // For export macro
27 #include "vtkObject.h"
28 
29 #include "vtkStdString.h" // For string support
30 #include "vtkUnicodeString.h" // For unicode string support
31 
32 class vtkRenderer;
33 class vtkWindow;
34 class vtkTextProperty;
35 
36 class VTKRENDERINGLABEL_EXPORT vtkLabelRenderStrategy : public vtkObject
37 {
38  public:
39  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
47  virtual bool SupportsRotation()
48  { return true; }
49 
57  virtual bool SupportsBoundedSize()
58  { return true; }
59 
61 
64  virtual void SetRenderer(vtkRenderer* ren);
65  vtkGetObjectMacro(Renderer, vtkRenderer);
67 
69 
72  virtual void SetDefaultTextProperty(vtkTextProperty* tprop);
73  vtkGetObjectMacro(DefaultTextProperty, vtkTextProperty);
75 
80  virtual void ComputeLabelBounds(vtkTextProperty* tprop, vtkStdString label,
81  double bds[4])
82  { this->ComputeLabelBounds(tprop, vtkUnicodeString::from_utf8(label.c_str()),
83  bds); }
84  virtual void ComputeLabelBounds(vtkTextProperty* tprop, vtkUnicodeString label,
85  double bds[4]) = 0;
86 
96  virtual void RenderLabel(int x[2], vtkTextProperty* tprop, vtkStdString label)
97  { this->RenderLabel(x, tprop, vtkUnicodeString::from_utf8(label)); }
98  virtual void RenderLabel(int x[2], vtkTextProperty* tprop, vtkStdString label,
99  int maxWidth)
100  { this->RenderLabel(x, tprop, vtkUnicodeString::from_utf8(label), maxWidth); }
101  virtual void RenderLabel(int x[2], vtkTextProperty* tprop,
102  vtkUnicodeString label) = 0;
103  virtual void RenderLabel(int x[2], vtkTextProperty* tprop,
104  vtkUnicodeString label, int vtkNotUsed(maxWidth))
105  { this->RenderLabel(x, tprop, label); }
106 
110  virtual void StartFrame() { }
111 
115  virtual void EndFrame() { }
116 
123 
124 protected:
126  ~vtkLabelRenderStrategy() override;
127 
130 
131 private:
133  void operator=(const vtkLabelRenderStrategy&) = delete;
134 };
135 
136 #endif
137 
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:40
Superclass for label rendering implementations.
abstract base class for most VTK objects
Definition: vtkObject.h:59
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void RenderLabel(int x[2], vtkTextProperty *tprop, vtkUnicodeString label, int vtkNotUsed(maxWidth))
abstract specification for renderers
Definition: vtkRenderer.h:63
virtual bool SupportsRotation()
Whether the text rendering strategy supports rotation.
virtual void ComputeLabelBounds(vtkTextProperty *tprop, vtkStdString label, double bds[4])
Compute the bounds of a label.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
static vtkUnicodeString from_utf8(const char *)
Constructs a string from a null-terminated sequence of UTF-8 encoded characters.
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this strategy.
vtkTextProperty * DefaultTextProperty
virtual void EndFrame()
End a rendering frame.
represent text properties.
virtual void RenderLabel(int x[2], vtkTextProperty *tprop, vtkStdString label, int maxWidth)
virtual bool SupportsBoundedSize()
Whether the text rendering strategy supports bounded size.
virtual void RenderLabel(int x[2], vtkTextProperty *tprop, vtkStdString label)
Render a label at a location in display coordinates.
virtual void StartFrame()
Start a rendering frame.
String class that stores Unicode text.