VTK
dox
Rendering
Qt
vtkQtLabelRenderStrategyInternals.h
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: Visualization Toolkit
4
Module: vtkQtLabelRenderStrategy.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
=========================================================================*/
15
// .NAME vtkQtLabelRenderStrategyInternals - Internals to render labels with Qt
16
//
17
// .SECTION Description
18
// This class is an implementation detail of vtkQtLabelRenderStrategy
19
//
20
// This should only be included in the source file of a class derived from
21
// vtkQtLabelRenderStrategy.
22
23
#ifndef vtkQtLabelRenderStrategyInternals_h
24
#define vtkQtLabelRenderStrategyInternals_h
25
26
#include "
vtkTextProperty.h
"
27
28
#include <QColor>
29
#include <QFont>
30
#include <QImage>
31
#include <QMap>
32
#include <QString>
33
34
class
QPainter;
35
36
struct
vtkQtLabelMapEntry
37
{
38
QString
Text
;
39
QColor
Color
;
40
QFont
Font
;
41
};
42
43
struct
vtkQtLabelMapValue
44
{
45
QImage
Image
;
46
QRectF
Bounds
;
47
};
48
49
bool
operator <
(
const
vtkQtLabelMapEntry
& a,
const
vtkQtLabelMapEntry
& other);
50
51
class
vtkQtLabelRenderStrategy::Internals
52
{
53
public
:
54
QImage*
Image
;
55
QPainter*
Painter
;
56
QMap<vtkQtLabelMapEntry, vtkQtLabelMapValue>
Cache
;
57
58
QFont
TextPropertyToFont
(
vtkTextProperty
* tprop)
59
{
60
QFont fontSpec(tprop->
GetFontFamilyAsString
());
61
fontSpec.setBold(tprop->
GetBold
());
62
fontSpec.setItalic(tprop->
GetItalic
());
63
fontSpec.setPixelSize(tprop->
GetFontSize
());
64
return
fontSpec;
65
}
66
67
QColor
TextPropertyToColor
(
double
* fc,
double
opacity)
68
{
69
QColor textColor(
70
static_cast<int>(fc[0]*255),
71
static_cast<int>(fc[1]*255),
72
static_cast<int>(fc[2]*255),
73
static_cast<int>(opacity*255));
74
return
textColor;
75
}
76
};
77
78
#endif // vtkQtLabelRenderStrategyInternals_h
79
// VTK-HeaderTest-Exclude: vtkQtLabelRenderStrategyInternals.h
vtkQtLabelRenderStrategy::Internals::Cache
QMap< vtkQtLabelMapEntry, vtkQtLabelMapValue > Cache
Definition:
vtkQtLabelRenderStrategyInternals.h:56
vtkTextProperty::GetFontFamilyAsString
virtual char * GetFontFamilyAsString()
Set/Get the font family.
vtkQtLabelRenderStrategy::Internals::TextPropertyToColor
QColor TextPropertyToColor(double *fc, double opacity)
Definition:
vtkQtLabelRenderStrategyInternals.h:67
vtkQtLabelMapEntry::Color
QColor Color
Definition:
vtkQtLabelRenderStrategyInternals.h:39
vtkQtLabelRenderStrategy::Internals::Painter
QPainter * Painter
Definition:
vtkQtLabelRenderStrategyInternals.h:55
vtkQtLabelRenderStrategy::Internals::TextPropertyToFont
QFont TextPropertyToFont(vtkTextProperty *tprop)
Definition:
vtkQtLabelRenderStrategyInternals.h:58
vtkQtLabelRenderStrategy::Internals::Image
QImage * Image
Definition:
vtkQtLabelRenderStrategyInternals.h:54
vtkTextProperty.h
vtkQtLabelMapValue
Definition:
vtkQtLabelRenderStrategyInternals.h:43
vtkTextProperty::GetFontSize
virtual int GetFontSize()
vtkTextProperty::GetItalic
virtual vtkTypeBool GetItalic()
vtkQtLabelMapEntry::Text
QString Text
Definition:
vtkQtLabelRenderStrategyInternals.h:38
vtkTextProperty
represent text properties.
Definition:
vtkTextProperty.h:39
operator<
bool operator<(const vtkQtLabelMapEntry &a, const vtkQtLabelMapEntry &other)
vtkQtLabelMapEntry
Definition:
vtkQtLabelRenderStrategyInternals.h:36
vtkQtLabelMapEntry::Font
QFont Font
Definition:
vtkQtLabelRenderStrategyInternals.h:40
vtkTextProperty::GetBold
virtual vtkTypeBool GetBold()
vtkQtLabelMapValue::Image
QImage Image
Definition:
vtkQtLabelRenderStrategyInternals.h:45
vtkQtLabelMapValue::Bounds
QRectF Bounds
Definition:
vtkQtLabelRenderStrategyInternals.h:46
vtkQtLabelRenderStrategy::Internals
Definition:
vtkQtLabelRenderStrategyInternals.h:51
Generated by
1.8.16