VTK
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 =========================================================================*/
41 #ifndef vtkLegendBoxActor_h
42 #define vtkLegendBoxActor_h
43 
44 #include "vtkRenderingAnnotationModule.h" // For export macro
45 #include "vtkActor2D.h"
46 
47 class vtkActor;
48 class vtkDoubleArray;
49 class vtkImageData;
50 class vtkPolyData;
52 class vtkPolyDataMapper;
53 class vtkPlaneSource;
54 class vtkTextMapper;
55 class vtkTextProperty;
56 class vtkTexturedActor2D;
57 class vtkTransform;
59 class vtkProperty2D;
60 
61 class VTKRENDERINGANNOTATION_EXPORT vtkLegendBoxActor : public vtkActor2D
62 {
63 public:
65  void PrintSelf(ostream& os, vtkIndent indent) override;
66 
71  static vtkLegendBoxActor *New();
72 
76  void SetNumberOfEntries(int num);
78  {return this->NumberOfEntries;}
79 
81 
91  void SetEntry(int i, vtkPolyData *symbol, const char* string, double color[3]);
92  void SetEntry(int i, vtkImageData *symbol, const char* string, double color[3]);
93  void SetEntry(int i, vtkPolyData *symbol, vtkImageData *icon,
94  const char* string, double color[3]);
96 
97  void SetEntrySymbol (int i, vtkPolyData *symbol);
98  void SetEntryIcon (int i, vtkImageData *icon);
99  void SetEntryString (int i, const char* string);
100  void SetEntryColor (int i, double color[3]);
101  void SetEntryColor (int i, double r, double g, double b);
102 
103  vtkPolyData* GetEntrySymbol(int i);
104  vtkImageData* GetEntryIcon(int i);
105  const char* GetEntryString(int i);
106  double* GetEntryColor(int i) VTK_SIZEHINT(3);
107 
109 
112  virtual void SetEntryTextProperty(vtkTextProperty *p);
113  vtkGetObjectMacro(EntryTextProperty,vtkTextProperty);
115 
117 
121  vtkSetMacro(Border, vtkTypeBool);
122  vtkGetMacro(Border, vtkTypeBool);
123  vtkBooleanMacro(Border, vtkTypeBool);
125 
127 
135  vtkSetMacro(LockBorder, vtkTypeBool);
136  vtkGetMacro(LockBorder, vtkTypeBool);
137  vtkBooleanMacro(LockBorder, vtkTypeBool);
139 
141 
145  vtkSetMacro(Box, vtkTypeBool);
146  vtkGetMacro(Box, vtkTypeBool);
147  vtkBooleanMacro(Box, vtkTypeBool);
149 
153  vtkProperty2D* GetBoxProperty() { return this->BoxActor->GetProperty(); };
154 
156 
160  vtkSetClampMacro(Padding, int, 0, 50);
161  vtkGetMacro(Padding, int);
163 
165 
170  vtkSetMacro(ScalarVisibility,vtkTypeBool);
171  vtkGetMacro(ScalarVisibility,vtkTypeBool);
172  vtkBooleanMacro(ScalarVisibility,vtkTypeBool);
174 
176 
179  vtkSetMacro(UseBackground, vtkTypeBool);
180  vtkGetMacro(UseBackground, vtkTypeBool);
181  vtkBooleanMacro(UseBackground, vtkTypeBool);
183 
185 
189  vtkSetVector3Macro(BackgroundColor, double);
190  vtkGetVector3Macro(BackgroundColor, double);
192 
194 
198  vtkSetClampMacro(BackgroundOpacity, double, 0.0, 1.0);
199  vtkGetMacro(BackgroundOpacity, double);
201 
206  void ShallowCopy(vtkProp *prop) override;
207 
215  void ReleaseGraphicsResources(vtkWindow *) override;
216 
218 
223  int RenderOpaqueGeometry(vtkViewport* viewport) override;
224  int RenderTranslucentPolygonalGeometry(vtkViewport* ) override {return 0;};
225  int RenderOverlay(vtkViewport* viewport) override;
227 
232 
233 protected:
235  ~vtkLegendBoxActor() override;
236 
237  void InitializeEntries();
238 
239  vtkPolyData createTexturedPlane();
240 
243  int Padding;
246  double BoxOpacity;
247 
248  // Internal actors, mappers, data to represent the legend
250  int Size; //allocation size
254 
260 
267 
275 
276  // Background plane.
279  double BackgroundColor[3];
281 
282  // May use texture.
285 
286  // Used to control whether the stuff is recomputed
288  int CachedSize[2];
290 
291 private:
292  vtkLegendBoxActor(const vtkLegendBoxActor&) = delete;
293  void operator=(const vtkLegendBoxActor&) = delete;
294 };
295 
296 
297 #endif
298 
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
draw symbols with text
vtkTypeBool UseBackground
vtkPolyData * BorderPolyData
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
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:47
vtkProperty2D * GetBoxProperty()
Get the box vtkProperty2D.
a actor that draws 2D data
Definition: vtkActor2D.h:45
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkPlaneSource ** Icon
transform points and associated normals and vectors for polygonal dataset
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
vtkActor2D ** TextActor
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkTypeBool ScalarVisibility
vtkPlaneSource * Background
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkActor2D.
2D text annotation
Definition: vtkTextMapper.h:53
dynamic, self-adjusting array of double
int vtkTypeBool
Definition: vtkABI.h:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkTextMapper ** TextMapper
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:39
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...
vtkDoubleArray * Colors
vtkTransform ** Transform
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?
vtkTransformPolyDataFilter ** SymbolTransform
vtkImageData ** IconImage
int RenderOpaqueGeometry(vtkViewport *viewport) override
Support the standard render methods.
vtkActor2D ** SymbolActor
vtkTransformPolyDataFilter ** IconTransformFilter
represent surface properties of a 2D image
Definition: vtkProperty2D.h:40
vtkTexturedActor2D * BackgroundActor
vtkPolyDataMapper2D * BoxMapper
vtkPolyData ** Symbol
draw vtkPolyData onto the image plane
vtkPolyDataMapper2D ** SymbolMapper
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTimeStamp BuildTime
vtkTransform ** IconTransform
vtkPolyDataMapper2D ** IconMapper
vtkTexturedActor2D ** IconActor