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
32class vtkRenderer;
33class vtkWindow;
34class vtkTextProperty;
35
36class VTKRENDERINGLABEL_EXPORT vtkLabelRenderStrategy : public vtkObject
37{
38 public:
39 void PrintSelf(ostream& os, vtkIndent indent);
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
73 vtkGetObjectMacro(DefaultTextProperty, vtkTextProperty);
75
81 double bds[4])
82 { this->ComputeLabelBounds(tprop, vtkUnicodeString::from_utf8(label.c_str()),
83 bds); }
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
124protected:
127
130
131private:
132 vtkLabelRenderStrategy(const vtkLabelRenderStrategy&) VTK_DELETE_FUNCTION;
133 void operator=(const vtkLabelRenderStrategy&) VTK_DELETE_FUNCTION;
134};
135
136#endif
137
a simple class to control print indentation
Definition: vtkIndent.h:40
Superclass for label rendering implementations.
virtual void ComputeLabelBounds(vtkTextProperty *tprop, vtkUnicodeString label, double bds[4])=0
virtual void RenderLabel(int x[2], vtkTextProperty *tprop, vtkStdString label, int maxWidth)
virtual void RenderLabel(int x[2], vtkTextProperty *tprop, vtkUnicodeString label, int vtkNotUsed(maxWidth))
virtual bool SupportsRotation()
Whether the text rendering strategy supports rotation.
virtual void EndFrame()
End a rendering frame.
virtual void RenderLabel(int x[2], vtkTextProperty *tprop, vtkUnicodeString label)=0
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
virtual bool SupportsBoundedSize()
Whether the text rendering strategy supports bounded size.
virtual void SetRenderer(vtkRenderer *ren)
Set the renderer associated with this strategy.
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this strategy.
virtual void StartFrame()
Start a rendering frame.
vtkTextProperty * DefaultTextProperty
virtual void RenderLabel(int x[2], vtkTextProperty *tprop, vtkStdString label)
Render a label at a location in display coordinates.
virtual void SetDefaultTextProperty(vtkTextProperty *tprop)
Set the default text property for the strategy.
virtual void ComputeLabelBounds(vtkTextProperty *tprop, vtkStdString label, double bds[4])
Compute the bounds of a label.
abstract base class for most VTK objects
Definition: vtkObject.h:60
abstract specification for renderers
Definition: vtkRenderer.h:64
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:49
represent text properties.
String class that stores Unicode text.
static vtkUnicodeString from_utf8(const char *)
Constructs a string from a null-terminated sequence of UTF-8 encoded characters.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35