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 "vtkActor2D.h"
62 
63 class vtkPolyData;
65 class vtkProperty2D;
66 class vtkScalarsToColors;
67 class vtkTextMapper;
68 class vtkTextProperty;
69 class vtkTexture;
70 
71 #define VTK_ORIENT_HORIZONTAL 0
72 #define VTK_ORIENT_VERTICAL 1
73 
75 {
76 public:
78  void PrintSelf(ostream& os, vtkIndent indent);
79 
83  static vtkScalarBarActor *New();
84 
86 
87  int RenderOpaqueGeometry(vtkViewport* viewport);
88  virtual int RenderTranslucentPolygonalGeometry(vtkViewport*) { return 0; };
89  int RenderOverlay(vtkViewport* viewport);
91 
93  virtual int HasTranslucentPolygonalGeometry();
94 
98  virtual void ReleaseGraphicsResources(vtkWindow *);
99 
101 
104  virtual void SetLookupTable(vtkScalarsToColors*);
105  vtkGetObjectMacro(LookupTable,vtkScalarsToColors);
107 
109 
114  vtkSetMacro( UseOpacity, int );
115  vtkGetMacro( UseOpacity, int );
116  vtkBooleanMacro( UseOpacity, int );
118 
120 
123  vtkSetClampMacro(MaximumNumberOfColors, int, 2, VTK_LARGE_INTEGER);
124  vtkGetMacro(MaximumNumberOfColors, int);
126 
128 
129  vtkSetClampMacro(NumberOfLabels, int, 0, 64);
130  vtkGetMacro(NumberOfLabels, int);
132 
134 
135  vtkSetClampMacro(Orientation,int,VTK_ORIENT_HORIZONTAL, VTK_ORIENT_VERTICAL);
136  vtkGetMacro(Orientation, int);
137  void SetOrientationToHorizontal()
138  {this->SetOrientation(VTK_ORIENT_HORIZONTAL);};
139  void SetOrientationToVertical() {this->SetOrientation(VTK_ORIENT_VERTICAL);};
141 
143 
144  virtual void SetTitleTextProperty(vtkTextProperty *p);
145  vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
147 
149 
150  virtual void SetLabelTextProperty(vtkTextProperty *p);
151  vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
153 
155 
156  vtkSetStringMacro(LabelFormat);
157  vtkGetStringMacro(LabelFormat);
159 
161 
162  vtkSetStringMacro(Title);
163  vtkGetStringMacro(Title);
165 
167 
168  vtkSetStringMacro(ComponentTitle);
169  vtkGetStringMacro(ComponentTitle);
171 
174  void ShallowCopy(vtkProp *prop);
175 
177 
178  vtkSetMacro( TextureGridWidth, double );
179  vtkGetMacro( TextureGridWidth, double );
181 
183 
184  vtkGetObjectMacro( TextureActor, vtkActor2D );
186 
187 //BTX
188  enum { PrecedeScalarBar = 0, SucceedScalarBar };
189 //ETX
190 
192 
196  vtkSetClampMacro( TextPosition, int, PrecedeScalarBar, SucceedScalarBar);
197  vtkGetMacro( TextPosition, int );
198  virtual void SetTextPositionToPrecedeScalarBar()
199  { this->SetTextPosition( vtkScalarBarActor::PrecedeScalarBar ); }
200  virtual void SetTextPositionToSucceedScalarBar()
201  { this->SetTextPosition( vtkScalarBarActor::SucceedScalarBar ); }
203 
205 
210  vtkSetMacro( MaximumWidthInPixels, int );
211  vtkGetMacro( MaximumWidthInPixels, int );
212  vtkSetMacro( MaximumHeightInPixels, int );
213  vtkGetMacro( MaximumHeightInPixels, int );
215 
217 
219  vtkSetMacro( DrawBackground, int );
220  vtkGetMacro( DrawBackground, int );
221  vtkBooleanMacro( DrawBackground, int );
223 
225 
227  vtkSetMacro( DrawFrame, int );
228  vtkGetMacro( DrawFrame, int );
229  vtkBooleanMacro( DrawFrame, int );
231 
233 
234  virtual void SetBackgroundProperty(vtkProperty2D *p);
235  vtkGetObjectMacro(BackgroundProperty,vtkProperty2D);
237 
239 
240  virtual void SetFrameProperty(vtkProperty2D *p);
241  vtkGetObjectMacro(FrameProperty,vtkProperty2D);
243 
244 protected:
247 
251 
256  char *Title;
258  char *LabelFormat;
259  int UseOpacity; // off by default
262 
265  virtual void AllocateAndSizeLabels(int *labelSize, int *size,
266  vtkViewport *viewport, double *range);
267 
270  virtual void SizeTitle(int *titleSize, int *size, vtkViewport *viewport);
271 
275 
279 
281  int LastSize[2];
282  int LastOrigin[2];
283 
286 
289 
290  int DrawBackground; // off by default
291  int DrawFrame; // off by default
292 
299 
300 private:
301  vtkScalarBarActor(const vtkScalarBarActor&); // Not implemented.
302  void operator=(const vtkScalarBarActor&); // Not implemented.
303 };
304 
305 
306 #endif
307