VTK  9.0.1
vtkLegendBoxActor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkLegendBoxActor.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 =========================================================================*/
38 #ifndef vtkLegendBoxActor_h
39 #define vtkLegendBoxActor_h
40 
41 #include "vtkActor2D.h"
42 #include "vtkRenderingAnnotationModule.h" // For export macro
43 
44 class vtkActor;
45 class vtkDoubleArray;
46 class vtkImageData;
47 class vtkPolyData;
49 class vtkPolyDataMapper;
50 class vtkPlaneSource;
51 class vtkTextMapper;
52 class vtkTextProperty;
53 class vtkTexturedActor2D;
54 class vtkTransform;
56 class vtkProperty2D;
57 
58 class VTKRENDERINGANNOTATION_EXPORT vtkLegendBoxActor : public vtkActor2D
59 {
60 public:
61  vtkTypeMacro(vtkLegendBoxActor, vtkActor2D);
62  void PrintSelf(ostream& os, vtkIndent indent) override;
63 
69 
73  void SetNumberOfEntries(int num);
74  int GetNumberOfEntries() { return this->NumberOfEntries; }
75 
77 
87  void SetEntry(int i, vtkPolyData* symbol, const char* string, double color[3]);
88  void SetEntry(int i, vtkImageData* symbol, const char* string, double color[3]);
89  void SetEntry(
90  int i, vtkPolyData* symbol, vtkImageData* icon, const char* string, double color[3]);
92 
93  void SetEntrySymbol(int i, vtkPolyData* symbol);
94  void SetEntryIcon(int i, vtkImageData* icon);
95  void SetEntryString(int i, const char* string);
96  void SetEntryColor(int i, double color[3]);
97  void SetEntryColor(int i, double r, double g, double b);
98 
101  const char* GetEntryString(int i);
102  double* GetEntryColor(int i) VTK_SIZEHINT(3);
103 
105 
109  vtkGetObjectMacro(EntryTextProperty, vtkTextProperty);
111 
113 
117  vtkSetMacro(Border, vtkTypeBool);
118  vtkGetMacro(Border, vtkTypeBool);
119  vtkBooleanMacro(Border, vtkTypeBool);
121 
123 
131  vtkSetMacro(LockBorder, vtkTypeBool);
132  vtkGetMacro(LockBorder, vtkTypeBool);
133  vtkBooleanMacro(LockBorder, vtkTypeBool);
135 
137 
141  vtkSetMacro(Box, vtkTypeBool);
142  vtkGetMacro(Box, vtkTypeBool);
143  vtkBooleanMacro(Box, vtkTypeBool);
145 
149  vtkProperty2D* GetBoxProperty() { return this->BoxActor->GetProperty(); }
150 
152 
156  vtkSetClampMacro(Padding, int, 0, 50);
157  vtkGetMacro(Padding, int);
159 
161 
166  vtkSetMacro(ScalarVisibility, vtkTypeBool);
167  vtkGetMacro(ScalarVisibility, vtkTypeBool);
168  vtkBooleanMacro(ScalarVisibility, vtkTypeBool);
170 
172 
175  vtkSetMacro(UseBackground, vtkTypeBool);
176  vtkGetMacro(UseBackground, vtkTypeBool);
177  vtkBooleanMacro(UseBackground, vtkTypeBool);
179 
181 
185  vtkSetVector3Macro(BackgroundColor, double);
186  vtkGetVector3Macro(BackgroundColor, double);
188 
190 
194  vtkSetClampMacro(BackgroundOpacity, double, 0.0, 1.0);
195  vtkGetMacro(BackgroundOpacity, double);
197 
202  void ShallowCopy(vtkProp* prop) override;
203 
212 
214 
219  int RenderOpaqueGeometry(vtkViewport* viewport) override;
220  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
221  int RenderOverlay(vtkViewport* viewport) override;
223 
228 
229 protected:
231  ~vtkLegendBoxActor() override;
232 
234 
236 
239  int Padding;
242  double BoxOpacity;
243 
244  // Internal actors, mappers, data to represent the legend
246  int Size; // allocation size
250 
256 
263 
271 
272  // Background plane.
275  double BackgroundColor[3];
277 
278  // May use texture.
281 
282  // Used to control whether the stuff is recomputed
284  int CachedSize[2];
286 
287 private:
288  vtkLegendBoxActor(const vtkLegendBoxActor&) = delete;
289  void operator=(const vtkLegendBoxActor&) = delete;
290 };
291 
292 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:37
vtkLegendBoxActor::GetBoxProperty
vtkProperty2D * GetBoxProperty()
Get the box vtkProperty2D.
Definition: vtkLegendBoxActor.h:149
vtkLegendBoxActor::SetEntryString
void SetEntryString(int i, const char *string)
vtkLegendBoxActor::IconActor
vtkTexturedActor2D ** IconActor
Definition: vtkLegendBoxActor.h:261
vtkLegendBoxActor::Symbol
vtkPolyData ** Symbol
Definition: vtkLegendBoxActor.h:251
vtkPolyDataMapper2D
draw vtkPolyData onto the image plane
Definition: vtkPolyDataMapper2D.h:45
vtkLegendBoxActor::LegendEntriesVisible
int LegendEntriesVisible
Definition: vtkLegendBoxActor.h:283
vtkLegendBoxActor::Icon
vtkPlaneSource ** Icon
Definition: vtkLegendBoxActor.h:257
vtkLegendBoxActor::SymbolMapper
vtkPolyDataMapper2D ** SymbolMapper
Definition: vtkLegendBoxActor.h:254
vtkTexturedActor2D
actor that draws 2D data with texture support
Definition: vtkTexturedActor2D.h:39
vtkLegendBoxActor::SetEntryIcon
void SetEntryIcon(int i, vtkImageData *icon)
vtkLegendBoxActor::IconTransform
vtkTransform ** IconTransform
Definition: vtkLegendBoxActor.h:258
vtkLegendBoxActor::IconMapper
vtkPolyDataMapper2D ** IconMapper
Definition: vtkLegendBoxActor.h:260
vtkLegendBoxActor::Padding
int Padding
Definition: vtkLegendBoxActor.h:239
vtkLegendBoxActor::TextActor
vtkActor2D ** TextActor
Definition: vtkLegendBoxActor.h:249
vtkLegendBoxActor
draw symbols with text
Definition: vtkLegendBoxActor.h:59
vtkLegendBoxActor::GetNumberOfEntries
int GetNumberOfEntries()
Definition: vtkLegendBoxActor.h:74
vtkLegendBoxActor::Background
vtkPlaneSource * Background
Definition: vtkLegendBoxActor.h:276
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:33
vtkPlaneSource
create an array of quadrilaterals located in a plane
Definition: vtkPlaneSource.h:55
vtkLegendBoxActor::UseBackground
vtkTypeBool UseBackground
Definition: vtkLegendBoxActor.h:273
vtkLegendBoxActor::BorderPolyData
vtkPolyData * BorderPolyData
Definition: vtkLegendBoxActor.h:264
vtkLegendBoxActor::~vtkLegendBoxActor
~vtkLegendBoxActor() override
vtkLegendBoxActor::BoxActor
vtkActor2D * BoxActor
Definition: vtkLegendBoxActor.h:269
vtkLegendBoxActor::SetEntryColor
void SetEntryColor(int i, double r, double g, double b)
vtkLegendBoxActor::ScalarVisibility
vtkTypeBool ScalarVisibility
Definition: vtkLegendBoxActor.h:241
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:55
vtkLegendBoxActor::SetEntryTextProperty
virtual void SetEntryTextProperty(vtkTextProperty *p)
Set/Get the text property.
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
vtkX3D::Box
@ Box
Definition: vtkX3D.h:71
vtkX3D::color
@ color
Definition: vtkX3D.h:227
vtkLegendBoxActor::vtkLegendBoxActor
vtkLegendBoxActor()
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:48
vtkLegendBoxActor::BackgroundOpacity
double BackgroundOpacity
Definition: vtkLegendBoxActor.h:274
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:45
vtkLegendBoxActor::BorderActor
vtkActor2D * BorderActor
Definition: vtkLegendBoxActor.h:266
vtkLegendBoxActor::GetEntryColor
double * GetEntryColor(int i)
vtkLegendBoxActor::NumberOfEntries
int NumberOfEntries
Definition: vtkLegendBoxActor.h:245
vtkLegendBoxActor::TextMapper
vtkTextMapper ** TextMapper
Definition: vtkLegendBoxActor.h:248
vtkLegendBoxActor::SetEntry
void SetEntry(int i, vtkImageData *symbol, const char *string, double color[3])
vtkLegendBoxActor::RenderOverlay
int RenderOverlay(vtkViewport *viewport) override
vtkLegendBoxActor::SetEntry
void SetEntry(int i, vtkPolyData *symbol, const char *string, double color[3])
Add an entry to the legend box.
vtkLegendBoxActor::Box
vtkTypeBool Box
Definition: vtkLegendBoxActor.h:238
vtkLegendBoxActor::BoxPolyData
vtkPolyData * BoxPolyData
Definition: vtkLegendBoxActor.h:267
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:46
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkLegendBoxActor::HasTranslucentPolygonalGeometry
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
vtkLegendBoxActor::IconImage
vtkImageData ** IconImage
Definition: vtkLegendBoxActor.h:262
vtkLegendBoxActor::Border
vtkTypeBool Border
Definition: vtkLegendBoxActor.h:237
vtkLegendBoxActor::SetEntryColor
void SetEntryColor(int i, double color[3])
vtkLegendBoxActor::GetEntryIcon
vtkImageData * GetEntryIcon(int i)
vtkLegendBoxActor::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Definition: vtkLegendBoxActor.h:220
vtkLegendBoxActor::BorderMapper
vtkPolyDataMapper2D * BorderMapper
Definition: vtkLegendBoxActor.h:265
vtkTransformPolyDataFilter
transform points and associated normals and vectors for polygonal dataset
Definition: vtkTransformPolyDataFilter.h:46
vtkLegendBoxActor::BackgroundMapper
vtkPolyDataMapper2D * BackgroundMapper
Definition: vtkLegendBoxActor.h:280
vtkLegendBoxActor::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkLegendBoxActor::EntryTextProperty
vtkTextProperty * EntryTextProperty
Definition: vtkLegendBoxActor.h:270
vtkLegendBoxActor::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:45
vtkLegendBoxActor::SetNumberOfEntries
void SetNumberOfEntries(int num)
Specify the number of entries in the legend box.
vtkLegendBoxActor::SymbolActor
vtkActor2D ** SymbolActor
Definition: vtkLegendBoxActor.h:255
vtkLegendBoxActor::IconTransformFilter
vtkTransformPolyDataFilter ** IconTransformFilter
Definition: vtkLegendBoxActor.h:259
vtkLegendBoxActor::SetEntrySymbol
void SetEntrySymbol(int i, vtkPolyData *symbol)
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:34
vtkLegendBoxActor::Size
int Size
Definition: vtkLegendBoxActor.h:246
vtkLegendBoxActor::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
vtkLegendBoxActor::LockBorder
vtkTypeBool LockBorder
Definition: vtkLegendBoxActor.h:240
vtkProperty2D
represent surface properties of a 2D image
Definition: vtkProperty2D.h:38
vtkLegendBoxActor::Colors
vtkDoubleArray * Colors
Definition: vtkLegendBoxActor.h:247
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:40
vtkLegendBoxActor::Transform
vtkTransform ** Transform
Definition: vtkLegendBoxActor.h:252
vtkActor2D.h
vtkLegendBoxActor::SetEntry
void SetEntry(int i, vtkPolyData *symbol, vtkImageData *icon, const char *string, double color[3])
vtkLegendBoxActor::New
static vtkLegendBoxActor * New()
Instantiate object with a rectangle in normaled view coordinates of (0.2,0.85, 0.8,...
vtkLegendBoxActor::SymbolTransform
vtkTransformPolyDataFilter ** SymbolTransform
Definition: vtkLegendBoxActor.h:253
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkLegendBoxActor::BoxMapper
vtkPolyDataMapper2D * BoxMapper
Definition: vtkLegendBoxActor.h:268
vtkLegendBoxActor::GetEntryString
const char * GetEntryString(int i)
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:36
vtkLegendBoxActor::ShallowCopy
void ShallowCopy(vtkProp *prop) override
Shallow copy of this scaled text actor.
vtkLegendBoxActor::BuildTime
vtkTimeStamp BuildTime
Definition: vtkLegendBoxActor.h:285
vtkLegendBoxActor::GetEntrySymbol
vtkPolyData * GetEntrySymbol(int i)
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkLegendBoxActor::createTexturedPlane
vtkPolyData createTexturedPlane()
vtkLegendBoxActor::BoxOpacity
double BoxOpacity
Definition: vtkLegendBoxActor.h:242
vtkLegendBoxActor::InitializeEntries
void InitializeEntries()
vtkLegendBoxActor::BackgroundActor
vtkTexturedActor2D * BackgroundActor
Definition: vtkLegendBoxActor.h:279