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 
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:36
vtkLegendBoxActor::GetBoxProperty
vtkProperty2D * GetBoxProperty()
Get the box vtkProperty2D.
Definition: vtkLegendBoxActor.h:150
vtkActor2D::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkLegendBoxActor::IconActor
vtkTexturedActor2D ** IconActor
Definition: vtkLegendBoxActor.h:262
vtkLegendBoxActor::Symbol
vtkPolyData ** Symbol
Definition: vtkLegendBoxActor.h:252
vtkPolyDataMapper2D
draw vtkPolyData onto the image plane
Definition: vtkPolyDataMapper2D.h:45
vtkLegendBoxActor::LegendEntriesVisible
int LegendEntriesVisible
Definition: vtkLegendBoxActor.h:284
vtkLegendBoxActor::Icon
vtkPlaneSource ** Icon
Definition: vtkLegendBoxActor.h:258
vtkLegendBoxActor::SymbolMapper
vtkPolyDataMapper2D ** SymbolMapper
Definition: vtkLegendBoxActor.h:255
vtkTexturedActor2D
actor that draws 2D data with texture support
Definition: vtkTexturedActor2D.h:38
vtkLegendBoxActor::IconTransform
vtkTransform ** IconTransform
Definition: vtkLegendBoxActor.h:259
vtkLegendBoxActor::IconMapper
vtkPolyDataMapper2D ** IconMapper
Definition: vtkLegendBoxActor.h:261
vtkLegendBoxActor::Padding
int Padding
Definition: vtkLegendBoxActor.h:240
vtkLegendBoxActor::TextActor
vtkActor2D ** TextActor
Definition: vtkLegendBoxActor.h:250
vtkLegendBoxActor
draw symbols with text
Definition: vtkLegendBoxActor.h:58
vtkActor2D::ShallowCopy
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkActor2D.
vtkLegendBoxActor::GetNumberOfEntries
int GetNumberOfEntries()
Definition: vtkLegendBoxActor.h:74
vtkLegendBoxActor::Background
vtkPlaneSource * Background
Definition: vtkLegendBoxActor.h:277
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:32
vtkPlaneSource
create an array of quadrilaterals located in a plane
Definition: vtkPlaneSource.h:54
vtkLegendBoxActor::UseBackground
vtkTypeBool UseBackground
Definition: vtkLegendBoxActor.h:274
vtkLegendBoxActor::BorderPolyData
vtkPolyData * BorderPolyData
Definition: vtkLegendBoxActor.h:265
vtkActor2D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkLegendBoxActor::BoxActor
vtkActor2D * BoxActor
Definition: vtkLegendBoxActor.h:270
vtkLegendBoxActor::ScalarVisibility
vtkTypeBool ScalarVisibility
Definition: vtkLegendBoxActor.h:242
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkX3D::Box
Definition: vtkX3D.h:65
vtkX3D::color
Definition: vtkX3D.h:221
vtkActor2D::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:47
vtkLegendBoxActor::BackgroundOpacity
double BackgroundOpacity
Definition: vtkLegendBoxActor.h:275
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:42
vtkLegendBoxActor::BorderActor
vtkActor2D * BorderActor
Definition: vtkLegendBoxActor.h:267
vtkLegendBoxActor::NumberOfEntries
int NumberOfEntries
Definition: vtkLegendBoxActor.h:246
vtkLegendBoxActor::TextMapper
vtkTextMapper ** TextMapper
Definition: vtkLegendBoxActor.h:249
vtkLegendBoxActor::Box
vtkTypeBool Box
Definition: vtkLegendBoxActor.h:239
vtkLegendBoxActor::BoxPolyData
vtkPolyData * BoxPolyData
Definition: vtkLegendBoxActor.h:268
vtkActor2D::RenderOverlay
int RenderOverlay(vtkViewport *viewport) override
Support the standard render methods.
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkActor2D::HasTranslucentPolygonalGeometry
int HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
vtkLegendBoxActor::IconImage
vtkImageData ** IconImage
Definition: vtkLegendBoxActor.h:263
vtkLegendBoxActor::Border
vtkTypeBool Border
Definition: vtkLegendBoxActor.h:238
vtkLegendBoxActor::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Definition: vtkLegendBoxActor.h:221
vtkLegendBoxActor::BorderMapper
vtkPolyDataMapper2D * BorderMapper
Definition: vtkLegendBoxActor.h:266
vtkTransformPolyDataFilter
transform points and associated normals and vectors for polygonal dataset
Definition: vtkTransformPolyDataFilter.h:45
vtkLegendBoxActor::BackgroundMapper
vtkPolyDataMapper2D * BackgroundMapper
Definition: vtkLegendBoxActor.h:281
vtkLegendBoxActor::EntryTextProperty
vtkTextProperty * EntryTextProperty
Definition: vtkLegendBoxActor.h:271
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:44
vtkLegendBoxActor::SymbolActor
vtkActor2D ** SymbolActor
Definition: vtkLegendBoxActor.h:256
vtkLegendBoxActor::IconTransformFilter
vtkTransformPolyDataFilter ** IconTransformFilter
Definition: vtkLegendBoxActor.h:260
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:33
vtkLegendBoxActor::Size
int Size
Definition: vtkLegendBoxActor.h:247
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:46
vtkLegendBoxActor::LockBorder
vtkTypeBool LockBorder
Definition: vtkLegendBoxActor.h:241
vtkProperty2D
represent surface properties of a 2D image
Definition: vtkProperty2D.h:37
vtkLegendBoxActor::Colors
vtkDoubleArray * Colors
Definition: vtkLegendBoxActor.h:248
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:39
vtkLegendBoxActor::Transform
vtkTransform ** Transform
Definition: vtkLegendBoxActor.h:253
vtkActor2D.h
vtkActor2D::New
static vtkActor2D * New()
Creates an actor2D with the following defaults: position (0,0) (coordinate system is viewport); at la...
vtkLegendBoxActor::SymbolTransform
vtkTransformPolyDataFilter ** SymbolTransform
Definition: vtkLegendBoxActor.h:254
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
vtkLegendBoxActor::BoxMapper
vtkPolyDataMapper2D * BoxMapper
Definition: vtkLegendBoxActor.h:269
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:35
vtkLegendBoxActor::BuildTime
vtkTimeStamp BuildTime
Definition: vtkLegendBoxActor.h:286
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkLegendBoxActor::BoxOpacity
double BoxOpacity
Definition: vtkLegendBoxActor.h:243
vtkLegendBoxActor::BackgroundActor
vtkTexturedActor2D * BackgroundActor
Definition: vtkLegendBoxActor.h:280