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 =========================================================================*/
38 #ifndef vtkLegendBoxActor_h
39 #define vtkLegendBoxActor_h
40 
41 #include "vtkRenderingAnnotationModule.h" // For export macro
42 #include "vtkActor2D.h"
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:
62  void PrintSelf(ostream& os, vtkIndent indent) override;
63 
68  static vtkLegendBoxActor *New();
69 
73  void SetNumberOfEntries(int num);
75  {return this->NumberOfEntries;}
76 
78 
88  void SetEntry(int i, vtkPolyData *symbol, const char* string, double color[3]);
89  void SetEntry(int i, vtkImageData *symbol, const char* string, double color[3]);
90  void SetEntry(int i, vtkPolyData *symbol, vtkImageData *icon,
91  const char* string, double color[3]);
93 
94  void SetEntrySymbol (int i, vtkPolyData *symbol);
95  void SetEntryIcon (int i, vtkImageData *icon);
96  void SetEntryString (int i, const char* string);
97  void SetEntryColor (int i, double color[3]);
98  void SetEntryColor (int i, double r, double g, double b);
99 
100  vtkPolyData* GetEntrySymbol(int i);
101  vtkImageData* GetEntryIcon(int i);
102  const char* GetEntryString(int i);
103  double* GetEntryColor(int i) VTK_SIZEHINT(3);
104 
106 
109  virtual void SetEntryTextProperty(vtkTextProperty *p);
110  vtkGetObjectMacro(EntryTextProperty,vtkTextProperty);
112 
114 
118  vtkSetMacro(Border, vtkTypeBool);
119  vtkGetMacro(Border, vtkTypeBool);
120  vtkBooleanMacro(Border, vtkTypeBool);
122 
124 
132  vtkSetMacro(LockBorder, vtkTypeBool);
133  vtkGetMacro(LockBorder, vtkTypeBool);
134  vtkBooleanMacro(LockBorder, vtkTypeBool);
136 
138 
142  vtkSetMacro(Box, vtkTypeBool);
143  vtkGetMacro(Box, vtkTypeBool);
144  vtkBooleanMacro(Box, vtkTypeBool);
146 
150  vtkProperty2D* GetBoxProperty() { return this->BoxActor->GetProperty(); };
151 
153 
157  vtkSetClampMacro(Padding, int, 0, 50);
158  vtkGetMacro(Padding, int);
160 
162 
167  vtkSetMacro(ScalarVisibility,vtkTypeBool);
168  vtkGetMacro(ScalarVisibility,vtkTypeBool);
169  vtkBooleanMacro(ScalarVisibility,vtkTypeBool);
171 
173 
176  vtkSetMacro(UseBackground, vtkTypeBool);
177  vtkGetMacro(UseBackground, vtkTypeBool);
178  vtkBooleanMacro(UseBackground, vtkTypeBool);
180 
182 
186  vtkSetVector3Macro(BackgroundColor, double);
187  vtkGetVector3Macro(BackgroundColor, double);
189 
191 
195  vtkSetClampMacro(BackgroundOpacity, double, 0.0, 1.0);
196  vtkGetMacro(BackgroundOpacity, double);
198 
203  void ShallowCopy(vtkProp *prop) override;
204 
212  void ReleaseGraphicsResources(vtkWindow *) override;
213 
215 
220  int RenderOpaqueGeometry(vtkViewport* viewport) override;
221  int RenderTranslucentPolygonalGeometry(vtkViewport* ) override {return 0;};
222  int RenderOverlay(vtkViewport* viewport) override;
224 
228  int HasTranslucentPolygonalGeometry() override;
229 
230 protected:
232  ~vtkLegendBoxActor() override;
233 
234  void InitializeEntries();
235 
236  vtkPolyData createTexturedPlane();
237 
240  int Padding;
243  double BoxOpacity;
244 
245  // Internal actors, mappers, data to represent the legend
247  int Size; //allocation size
251 
257 
264 
272 
273  // Background plane.
276  double BackgroundColor[3];
278 
279  // May use texture.
282 
283  // Used to control whether the stuff is recomputed
285  int CachedSize[2];
287 
288 private:
289  vtkLegendBoxActor(const vtkLegendBoxActor&) = delete;
290  void operator=(const vtkLegendBoxActor&) = delete;
291 };
292 
293 
294 #endif
295 
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:46
draw symbols with text
vtkTypeBool UseBackground
vtkPolyData * BorderPolyData
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
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:44
vtkProperty2D * GetBoxProperty()
Get the box vtkProperty2D.
a actor that draws 2D data
Definition: vtkActor2D.h:39
record modification and/or execution time
Definition: vtkTimeStamp.h:32
vtkPlaneSource ** Icon
transform points and associated normals and vectors for polygonal dataset
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
vtkActor2D ** TextActor
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
vtkTypeBool ScalarVisibility
vtkPlaneSource * Background
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkActor2D.
2D text annotation
Definition: vtkTextMapper.h:47
dynamic, self-adjusting array of double
int vtkTypeBool
Definition: vtkABI.h:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
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:33
vtkTextProperty * EntryTextProperty
vtkActor2D * BorderActor
int HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
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
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:37
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