VTK  9.0.1
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 "vtkObject.h"
27 #include "vtkRenderingLabelModule.h" // For export macro
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() { return true; }
48 
56  virtual bool SupportsBoundedSize() { return true; }
57 
59 
62  virtual void SetRenderer(vtkRenderer* ren);
63  vtkGetObjectMacro(Renderer, vtkRenderer);
65 
67 
70  virtual void SetDefaultTextProperty(vtkTextProperty* tprop);
71  vtkGetObjectMacro(DefaultTextProperty, vtkTextProperty);
73 
78  virtual void ComputeLabelBounds(vtkTextProperty* tprop, vtkStdString label, double bds[4])
79  {
80  this->ComputeLabelBounds(tprop, vtkUnicodeString::from_utf8(label.c_str()), bds);
81  }
82  virtual void ComputeLabelBounds(
83  vtkTextProperty* tprop, vtkUnicodeString label, double bds[4]) = 0;
84 
94  virtual void RenderLabel(int x[2], vtkTextProperty* tprop, vtkStdString label)
95  {
96  this->RenderLabel(x, tprop, vtkUnicodeString::from_utf8(label));
97  }
98  virtual void RenderLabel(int x[2], vtkTextProperty* tprop, vtkStdString label, int maxWidth)
99  {
100  this->RenderLabel(x, tprop, vtkUnicodeString::from_utf8(label), maxWidth);
101  }
102  virtual void RenderLabel(int x[2], vtkTextProperty* tprop, vtkUnicodeString label) = 0;
103  virtual void RenderLabel(
104  int x[2], vtkTextProperty* tprop, vtkUnicodeString label, int vtkNotUsed(maxWidth))
105  {
106  this->RenderLabel(x, tprop, label);
107  }
108 
112  virtual void StartFrame() {}
113 
117  virtual void EndFrame() {}
118 
125 
126 protected:
128  ~vtkLabelRenderStrategy() override;
129 
132 
133 private:
135  void operator=(const vtkLabelRenderStrategy&) = delete;
136 };
137 
138 #endif
vtkLabelRenderStrategy::DefaultTextProperty
vtkTextProperty * DefaultTextProperty
Definition: vtkLabelRenderStrategy.h:131
vtkStdString.h
vtkLabelRenderStrategy::EndFrame
virtual void EndFrame()
End a rendering frame.
Definition: vtkLabelRenderStrategy.h:117
vtkUnicodeString.h
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkLabelRenderStrategy::RenderLabel
virtual void RenderLabel(int x[2], vtkTextProperty *tprop, vtkStdString label, int maxWidth)
Definition: vtkLabelRenderStrategy.h:98
vtkUnicodeString::from_utf8
static vtkUnicodeString from_utf8(const char *)
Constructs a string from a null-terminated sequence of UTF-8 encoded characters.
vtkLabelRenderStrategy::RenderLabel
virtual void RenderLabel(int x[2], vtkTextProperty *tprop, vtkStdString label)
Render a label at a location in display coordinates.
Definition: vtkLabelRenderStrategy.h:94
vtkLabelRenderStrategy::SupportsBoundedSize
virtual bool SupportsBoundedSize()
Whether the text rendering strategy supports bounded size.
Definition: vtkLabelRenderStrategy.h:56
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkLabelRenderStrategy::StartFrame
virtual void StartFrame()
Start a rendering frame.
Definition: vtkLabelRenderStrategy.h:112
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkUnicodeString
String class that stores Unicode text.
Definition: vtkUnicodeString.h:69
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkLabelRenderStrategy::RenderLabel
virtual void RenderLabel(int x[2], vtkTextProperty *tprop, vtkUnicodeString label, int vtkNotUsed(maxWidth))
Definition: vtkLabelRenderStrategy.h:103
vtkLabelRenderStrategy
Superclass for label rendering implementations.
Definition: vtkLabelRenderStrategy.h:36
vtkObject.h
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:33
vtkLabelRenderStrategy::SupportsRotation
virtual bool SupportsRotation()
Whether the text rendering strategy supports rotation.
Definition: vtkLabelRenderStrategy.h:47
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:67
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:34
vtkLabelRenderStrategy::Renderer
vtkRenderer * Renderer
Definition: vtkLabelRenderStrategy.h:130
vtkLabelRenderStrategy::ComputeLabelBounds
virtual void ComputeLabelBounds(vtkTextProperty *tprop, vtkStdString label, double bds[4])
Compute the bounds of a label.
Definition: vtkLabelRenderStrategy.h:78
vtkLabelRenderStrategy::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this strategy.
Definition: vtkLabelRenderStrategy.h:124