VTK
vtkScalarBarActor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkScalarBarActor.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 =========================================================================*/
58 #ifndef __vtkScalarBarActor_h
59 #define __vtkScalarBarActor_h
60 
61 #include "vtkRenderingAnnotationModule.h" // For export macro
62 #include "vtkActor2D.h"
63 
64 class vtkPolyData;
66 class vtkProperty2D;
67 class vtkScalarsToColors;
68 class vtkTextMapper;
69 class vtkTextProperty;
70 class vtkTexture;
71 
72 #define VTK_ORIENT_HORIZONTAL 0
73 #define VTK_ORIENT_VERTICAL 1
74 
75 class VTKRENDERINGANNOTATION_EXPORT vtkScalarBarActor : public vtkActor2D
76 {
77 public:
79  void PrintSelf(ostream& os, vtkIndent indent);
80 
84  static vtkScalarBarActor *New();
85 
87 
88  int RenderOpaqueGeometry(vtkViewport* viewport);
89  virtual int RenderTranslucentPolygonalGeometry(vtkViewport*) { return 0; };
90  int RenderOverlay(vtkViewport* viewport);
92 
94  virtual int HasTranslucentPolygonalGeometry();
95 
99  virtual void ReleaseGraphicsResources(vtkWindow *);
100 
102 
105  virtual void SetLookupTable(vtkScalarsToColors*);
106  vtkGetObjectMacro(LookupTable,vtkScalarsToColors);
108 
110 
115  vtkSetMacro( UseOpacity, int );
116  vtkGetMacro( UseOpacity, int );
117  vtkBooleanMacro( UseOpacity, int );
119 
121 
124  vtkSetClampMacro(MaximumNumberOfColors, int, 2, VTK_LARGE_INTEGER);
125  vtkGetMacro(MaximumNumberOfColors, int);
127 
129 
130  vtkSetClampMacro(NumberOfLabels, int, 0, 64);
131  vtkGetMacro(NumberOfLabels, int);
133 
135 
136  vtkSetClampMacro(Orientation,int,VTK_ORIENT_HORIZONTAL, VTK_ORIENT_VERTICAL);
137  vtkGetMacro(Orientation, int);
138  void SetOrientationToHorizontal()
139  {this->SetOrientation(VTK_ORIENT_HORIZONTAL);};
140  void SetOrientationToVertical() {this->SetOrientation(VTK_ORIENT_VERTICAL);};
142 
144 
145  virtual void SetTitleTextProperty(vtkTextProperty *p);
146  vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
148 
150 
151  virtual void SetLabelTextProperty(vtkTextProperty *p);
152  vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
154 
156 
157  vtkSetStringMacro(LabelFormat);
158  vtkGetStringMacro(LabelFormat);
160 
162 
163  vtkSetStringMacro(Title);
164  vtkGetStringMacro(Title);
166 
168 
169  vtkSetStringMacro(ComponentTitle);
170  vtkGetStringMacro(ComponentTitle);
172 
175  void ShallowCopy(vtkProp *prop);
176 
178 
179  vtkSetMacro( TextureGridWidth, double );
180  vtkGetMacro( TextureGridWidth, double );
182 
184 
185  vtkGetObjectMacro( TextureActor, vtkActor2D );
187 
188 //BTX
189  enum { PrecedeScalarBar = 0, SucceedScalarBar };
190 //ETX
191 
193 
197  vtkSetClampMacro( TextPosition, int, PrecedeScalarBar, SucceedScalarBar);
198  vtkGetMacro( TextPosition, int );
199  virtual void SetTextPositionToPrecedeScalarBar()
200  { this->SetTextPosition( vtkScalarBarActor::PrecedeScalarBar ); }
201  virtual void SetTextPositionToSucceedScalarBar()
202  { this->SetTextPosition( vtkScalarBarActor::SucceedScalarBar ); }
204 
206 
211  vtkSetMacro( MaximumWidthInPixels, int );
212  vtkGetMacro( MaximumWidthInPixels, int );
213  vtkSetMacro( MaximumHeightInPixels, int );
214  vtkGetMacro( MaximumHeightInPixels, int );
216 
218 
220  vtkSetMacro( DrawBackground, int );
221  vtkGetMacro( DrawBackground, int );
222  vtkBooleanMacro( DrawBackground, int );
224 
226 
228  vtkSetMacro( DrawFrame, int );
229  vtkGetMacro( DrawFrame, int );
230  vtkBooleanMacro( DrawFrame, int );
232 
234 
235  virtual void SetBackgroundProperty(vtkProperty2D *p);
236  vtkGetObjectMacro(BackgroundProperty,vtkProperty2D);
238 
240 
241  virtual void SetFrameProperty(vtkProperty2D *p);
242  vtkGetObjectMacro(FrameProperty,vtkProperty2D);
244 
245 protected:
248 
252 
257  char *Title;
259  char *LabelFormat;
260  int UseOpacity; // off by default
263 
266  virtual void AllocateAndSizeLabels(int *labelSize, int *size,
267  vtkViewport *viewport, double *range);
268 
271  virtual void SizeTitle(int *titleSize, int *size, vtkViewport *viewport);
272 
276 
280 
282  int LastSize[2];
283  int LastOrigin[2];
284 
287 
290 
291  int DrawBackground; // off by default
292  int DrawFrame; // off by default
293 
300 
301 private:
302  vtkScalarBarActor(const vtkScalarBarActor&); // Not implemented.
303  void operator=(const vtkScalarBarActor&); // Not implemented.
304 };
305 
306 
307 #endif
308