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 =========================================================================*/
40 #ifndef __vtkLegendBoxActor_h
41 #define __vtkLegendBoxActor_h
42 
43 #include "vtkRenderingAnnotationModule.h" // For export macro
44 #include "vtkActor2D.h"
45 
46 class vtkActor;
47 class vtkDoubleArray;
48 class vtkImageData;
49 class vtkPolyData;
51 class vtkPolyDataMapper;
52 class vtkPlaneSource;
53 class vtkTextMapper;
54 class vtkTextProperty;
55 class vtkTexturedActor2D;
56 class vtkTransform;
58 class vtkProperty2D;
59 
60 class VTKRENDERINGANNOTATION_EXPORT vtkLegendBoxActor : public vtkActor2D
61 {
62 public:
64  void PrintSelf(ostream& os, vtkIndent indent);
65 
68  static vtkLegendBoxActor *New();
69 
71 
72  void SetNumberOfEntries(int num);
73  int GetNumberOfEntries()
74  {return this->NumberOfEntries;}
76 
78 
86  void SetEntry(int i, vtkPolyData *symbol, const char* string, double color[3]);
87  void SetEntry(int i, vtkImageData *symbol, const char* string, double color[3]);
88  void SetEntry(int i, vtkPolyData *symbol, vtkImageData *icon,
89  const char* string, double color[3]);
91 
92  void SetEntrySymbol (int i, vtkPolyData *symbol);
93  void SetEntryIcon (int i, vtkImageData *icon);
94  void SetEntryString (int i, const char* string);
95  void SetEntryColor (int i, double color[3]);
96  void SetEntryColor (int i, double r, double g, double b);
97 
98  vtkPolyData* GetEntrySymbol(int i);
99  vtkImageData* GetEntryIcon(int i);
100  const char* GetEntryString(int i);
101  double* GetEntryColor(int i);
102 
104 
105  virtual void SetEntryTextProperty(vtkTextProperty *p);
106  vtkGetObjectMacro(EntryTextProperty,vtkTextProperty);
108 
110 
112  vtkSetMacro(Border, int);
113  vtkGetMacro(Border, int);
114  vtkBooleanMacro(Border, int);
116 
118 
124  vtkSetMacro(LockBorder, int);
125  vtkGetMacro(LockBorder, int);
126  vtkBooleanMacro(LockBorder, int);
128 
130 
132  vtkSetMacro(Box, int);
133  vtkGetMacro(Box, int);
134  vtkBooleanMacro(Box, int);
136 
138  vtkProperty2D* GetBoxProperty() { return this->BoxActor->GetProperty(); };
139 
141 
143  vtkSetClampMacro(Padding, int, 0, 50);
144  vtkGetMacro(Padding, int);
146 
148 
151  vtkSetMacro(ScalarVisibility,int);
152  vtkGetMacro(ScalarVisibility,int);
153  vtkBooleanMacro(ScalarVisibility,int);
155 
157 
158  vtkSetMacro(UseBackground, int);
159  vtkGetMacro(UseBackground, int);
160  vtkBooleanMacro(UseBackground, int);
162 
164 
165  vtkSetVector3Macro(BackgroundColor, double);
166  vtkGetVector3Macro(BackgroundColor, double);
168 
170 
171  vtkSetClampMacro(BackgroundOpacity, double, 0.0, 1.0);
172  vtkGetMacro(BackgroundOpacity, double);
174 
177  void ShallowCopy(vtkProp *prop);
178 
179 //BTX
184  virtual void ReleaseGraphicsResources(vtkWindow *);
185 
187 
190  int RenderOpaqueGeometry(vtkViewport* viewport);
192  int RenderOverlay(vtkViewport* viewport);
194 
196 
197  virtual int HasTranslucentPolygonalGeometry();
198 //ETX
200 
201 protected:
204 
205  void InitializeEntries();
206 
207  vtkPolyData createTexturedPlane();
208 
209  int Border;
210  int Box;
211  int Padding;
214  double BoxOpacity;
215 
216  // Internal actors, mappers, data to represent the legend
218  int Size; //allocation size
222 
228 
235 
243 
244  // Background plane.
247  double BackgroundColor[3];
249 
250  // May use texture.
253 
254  // Used to control whether the stuff is recomputed
256  int CachedSize[2];
258 
259 private:
260  vtkLegendBoxActor(const vtkLegendBoxActor&); // Not implemented.
261  void operator=(const vtkLegendBoxActor&); // Not implemented.
262 };
263 
264 
265 #endif
266