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 
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:42
vtkLegendBoxActor::GetBoxProperty
vtkProperty2D * GetBoxProperty()
Get the box vtkProperty2D.
Definition: vtkLegendBoxActor.h:153
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:265
vtkLegendBoxActor::Symbol
vtkPolyData ** Symbol
Definition: vtkLegendBoxActor.h:255
vtkPolyDataMapper2D
draw vtkPolyData onto the image plane
Definition: vtkPolyDataMapper2D.h:51
vtkLegendBoxActor::LegendEntriesVisible
int LegendEntriesVisible
Definition: vtkLegendBoxActor.h:287
vtkLegendBoxActor::Icon
vtkPlaneSource ** Icon
Definition: vtkLegendBoxActor.h:261
vtkLegendBoxActor::SymbolMapper
vtkPolyDataMapper2D ** SymbolMapper
Definition: vtkLegendBoxActor.h:258
vtkTexturedActor2D
actor that draws 2D data with texture support
Definition: vtkTexturedActor2D.h:41
vtkLegendBoxActor::IconTransform
vtkTransform ** IconTransform
Definition: vtkLegendBoxActor.h:262
vtkLegendBoxActor::IconMapper
vtkPolyDataMapper2D ** IconMapper
Definition: vtkLegendBoxActor.h:264
vtkLegendBoxActor::Padding
int Padding
Definition: vtkLegendBoxActor.h:243
vtkLegendBoxActor::TextActor
vtkActor2D ** TextActor
Definition: vtkLegendBoxActor.h:253
vtkLegendBoxActor
draw symbols with text
Definition: vtkLegendBoxActor.h:61
vtkActor2D::ShallowCopy
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkActor2D.
vtkLegendBoxActor::GetNumberOfEntries
int GetNumberOfEntries()
Definition: vtkLegendBoxActor.h:77
vtkLegendBoxActor::Background
vtkPlaneSource * Background
Definition: vtkLegendBoxActor.h:280
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkPlaneSource
create an array of quadrilaterals located in a plane
Definition: vtkPlaneSource.h:60
vtkLegendBoxActor::UseBackground
vtkTypeBool UseBackground
Definition: vtkLegendBoxActor.h:277
vtkLegendBoxActor::BorderPolyData
vtkPolyData * BorderPolyData
Definition: vtkLegendBoxActor.h:268
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:273
vtkLegendBoxActor::ScalarVisibility
vtkTypeBool ScalarVisibility
Definition: vtkLegendBoxActor.h:245
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
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:53
vtkLegendBoxActor::BackgroundOpacity
double BackgroundOpacity
Definition: vtkLegendBoxActor.h:278
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:42
vtkLegendBoxActor::BorderActor
vtkActor2D * BorderActor
Definition: vtkLegendBoxActor.h:270
vtkLegendBoxActor::NumberOfEntries
int NumberOfEntries
Definition: vtkLegendBoxActor.h:249
vtkLegendBoxActor::TextMapper
vtkTextMapper ** TextMapper
Definition: vtkLegendBoxActor.h:252
vtkLegendBoxActor::Box
vtkTypeBool Box
Definition: vtkLegendBoxActor.h:242
vtkLegendBoxActor::BoxPolyData
vtkPolyData * BoxPolyData
Definition: vtkLegendBoxActor.h:271
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:51
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkLegendBoxActor::IconImage
vtkImageData ** IconImage
Definition: vtkLegendBoxActor.h:266
vtkLegendBoxActor::Border
vtkTypeBool Border
Definition: vtkLegendBoxActor.h:241
vtkLegendBoxActor::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Definition: vtkLegendBoxActor.h:224
vtkLegendBoxActor::BorderMapper
vtkPolyDataMapper2D * BorderMapper
Definition: vtkLegendBoxActor.h:269
vtkTransformPolyDataFilter
transform points and associated normals and vectors for polygonal dataset
Definition: vtkTransformPolyDataFilter.h:51
vtkLegendBoxActor::BackgroundMapper
vtkPolyDataMapper2D * BackgroundMapper
Definition: vtkLegendBoxActor.h:284
vtkLegendBoxActor::EntryTextProperty
vtkTextProperty * EntryTextProperty
Definition: vtkLegendBoxActor.h:274
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkLegendBoxActor::SymbolActor
vtkActor2D ** SymbolActor
Definition: vtkLegendBoxActor.h:259
vtkLegendBoxActor::IconTransformFilter
vtkTransformPolyDataFilter ** IconTransformFilter
Definition: vtkLegendBoxActor.h:263
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:39
vtkLegendBoxActor::Size
int Size
Definition: vtkLegendBoxActor.h:250
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
vtkLegendBoxActor::LockBorder
vtkTypeBool LockBorder
Definition: vtkLegendBoxActor.h:244
vtkProperty2D
represent surface properties of a 2D image
Definition: vtkProperty2D.h:40
vtkLegendBoxActor::Colors
vtkDoubleArray * Colors
Definition: vtkLegendBoxActor.h:251
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:45
vtkLegendBoxActor::Transform
vtkTransform ** Transform
Definition: vtkLegendBoxActor.h:256
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:257
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkLegendBoxActor::BoxMapper
vtkPolyDataMapper2D * BoxMapper
Definition: vtkLegendBoxActor.h:272
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:41
vtkActor2D::HasTranslucentPolygonalGeometry
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
vtkLegendBoxActor::BuildTime
vtkTimeStamp BuildTime
Definition: vtkLegendBoxActor.h:289
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkLegendBoxActor::BoxOpacity
double BoxOpacity
Definition: vtkLegendBoxActor.h:246
vtkLegendBoxActor::BackgroundActor
vtkTexturedActor2D * BackgroundActor
Definition: vtkLegendBoxActor.h:283