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) VTK_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);
104 
106 
109  virtual void SetEntryTextProperty(vtkTextProperty *p);
110  vtkGetObjectMacro(EntryTextProperty,vtkTextProperty);
112 
114 
118  vtkSetMacro(Border, int);
119  vtkGetMacro(Border, int);
120  vtkBooleanMacro(Border, int);
122 
124 
132  vtkSetMacro(LockBorder, int);
133  vtkGetMacro(LockBorder, int);
134  vtkBooleanMacro(LockBorder, int);
136 
138 
142  vtkSetMacro(Box, int);
143  vtkGetMacro(Box, int);
144  vtkBooleanMacro(Box, int);
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,int);
168  vtkGetMacro(ScalarVisibility,int);
169  vtkBooleanMacro(ScalarVisibility,int);
171 
173 
176  vtkSetMacro(UseBackground, int);
177  vtkGetMacro(UseBackground, int);
178  vtkBooleanMacro(UseBackground, int);
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) VTK_OVERRIDE;
204 
212  void ReleaseGraphicsResources(vtkWindow *) VTK_OVERRIDE;
213 
215 
220  int RenderOpaqueGeometry(vtkViewport* viewport) VTK_OVERRIDE;
221  int RenderTranslucentPolygonalGeometry(vtkViewport* ) VTK_OVERRIDE {return 0;};
222  int RenderOverlay(vtkViewport* viewport) VTK_OVERRIDE;
224 
228  int HasTranslucentPolygonalGeometry() VTK_OVERRIDE;
229 
230 protected:
232  ~vtkLegendBoxActor() VTK_OVERRIDE;
233 
234  void InitializeEntries();
235 
236  vtkPolyData createTexturedPlane();
237 
238  int Border;
239  int Box;
240  int Padding;
241  int LockBorder;
242  int ScalarVisibility;
243  double BoxOpacity;
244 
245  // Internal actors, mappers, data to represent the legend
246  int NumberOfEntries;
247  int Size; //allocation size
248  vtkDoubleArray *Colors;
249  vtkTextMapper **TextMapper;
250  vtkActor2D **TextActor;
251 
252  vtkPolyData **Symbol;
254  vtkTransformPolyDataFilter **SymbolTransform;
255  vtkPolyDataMapper2D **SymbolMapper;
256  vtkActor2D **SymbolActor;
257 
259  vtkTransform **IconTransform;
260  vtkTransformPolyDataFilter **IconTransformFilter;
261  vtkPolyDataMapper2D **IconMapper;
262  vtkTexturedActor2D **IconActor;
263  vtkImageData **IconImage;
264 
265  vtkPolyData *BorderPolyData;
266  vtkPolyDataMapper2D *BorderMapper;
267  vtkActor2D *BorderActor;
268  vtkPolyData *BoxPolyData;
270  vtkActor2D *BoxActor;
271  vtkTextProperty *EntryTextProperty;
272 
273  // Background plane.
274  int UseBackground;
275  double BackgroundOpacity;
276  double BackgroundColor[3];
278 
279  // May use texture.
280  vtkTexturedActor2D *BackgroundActor;
281  vtkPolyDataMapper2D *BackgroundMapper;
282 
283  // Used to control whether the stuff is recomputed
284  int LegendEntriesVisible;
285  int CachedSize[2];
287 
288 private:
289  vtkLegendBoxActor(const vtkLegendBoxActor&) VTK_DELETE_FUNCTION;
290  void operator=(const vtkLegendBoxActor&) VTK_DELETE_FUNCTION;
291 };
292 
293 
294 #endif
295 
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:44
draw symbols with text
vtkTimeStamp BuildTime
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
transform points and associated normals and vectors for polygonal dataset
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkActor2D.
2D text annotation
Definition: vtkTextMapper.h:47
dynamic, self-adjusting array of double
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
a simple class to control print indentation
Definition: vtkIndent.h:33
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...
represent text properties.
create an array of quadrilaterals located in a plane
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
map vtkPolyData to graphics primitives
represent surface properties of a 2D image
Definition: vtkProperty2D.h:37
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
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.
Transform
Definition: ADIOSDefs.h:39