VTK  9.7.1
vtkLegendBoxActor.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
29 #ifndef vtkLegendBoxActor_h
30 #define vtkLegendBoxActor_h
31 
32 #include "vtkActor2D.h"
33 #include "vtkNew.h" // for vtkNew
34 #include "vtkRenderingAnnotationModule.h" // For export macro
35 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
36 
37 VTK_ABI_NAMESPACE_BEGIN
38 class vtkActor;
39 class vtkDoubleArray;
40 class vtkImageData;
42 class vtkPolyData;
44 class vtkPolyDataMapper;
45 class vtkPlaneSource;
46 class vtkTextMapper;
47 class vtkTextProperty;
48 class vtkTexturedActor2D;
49 class vtkTransform;
50 class vtkTransformFilter;
51 class vtkProperty2D;
52 
53 class VTKRENDERINGANNOTATION_EXPORT VTK_MARSHALAUTO vtkLegendBoxActor : public vtkActor2D
54 {
55 public:
56  vtkTypeMacro(vtkLegendBoxActor, vtkActor2D);
57  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
63  static vtkLegendBoxActor* New();
64 
68  void SetNumberOfEntries(int num);
69  int GetNumberOfEntries() { return this->NumberOfEntries; }
70 
72 
82  void SetEntry(int i, vtkPolyData* symbol, const char* string, double color[3]);
83  void SetEntry(int i, vtkImageData* symbol, const char* string, double color[3]);
84  void SetEntry(
85  int i, vtkPolyData* symbol, vtkImageData* icon, const char* string, double color[3]);
87 
88  void SetEntrySymbol(int i, vtkPolyData* symbol);
89  void SetEntryIcon(int i, vtkImageData* icon);
90  void SetEntryString(int i, const char* string);
91  void SetEntryColor(int i, double color[3]);
92  void SetEntryColor(int i, double r, double g, double b);
93 
94  vtkPolyData* GetEntrySymbol(int i);
95  vtkImageData* GetEntryIcon(int i);
96  const char* GetEntryString(int i);
97  double* GetEntryColor(int i) VTK_SIZEHINT(3);
98 
99  int GetNumberOfEntrySymbols() { return NumberOfEntries; }
100  int GetNumberOfEntryColors() { return NumberOfEntries; }
101  int GetNumberOfEntryStrings() { return NumberOfEntries; }
102  int GetNumberOfEntryIcons() { return NumberOfEntries; }
104 
107  virtual void SetEntryTextProperty(vtkTextProperty* p);
108  vtkGetObjectMacro(EntryTextProperty, vtkTextProperty);
110 
112 
116  vtkSetMacro(Border, vtkTypeBool);
117  vtkGetMacro(Border, vtkTypeBool);
118  vtkBooleanMacro(Border, vtkTypeBool);
120 
122 
130  vtkSetMacro(LockBorder, vtkTypeBool);
131  vtkGetMacro(LockBorder, vtkTypeBool);
132  vtkBooleanMacro(LockBorder, vtkTypeBool);
134 
136 
140  vtkSetMacro(Box, vtkTypeBool);
141  vtkGetMacro(Box, vtkTypeBool);
142  vtkBooleanMacro(Box, vtkTypeBool);
144 
148  vtkProperty2D* GetBoxProperty() { return this->BoxActor->GetProperty(); }
149 
151 
155  vtkSetClampMacro(Padding, int, 0, 50);
156  vtkGetMacro(Padding, int);
158 
160 
165  vtkSetMacro(ScalarVisibility, vtkTypeBool);
166  vtkGetMacro(ScalarVisibility, vtkTypeBool);
167  vtkBooleanMacro(ScalarVisibility, vtkTypeBool);
169 
171 
174  vtkSetMacro(UseBackground, vtkTypeBool);
175  vtkGetMacro(UseBackground, vtkTypeBool);
176  vtkBooleanMacro(UseBackground, vtkTypeBool);
178 
180 
184  vtkSetVector3Macro(BackgroundColor, double);
185  vtkGetVector3Macro(BackgroundColor, double);
187 
189 
193  vtkSetClampMacro(BackgroundOpacity, double, 0.0, 1.0);
194  vtkGetMacro(BackgroundOpacity, double);
196 
201  void ShallowCopy(vtkProp* prop) override;
202 
210  void ReleaseGraphicsResources(vtkWindow*) override;
211 
213 
218  int RenderOpaqueGeometry(vtkViewport* viewport) override;
219  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
220  int RenderOverlay(vtkViewport* viewport) override;
222 
227 
228 protected:
230  ~vtkLegendBoxActor() override;
231 
232  void InitializeEntries();
233 
234  vtkPolyData createTexturedPlane();
235 
238  int Padding;
241  double BoxOpacity;
242 
244 
252 
253  // Background plane.
256  double BackgroundColor[3];
258 
259  // May use texture.
262 
263  // Used to control whether the stuff is recomputed
265  int CachedSize[2];
267 
268 private:
269  vtkLegendBoxActor(const vtkLegendBoxActor&) = delete;
270  void operator=(const vtkLegendBoxActor&) = delete;
271 
272  std::vector<std::unique_ptr<vtkLegendBoxEntryInternal>> Entries;
273 };
274 
275 VTK_ABI_NAMESPACE_END
276 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:49
draw symbols with text
vtkTypeBool UseBackground
vtkPolyData * BorderPolyData
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:41
int RenderOverlay(vtkViewport *viewport) override
Support the standard render methods.
actor that draws 2D data with texture support
abstract specification for Viewports
Definition: vtkViewport.h:46
vtkProperty2D * GetBoxProperty()
Get the box vtkProperty2D.
a actor that draws 2D data
Definition: vtkActor2D.h:35
record modification and/or execution time
Definition: vtkTimeStamp.h:24
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:50
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
vtkTypeBool ScalarVisibility
vtkPlaneSource * Background
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkActor2D.
2D text annotation
Definition: vtkTextMapper.h:39
dynamic, self-adjusting array of double
int vtkTypeBool
Definition: vtkABI.h:64
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
vtkPolyDataMapper2D * BackgroundMapper
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkTextProperty * EntryTextProperty
vtkActor2D * BorderActor
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
static vtkActor2D * New()
Creates an actor2D with the following defaults: position (0,0) (coordinate system is viewport); at la...
vtkPolyData * BoxPolyData
#define VTK_SIZEHINT(...)
represent text properties.
create an array of quadrilaterals located in a plane
vtkPolyDataMapper2D * BorderMapper
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
map vtkPolyData to graphics primitives
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
int RenderOpaqueGeometry(vtkViewport *viewport) override
Support the standard render methods.
transform points and associated normals and vectors
represent surface properties of a 2D image
Definition: vtkProperty2D.h:30
vtkTexturedActor2D * BackgroundActor
#define VTK_MARSHALAUTO
vtkPolyDataMapper2D * BoxMapper
A single entry to use inside vtkLegendBoxActor.
draw vtkPolyData onto the image plane
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTimeStamp BuildTime