1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkLabelRenderStrategy.cxx
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 =========================================================================*/
15 
16 // Hide VTK_DEPRECATED_IN_9_1_0() warnings for this class.
17 #define VTK_DEPRECATION_LEVEL 0
18 
19 #include "vtkLabelRenderStrategy.h"
20 
21 #include "vtkRenderer.h"
22 #include "vtkTextProperty.h"
23 
24 vtkCxxSetObjectMacro(vtkLabelRenderStrategy, Renderer, vtkRenderer);
25 vtkCxxSetObjectMacro(vtkLabelRenderStrategy, DefaultTextProperty, vtkTextProperty);
26 
27 //------------------------------------------------------------------------------
vtkLabelRenderStrategy()28 vtkLabelRenderStrategy::vtkLabelRenderStrategy()
29 {
30   this->Renderer = nullptr;
31   this->DefaultTextProperty = vtkTextProperty::New();
32 }
33 
34 //------------------------------------------------------------------------------
~vtkLabelRenderStrategy()35 vtkLabelRenderStrategy::~vtkLabelRenderStrategy()
36 {
37   this->SetRenderer(nullptr);
38   this->SetDefaultTextProperty(nullptr);
39 }
40 
41 //------------------------------------------------------------------------------
PrintSelf(ostream & os,vtkIndent indent)42 void vtkLabelRenderStrategy::PrintSelf(ostream& os, vtkIndent indent)
43 {
44   this->Superclass::PrintSelf(os, indent);
45   os << indent << "Renderer: " << this->Renderer << endl;
46   os << indent << "DefaultTextProperty: " << this->DefaultTextProperty << endl;
47 }
48 
49 //------------------------------------------------------------------------------
ComputeLabelBounds(vtkTextProperty * tprop,vtkStdString label,double bds[4])50 void vtkLabelRenderStrategy::ComputeLabelBounds(
51   vtkTextProperty* tprop, vtkStdString label, double bds[4])
52 {
53   this->ComputeLabelBounds(tprop, vtkUnicodeString::from_utf8(label.c_str()), bds);
54 }
55 
56 //------------------------------------------------------------------------------
RenderLabel(int x[2],vtkTextProperty * tprop,vtkStdString label)57 void vtkLabelRenderStrategy::RenderLabel(int x[2], vtkTextProperty* tprop, vtkStdString label)
58 {
59   this->RenderLabel(x, tprop, vtkUnicodeString::from_utf8(label));
60 }
61 
62 //------------------------------------------------------------------------------
RenderLabel(int x[2],vtkTextProperty * tprop,vtkStdString label,int maxWidth)63 void vtkLabelRenderStrategy::RenderLabel(
64   int x[2], vtkTextProperty* tprop, vtkStdString label, int maxWidth)
65 {
66   this->RenderLabel(x, tprop, vtkUnicodeString::from_utf8(label), maxWidth);
67 }
68 
69 //------------------------------------------------------------------------------
RenderLabel(int x[2],vtkTextProperty * tprop,vtkUnicodeString label,int vtkNotUsed (maxWidth))70 void vtkLabelRenderStrategy::RenderLabel(
71   int x[2], vtkTextProperty* tprop, vtkUnicodeString label, int vtkNotUsed(maxWidth))
72 {
73   this->RenderLabel(x, tprop, label);
74 }
75