VTK  9.7.1
vtkLegendBoxEntryInternal.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
12 #ifndef vtkLegendBoxEntryInternal_h
13 #define vtkLegendBoxEntryInternal_h
14 
15 #include "vtkNew.h"
16 #include "vtkSmartPointer.h"
17 
18 VTK_ABI_NAMESPACE_BEGIN
19 class vtkActor2D;
20 class vtkImageData;
21 class vtkPlaneSource;
22 class vtkPolyData;
24 class vtkProperty2D;
25 class vtkTextMapper;
26 class vtkTextProperty;
27 class vtkTexturedActor2D;
28 class vtkTransform;
29 class vtkTransformFilter;
30 class vtkViewport;
31 class vtkWindow;
32 
34 {
35 public:
38 
40 
44  bool SetText(const char* text);
45  const char* GetText();
47 
49 
53  bool SetSymbol(vtkPolyData*);
56 
61  bool HasSymbol();
62 
64 
68  bool SetIcon(vtkImageData*);
71 
76  bool HasIcon();
77 
79 
83  bool SetColor(double color[3]);
84  double* GetColor();
86 
88 
95 
99  void SetTextPosition(double X, double Y);
100 
105  void UpdateIconTransform(int width, int height, double posX, double posY);
106 
111  void UpdateSymbolTransform(int width, int height, double posX, double posY);
112 
117  void UpdateProperties(bool visibility, vtkProperty2D* prop);
118 
122  void CopyTextProperty(vtkTextProperty* prop);
123 
127  double* GetSymbolBounds();
128 
132  double* GetIconBounds();
133 
135 
138  void SetFontSize(int size);
139  int SetConstrainedFontSize(vtkViewport* viewport, int size[2]);
140  void GetSize(vtkViewport* viewport, int size[2]);
142 
143 private:
149  void UpdateTransform(
150  vtkTransform* tranform, double posX, double posY, double bounds[6], int width, int height);
151 
155  double GetScale(double bounds[6], int width, int height);
156 
157  vtkNew<vtkTextMapper> TextMapper;
158  vtkNew<vtkActor2D> TextActor;
159 
161  vtkNew<vtkTransform> Transform;
162  vtkNew<vtkTransformFilter> SymbolTransform;
163  vtkNew<vtkPolyDataMapper2D> SymbolMapper;
164  vtkNew<vtkActor2D> SymbolActor;
165 
168  vtkNew<vtkTransform> IconTransform;
169  vtkNew<vtkTransformFilter> IconTransformFilter;
170  vtkNew<vtkPolyDataMapper2D> IconMapper;
171  vtkNew<vtkTexturedActor2D> IconActor;
172 
173  double Color[3] = { -1, -1, -1 };
174 };
175 
176 VTK_ABI_NAMESPACE_END
177 
178 #endif
bool HasSymbol()
Returns true if the entry has a symbol set (i.e.
actor that draws 2D data with texture support
void UpdateSymbolTransform(int width, int height, double posX, double posY)
Update the symbol transform (scale and position).
bool SetIcon(vtkImageData *)
Set / Get the entry icon.
abstract specification for Viewports
Definition: vtkViewport.h:46
int RenderOpaqueGeometry(vtkViewport *)
Forward usual rendering methods to internal actors.
a actor that draws 2D data
Definition: vtkActor2D.h:35
void GetSize(vtkViewport *viewport, int size[2])
Forwarded to internal text mapper.
const char * GetText()
Set / Get the entry text.
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:50
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
2D text annotation
Definition: vtkTextMapper.h:39
void UpdateProperties(bool visibility, vtkProperty2D *prop)
Update internal actors properties.
void UpdateIconTransform(int width, int height, double posX, double posY)
Update the icon transform (scale and position).
bool SetColor(double color[3])
Set / Get the entry color.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
double * GetIconBounds()
Get the entry symbol bounds.
vtkPolyData * GetSymbol()
Set / Get the entry symbol.
bool SetSymbol(vtkPolyData *)
Set / Get the entry symbol.
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
void CopyTextProperty(vtkTextProperty *prop)
Copy given property into internal TextActor property.
int RenderOverlay(vtkViewport *)
Forward usual rendering methods to internal actors.
bool HasIcon()
Returns true if the entry has an icon set (i.e.
vtkImageData * GetIcon()
Set / Get the entry icon.
represent text properties.
create an array of quadrilaterals located in a plane
bool SetText(const char *text)
Set / Get the entry text.
double * GetSymbolBounds()
Get the entry symbol bounds.
void SetFontSize(int size)
Forwarded to internal text mapper.
double * GetColor()
Set / Get the entry color.
void SetTextPosition(double X, double Y)
Set the text position.
int SetConstrainedFontSize(vtkViewport *viewport, int size[2])
Forwarded to internal text mapper.
transform points and associated normals and vectors
represent surface properties of a 2D image
Definition: vtkProperty2D.h:30
A single entry to use inside vtkLegendBoxActor.
draw vtkPolyData onto the image plane
void ReleaseGraphicsResources(vtkWindow *win)
Forward usual rendering methods to internal actors.